Skip to content

Commit

Permalink
Compile no_std test using xargo
Browse files Browse the repository at this point in the history
The `no_std` test disables `std`, so unwinding is unsupported, so we use
`panic = "abort"` but the `core` library is compiled with unwind by
default which breaks the build. Xargo can handle this by recompiling
`core` with `panic = "abort"` so we use it.
  • Loading branch information
Kixunil committed Jul 4, 2024
1 parent 2572fb6 commit 742c69f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
uses: dtolnay/rust-toolchain@nightly
- name: Install src
run: rustup component add rust-src
- name: Install xargo
run: cargo install xargo
- name: Running test script
env:
DO_FMT: true
Expand Down
6 changes: 4 additions & 2 deletions contrib/_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ if [ "$DO_ASAN" = true ]; then
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes -Cllvm-args=-msan-eager-checks=0' \
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu

cargo run --release --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified Successfully"
cargo run --release --features=alloc --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified alloc Successfully"
cd no_std_test
xargo run --release --target=x86_64-unknown-linux-gnu | grep -q "Verified Successfully"
xargo run --release --target=x86_64-unknown-linux-gnu --features=alloc | grep -q "Verified alloc Successfully"
cd -
fi

# Run formatter if told to.
Expand Down
2 changes: 2 additions & 0 deletions no_std_test/Xargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[dependencies]
alloc = {}

0 comments on commit 742c69f

Please sign in to comment.