secs-dev / xv6-riscv

Fork of the Xv6 OS for RISC-V for the ITMO CSE course.
Other
2 stars 6 forks source link

Colored output for tests #4

Open vityaman opened 2 months ago

vityaman commented 2 months ago

Currently there are just logs in default terminal color. Want it to look fancy. ANSI escape codes can be used.

manas-02 commented 2 months ago

Hi, I am new to open-source contributions. I would like to help. Can u share some details of the project.

vityaman commented 2 months ago

@manas-02, hi! It is very unexpected and nice to receive such an offer from you.

We develop an OS course in the ITMO University. We have some homeworks related to kernel development, there student should add some features to the educational OS Xv6 developed in the MIT: write some syscalls, add linked lists to the kernel structures and implement COW fork with lazy allocation.

We leave the Xv6 as it is, but want to improve the experience for students. One of improvements is automated testing of the OS. Currently tests exist as a binary that is run inside the OS under QEMU and it just prints messages like "test bigdir: OK" to stdout.

We want to run tests in a GitHub Workflow to check that tests was passed. This will let us (teachers and assistants) to concentrate on the logic and style of changes student sent via an MR, rather than ensuring that code is working correctly.

For this we are currently developing a python script for parsing OS output: https://github.com/secs-dev/xv6-riscv/pull/3 (review stage). It prints output in a such format (available in Actions):

Starting Xv6 userspace tests...
Qemu was started.
Kernel was booted.
[ 0%] Running test 'copyin'...       20.000s >  6.527s => OK!
[ 4%] Running test 'copyout'...       0.200s >  0.016s => OK!
[ 4%] Running test 'copyinstr1'...    0.200s >  0.006s => OK!
[ 4%] Running test 'copyinstr2'...    0.200s >  0.009s => OK!
[ 4%] Running test 'copyinstr3'...    0.200s >  0.007s => OK!
[ 4%] Running test 'rwsbrk'...        1.000s >  0.042s => OK!
[ 4%] Running test 'truncate1'...     2.000s >  0.065s => OK!
[ 4%] Running test 'truncate2'...     2.000s >  0.053s => OK!
[ 5%] Running test 'truncate3'...    40.000s >  1.791s => OK!
[12%] Running test 'openiput'...      1.000s >  0.142s => OK!
[12%] Running test 'exitiput'...      1.000s >  0.046s => OK!
[12%] Running test 'iput'...          1.000s >  0.047s => OK!
...

This script can be used not only in GitHub, but on a students local machine. I thought that it would be nice to have fancy colored output and cool formatting. Just for fun.

manas-02 commented 2 months ago

Thanks, for providing details. This was my first request to an open source project. I am sorry but I am not familiar with python. I was expecting it to be a C or C++ project. Also I am not a professional programmer I am just a student, expecting to learn something new. So, sorry I don't think I will be of any help. Apologies for taking your time.