twizzler-operating-system / twizzler

The Twizzler Operating System
BSD 3-Clause "New" or "Revised" License
66 stars 13 forks source link

Enhance kernel's test framework. #103

Closed dbittman closed 1 year ago

dbittman commented 1 year ago

This patch enables the test runner to print the names of test functions in the kernel when running tests.

At time of writing, doing this either involves extremely cursed unsafe rust to figure out the function pointer address followed by a symbol lookup, or using a proc macro. Which is also arguably cursed, but it is at least all safe and stable rust.

Anyway, to annotate a function as a test function, use the kernel_test attribute from the twizzler-kernel-macros crate that is now compiled into the kernel.

This attribute adds static const item containing a function pointer that will run the test and the name of the test as given by the programmer.