now test-cargo-miri will actually work even without a hot cache :D
This commit is contained in:
parent
6c0398da7d
commit
0c5392f435
@ -510,7 +510,9 @@ path = "lib.rs"
|
||||
if only_setup {
|
||||
show_error(format!("failed to run xargo, see error details above"))
|
||||
} else {
|
||||
show_error(format!("failed to run xargo; run `cargo miri setup` to see the error details"))
|
||||
show_error(format!(
|
||||
"failed to run xargo; run `cargo miri setup` to see the error details"
|
||||
))
|
||||
}
|
||||
}
|
||||
if !only_setup {
|
||||
|
5
ci.sh
5
ci.sh
@ -21,6 +21,7 @@ function run_tests {
|
||||
echo "Testing host architecture"
|
||||
fi
|
||||
|
||||
## ui test suite
|
||||
./miri test --locked
|
||||
if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
|
||||
# Only for host architecture: tests with optimizations (`-O` is what cargo passes, but crank MIR
|
||||
@ -30,15 +31,13 @@ function run_tests {
|
||||
MIRIFLAGS="-O -Zmir-opt-level=4" MIRI_SKIP_UI_CHECKS=1 ./miri test --locked -- tests/{pass,panic}
|
||||
fi
|
||||
|
||||
## test-cargo-miri
|
||||
# On Windows, there is always "python", not "python3" or "python2".
|
||||
if command -v python3 > /dev/null; then
|
||||
PYTHON=python3
|
||||
else
|
||||
PYTHON=python
|
||||
fi
|
||||
|
||||
# "miri test" has built the sysroot for us, now this should pass without
|
||||
# any interactive questions.
|
||||
${PYTHON} test-cargo-miri/run-test.py
|
||||
echo
|
||||
|
||||
|
@ -25,7 +25,12 @@ def cargo_miri(cmd, quiet = True):
|
||||
|
||||
def normalize_stdout(str):
|
||||
str = str.replace("src\\", "src/") # normalize paths across platforms
|
||||
return re.sub("finished in \d+\.\d\ds", "finished in $TIME", str)
|
||||
str = re.sub("finished in \d+\.\d\ds", "finished in $TIME", str) # the time keeps changing, obviously
|
||||
return str
|
||||
|
||||
def normalize_stderr(str):
|
||||
str = str.replace("Preparing a sysroot for Miri... done\n", "") # remove leading cargo-miri setup output
|
||||
return str
|
||||
|
||||
def check_output(actual, path, name):
|
||||
expected = open(path).read()
|
||||
@ -51,9 +56,8 @@ def test(name, cmd, stdout_ref, stderr_ref, stdin=b'', env={}):
|
||||
env=p_env,
|
||||
)
|
||||
(stdout, stderr) = p.communicate(input=stdin)
|
||||
stdout = stdout.decode("UTF-8")
|
||||
stderr = stderr.decode("UTF-8")
|
||||
stdout = normalize_stdout(stdout)
|
||||
stdout = normalize_stdout(stdout.decode("UTF-8"))
|
||||
stderr = normalize_stderr(stderr.decode("UTF-8"))
|
||||
|
||||
stdout_matches = check_output(stdout, stdout_ref, "stdout")
|
||||
stderr_matches = check_output(stderr, stderr_ref, "stderr")
|
||||
@ -175,10 +179,6 @@ os.environ["RUST_TEST_THREADS"] = "1" # avoid non-deterministic output due to co
|
||||
target_str = " for target {}".format(os.environ['MIRI_TEST_TARGET']) if 'MIRI_TEST_TARGET' in os.environ else ""
|
||||
print(CGREEN + CBOLD + "## Running `cargo miri` tests{}".format(target_str) + CEND)
|
||||
|
||||
if not 'MIRI_SYSROOT' in os.environ:
|
||||
# Make sure we got a working sysroot.
|
||||
# (If the sysroot gets built later when output is compared, that leads to test failures.)
|
||||
subprocess.run(cargo_miri("setup"), check=True)
|
||||
test_cargo_miri_run()
|
||||
test_cargo_miri_test()
|
||||
# Ensure we did not create anything outside the expected target dir.
|
||||
|
Loading…
x
Reference in New Issue
Block a user