Compile `no_std` test using xargo

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.
This commit is contained in:
Martin Habovstiak 2024-07-04 08:14:18 +02:00
parent 2572fb6ab0
commit 742c69f975
3 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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.

2
no_std_test/Xargo.toml Normal file
View File

@ -0,0 +1,2 @@
[dependencies]
alloc = {}