Skip to content

Commit 9b5faa9

Browse files
committed
Auto merge of #1656 - RalfJung:tests, r=RalfJung
test suite updates
2 parents 24d8e8d + 6dc353c commit 9b5faa9

16 files changed

+29
-10
lines changed

test-cargo-miri/run-test.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test(name, cmd, stdout_ref, stderr_ref, stdin=b'', env={}):
5151
def test_cargo_miri_run():
5252
test("`cargo miri run` (no isolation)",
5353
cargo_miri("run"),
54-
"stdout.ref1", "stderr.ref1",
54+
"run.default.stdout.ref", "run.default.stderr.ref",
5555
stdin=b'12\n21\n',
5656
env={
5757
'MIRIFLAGS': "-Zmiri-disable-isolation",
@@ -60,44 +60,49 @@ def test_cargo_miri_run():
6060
)
6161
test("`cargo miri run` (with arguments and target)",
6262
cargo_miri("run") + ["--bin", "cargo-miri-test", "--", "hello world", '"hello world"'],
63-
"stdout.ref2", "stderr.ref2",
63+
"run.args.stdout.ref", "run.args.stderr.ref",
6464
)
6565
test("`cargo miri run` (subcrate, no ioslation)",
6666
cargo_miri("run") + ["-p", "subcrate"],
67-
"stdout.ref3", "stderr.ref3",
67+
"run.subcrate.stdout.ref", "run.subcrate.stderr.ref",
6868
env={'MIRIFLAGS': "-Zmiri-disable-isolation"},
6969
)
7070

7171
def test_cargo_miri_test():
7272
# rustdoc is not run on foreign targets
7373
is_foreign = 'MIRI_TEST_TARGET' in os.environ
74-
rustdoc_ref = "test.stderr.ref2" if is_foreign else "test.stderr.ref1"
74+
rustdoc_ref = "test.stderr-empty.ref" if is_foreign else "test.stderr-rustdoc.ref"
7575

7676
test("`cargo miri test`",
7777
cargo_miri("test"),
78-
"test.stdout.ref1", rustdoc_ref,
78+
"test.default.stdout.ref", rustdoc_ref,
7979
env={'MIRIFLAGS': "-Zmiri-seed=feed"},
8080
)
8181
test("`cargo miri test` (no isolation)",
8282
cargo_miri("test"),
83-
"test.stdout.ref1", rustdoc_ref,
83+
"test.default.stdout.ref", rustdoc_ref,
8484
env={'MIRIFLAGS': "-Zmiri-disable-isolation"},
8585
)
86+
test("`cargo miri test` (raw-ptr tracking)",
87+
cargo_miri("test") + ["--", "-Zunstable-options", "--exclude-should-panic"],
88+
"test.raw-ptr-track.stdout.ref", rustdoc_ref,
89+
env={'MIRIFLAGS': "-Zmiri-track-raw-pointers"},
90+
)
8691
test("`cargo miri test` (with filter)",
8792
cargo_miri("test") + ["--", "--format=pretty", "le1"],
88-
"test.stdout.ref2", rustdoc_ref,
93+
"test.filter.stdout.ref", rustdoc_ref,
8994
)
9095
test("`cargo miri test` (test target)",
9196
cargo_miri("test") + ["--test", "test", "--", "--format=pretty"],
92-
"test.stdout.ref3", "test.stderr.ref2",
97+
"test.test-target.stdout.ref", "test.stderr-empty.ref",
9398
)
9499
test("`cargo miri test` (bin target)",
95100
cargo_miri("test") + ["--bin", "cargo-miri-test", "--", "--format=pretty"],
96-
"test.stdout.ref4", "test.stderr.ref2",
101+
"test.bin-target.stdout.ref", "test.stderr-empty.ref",
97102
)
98103
test("`cargo miri test` (subcrate, no isolation)",
99104
cargo_miri("test") + ["-p", "subcrate"],
100-
"test.stdout.ref5", "test.stderr.ref2",
105+
"test.subcrate.stdout.ref", "test.stderr-empty.ref",
101106
env={'MIRIFLAGS': "-Zmiri-disable-isolation"},
102107
)
103108

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
running 1 test
3+
.
4+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
5+
6+
7+
running 5 tests
8+
.i...
9+
test result: ok. 4 passed; 0 failed; 1 ignored; 0 measured; 2 filtered out
10+

tests/run-pass/leak-in-static.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@ fn main() {
1212
{
1313
static LEAK: AtomicPtr<usize> = AtomicPtr::new(ptr::null_mut());
1414
LEAK.store(Box::into_raw(Box::new(0usize)), Ordering::SeqCst);
15+
16+
static LEAK2: AtomicPtr<usize> = AtomicPtr::new(ptr::null_mut());
17+
// Make sure this also works when using 'swap'.
18+
LEAK2.swap(Box::into_raw(Box::new(0usize)), Ordering::SeqCst);
1519
}
1620
}

0 commit comments

Comments
 (0)