Writing an OS in Rust - Part 4 - Testing

preview_player
Показать описание
This is my version of Philipp Oppermann's "BlogOS". It's a baremetal operating system that can boot off of a USB stick on any BIOS-compatible machine, which is pretty amazing. I'm going to be following the whole blog, one video at a time, and running the OS using QEMU instead of booting a physical machine. Just to keep things simple.

Trying to get testing to work we learned a bunch of things:
- how to exit QEMU programatically
- how to write to the "serial port", which ends up writing to the terminal
- how to write separate integration tests

#rust #rustos #blogos #rustlang
Рекомендации по теме
Комментарии
Автор

42:50 Not sure if you had realized it later, but if you want to dismiss a rust / clippy warning, you use #[allow(…)]. Warn is the default for the warnings, and deny is when you want the compilation to fail when the situation occurs.
Edit: you found it 30 seconds later 😂

ruijieyu
Автор

exit_qemu should be a divergent function. If it doesn't return normally (and a function that causes the machine to shut down would count!) then it should be divergent.

This doesn't cause any problem, but marking it divergent could *theoretically* offer some kind of optimization further up in the system. Further, it's better to mark it divergent since it shows to the reader that it is one of those weird and wacky functions.

addmoreice
Автор

Hi, I really like these videos. Is it possible to follow along on MacOS?

well.