Skip to content

Commit

Permalink
No more examples in regex so cannot run them
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 16, 2024
1 parent c00dc79 commit 95ee23e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 63 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
# "--asm-tests",
"--test-libcore",
"--extended-rand-tests",
"--extended-regex-example-tests",
"--extended-regex-tests",
"--test-successful-rustc --nb-parts 2 --current-part 0",
"--test-successful-rustc --nb-parts 2 --current-part 1",
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/m68k.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
# TODO(antoyo): fix those on m68k.
#"--test-libcore",
#"--extended-rand-tests",
#"--extended-regex-example-tests",
#"--extended-regex-tests",
#"--test-successful-rustc --nb-parts 2 --current-part 0",
#"--test-successful-rustc --nb-parts 2 --current-part 1",
Expand Down
95 changes: 34 additions & 61 deletions build_system/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ fn get_runners() -> Runners {
"--extended-rand-tests",
("Run extended rand tests", extended_rand_tests),
);
runners.insert(
"--extended-regex-example-tests",
(
"Run extended regex example tests",
extended_regex_example_tests,
),
);
runners.insert(
"--extended-regex-tests",
("Run extended regex tests", extended_regex_tests),
Expand Down Expand Up @@ -782,76 +775,39 @@ fn extended_rand_tests(env: &Env, args: &TestArg) -> Result<(), String> {
Ok(())
}

fn extended_regex_example_tests(env: &Env, args: &TestArg) -> Result<(), String> {
fn extended_regex_tests(env: &Env, args: &TestArg) -> Result<(), String> {
if !args.is_using_gcc_master_branch() {
println!("Not using GCC master branch. Skipping `extended_regex_example_tests`.");
println!("Not using GCC master branch. Skipping `extended_regex_tests`.");
return Ok(());
}
let path = Path::new(crate::BUILD_DIR).join("regex");
run_cargo_command(&[&"clean"], Some(&path), env, args)?;
// FIXME: create a function "display_if_not_quiet" or something along the line.
println!("[TEST] rust-lang/regex example shootout-regex-dna");
println!("[TEST] rust-lang/regex tests");
let mut env = env.clone();
// newer aho_corasick versions throw a deprecation warning
let rustflags = format!(
"{} --cap-lints warn",
env.get("RUSTFLAGS").cloned().unwrap_or_default()
);
env.insert("RUSTFLAGS".to_string(), rustflags);
// Make sure `[codegen mono items] start` doesn't poison the diff
run_cargo_command(
&[&"build", &"--example", &"shootout-regex-dna"],
Some(&path),
&env,
args,
)?;
let path = Path::new(crate::BUILD_DIR).join("regex");

run_cargo_command_with_callback(
&[&"run", &"--example", &"shootout-regex-dna"],
run_cargo_command(
&[
&"build",
&"-p",
&"regex",
&"-p",
&"regex-syntax",
&"--release",
&"--all-targets",
&"--",
&"-q",
],
Some(&path),
&env,
args,
|cargo_command, cwd, env| {
// FIXME: rewrite this with `child.stdin.write_all()` because
// `examples/regexdna-input.txt` is very small.
let mut command: Vec<&dyn AsRef<OsStr>> = vec![&"bash", &"-c"];
let cargo_args = cargo_command
.iter()
.map(|s| s.as_ref().to_str().unwrap())
.collect::<Vec<_>>();
let bash_command = format!(
"cat examples/regexdna-input.txt | {} | grep -v 'Spawned thread' > res.txt",
cargo_args.join(" "),
);
command.push(&bash_command);
run_command_with_output_and_env(&command, cwd, Some(env))?;
run_command_with_output_and_env(
&[&"diff", &"-u", &"res.txt", &"examples/regexdna-output.txt"],
cwd,
Some(env),
)?;
Ok(())
},
)?;

Ok(())
}

fn extended_regex_tests(env: &Env, args: &TestArg) -> Result<(), String> {
if !args.is_using_gcc_master_branch() {
println!("Not using GCC master branch. Skipping `extended_regex_tests`.");
return Ok(());
}
// FIXME: create a function "display_if_not_quiet" or something along the line.
println!("[TEST] rust-lang/regex tests");
let mut env = env.clone();
// newer aho_corasick versions throw a deprecation warning
let rustflags = format!(
"{} --cap-lints warn",
env.get("RUSTFLAGS").cloned().unwrap_or_default()
);
env.insert("RUSTFLAGS".to_string(), rustflags);
let path = Path::new(crate::BUILD_DIR).join("regex");
run_cargo_command(
&[
&"test",
Expand All @@ -868,6 +824,24 @@ fn extended_regex_tests(env: &Env, args: &TestArg) -> Result<(), String> {
&env,
args,
)?;

// Don't run integration tests for regex-autonata. they take like 2min each without
// much extra coverage of simd usage.
run_cargo_command(
&[
&"build",
&"-p",
&"regex-automata",
&"--release",
&"--lib",
&"--",
&"-q",
],
Some(&path),
&env,
args,
)?;

Ok(())
}

Expand All @@ -883,7 +857,6 @@ fn extended_sysroot_tests(env: &Env, args: &TestArg) -> Result<(), String> {
// hyperfine --runs "${RUN_RUNS:-10}" ./raytracer_cg_llvm ./raytracer_cg_gcc
// popd
extended_rand_tests(env, args)?;
extended_regex_example_tests(env, args)?;
extended_regex_tests(env, args)?;

Ok(())
Expand Down

0 comments on commit 95ee23e

Please sign in to comment.