Skip to content

Commit 0c5392f

Browse files
committed
now test-cargo-miri will actually work even without a hot cache :D
1 parent 6c0398d commit 0c5392f

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

cargo-miri/bin.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,9 @@ path = "lib.rs"
510510
if only_setup {
511511
show_error(format!("failed to run xargo, see error details above"))
512512
} else {
513-
show_error(format!("failed to run xargo; run `cargo miri setup` to see the error details"))
513+
show_error(format!(
514+
"failed to run xargo; run `cargo miri setup` to see the error details"
515+
))
514516
}
515517
}
516518
if !only_setup {

ci.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function run_tests {
2121
echo "Testing host architecture"
2222
fi
2323

24+
## ui test suite
2425
./miri test --locked
2526
if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
2627
# Only for host architecture: tests with optimizations (`-O` is what cargo passes, but crank MIR
@@ -30,15 +31,13 @@ function run_tests {
3031
MIRIFLAGS="-O -Zmir-opt-level=4" MIRI_SKIP_UI_CHECKS=1 ./miri test --locked -- tests/{pass,panic}
3132
fi
3233

34+
## test-cargo-miri
3335
# On Windows, there is always "python", not "python3" or "python2".
3436
if command -v python3 > /dev/null; then
3537
PYTHON=python3
3638
else
3739
PYTHON=python
3840
fi
39-
40-
# "miri test" has built the sysroot for us, now this should pass without
41-
# any interactive questions.
4241
${PYTHON} test-cargo-miri/run-test.py
4342
echo
4443

test-cargo-miri/run-test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ def cargo_miri(cmd, quiet = True):
2525

2626
def normalize_stdout(str):
2727
str = str.replace("src\\", "src/") # normalize paths across platforms
28-
return re.sub("finished in \d+\.\d\ds", "finished in $TIME", str)
28+
str = re.sub("finished in \d+\.\d\ds", "finished in $TIME", str) # the time keeps changing, obviously
29+
return str
30+
31+
def normalize_stderr(str):
32+
str = str.replace("Preparing a sysroot for Miri... done\n", "") # remove leading cargo-miri setup output
33+
return str
2934

3035
def check_output(actual, path, name):
3136
expected = open(path).read()
@@ -51,9 +56,8 @@ def test(name, cmd, stdout_ref, stderr_ref, stdin=b'', env={}):
5156
env=p_env,
5257
)
5358
(stdout, stderr) = p.communicate(input=stdin)
54-
stdout = stdout.decode("UTF-8")
55-
stderr = stderr.decode("UTF-8")
56-
stdout = normalize_stdout(stdout)
59+
stdout = normalize_stdout(stdout.decode("UTF-8"))
60+
stderr = normalize_stderr(stderr.decode("UTF-8"))
5761

5862
stdout_matches = check_output(stdout, stdout_ref, "stdout")
5963
stderr_matches = check_output(stderr, stderr_ref, "stderr")
@@ -175,10 +179,6 @@ def test_cargo_miri_test():
175179
target_str = " for target {}".format(os.environ['MIRI_TEST_TARGET']) if 'MIRI_TEST_TARGET' in os.environ else ""
176180
print(CGREEN + CBOLD + "## Running `cargo miri` tests{}".format(target_str) + CEND)
177181

178-
if not 'MIRI_SYSROOT' in os.environ:
179-
# Make sure we got a working sysroot.
180-
# (If the sysroot gets built later when output is compared, that leads to test failures.)
181-
subprocess.run(cargo_miri("setup"), check=True)
182182
test_cargo_miri_run()
183183
test_cargo_miri_test()
184184
# Ensure we did not create anything outside the expected target dir.

0 commit comments

Comments
 (0)