Skip to content

Commit 742c69f

Browse files
committed
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.
1 parent 2572fb6 commit 742c69f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.github/workflows/rust.yml

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
uses: dtolnay/rust-toolchain@nightly
4747
- name: Install src
4848
run: rustup component add rust-src
49+
- name: Install xargo
50+
run: cargo install xargo
4951
- name: Running test script
5052
env:
5153
DO_FMT: true

contrib/_test.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ if [ "$DO_ASAN" = true ]; then
101101
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes -Cllvm-args=-msan-eager-checks=0' \
102102
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
103103

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

108110
# Run formatter if told to.

no_std_test/Xargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[dependencies]
2+
alloc = {}

0 commit comments

Comments
 (0)