Skip to content

Commit 732d48a

Browse files
committed
Change test skipping logic a little, separate feature-based and function-based skipping
1 parent 5056fa7 commit 732d48a

File tree

5 files changed

+27
-31
lines changed

5 files changed

+27
-31
lines changed

ci/docker/powerpc64-unknown-linux-gnu/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
88
ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
99
CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -cpu power10 -L /usr/powerpc64-linux-gnu" \
1010
CC=powerpc64-linux-gnu-gcc \
11-
OBJDUMP=powerpc64-linux-gnu-objdump
11+
OBJDUMP=powerpc64-linux-gnu-objdump \
12+
# These 2 tests have erratic behaviour with qemu, see https://gitlab.com/qemu-project/qemu/-/issues/1623#note_2449012173
13+
STDARCH_TEST_SKIP_FUNCTION=vec_lde_u16,vec_lde_u32

ci/run.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ case ${TARGET} in
5656
esac
5757

5858
echo "RUSTFLAGS=${RUSTFLAGS}"
59-
echo "FEATURES=${FEATURES}"
6059
echo "OBJDUMP=${OBJDUMP}"
6160
echo "STDARCH_DISABLE_ASSERT_INSTR=${STDARCH_DISABLE_ASSERT_INSTR}"
6261
echo "STDARCH_TEST_EVERYTHING=${STDARCH_TEST_EVERYTHING}"
62+
echo "STDARCH_TEST_SKIP_FEATURE=${STDARCH_TEST_SKIP_FEATURE}"
63+
echo "STDARCH_TEST_SKIP_FUNCTION=${STDARCH_TEST_SKIP_FUNCTION}"
6364
echo "PROFILE=${PROFILE}"
6465

6566
cargo_test() {
@@ -78,15 +79,7 @@ cargo_test() {
7879
wasm32*)
7980
cmd="$cmd --nocapture"
8081
;;
81-
# qemu has an erratic behavior on those tests
82-
powerpc64-unknown-linux-gnu)
83-
cmd="$cmd --skip test_vec_lde_u16 --skip test_vec_lde_u32"
84-
;;
8582
esac
86-
87-
if [ "$SKIP_TESTS" != "" ]; then
88-
cmd="$cmd --skip "$SKIP_TESTS
89-
fi
9083
$cmd
9184
}
9285

crates/assert-instr-macro/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ test = false
1212
proc-macro2 = "1.0"
1313
quote = "1.0"
1414
syn = { version = "2.0", features = ["full"] }
15+
16+
[lints.rust]
17+
unexpected_cfgs = {level = "warn", check-cfg = ['cfg(optimized)'] }

crates/assert-instr-macro/build.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::env;
22

33
fn main() {
4-
println!("cargo:rerun-if-changed=build.rs");
5-
println!("cargo::rustc-check-cfg=cfg(optimized)");
64
let opt_level = env::var("OPT_LEVEL")
75
.ok()
86
.and_then(|s| s.parse().ok())

crates/simd-test-macro/src/lib.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ pub fn simd_test(
5151
let target = env::var("TARGET").expect(
5252
"TARGET environment variable should be set for rustc (e.g. TARGET=x86_64-apple-darwin cargo test)"
5353
);
54-
let mut force_test = false;
5554
let macro_test = match target
5655
.split('-')
5756
.next()
@@ -63,27 +62,29 @@ pub fn simd_test(
6362
maybe_riscv if maybe_riscv.starts_with("riscv") => "is_riscv_feature_detected",
6463
"powerpc" | "powerpcle" => "is_powerpc_feature_detected",
6564
"powerpc64" | "powerpc64le" => "is_powerpc64_feature_detected",
66-
"mips" | "mipsel" | "mipsisa32r6" | "mipsisa32r6el" => {
67-
// FIXME:
68-
// On MIPS CI run-time feature detection always returns false due
69-
// to this qemu bug: https://bugs.launchpad.net/qemu/+bug/1754372
70-
//
71-
// This is a workaround to force the MIPS tests to always run on
72-
// CI.
73-
force_test = true;
74-
"is_mips_feature_detected"
75-
}
76-
"mips64" | "mips64el" | "mipsisa64r6" | "mipsisa64r6el" => {
77-
// FIXME: see above
78-
force_test = true;
79-
"is_mips64_feature_detected"
80-
}
8165
"loongarch64" => "is_loongarch_feature_detected",
8266
"s390x" => "is_s390x_feature_detected",
8367
t => panic!("unknown target: {t}"),
8468
};
8569
let macro_test = Ident::new(macro_test, Span::call_site());
8670

71+
let skipped_functions = env::var("STDARCH_TEST_SKIP_FUNCTION").unwrap_or_default();
72+
let skipped_features = env::var("STDARCH_TEST_SKIP_FEATURE").unwrap_or_default();
73+
74+
let mut name_str = &*name.to_string();
75+
if name_str.starts_with("test_") {
76+
name_str = &name_str[5..];
77+
}
78+
79+
let skip_this = skipped_functions
80+
.split(',')
81+
.map(str::trim)
82+
.any(|s| s == name_str)
83+
|| skipped_features
84+
.split(',')
85+
.map(str::trim)
86+
.any(|s| target_features.iter().any(|feature| s == feature));
87+
8788
let mut detect_missing_features = TokenStream::new();
8889
for feature in target_features {
8990
let q = quote_spanned! {
@@ -95,8 +96,7 @@ pub fn simd_test(
9596
q.to_tokens(&mut detect_missing_features);
9697
}
9798

98-
let test_norun = std::env::var("STDSIMD_TEST_NORUN").is_ok();
99-
let maybe_ignore = if test_norun {
99+
let maybe_ignore = if skip_this {
100100
quote! { #[ignore] }
101101
} else {
102102
TokenStream::new()
@@ -111,7 +111,7 @@ pub fn simd_test(
111111
fn #name() {
112112
let mut missing_features = ::std::vec::Vec::new();
113113
#detect_missing_features
114-
if #force_test || missing_features.is_empty() {
114+
if missing_features.is_empty() {
115115
let v = unsafe { #name() };
116116
return v;
117117
} else {

0 commit comments

Comments
 (0)