Skip to content

Commit 407420a

Browse files
committed
Update the assertion message
1 parent afe33d1 commit 407420a

File tree

1 file changed

+20
-8
lines changed
  • fearless_simd_tests/tests

1 file changed

+20
-8
lines changed

fearless_simd_tests/tests/mod.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,41 @@ fn generic_cast<S: Simd>(x: S::f32s) -> S::u32s {
4343
unused_variables,
4444
reason = "The constructed `Level` is only used in some cfgs."
4545
)]
46+
#[allow(
47+
dead_code,
48+
reason = "The `UNSUPPORTED_LEVEL_MESSAGE` is only used in some cfgs."
49+
)]
4650
#[test]
4751
fn supports_highest_level() {
52+
const UNSUPPORTED_LEVEL_MESSAGE: &str = "This means that some of the other tests in this run may be false positives, that is, they have been marked as succeeding even though they would actually fail if they could run.\n\
53+
When these tests are run on CI, any false positives should be caught.\n\
54+
However, please open a thread in the #simd channel on the Linebender Zulip if you see this message.\n\
55+
That would allow us to know whether it's worth us setting up the tests to run on an emulated system (such as using QEMU).";
56+
57+
let level = Level::new();
58+
4859
// When running tests locally, ensure that every SIMD level to be tested is actually supported. The tests themselves
4960
// will return early and pass if run with an unsupported SIMD level.
5061
//
5162
// We skip this on CI because some runners may not support all SIMD levels--in particular, the macOS x86_64 runner
5263
// doesn't support AVX2.
5364
if std::env::var_os("CI").is_none() {
54-
let level = Level::new();
55-
5665
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
5766
assert!(
5867
level.as_avx2().is_some(),
59-
"This machine supports AVX2 and below"
68+
"This machine does not support every `Level` supported by Fearless SIMD (currently AVX2 and below).\n{UNSUPPORTED_LEVEL_MESSAGE}",
6069
);
6170

6271
#[cfg(target_arch = "aarch64")]
63-
assert!(level.as_neon().is_some(), "This machine supports NEON");
64-
65-
#[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
6672
assert!(
67-
level.as_wasm_simd128().is_some(),
68-
"This environment supports WASM SIMD128"
73+
level.as_neon().is_some(),
74+
"This machine does not support every `Level` supported by Fearless SIMD (currently NEON and below).\n{UNSUPPORTED_LEVEL_MESSAGE}",
6975
);
7076
}
77+
78+
#[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
79+
assert!(
80+
level.as_wasm_simd128().is_some(),
81+
"This environment does not support WASM SIMD128. This should never happen, since it should always be supported if the `simd128` feature is enabled."
82+
);
7183
}

0 commit comments

Comments
 (0)