Add a test that multiboot works

This commit is contained in:
Gwilym Inzani 2023-10-17 23:49:57 +01:00
parent aa33a46919
commit 5feb67285d
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,23 @@
#![no_std]
#![no_main]
#![feature(custom_test_frameworks)]
#![reexport_test_harness_main = "test_main"]
#![test_runner(agb::test_runner::test_runner)]
fn hello() {}
#[test_case]
fn multiboot_test(_gba: &mut agb::Gba) {
if option_env!("AGB_MULTIBOOT").is_some() {
let address = hello as usize;
assert!(
(0x0200_0000..0x0204_0000).contains(&address),
"multiboot functions should all be in ewram 0x0300_0000 and 0x0300_8000, but was actually found to be at {address:#010X}"
);
}
}
#[agb::entry]
fn entry(_gba: agb::Gba) -> ! {
loop {}
}

View file

@ -15,6 +15,7 @@ clippy:
test:
just _test-debug agb
just _test-multiboot
just _test-debug agb-fixnum
just _test-debug agb-hashmap
just _test-debug tracker/agb-tracker
@ -152,6 +153,8 @@ _test-debug crate:
(cd "{{crate}}" && cargo test)
_test-debug-arm crate:
(cd "{{crate}}" && cargo test --target=armv4t-none-eabi)
_test-multiboot:
(cd "agb" && AGB_MULTIBOOT=true RUSTFLAGS="-Clink-arg=-Tgba_mb.ld -Ctarget-cpu=arm7tdmi" cargo test --test=test_multiboot)
_clippy crate:
(cd "{{crate}}" && cargo clippy --examples --tests -- {{CLIPPY_ARGUMENTS}})
_clean crate: