From 97a1b1504a2b2aa5a6c61a3bdd8863266ba6b738 Mon Sep 17 00:00:00 2001 From: messense Date: Sat, 22 Jan 2022 12:33:44 +0800 Subject: [PATCH] chore: run asan with recompiled and instrumented Rust std library https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/sanitizer.html#instrumentation-of-external-dependencies-and-std --- .github/workflows/asan.yml | 9 ++------- package.json | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index 15724ce5..41920480 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -35,6 +35,7 @@ jobs: with: toolchain: nightly profile: minimal + components: rust-src override: true - name: Generate Cargo.lock @@ -66,15 +67,9 @@ jobs: - name: 'Build TypeScript' run: yarn build - - name: Check build - uses: actions-rs/cargo@v1 - with: - command: check - args: --all --bins --examples --tests -vvv - - name: Unit tests with address sanitizer run: | - yarn build:test + yarn build:test:asan LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/9/libasan.so yarn test env: RUST_TARGET: x86_64-unknown-linux-gnu diff --git a/package.json b/package.json index 289f1af7..a982893b 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "build:bench": "yarn --cwd ./bench build", "build:memory": "yarn --cwd ./memory-testing build", "build:test": "yarn --cwd ./examples/napi-compat-mode build && yarn --cwd ./examples/napi build", + "build:test:asan": "yarn --cwd ./examples/napi-compat-mode build --cargo-flags='-Zbuild-std' && yarn --cwd ./examples/napi build --cargo-flags='-Zbuild-std'", "build:test:aarch64": "yarn --cwd ./examples/napi-compat-mode build-aarch64 && yarn --cwd ./examples/napi build-aarch64", "build:test:android": "yarn --cwd ./examples/napi-compat-mode build --target aarch64-linux-android && yarn --cwd ./examples/napi build --target aarch64-linux-android", "build:test:android:armv7": "yarn --cwd ./examples/napi-compat-mode build --target armv7-linux-androideabi && yarn --cwd ./examples/napi build --target armv7-linux-androideabi",