Skip to content

Commit

Permalink
panic checks in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel5151 committed Feb 12, 2023
1 parent 1c5407e commit a2b811a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,35 @@ jobs:
profile: minimal
toolchain: stable
override: true

- name: cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --tests --examples --features=std -- -D warnings

- name: cargo doc
uses: actions-rs/cargo@v1
with:
command: doc
args: --workspace --features=std

# don't forget the no_std example!
- name: cargo clippy (example_no_std)
uses: actions-rs/cargo@v1
with:
command: clippy
args: --manifest-path example_no_std/Cargo.toml

- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --features=std
- name: cargo doc
uses: actions-rs/cargo@v1
with:
command: doc
args: --workspace --features=std

- name: no panics in example_no_std
run: ./example_no_std/dump_asm.sh
shell: bash

rustfmt:
name: rustfmt (nightly)
Expand Down
16 changes: 15 additions & 1 deletion example_no_std/dump_asm.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#!/bin/bash
set -e

cd "$(dirname "$(realpath "$0")")"

if ! command -v rustfilt &> /dev/null
then
cargo install rustfilt
fi

cargo rustc --release -- --emit asm -C "llvm-args=-x86-asm-syntax=intel"
cat ./target/release/deps/gdbstub_nostd-*.s | c++filt > asm.s
cat ./target/release/deps/gdbstub_nostd-*.s | rustfilt > asm.s
sed -i -E '/\.(cfi_def_cfa_offset|cfi_offset|cfi_startproc|cfi_endproc|size)/d' asm.s
echo "asm emitted to asm.s"

if grep "core::panicking::panic_fmt" asm.s
then
echo "found panic in example_no_std!"
exit 1
fi

0 comments on commit a2b811a

Please sign in to comment.