Skip to content

Commit 6bfa008

Browse files
Only run tests/assembly-* and tests/codegen-* tests if they match the current codegen backend
1 parent a27f3e3 commit 6bfa008

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/tools/compiletest/src/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ impl TestMode {
5757
string_enum! {
5858
#[derive(Clone, Copy, PartialEq, Debug)]
5959
pub enum TestSuite {
60-
Assembly => "assembly",
61-
Codegen => "codegen",
60+
AssemblyLlvm => "assembly-llvm",
61+
CodegenLlvm => "codegen-llvm",
6262
CodegenUnits => "codegen-units",
6363
Coverage => "coverage",
6464
CoverageRunRustdoc => "coverage-run-rustdoc",

src/tools/compiletest/src/lib.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use std::time::SystemTime;
3131
use std::{env, fs, vec};
3232

3333
use build_helper::git::{get_git_modified_files, get_git_untracked_files};
34-
use camino::{Utf8Path, Utf8PathBuf};
34+
use camino::{Utf8Component, Utf8Path, Utf8PathBuf};
3535
use getopts::Options;
3636
use rayon::iter::{ParallelBridge, ParallelIterator};
3737
use tracing::debug;
@@ -799,6 +799,23 @@ fn collect_tests_from_dir(
799799
return Ok(TestCollector::new());
800800
}
801801

802+
let mut components = dir.components().rev();
803+
if let Some(Utf8Component::Normal(last)) = components.next()
804+
&& let Some(("assembly" | "codegen", backend)) = last.split_once('-')
805+
&& let Some(Utf8Component::Normal(parent)) = components.next()
806+
&& parent == "tests"
807+
&& let Ok(backend) = CodegenBackend::try_from(backend)
808+
&& backend != cx.config.codegen_backend
809+
{
810+
// We ignore asm tests which don't match the current codegen backend.
811+
warning!(
812+
"Ignoring tests in `{dir}` because they don't match the configured codegen \
813+
backend (`{}`)",
814+
cx.config.codegen_backend.as_str(),
815+
);
816+
return Ok(TestCollector::new());
817+
}
818+
802819
// For run-make tests, a "test file" is actually a directory that contains an `rmake.rs`.
803820
if cx.config.mode == TestMode::RunMake {
804821
let mut collector = TestCollector::new();

0 commit comments

Comments
 (0)