Skip to content

Commit 339d636

Browse files
committed
attempt to better normalize remote-test-client output for tests
1 parent 6f8ae03 commit 339d636

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/tools/compiletest/src/runtest.rs

+13-9
Original file line numberDiff line numberDiff line change
@@ -3634,26 +3634,30 @@ impl<'test> TestCx<'test> {
36343634
let expected_stderr = self.load_expected_output(stderr_kind);
36353635
let expected_stdout = self.load_expected_output(stdout_kind);
36363636

3637-
let normalized_stdout = match output_kind {
3637+
let mut normalized_stdout =
3638+
self.normalize_output(&proc_res.stdout, &self.props.normalize_stdout);
3639+
match output_kind {
36383640
TestOutput::Run if self.config.remote_test_client.is_some() => {
36393641
// When tests are run using the remote-test-client, the string
36403642
// 'uploaded "$TEST_BUILD_DIR/<test_executable>, waiting for result"'
36413643
// is printed to stdout by the client and then captured in the ProcRes,
3642-
// so it needs to be removed when comparing the run-pass test execution output
3644+
// so it needs to be removed when comparing the run-pass test execution output.
36433645
static REMOTE_TEST_RE: Lazy<Regex> = Lazy::new(|| {
36443646
Regex::new(
36453647
"^uploaded \"\\$TEST_BUILD_DIR(/[[:alnum:]_\\-.]+)+\", waiting for result\n"
36463648
)
36473649
.unwrap()
36483650
});
3649-
REMOTE_TEST_RE
3650-
.replace(
3651-
&self.normalize_output(&proc_res.stdout, &self.props.normalize_stdout),
3652-
"",
3653-
)
3654-
.to_string()
3651+
normalized_stdout = REMOTE_TEST_RE.replace(&normalized_stdout, "").to_string();
3652+
// When there is a panic, the remote-test-client also prints "died due to signal";
3653+
// that needs to be removed as well.
3654+
static SIGNAL_DIED_RE: Lazy<Regex> =
3655+
Lazy::new(|| Regex::new("^died due to signal [0-9]+\n").unwrap());
3656+
normalized_stdout = SIGNAL_DIED_RE.replace(&normalized_stdout, "").to_string();
3657+
// FIXME: it would be much nicer if we could just tell the remote-test-client to not
3658+
// print these things.
36553659
}
3656-
_ => self.normalize_output(&proc_res.stdout, &self.props.normalize_stdout),
3660+
_ => {}
36573661
};
36583662

36593663
let stderr = if explicit_format {

0 commit comments

Comments
 (0)