diff --git a/agb/tests/test_multiboot.rs b/agb/tests/test_multiboot.rs new file mode 100644 index 00000000..5fe0247a --- /dev/null +++ b/agb/tests/test_multiboot.rs @@ -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 {} +} diff --git a/justfile b/justfile index bfac29b9..1aee24b2 100644 --- a/justfile +++ b/justfile @@ -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: