Skip to content

Commit eb8d49e

Browse files
authored
Merge branch 'master' into macos-rand
2 parents 009d0c2 + 298bd1f commit eb8d49e

File tree

3 files changed

+33
-13
lines changed

3 files changed

+33
-13
lines changed

test-cargo-miri/run-test.py

+17-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
and the working directory to contain the cargo-miri-test project.
66
'''
77

8-
import sys, subprocess
8+
import sys, subprocess, os
99

1010
def fail(msg):
1111
print("TEST FAIL: {}".format(msg))
1212
sys.exit(1)
1313

14+
def cargo_miri(cmd):
15+
args = ["cargo", "miri", cmd, "-q"]
16+
if 'MIRI_TEST_TARGET' in os.environ:
17+
args += ["--target", os.environ['MIRI_TEST_TARGET']]
18+
return args
19+
1420
def test(name, cmd, stdout_ref, stderr_ref):
1521
print("==> Testing `{}` <==".format(name))
1622
## Call `cargo miri`, capture all output
@@ -36,16 +42,22 @@ def test(name, cmd, stdout_ref, stderr_ref):
3642
fail("stderr does not match reference")
3743

3844
def test_cargo_miri_run():
39-
test("cargo miri run", ["cargo", "miri", "run", "-q"], "stdout.ref", "stderr.ref")
45+
test("cargo miri run",
46+
cargo_miri("run"),
47+
"stdout.ref", "stderr.ref"
48+
)
4049
test("cargo miri run (with arguments)",
41-
["cargo", "miri", "run", "-q", "--", "--", "hello world", '"hello world"'],
50+
cargo_miri("run") + ["--", "--", "hello world", '"hello world"'],
4251
"stdout.ref", "stderr.ref2"
4352
)
4453

4554
def test_cargo_miri_test():
46-
test("cargo miri test", ["cargo", "miri", "test", "-q", "--", "-Zmiri-seed=feed"], "test.stdout.ref", "test.stderr.ref")
55+
test("cargo miri test",
56+
cargo_miri("test") + ["--", "-Zmiri-seed=feed"],
57+
"test.stdout.ref", "test.stderr.ref"
58+
)
4759
test("cargo miri test (with filter)",
48-
["cargo", "miri", "test", "-q", "--", "--", "impl"],
60+
cargo_miri("test") + ["--", "--", "impl"],
4961
"test.stdout.ref2", "test.stderr.ref"
5062
)
5163

tests/compiletest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn get_host() -> String {
101101
}
102102

103103
fn get_target() -> String {
104-
std::env::var("MIRI_COMPILETEST_TARGET").unwrap_or_else(|_| get_host())
104+
std::env::var("MIRI_TEST_TARGET").unwrap_or_else(|_| get_host())
105105
}
106106

107107
fn run_pass_miri(opt: bool) {

travis.sh

+15-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ set -euo pipefail
33

44
# Determine configuration
55
if [ "$TRAVIS_OS_NAME" == osx ]; then
6-
export MIRI_SYSROOT_BASE=~/Library/Caches/miri.miri.miri/
6+
MIRI_SYSROOT_BASE=~/Library/Caches/miri.miri.miri/
77
FOREIGN_TARGET=i686-apple-darwin
88
else
9-
export MIRI_SYSROOT_BASE=~/.cache/miri/
9+
MIRI_SYSROOT_BASE=~/.cache/miri/
1010
FOREIGN_TARGET=i686-unknown-linux-gnu
1111
fi
1212

13+
# Prepare
1314
echo "Build and install miri"
1415
cargo build --release --all-features --all-targets
1516
cargo install --all-features --force --path .
@@ -20,11 +21,18 @@ cargo miri setup
2021
cargo miri setup --target "$FOREIGN_TARGET"
2122
echo
2223

23-
echo "Test miri with full MIR, on the host and other architectures"
24-
MIRI_SYSROOT="$MIRI_SYSROOT_BASE"/HOST cargo test --release --all-features
25-
MIRI_SYSROOT="$MIRI_SYSROOT_BASE" MIRI_COMPILETEST_TARGET="$FOREIGN_TARGET" cargo test --release --all-features
24+
# Test
25+
function run_tests {
26+
cargo test --release --all-features
27+
(cd test-cargo-miri && ./run-test.py)
28+
}
29+
30+
echo "Test host architecture"
31+
export MIRI_SYSROOT="$MIRI_SYSROOT_BASE"/HOST
32+
run_tests
2633
echo
2734

28-
echo "Test cargo integration"
29-
(cd test-cargo-miri && MIRI_SYSROOT="$MIRI_SYSROOT_BASE"/HOST ./run-test.py)
35+
echo "Test foreign architecture ($FOREIGN_TARGET)"
36+
export MIRI_SYSROOT="$MIRI_SYSROOT_BASE" MIRI_TEST_TARGET="$FOREIGN_TARGET"
37+
run_tests
3038
echo

0 commit comments

Comments
 (0)