|
12 | 12 |
|
13 | 13 | //@ ignore-cross-compile |
14 | 14 |
|
15 | | -use run_make_support::{rustc, tmp_dir}; |
| 15 | +use run_make_support::{rustc, tmp_dir, run_in_tmpdir}; |
16 | 16 | use std::fs; |
17 | 17 |
|
18 | | -fn test_with_teardown(rustc_calls: impl Fn()) { |
19 | | - rustc_calls(); |
20 | | - //FIXME(Oneirical): This should be replaced with the run-make-support fs wrappers. |
21 | | - fs::remove_dir_all(tmp_dir()).unwrap(); |
22 | | - fs::create_dir(tmp_dir()).unwrap(); |
23 | | -} |
24 | | - |
25 | 18 | fn main() { |
26 | | - test_with_teardown(|| { |
| 19 | + run_in_tmpdir(|| { |
27 | 20 | // Building just baz |
28 | 21 | rustc().crate_type("rlib").input("foo.rs").run(); |
29 | 22 | rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); |
30 | 23 | rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run(); |
31 | 24 | rustc().crate_type("bin").input("baz.rs").run(); |
32 | 25 | }); |
33 | | - test_with_teardown(|| { |
| 26 | + run_in_tmpdir(|| { |
34 | 27 | rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); |
35 | 28 | rustc().crate_type("rlib").input("bar1.rs").run(); |
36 | 29 | rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run(); |
37 | 30 | rustc().crate_type("bin").input("baz.rs").run(); |
38 | 31 | }); |
39 | | - test_with_teardown(|| { |
| 32 | + run_in_tmpdir(|| { |
40 | 33 | // Building baz2 |
41 | 34 | rustc().crate_type("rlib").input("foo.rs").run(); |
42 | 35 | rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); |
43 | 36 | rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run(); |
44 | 37 | rustc().crate_type("dylib").input("baz2.rs").run_fail_assert_exit_code(1); |
45 | 38 | rustc().crate_type("bin").input("baz2.rs").run_fail_assert_exit_code(1); |
46 | 39 | }); |
47 | | - test_with_teardown(|| { |
| 40 | + run_in_tmpdir(|| { |
48 | 41 | rustc().crate_type("rlib").input("foo.rs").run(); |
49 | 42 | rustc().crate_type("rlib").input("bar1.rs").run(); |
50 | 43 | rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run(); |
51 | 44 | rustc().crate_type("dylib,rlib").input("baz2.rs").run(); |
52 | 45 | rustc().crate_type("bin").input("baz2.rs").run(); |
53 | 46 | }); |
54 | | - test_with_teardown(|| { |
| 47 | + run_in_tmpdir(|| { |
55 | 48 | rustc().crate_type("rlib").input("foo.rs").run(); |
56 | 49 | rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); |
57 | 50 | rustc().crate_type("rlib").input("bar2.rs").run(); |
58 | 51 | rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run(); |
59 | 52 | rustc().crate_type("bin").input("baz2.rs").run(); |
60 | 53 | }); |
61 | | - test_with_teardown(|| { |
| 54 | + run_in_tmpdir(|| { |
62 | 55 | rustc().crate_type("rlib").input("foo.rs").run(); |
63 | 56 | rustc().crate_type("rlib").input("bar1.rs").run(); |
64 | 57 | rustc().crate_type("rlib").input("bar2.rs").run(); |
65 | 58 | rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run(); |
66 | 59 | rustc().crate_type("bin").input("baz2.rs").run(); |
67 | 60 | }); |
68 | | - test_with_teardown(|| { |
| 61 | + run_in_tmpdir(|| { |
69 | 62 | rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); |
70 | 63 | rustc().crate_type("rlib").input("bar1.rs").run(); |
71 | 64 | rustc().crate_type("rlib").input("bar2.rs").run(); |
72 | 65 | rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run(); |
73 | 66 | rustc().crate_type("bin").input("baz2.rs").run(); |
74 | 67 | }); |
75 | | - test_with_teardown(|| { |
| 68 | + run_in_tmpdir(|| { |
76 | 69 | rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); |
77 | 70 | rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run(); |
78 | 71 | rustc().crate_type("rlib").input("bar2.rs").run(); |
79 | 72 | rustc().crate_type("dylib,rlib").input("baz2.rs").run(); |
80 | 73 | rustc().crate_type("bin").input("baz2.rs").run(); |
81 | 74 | }); |
82 | | - test_with_teardown(|| { |
| 75 | + run_in_tmpdir(|| { |
83 | 76 | rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run(); |
84 | 77 | rustc().crate_type("rlib").input("bar1.rs").run(); |
85 | 78 | rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run(); |
|
0 commit comments