diff options
| author | Natasha Moongrave <natasha@256phi.eu> | 2026-03-10 15:54:50 +0100 |
|---|---|---|
| committer | Natasha Moongrave <natasha@256phi.eu> | 2026-03-10 15:54:50 +0100 |
| commit | c7eb282304081bfd13f7d371d12c567f52fe22eb (patch) | |
| tree | 32ab99250cfdb1b29a11adb4c08c06959dde1612 | |
| parent | 3e156cae55172c0d88237c3d396d2fd8f9b98245 (diff) | |
rewrote the test for println_output() to avoid a race condition occuring with the new way we handle deadlocks
| -rw-r--r-- | StrixKernel/src/vga_buffer.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/StrixKernel/src/vga_buffer.rs b/StrixKernel/src/vga_buffer.rs index 9e4ffcf..f21a94e 100644 --- a/StrixKernel/src/vga_buffer.rs +++ b/StrixKernel/src/vga_buffer.rs @@ -188,10 +188,17 @@ fn test_println_many() { #[test_case] fn test_println_output() { + use core::fmt::Write; + use x86_64::instructions::interrupts; + let s = "Some test string that fits on a single line"; - println!("{}", s); - for (i, c) in s.chars().enumerate() { - let screen_char = WRITER.lock().buffer.chars[BUFFER_HEIGHT - 2][i].read(); - assert_eq!(char::from(screen_char.ascii_character), c); - } + interrupts::without_interrupts(|| { + let mut writer = WRITER.lock(); + writeln!(writer, "\n{}", s).expect("writeln failed"); + for (i, c) in s.chars().enumerate() { + let screen_char = writer.buffer.chars[BUFFER_HEIGHT - 2][i].read(); + assert_eq!(char::from(screen_char.ascii_character), c); + } + }); } + |
