Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Anders429/gba_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Anders429 committed Jun 17, 2024
2 parents b17bc03 + d2445dd commit 26258a1
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/mgba-rom-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@ jobs:
rom-path: ignore_with_message.gba
success-code: 0 # Pass

multiple_ignore:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- run: sudo apt-get install binutils-arm-none-eabi
- run: cd tests/multiple_ignore && cargo test --no-run --message-format=json | tee results.json
- run: echo "ROM_PATH=$(cd tests/parse_executable && cargo run ../multiple_ignore/results.json)" >> $GITHUB_ENV
- run: arm-none-eabi-objcopy -O binary ${{ env.ROM_PATH }} multiple_ignore.gba
- run: cargo install gbafix
- run: gbafix multiple_ignore.gba
- uses: felixjones/github-mgba-rom-test@v1
with:
swi-call: 0x27
read-register: 'r0'
rom-path: multiple_ignore.gba
success-code: 0 # Pass

fail:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions gba_test/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Panic displaying now properly clears all previous text before displaying the panic info.
- User interface no longer panics when attempting to scroll down an empty list.
- Panics are now properly reported to `mgba-rom-test` using the same bios call as pass/fail reports.
- Ignored tests with long names no longer cause misaligned display of tests in user interface.

## 0.1.2 - 2024-06-06
### Fixed
Expand Down
6 changes: 3 additions & 3 deletions gba_test/src/ui/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ impl Write for Cursor {
self.cursor = (((self.cursor as usize / 0x40) + 1) * 0x40) as *mut u16;
} else if ascii < 128 {
unsafe {
self.cursor
.write_volatile((ascii | ((self.palette as u32) << 12)) as u16);
self.cursor = self.cursor.add(1);
// Don't write past the view of the screen.
if (self.cursor as usize) % 0x40 > 0x3a {
self.cursor = (((self.cursor as usize / 0x40) + 1) * 0x40) as *mut u16;
}
self.cursor
.write_volatile((ascii | ((self.palette as u32) << 12)) as u16);
self.cursor = self.cursor.add(1);
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions tests/multiple_ignore/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[build]
target = "thumbv4t-none-eabi"

[target.thumbv4t-none-eabi]
runner = "mgba"
rustflags = ["-Clinker=arm-none-eabi-ld", "-Clink-arg=-Tgba.ld", "-Ztrap-unreachable=no"]

[unstable]
build-std = ["core"]
14 changes: 14 additions & 0 deletions tests/multiple_ignore/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "multiple_ignore"
version = "0.0.0"
edition = "2021"
publish = false

[profile.dev]
opt-level = 3

[profile.release]
lto = true

[dependencies]
gba_test = {path = "../../gba_test"}
37 changes: 37 additions & 0 deletions tests/multiple_ignore/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//! Defines a single basic test.

#![no_std]
#![no_main]
#![feature(custom_test_frameworks)]
#![test_runner(gba_test::runner)]
#![reexport_test_harness_main = "test_harness"]

pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
#[no_mangle]
pub fn main() {
test_harness()
}

#[cfg(test)]
mod tests {
use super::add;
use gba_test::test;

#[test]
#[ignore]
fn it_works_with_a_long_name() {
let result = add(2, 2);
assert_eq!(result, 4);
}

#[test]
#[ignore]
fn it_works_with_a_long_name_2() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}

0 comments on commit 26258a1

Please sign in to comment.