Skip to content

Commit c974bc8

Browse files
committed
Update regex and implement necessary AArch64 vendor intrinsics
Upstream has removed the shootout-regex-dna example.
1 parent cf36f4e commit c974bc8

File tree

5 files changed

+276
-265
lines changed

5 files changed

+276
-265
lines changed

build_system/tests.rs

+19-38
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::path::{Dirs, RelPath};
99
use crate::prepare::{apply_patches, GitRepo};
1010
use crate::rustc_info::get_default_sysroot;
1111
use crate::shared_utils::rustflags_from_env;
12-
use crate::utils::{spawn_and_wait, spawn_and_wait_with_input, CargoProject, Compiler, LogGroup};
12+
use crate::utils::{spawn_and_wait, CargoProject, Compiler, LogGroup};
1313
use crate::{CodegenBackend, SysrootKind};
1414

1515
static BUILD_EXAMPLE_OUT_DIR: RelPath = RelPath::BUILD.join("example");
@@ -114,8 +114,8 @@ pub(crate) static RAND: CargoProject = CargoProject::new(&RAND_REPO.source_dir()
114114
pub(crate) static REGEX_REPO: GitRepo = GitRepo::github(
115115
"rust-lang",
116116
"regex",
117-
"32fed9429eafba0ae92a64b01796a0c5a75b88c8",
118-
"fcc4df7c5b902633",
117+
"061ee815ef2c44101dba7b0b124600fcb03c1912",
118+
"dc26aefbeeac03ca",
119119
"regex",
120120
);
121121

@@ -178,40 +178,6 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
178178
spawn_and_wait(build_cmd);
179179
}
180180
}),
181-
TestCase::custom("test.regex-shootout-regex-dna", &|runner| {
182-
REGEX_REPO.patch(&runner.dirs);
183-
184-
REGEX.clean(&runner.dirs);
185-
186-
let mut build_cmd = REGEX.build(&runner.target_compiler, &runner.dirs);
187-
build_cmd.arg("--example").arg("shootout-regex-dna");
188-
spawn_and_wait(build_cmd);
189-
190-
if runner.is_native {
191-
let mut run_cmd = REGEX.run(&runner.target_compiler, &runner.dirs);
192-
run_cmd.arg("--example").arg("shootout-regex-dna");
193-
194-
let input = fs::read_to_string(
195-
REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-input.txt"),
196-
)
197-
.unwrap();
198-
let expected = fs::read_to_string(
199-
REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-output.txt"),
200-
)
201-
.unwrap();
202-
203-
let output = spawn_and_wait_with_input(run_cmd, input);
204-
205-
let output_matches = expected.lines().eq(output.lines());
206-
if !output_matches {
207-
println!("Output files don't match!");
208-
println!("Expected Output:\n{}", expected);
209-
println!("Actual Output:\n{}", output);
210-
211-
std::process::exit(1);
212-
}
213-
}
214-
}),
215181
TestCase::custom("test.regex", &|runner| {
216182
REGEX_REPO.patch(&runner.dirs);
217183

@@ -221,7 +187,22 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
221187
let mut run_cmd = REGEX.test(&runner.target_compiler, &runner.dirs);
222188
// regex-capi and regex-debug don't have any tests. Nor do they contain any code
223189
// that is useful to test with cg_clif. Skip building them to reduce test time.
224-
run_cmd.args(["-p", "regex", "-p", "regex-syntax", "--", "-q"]);
190+
run_cmd.args([
191+
"-p",
192+
"regex",
193+
"-p",
194+
"regex-syntax",
195+
"--release",
196+
"--all-targets",
197+
"--",
198+
"-q",
199+
]);
200+
spawn_and_wait(run_cmd);
201+
202+
let mut run_cmd = REGEX.test(&runner.target_compiler, &runner.dirs);
203+
// don't run integration tests for regex-autonata. they take like 2min each without
204+
// much extra coverage of simd usage.
205+
run_cmd.args(["-p", "regex-automata", "--release", "--lib", "--", "-q"]);
225206
spawn_and_wait(run_cmd);
226207
} else {
227208
eprintln!("Cross-Compiling: Not running tests");

build_system/utils.rs

+2-24
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::env;
22
use std::fs;
3-
use std::io::{self, Write};
3+
use std::io;
44
use std::path::{Path, PathBuf};
5-
use std::process::{self, Command, Stdio};
5+
use std::process::{self, Command};
66
use std::sync::atomic::{AtomicBool, Ordering};
77

88
use crate::path::{Dirs, RelPath};
@@ -220,28 +220,6 @@ pub(crate) fn retry_spawn_and_wait(tries: u64, mut cmd: Command) {
220220
process::exit(1);
221221
}
222222

223-
#[track_caller]
224-
pub(crate) fn spawn_and_wait_with_input(mut cmd: Command, input: String) -> String {
225-
let mut child = cmd
226-
.stdin(Stdio::piped())
227-
.stdout(Stdio::piped())
228-
.spawn()
229-
.expect("Failed to spawn child process");
230-
231-
let mut stdin = child.stdin.take().expect("Failed to open stdin");
232-
std::thread::spawn(move || {
233-
stdin.write_all(input.as_bytes()).expect("Failed to write to stdin");
234-
});
235-
236-
let output = child.wait_with_output().expect("Failed to read stdout");
237-
if !output.status.success() {
238-
eprintln!("{cmd:?} exited with status {:?}", output.status);
239-
process::exit(1);
240-
}
241-
242-
String::from_utf8(output.stdout).unwrap()
243-
}
244-
245223
pub(crate) fn remove_dir_if_exists(path: &Path) {
246224
match fs::remove_dir_all(&path) {
247225
Ok(()) => {}

config.txt

-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,5 @@ aot.issue-59326
4646
testsuite.extended_sysroot
4747
test.rust-random/rand
4848
test.libcore
49-
test.regex-shootout-regex-dna
5049
test.regex
5150
test.portable-simd

0 commit comments

Comments
 (0)