Testing #1009
Replies: 155 comments 66 replies
-
I'm not sure if I did something wrong, but by following along with this guide exactly I was receiving an error about fmt being undeclared after setting up the CompareMessage implementation. I fixed it by adding |
Beta Was this translation helpful? Give feedback.
-
@leggettc18 You did nothing wrong, I forgot to mention these imports. Fixed in 1f97103. Thanks for reporting! |
Beta Was this translation helpful? Give feedback.
-
I'm unable to run
|
Beta Was this translation helpful? Give feedback.
-
Try I have the same problem but couldn't figure out why the file isn't automatically found. |
Beta Was this translation helpful? Give feedback.
-
@AntoineSebert Do you have a @Beidah Sounds like forgot a |
Beta Was this translation helpful? Give feedback.
-
@phil-opp Yes it's there. The problem seems to have disappread today, and anyway it's not a big deal. |
Beta Was this translation helpful? Give feedback.
-
The recent improvements in the test framework now produce text outputs that are not colored in green, thus making the test result less visible within the terminal. |
Beta Was this translation helpful? Give feedback.
-
Yes, there is! You can use ANSI escape codes for coloring. For example, you can create a type to print something in green: use core::fmt;
struct Green(&'static str);
impl fmt::Display for Green {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "\x1B[32m")?; // prefix code
write!(f, "{}", self.0)?;
write!(f, "\x1B[0m")?; // postfix code
Ok(())
}
} Now you can do I opened #603 for adding this to the post. |
Beta Was this translation helpful? Give feedback.
-
In the process of adding tests, I encountered some strange errors. In this test, I simply created a writer, but failed, and judging from the error message, it seems that it did not execute any tests at all, because I did not see the information printed by test_runner or panic_handler on the console. lws@lsw:/document/project/flandre-os/FlandreOS$ cargo xtest test_default_writer
Compiling flandre_os v0.0.1 (/document/project/flandre-os/FlandreOS)
Finished dev [unoptimized + debuginfo] target(s) in 0.33s
Running target/x86_64-flandre_os/debug/deps/flandre_os-d120248f92b70111
Building bootloader
Compiling bootloader v0.6.0 (/work/tool/rust/cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/bootloader-0.6.0)
Finished release [optimized + debuginfo] target(s) in 0.72s
Running: `qemu-system-x86_64 -drive format=raw,file=/document/project/flandre-os/FlandreOS/target/x86_64-flandre_os/debug/deps/bootimage-flandre_os-d120248f92b70111.bin -device isa-debug-exit,iobase=0xf4,iosize=0x04 -serial stdio -display none test_default_writer`
qemu-system-x86_64: -display none: drive with bus=0, unit=0 (index=0) exists
error: test failed, to rerun pass '--lib'
|
Beta Was this translation helpful? Give feedback.
-
I did all kinds of printing tests and the printing function seemed to work normally, but when I tried to add some tests to ensure that these functions would not be damaged in future modifications, I got the above errors. |
Beta Was this translation helpful? Give feedback.
-
I think passing a test name to |
Beta Was this translation helpful? Give feedback.
-
Yes, as you see from the "Running: What you can do is to run the tests of the library component through |
Beta Was this translation helpful? Give feedback.
-
I tried adding the "x" as you indicated in the above paragraph. The test did not fail. WIth some more fooling about i see that the I have submitted a pull request #610 |
Beta Was this translation helpful? Give feedback.
-
@xj42 Thanks a lot for reporting! I created #611 to fix this. |
Beta Was this translation helpful? Give feedback.
-
Hi, thank you for taking your time and effort into making this brilliant blog! I've learnt so much about operating systems and the Rust language in general! Can't wait to see how this blog unfolds and what new things you'll bring. I just wanted to ask if it is the expected behaviour for It seems to me that perhaps this was the desired behaviour? If so, is there a way for me to send data to the serial port while the QEMU instance is running as normal? |
Beta Was this translation helpful? Give feedback.
-
I’m using 1.61.0-nightly indeed. How do I upgrade? I tried `rustup update stable`, but that does not install a newer version.
How come I need a not even released version of Rust for a tutorial that has been around for quite a while? Wouldn’t it work to somehow pin uart_16550 to an older version? (No idea how to do that, though…)
… Am 18.05.2022 um 20:38 schrieb bjorn3 ***@***.***>:
Which rustc version are you using? It should work with 1.62 nightly as this method will be stabilized in 1.61 which is currently in beta. I think you are using 1.61 nightly from just before it was marked as stabilized in 1.61, so updating to the latest nightly should fix this issue.
—
Reply to this email directly, view it on GitHub <#1009 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAGD2ZFQS3HXYAWE7YJK6ZLVKU2LPANCNFSM5ARPOQNQ>.
You are receiving this because you commented.
|
Beta Was this translation helpful? Give feedback.
-
Having similar issues as others,
and later
removing the |
Beta Was this translation helpful? Give feedback.
-
Maybe not for this stage but I think that it could be solved with threads, so when you introduce the threads in the kernel you could revisit the should_panic equivalent. You should still find a way to stop the work in these threads after sometime or it will loop forever until the timeout of the tests. If this can't be done I will appreciate any explanation. Forgive me for my ignorance I'm advance. |
Beta Was this translation helpful? Give feedback.
-
Qemu can not exit on mac, Is the port 0xf4 not work in macos? |
Beta Was this translation helpful? Give feedback.
-
The test case in main.rs and basic_boot.rs don't work. Also I download the code from github, then run cargo test, Only print test case from vag_buffer in console.
What's the wrong with my code or enviroment? Thanks. |
Beta Was this translation helpful? Give feedback.
-
One option for allowing for multiple In short: start with a build flag that allows all the tests to be compiled, and emit their names through the serial port, but do not run them. Then, for each test case name received over the serial port, recompile with a config flag that will cause only that specific test case to be compiled and executed. To lower the cost of multiple executions of QEMU, you could also skip the enumeration stage, and have that macro exclude specified tests on compilation. You'd run all tests until you get your first panic (tracking completions), then recompile with all the tests you already executed (successfully or not) skipped, and re-invoke. |
Beta Was this translation helpful? Give feedback.
-
Its extremely hard to find a tutor for Rust that does OS Development lol |
Beta Was this translation helpful? Give feedback.
-
Hi! First of all appreciate for your absolutely awesome tutorial! I met a problem at very beginning of this section. After replacing the default test framework by inserting below announcement and #![feature(custom_test_frameworks)]
#![test_runner(crate::test_runner)]
#![reexport_test_harness_main = "test_main"] Then I met the problem of “duplicate lang item” errors. So I remove all Thank you so much! |
Beta Was this translation helpful? Give feedback.
-
On macOS, running error: could not compile `spin` (lib) due to 118 previous errors``` |
Beta Was this translation helpful? Give feedback.
-
Hello, when i run the cargo test command i got this error :
my config.toml file :
my json file :
and yes i have :
Thanks you. |
Beta Was this translation helpful? Give feedback.
-
I'm getting a segfault on the first step of adding the test_runner function and running the cargo test. Is there anything that could explain this behavior?? |
Beta Was this translation helpful? Give feedback.
-
hi!
My rust.yml looks like this:
anyone know why this is happening? |
Beta Was this translation helpful? Give feedback.
-
Hi, when I try to pass arguments "-display none" to QUME, and then run the cargo test, it will below error message.
|
Beta Was this translation helpful? Give feedback.
-
The section where we try to print the names of the test functions is not functioning correctly for me. Whenever I use core::any::type_name::(), it only prints the actual type, which is &dyn core::ops::function::Fn() instead of the function's name. |
Beta Was this translation helpful? Give feedback.
-
main.rs:
|
Beta Was this translation helpful? Give feedback.
-
This is a general purpose comment thread for the Testing post.
Beta Was this translation helpful? Give feedback.
All reactions