Skip to content

Commit 565d502

Browse files
committed
Test the try_op feature with a custom cfg
1 parent eb4e29f commit 565d502

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

.github/actions/install-rust/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ runs:
4040
EOF
4141
4242
# Deny warnings on CI to keep our code warning-free as it lands in-tree.
43-
echo RUSTFLAGS="-D warnings" >> "$GITHUB_ENV"
43+
echo RUSTFLAGS="-D warnings $RUSTFLAGS" >> "$GITHUB_ENV"
4444
4545
- run: rustup target add wasm32-wasip2
4646
if: inputs.toolchain != 'msrv'

.github/workflows/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ jobs:
132132
rust: stable
133133
env:
134134
RUST_BACKTRACE: 1
135+
# test the 'try_op' feature
136+
- os: ubuntu-latest
137+
rust: stable
138+
env:
139+
RUSTFLAGS: --cfg=debug_check_try_op
140+
flags: -F wasmparser/try-op
135141
env: ${{ matrix.env || fromJSON('{}') }}
136142
steps:
137143
- uses: actions/checkout@v6
@@ -155,7 +161,6 @@ jobs:
155161
- run: cargo test -p wasm-smith --features wasmparser
156162
- run: cargo test -p wasm-smith --features component-model
157163
- run: cargo test --locked -p wasmparser --features try-op
158-
- run: cargo test --locked -F wasmparser/try-op
159164

160165
test_capi:
161166
name: Test the C API

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ rust-2024-incompatible-pat = 'warn'
6666
missing-unsafe-on-extern = 'warn'
6767
unsafe-op-in-unsafe-fn = 'warn'
6868

69-
unexpected_cfgs = { level = 'warn', check-cfg = ['cfg(fuzzing)'] }
69+
unexpected_cfgs = { level = 'warn', check-cfg = ['cfg(fuzzing)', 'cfg(debug_check_try_op)'] }
7070

7171
[workspace.lints.clippy]
7272
# The default set of lints in Clippy is viewed as "too noisy" right now so

crates/wasmparser/src/validator/func.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ impl<T: WasmModuleResources> FuncValidator<T> {
122122
reader.set_features(self.validator.features);
123123
}
124124
while !reader.eof() {
125-
// In a debug build, verify that `rollback` successfully returns the
125+
// In a `debug_check_try_op` build, verify that `rollback` successfully returns the
126126
// validator to its previous state after each (valid or invalid) operator.
127-
#[cfg(all(debug_assertions, feature = "try-op"))]
127+
#[cfg(all(debug_check_try_op, feature = "try-op"))]
128128
{
129129
let snapshot = self.validator.clone();
130130
let op = reader.peek_operator(&self.visitor(reader.original_position()))?;

0 commit comments

Comments
 (0)