From 7a864c8ef54ca810884b0a27d108a350c3e6b4d7 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 26 Feb 2023 14:04:45 +0000 Subject: [PATCH 1/6] Update test repo versions --- build_system/tests.rs | 6 ++++-- patches/0003-rand-Disable-rand-tests-on-mingw.patch | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build_system/tests.rs b/build_system/tests.rs index b55187aa3b4c..5ce1786e2561 100644 --- a/build_system/tests.rs +++ b/build_system/tests.rs @@ -94,13 +94,15 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[ TestCase::build_bin_and_run("aot.issue-72793", "example/issue-72793.rs", &[]), ]; +// FIXME(rust-random/rand#1293): Newer rand versions fail to test on Windows. Update once this is +// fixed. pub(crate) static RAND_REPO: GitRepo = - GitRepo::github("rust-random", "rand", "0f933f9c7176e53b2a3c7952ded484e1783f0bf1", "rand"); + GitRepo::github("rust-random", "rand", "50b9a447410860af8d6db9a208c3576886955874", "rand"); pub(crate) static RAND: CargoProject = CargoProject::new(&RAND_REPO.source_dir(), "rand"); pub(crate) static REGEX_REPO: GitRepo = - GitRepo::github("rust-lang", "regex", "341f207c1071f7290e3f228c710817c280c8dca1", "regex"); + GitRepo::github("rust-lang", "regex", "a9b2e02352db92ce1f6e5b7ecd41b8bbffbe161a", "regex"); pub(crate) static REGEX: CargoProject = CargoProject::new(®EX_REPO.source_dir(), "regex"); diff --git a/patches/0003-rand-Disable-rand-tests-on-mingw.patch b/patches/0003-rand-Disable-rand-tests-on-mingw.patch index d8775e2d022a..eb452c5cd377 100644 --- a/patches/0003-rand-Disable-rand-tests-on-mingw.patch +++ b/patches/0003-rand-Disable-rand-tests-on-mingw.patch @@ -19,8 +19,8 @@ index 217899e..9cedeb7 100644 + // This is broken on x86_64-pc-windows-gnu presumably due to a broken powf implementation + #[cfg_attr(all(target_os = "windows", target_env = "gnu"), ignore)] fn value_stability() { - fn test_samples>( - distr: D, zero: F, expected: &[F], + fn test_samples>( + distr: D, thresh: F, expected: &[F], diff --git a/rand_distr/tests/value_stability.rs b/rand_distr/tests/value_stability.rs index 192ba74..0101ace 100644 --- a/rand_distr/tests/value_stability.rs From 5e6cde150e4b09d97a204f697e65e9d53e0af96a Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 26 Feb 2023 14:27:45 +0000 Subject: [PATCH 2/6] Remove --cap-lint warn from regex test --- build_system/tests.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/build_system/tests.rs b/build_system/tests.rs index 5ce1786e2561..3738b5319b0c 100644 --- a/build_system/tests.rs +++ b/build_system/tests.rs @@ -153,18 +153,13 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[ TestCase::custom("test.regex-shootout-regex-dna", &|runner| { REGEX.clean(&runner.dirs); - // newer aho_corasick versions throw a deprecation warning - let lint_rust_flags = format!("{} --cap-lints warn", runner.target_compiler.rustflags); - let mut build_cmd = REGEX.build(&runner.target_compiler, &runner.dirs); build_cmd.arg("--example").arg("shootout-regex-dna"); - build_cmd.env("RUSTFLAGS", lint_rust_flags.clone()); spawn_and_wait(build_cmd); if runner.is_native { let mut run_cmd = REGEX.run(&runner.target_compiler, &runner.dirs); run_cmd.arg("--example").arg("shootout-regex-dna"); - run_cmd.env("RUSTFLAGS", lint_rust_flags); let input = fs::read_to_string( REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-input.txt"), @@ -197,9 +192,6 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[ TestCase::custom("test.regex", &|runner| { REGEX.clean(&runner.dirs); - // newer aho_corasick versions throw a deprecation warning - let lint_rust_flags = format!("{} --cap-lints warn", runner.target_compiler.rustflags); - if runner.is_native { let mut run_cmd = REGEX.test(&runner.target_compiler, &runner.dirs); run_cmd.args([ @@ -211,13 +203,11 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[ "-Zunstable-options", "-q", ]); - run_cmd.env("RUSTFLAGS", lint_rust_flags); spawn_and_wait(run_cmd); } else { eprintln!("Cross-Compiling: Not running tests"); let mut build_cmd = REGEX.build(&runner.target_compiler, &runner.dirs); build_cmd.arg("--tests"); - build_cmd.env("RUSTFLAGS", lint_rust_flags.clone()); spawn_and_wait(build_cmd); } }), From 19ed2139a3250f974312becfd0fe3ef609cf68bf Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 26 Feb 2023 14:28:22 +0000 Subject: [PATCH 3/6] Remove no longer necessary code removing "[codegen mono items]" from test output --- build_system/tests.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/build_system/tests.rs b/build_system/tests.rs index 3738b5319b0c..ff958dcdc697 100644 --- a/build_system/tests.rs +++ b/build_system/tests.rs @@ -171,13 +171,6 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[ .unwrap(); let output = spawn_and_wait_with_input(run_cmd, input); - // Make sure `[codegen mono items] start` doesn't poison the diff - let output = output - .lines() - .filter(|line| !line.contains("codegen mono items")) - .chain(Some("")) // This just adds the trailing newline - .collect::>() - .join("\r\n"); let output_matches = expected.lines().eq(output.lines()); if !output_matches { From b193419ec7550d1d4262e8bc4448f4bd55fc9f20 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 26 Feb 2023 16:50:08 +0000 Subject: [PATCH 4/6] Allow multiple threads and panicking tests when testing regex I guess this was a leftover from very early in the development of cg_clif. Allowing multiple threads significantly improves performance, while panicking tests can run now thanks to -Zpanic-abort-tests. --- build_system/tests.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/build_system/tests.rs b/build_system/tests.rs index ff958dcdc697..ba0a98e73713 100644 --- a/build_system/tests.rs +++ b/build_system/tests.rs @@ -187,15 +187,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[ if runner.is_native { let mut run_cmd = REGEX.test(&runner.target_compiler, &runner.dirs); - run_cmd.args([ - "--tests", - "--", - "--exclude-should-panic", - "--test-threads", - "1", - "-Zunstable-options", - "-q", - ]); + run_cmd.args(["--tests", "--", "-q"]); spawn_and_wait(run_cmd); } else { eprintln!("Cross-Compiling: Not running tests"); From c615e9248aed8ce6bbb5ae73d38595bde3457bae Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 26 Feb 2023 17:35:53 +0000 Subject: [PATCH 5/6] Run tests for all crates in the regex workspace --- build_system/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_system/tests.rs b/build_system/tests.rs index ba0a98e73713..956a61ceaecc 100644 --- a/build_system/tests.rs +++ b/build_system/tests.rs @@ -187,7 +187,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[ if runner.is_native { let mut run_cmd = REGEX.test(&runner.target_compiler, &runner.dirs); - run_cmd.args(["--tests", "--", "-q"]); + run_cmd.args(["--workspace", "--", "-q"]); spawn_and_wait(run_cmd); } else { eprintln!("Cross-Compiling: Not running tests"); From b88e129915b2b623331997b4234cdfeb367b45c7 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 26 Feb 2023 17:37:29 +0000 Subject: [PATCH 6/6] Avoid a duplicate "[TEST] rust-random/rand" --- build_system/tests.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build_system/tests.rs b/build_system/tests.rs index 956a61ceaecc..261948a69713 100644 --- a/build_system/tests.rs +++ b/build_system/tests.rs @@ -125,12 +125,11 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[ RAND.clean(&runner.dirs); if runner.is_native { - eprintln!("[TEST] rust-random/rand"); let mut test_cmd = RAND.test(&runner.target_compiler, &runner.dirs); test_cmd.arg("--workspace").arg("--").arg("-q"); spawn_and_wait(test_cmd); } else { - eprintln!("[AOT] rust-random/rand"); + eprintln!("Cross-Compiling: Not running tests"); let mut build_cmd = RAND.build(&runner.target_compiler, &runner.dirs); build_cmd.arg("--workspace").arg("--tests"); spawn_and_wait(build_cmd);