|
5 | 5 | // fail to be used by the compiler. |
6 | 6 | // See https://github.com/rust-lang/rust/pull/19941 |
7 | 7 |
|
8 | | -use run_make_support::fs_wrapper; |
9 | | -use run_make_support::{rmake_out_path, rustc}; |
| 8 | +use run_make_support::{fs_wrapper, rustc}; |
10 | 9 |
|
11 | 10 | fn main() { |
12 | | - assert!(rmake_out_path("libnative.a").exists()); |
13 | | - fs_wrapper::create_dir_all(rmake_out_path("crate")); |
14 | | - fs_wrapper::create_dir_all(rmake_out_path("native")); |
15 | | - fs_wrapper::rename(rmake_out_path("libnative.a"), rmake_out_path("native")); |
| 11 | + assert!("libnative.a".exists()); |
| 12 | + fs_wrapper::create_dir_all("crate"); |
| 13 | + fs_wrapper::create_dir_all("native"); |
| 14 | + fs_wrapper::rename("libnative.a", "native/libnative.a"); |
16 | 15 | rustc().input("a.rs").run(); |
17 | | - fs_wrapper::rename(rmake_out_path("liba.a"), rmake_out_path("crate")); |
18 | | - rustc() |
19 | | - .input("b.rs") |
20 | | - .specific_library_search_path("native", rmake_out_path("crate")) |
21 | | - .run_fail(); |
22 | | - rustc() |
23 | | - .input("b.rs") |
24 | | - .specific_library_search_path("dependency", rmake_out_path("crate")) |
25 | | - .run_fail(); |
26 | | - rustc().input("b.rs").specific_library_search_path("crate", rmake_out_path("crate")).run(); |
27 | | - rustc().input("b.rs").specific_library_search_path("all", rmake_out_path("crate")).run(); |
| 16 | + fs_wrapper::rename("liba.a", "crate/liba.a"); |
| 17 | + rustc().input("b.rs").specific_library_search_path("native", "crate").run_fail(); |
| 18 | + rustc().input("b.rs").specific_library_search_path("dependency", "crate").run_fail(); |
| 19 | + rustc().input("b.rs").specific_library_search_path("crate", "crate").run(); |
| 20 | + rustc().input("b.rs").specific_library_search_path("all", "crate").run(); |
28 | 21 |
|
29 | | - rustc() |
30 | | - .input("c.rs") |
31 | | - .specific_library_search_path("native", rmake_out_path("crate")) |
32 | | - .run_fail(); |
33 | | - rustc().input("c.rs").specific_library_search_path("crate", rmake_out_path("crate")).run_fail(); |
34 | | - rustc().input("c.rs").specific_library_search_path("dependency", rmake_out_path("crate")).run(); |
35 | | - rustc().input("c.rs").specific_library_search_path("all", rmake_out_path("crate")).run(); |
| 22 | + rustc().input("c.rs").specific_library_search_path("native", "crate").run_fail(); |
| 23 | + rustc().input("c.rs").specific_library_search_path("crate", "crate").run_fail(); |
| 24 | + rustc().input("c.rs").specific_library_search_path("dependency", "crate").run(); |
| 25 | + rustc().input("c.rs").specific_library_search_path("all", "crate").run(); |
36 | 26 |
|
37 | | - rustc() |
38 | | - .input("d.rs") |
39 | | - .specific_library_search_path("dependency", rmake_out_path("native")) |
40 | | - .run_fail(); |
41 | | - rustc() |
42 | | - .input("d.rs") |
43 | | - .specific_library_search_path("crate", rmake_out_path("native")) |
44 | | - .run_fail(); |
45 | | - rustc().input("d.rs").specific_library_search_path("native", rmake_out_path("native")).run(); |
46 | | - rustc().input("d.rs").specific_library_search_path("all", rmake_out_path("native")).run(); |
| 27 | + rustc().input("d.rs").specific_library_search_path("dependency", "native").run_fail(); |
| 28 | + rustc().input("d.rs").specific_library_search_path("crate", "native").run_fail(); |
| 29 | + rustc().input("d.rs").specific_library_search_path("native", "native").run(); |
| 30 | + rustc().input("d.rs").specific_library_search_path("all", "native").run(); |
47 | 31 |
|
48 | 32 | // Deduplication tests. |
49 | | - fs_wrapper::create_dir_all(rmake_out_path("e1")); |
50 | | - fs_wrapper::create_dir_all(rmake_out_path("e2")); |
| 33 | + fs_wrapper::create_dir_all("e1"); |
| 34 | + fs_wrapper::create_dir_all("e2"); |
51 | 35 |
|
52 | | - rustc().input("e.rs").output(rmake_out_path("e1/libe.rlib")).run(); |
53 | | - rustc().input("e.rs").output(rmake_out_path("e2/libe.rlib")).run(); |
| 36 | + rustc().input("e.rs").output("e1/libe.rlib").run(); |
| 37 | + rustc().input("e.rs").output("e2/libe.rlib").run(); |
54 | 38 | // If the library hash is correct, compilation should succeed. |
| 39 | + rustc().input("f.rs").library_search_path("e1").library_search_path("e2").run(); |
55 | 40 | rustc() |
56 | 41 | .input("f.rs") |
57 | | - .library_search_path(rmake_out_path("e1")) |
58 | | - .library_search_path(rmake_out_path("e2")) |
59 | | - .run(); |
60 | | - rustc() |
61 | | - .input("f.rs") |
62 | | - .specific_library_search_path("crate", rmake_out_path("e1")) |
63 | | - .library_search_path(rmake_out_path("e2")) |
| 42 | + .specific_library_search_path("crate", "e1") |
| 43 | + .library_search_path("e2") |
64 | 44 | .run(); |
65 | 45 | rustc() |
66 | 46 | .input("f.rs") |
67 | | - .specific_library_search_path("crate", rmake_out_path("e1")) |
68 | | - .specific_library_search_path("crate", rmake_out_path("e2")) |
| 47 | + .specific_library_search_path("crate", "e1") |
| 48 | + .specific_library_search_path("crate", "e2") |
69 | 49 | .run(); |
70 | 50 | // If the library has a different hash, errors should occur. |
71 | | - rustc().input("e2.rs").output(rmake_out_path("e2/libe.rlib")).run(); |
72 | | - rustc() |
73 | | - .input("f.rs") |
74 | | - .library_search_path(rmake_out_path("e1")) |
75 | | - .library_search_path(rmake_out_path("e2")) |
76 | | - .run_fail(); |
| 51 | + rustc().input("e2.rs").output("e2/libe.rlib").run(); |
| 52 | + rustc().input("f.rs").library_search_path("e1").library_search_path("e2").run_fail(); |
77 | 53 | rustc() |
78 | 54 | .input("f.rs") |
79 | | - .specific_library_search_path("crate", rmake_out_path("e1")) |
80 | | - .library_search_path(rmake_out_path("e2")) |
| 55 | + .specific_library_search_path("crate", "e1") |
| 56 | + .library_search_path("e2") |
81 | 57 | .run_fail(); |
82 | 58 | rustc() |
83 | 59 | .input("f.rs") |
84 | | - .specific_library_search_path("crate", rmake_out_path("e1")) |
85 | | - .specific_library_search_path("crate", rmake_out_path("e2")) |
| 60 | + .specific_library_search_path("crate", "e1") |
| 61 | + .specific_library_search_path("crate", "e2") |
86 | 62 | .run_fail(); |
87 | 63 | // Native and dependency paths do not cause errors. |
88 | 64 | rustc() |
89 | 65 | .input("f.rs") |
90 | | - .specific_library_search_path("native", rmake_out_path("e1")) |
91 | | - .library_search_path(rmake_out_path("e2")) |
| 66 | + .specific_library_search_path("native", "e1") |
| 67 | + .library_search_path("e2") |
92 | 68 | .run(); |
93 | 69 | rustc() |
94 | 70 | .input("f.rs") |
95 | | - .specific_library_search_path("dependency", rmake_out_path("e1")) |
96 | | - .library_search_path(rmake_out_path("e2")) |
| 71 | + .specific_library_search_path("dependency", "e1") |
| 72 | + .library_search_path("e2") |
97 | 73 | .run(); |
98 | 74 | rustc() |
99 | 75 | .input("f.rs") |
100 | | - .specific_library_search_path("dependency", rmake_out_path("e1")) |
101 | | - .specific_library_search_path("crate", rmake_out_path("e2")) |
| 76 | + .specific_library_search_path("dependency", "e1") |
| 77 | + .specific_library_search_path("crate", "e2") |
102 | 78 | .run(); |
103 | 79 | } |
0 commit comments