-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How would I write tests with the 0.11 versions? #366
Comments
Thanks for raising this issue! You"re right that the
|
Sounds intuitive, however, when doing so, I get stopped with I"ll continue on this for a bit, maybe I can get something to work. |
I didn"t yet find the time to actually try this, but the inventory crate points to a similar package that might work. |
I"m currently trying to implement tests using However there is a rather large issue I ran into. Just cost me the better part of today to debug this. I had to add
to my .cargo/config. Otherwise |
I ran into the same error that you did and solved it the same way. I just got my |
I also use a wrapper type, but you can generate that using a proc macro.
becomes something like
feel free to use (or improve) my proc macro https://github.com/Wasabi375/WasabiOS/blob/main/testing/derive/src/lib.rs |
I just modified your proc macro to have support for including the function in different lists, and the functions to have varying input types. That way I can have a slice for modules, and those modules can call their own tests and pass in different inputs.
Thanks for sharing |
Works for me as well. This is more of an integration test solution though. I"m starting the tests via However, I think the answer of this ticket has been answered, and it can be closed. @phil-opp maybe it"s worth thinking about including this approach in edition 3 for testing, since the only other way to get unit tests for stuff in the kernel, is to extract that functionality into a separate |
I would like to be able to execute my kernel tests with QEMU with a simple
cargo test
, like in the versions before 0.11.From what I see though, with the bindeps, when I call
cargo test
, the kernel is not even built in "test mode", and only the root crate (which I will call "runner" from now on) is being tested.Is there an easy way to boot up QEMU and run the kernel tests, or do I have to manually build the kernel with
cargo test --no-run --package kernel --target x86_64-unknown-none
?When running this, I get an error
without any additional context, so I"m not sure whether this is the way to go.
The way this bootloader runs tests is also not applicable I think, because as far as I see, it runs kernels, not tests inside kernels.
Correct me if I"m wrong somewhere please
The text was updated successfully, but these errors were encountered: