From 5c9c97117bcc2be5e68258183bb07a22b7273855 Mon Sep 17 00:00:00 2001 From: Stefan Butz Date: Mon, 22 Dec 2025 11:32:57 +0100 Subject: [PATCH 1/3] Fix tests --- tests/hvc.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/hvc.rs b/tests/hvc.rs index 95070d3..83b29bb 100644 --- a/tests/hvc.rs +++ b/tests/hvc.rs @@ -29,9 +29,9 @@ fn vm_create() { mem[EL1_USER_PAYLOAD_ADDRESS as usize..EL1_USER_PAYLOAD_ADDRESS as usize + sz] .clone_from_slice(&el1_user_payload); //map the vec at address 0 - map_mem(mem, 0, MemPerm::ExecAndWrite).unwrap(); + map_mem(mem, 0, MemPerm::ExecWrite).unwrap(); - let vcpu = VirtualCpu::new().unwrap(); + let vcpu = VirtualCpu::new(0).unwrap(); vcpu.write_register(Register::CPSR, 0x3c4).unwrap(); vcpu.write_register(Register::PC, EL1_USER_PAYLOAD_ADDRESS) From ffdfd5b599a6e5998e3df0082de15e78a15b0974 Mon Sep 17 00:00:00 2001 From: Stefan Butz Date: Mon, 22 Dec 2025 11:33:27 +0100 Subject: [PATCH 2/3] Codesign tests on macos --- .cargo/config.toml | 5 +++++ test-runner.sh | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 .cargo/config.toml create mode 100755 test-runner.sh diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..5fed11a --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,5 @@ +[target.aarch64-apple-darwin] +runner = "./test-runner.sh" + +[target.x86_64-apple-darwin] +runner = "./test-runner.sh" diff --git a/test-runner.sh b/test-runner.sh new file mode 100755 index 0000000..8f2b762 --- /dev/null +++ b/test-runner.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Test runner wrapper that codesigns the test binary before running it + +TEST_BINARY="$1" +shift + +# Codesign the test binary on macOS +if [[ "$OSTYPE" == "darwin"* ]]; then + ENTITLEMENTS="$(dirname "$0")/app.entitlements" + if [[ -f "$ENTITLEMENTS" ]]; then + codesign --entitlements "$ENTITLEMENTS" --force -s - "$TEST_BINARY" 2>/dev/null || true + fi +fi + +# Run the test +exec "$TEST_BINARY" "$@" From 19c3553ac69574f4bab40686c3b8e2d6bedbbc66 Mon Sep 17 00:00:00 2001 From: Stefan Butz Date: Mon, 22 Dec 2025 11:51:26 +0100 Subject: [PATCH 3/3] Run tests in ci --- .github/workflows/test.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..9d93d8d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ + +name: Build + +on: + pull_request: + push: + branches: + - main + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + name: Test + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Install toolchain from rust-toolchain.toml + run: rustup show + - name: Install missing targets + run: rustup target add aarch64-apple-darwin x86_64-apple-darwin + - name: Test + run: cargo test --no-fail-fast + env: + RUST_BACKTRACE: 1 \ No newline at end of file