Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,117 @@ impl CommandLineStep for StdarchVerify {
}
}

/// Runs `core_arch`'s inline unit and `assert_instr` tests for the native
/// targets rust already tests on (x86_64 / aarch64).
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CoreArchTest {
build_compiler: Compiler,
host: TargetSelection,
}

impl CommandLineStep for CoreArchTest {
type Output = ();
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.alias("core-arch")
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
true
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(CoreArchTest {
build_compiler: get_compiler_to_test(run.builder, run.target),
host: run.target,
});
}

fn run(self, builder: &Builder<'_>) {
let host = self.host;
if !host.contains("x86_64-unknown-linux") && !host.contains("aarch64-unknown-linux") {
builder.info(&format!("Skipping core_arch tests, unsupported on {host}"));
return;
}

let build_compiler = self.build_compiler;
builder.std(build_compiler, host);
let record_failed_tests = builder.ensure(SetupFailedTestsFile);

let mut cargo = tool::prepare_tool_cargo(
builder,
build_compiler,
Mode::ToolStd,
host,
Kind::Test,
"library/stdarch/crates/core_arch",
SourceType::InTree,
&[],
);
cargo.env("TARGET", host.to_string().as_str());

let allowed_features = [
// tidy-alphabetical-start
"aarch64_unstable_target_feature",
"abi_unadjusted",
"abi_vectorcall",
"allow_internal_unstable",
"arm_target_feature",
"asm_experimental_arch",
"avx10_target_feature",
"clflushopt_target_feature",
"const_cmp",
"const_eval_select",
"const_trait_impl",
"core_intrinsics",
"custom_inner_attributes",
"decl_macro",
"doc_cfg",
"f16",
"fmt_helpers_for_derive",
"funnel_shifts",
"hexagon_target_feature",
"link_llvm_intrinsics",
"loongarch_target_feature",
"maybe_uninit_as_bytes",
"min_adt_const_params",
"mips_target_feature",
"movrs_target_feature",
"no_core",
"powerpc_target_feature",
"proc_macro_hygiene",
"repr_simd",
"riscv_target_feature",
"rtm_target_feature",
"rustc_attrs",
"simd_ffi",
"staged_api",
"stdarch_arm_feature_detection",
"stdarch_internal",
"stdarch_mips_feature_detection",
"stdarch_powerpc_feature_detection",
"stmt_expr_attributes",
"test",
"wasm_target_feature",
"x86_amx_intrinsics",
// tidy-alphabetical-end
];
cargo.allow_features(&allowed_features.join(","));
cargo.rustflag("-Zmerge-functions=disabled");

run_cargo_test(
cargo,
&[],
&["core_arch".to_string()],
Some("core_arch"),
host,
builder,
record_failed_tests,
);
}
}

/// Runs stdarch's intrinsic-test binary crate to verify that Rust's `core::arch`
/// SIMD intrinsics produce the same results as their C counterparts.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ expression: test
[Test] test::StdarchVerify
targets: [x86_64-unknown-linux-gnu]
- Set({library/stdarch/crates/stdarch-verify})
[Test] test::CoreArchTest
targets: [x86_64-unknown-linux-gnu]
- Set({core-arch})
[Test] test::RustdocJSStd
targets: [x86_64-unknown-linux-gnu]
- Suite(tests/rustdoc-js-std)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ expression: test --skip=coverage
[Test] test::StdarchVerify
targets: [x86_64-unknown-linux-gnu]
- Set({library/stdarch/crates/stdarch-verify})
[Test] test::CoreArchTest
targets: [x86_64-unknown-linux-gnu]
- Set({core-arch})
[Test] test::RustdocJSStd
targets: [x86_64-unknown-linux-gnu]
- Suite(tests/rustdoc-js-std)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ expression: test --skip=coverage-map
[Test] test::StdarchVerify
targets: [x86_64-unknown-linux-gnu]
- Set({library/stdarch/crates/stdarch-verify})
[Test] test::CoreArchTest
targets: [x86_64-unknown-linux-gnu]
- Set({core-arch})
[Test] test::RustdocJSStd
targets: [x86_64-unknown-linux-gnu]
- Suite(tests/rustdoc-js-std)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ expression: test --skip=coverage-run
[Test] test::StdarchVerify
targets: [x86_64-unknown-linux-gnu]
- Set({library/stdarch/crates/stdarch-verify})
[Test] test::CoreArchTest
targets: [x86_64-unknown-linux-gnu]
- Set({core-arch})
[Test] test::RustdocJSStd
targets: [x86_64-unknown-linux-gnu]
- Suite(tests/rustdoc-js-std)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ expression: test --skip=tests
[Test] test::StdarchVerify
targets: [x86_64-unknown-linux-gnu]
- Set({library/stdarch/crates/stdarch-verify})
[Test] test::CoreArchTest
targets: [x86_64-unknown-linux-gnu]
- Set({core-arch})
[Test] test::RustdocTheme
targets: [x86_64-unknown-linux-gnu]
- Set({src/tools/rustdoc-themes})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ expression: test --skip=tests/coverage
[Test] test::StdarchVerify
targets: [x86_64-unknown-linux-gnu]
- Set({library/stdarch/crates/stdarch-verify})
[Test] test::CoreArchTest
targets: [x86_64-unknown-linux-gnu]
- Set({core-arch})
[Test] test::RustdocJSStd
targets: [x86_64-unknown-linux-gnu]
- Suite(tests/rustdoc-js-std)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ expression: test --skip=tests --skip=library --skip=tidyselftest
[Test] test::RustcBook
targets: [x86_64-unknown-linux-gnu]
- Set({src/doc/rustc})
[Test] test::CoreArchTest
targets: [x86_64-unknown-linux-gnu]
- Set({core-arch})
[Test] test::RustdocTheme
targets: [x86_64-unknown-linux-gnu]
- Set({src/tools/rustdoc-themes})
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ impl<'a> Builder<'a> {
test::Clippy,
test::CompiletestTest,
test::StdarchVerify,
test::CoreArchTest,
test::CrateRunMakeSupport,
test::CrateBuildHelper,
test::RustdocJSStd,
Expand Down
7 changes: 7 additions & 0 deletions src/ci/docker/scripts/stage_2_test_set1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ if [ "$LLVM_VERSION" = "21" ]; then
SKIP_INTRINSICS="--skip intrinsic-test"
fi

# Skip core-arch on LLVM < 23 to avoid CI failures.
if [ -n "$LLVM_VERSION" ] && [ "$LLVM_VERSION" -lt 23 ]; then
echo "LLVM_VERSION < 23; skipping core-arch"
SKIP_CORE_ARCH="--skip core-arch"
fi

../x.py --stage 2 test \
${SKIP_TIDY:+$SKIP_TIDY} \
${SKIP_INTRINSICS:+$SKIP_INTRINSICS} \
${SKIP_CORE_ARCH:+$SKIP_CORE_ARCH} \
--skip compiler \
--skip src
7 changes: 7 additions & 0 deletions src/ci/docker/scripts/stage_2_test_set2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ if [ "$LLVM_VERSION" = "21" ]; then
SKIP_INTRINSICS="--skip intrinsic-test"
fi

# Skip core-arch on LLVM < 23 to avoid CI failures.
if [ -n "$LLVM_VERSION" ] && [ "$LLVM_VERSION" -lt 23 ]; then
echo "LLVM_VERSION < 23; skipping core-arch"
SKIP_CORE_ARCH="--skip core-arch"
fi

../x.py --stage 2 test \
${SKIP_TIDY:+$SKIP_TIDY} \
${SKIP_INTRINSICS:+$SKIP_INTRINSICS} \
${SKIP_RUST_ANALYZER:+$SKIP_RUST_ANALYZER} \
${SKIP_CORE_ARCH:+$SKIP_CORE_ARCH} \
--skip tests \
--skip library \
--skip tidyselftest
Loading