Skip to content

Commit e3fa7b4

Browse files
committed
tests: Don't run panicky tests if debug assertions are disabled
1 parent 3925faf commit e3fa7b4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

tests/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ ignore = false
4040
# When the test passes in the future, it'll fail and alert that it now passes.
4141
# This will not catch Ruffle panics; if the test is expected to panic, use
4242
# `known_failure.panic = "panic message"`
43-
# instead.
43+
# instead (note that 'panicky' tests will be skipped if the test harness is run
44+
# with debug assertions disabled, e.g. with `--release`).
4445
known_failure = false
4546

4647
# Path (relative to the directory containing test.toml) to the expected output

tests/framework/src/test.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::collections::HashMap;
22

33
use crate::environment::Environment;
44
use crate::options::TestOptions;
5+
use crate::options::known_failure::KnownFailure;
56
use crate::runner::TestRunner;
67
use crate::util::read_bytes;
78
use anyhow::{Result, anyhow};
@@ -145,6 +146,15 @@ impl Test {
145146
if ignore_known_failures && self.options.has_known_failure() {
146147
return false;
147148
}
149+
150+
// Panicky tests may expect to hit a debug assertion, so don't run them
151+
// if assertions are disabled.
152+
if !cfg!(debug_assertions)
153+
&& matches!(self.options.known_failure, KnownFailure::Panic { .. })
154+
{
155+
return false;
156+
}
157+
148158
self.options.required_features.can_run()
149159
&& self
150160
.options

0 commit comments

Comments
 (0)