XyrisOS / xyris

The Xyris Kernel
https://xyr.is
MIT License
154 stars 11 forks source link

Headless Boot Test #274

Open micahswitzer opened 3 years ago

micahswitzer commented 3 years ago

Describe the feature request in detail It would be nice to be able to test that a given kernel can boot to the end of kernel_main as a part of our testing suite. This gives us confidence that core pieces of the kernel are functioning with every PR.

The best way that I can think of to do that is to use the QEMU isa-debug-exit device which allows the guest kernel to tell QEMU to exit with a specific exit code. This code can be detected by the test runner and then used to either cause the tests to fail or succeed.

I propose adding a TEST define that specifies whether or not the kernel should run self-tests and then exit using this QEMU device. There should be a positive exit at the end of kernel_main, and then a negative exit in the panic handlers.

Unfortunately there's very little documentation on this device and the best I could find was for a Rust kernel tutorial here: https://os.phil-opp.com/testing/#exiting-qemu