Skip to content

Commit 4484eb1

Browse files
committed
rewrite prune-link-args as a ui test
1 parent e2c4662 commit 4484eb1

File tree

6 files changed

+56
-55
lines changed

6 files changed

+56
-55
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ run-make/pretty-print-with-dep-file/Makefile
182182
run-make/print-calling-conventions/Makefile
183183
run-make/print-target-list/Makefile
184184
run-make/profile/Makefile
185-
run-make/prune-link-args/Makefile
186185
run-make/raw-dylib-alt-calling-convention/Makefile
187186
run-make/raw-dylib-c/Makefile
188187
run-make/raw-dylib-cross-compilation/Makefile

tests/run-make/compiler-lookup-paths/rmake.rs

+41-42
Original file line numberDiff line numberDiff line change
@@ -5,99 +5,98 @@
55
// fail to be used by the compiler.
66
// See https://github.com/rust-lang/rust/pull/19941
77

8-
use run_make_support::fs_wrapper;
9-
use run_make_support::{rmake_out_path, rustc};
8+
use run_make_support::{fs_wrapper, rustc};
109

1110
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");
1615
rustc().input("a.rs").run();
17-
fs_wrapper::rename(rmake_out_path("liba.a"), rmake_out_path("crate"));
16+
fs_wrapper::rename("liba.a", "crate/liba.a");
1817
rustc()
1918
.input("b.rs")
20-
.specific_library_search_path("native", rmake_out_path("crate"))
19+
.specific_library_search_path("native", "crate")
2120
.run_fail();
2221
rustc()
2322
.input("b.rs")
24-
.specific_library_search_path("dependency", rmake_out_path("crate"))
23+
.specific_library_search_path("dependency", "crate")
2524
.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();
25+
rustc().input("b.rs").specific_library_search_path("crate", "crate").run();
26+
rustc().input("b.rs").specific_library_search_path("all", "crate").run();
2827

2928
rustc()
3029
.input("c.rs")
31-
.specific_library_search_path("native", rmake_out_path("crate"))
30+
.specific_library_search_path("native", "crate")
3231
.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();
32+
rustc().input("c.rs").specific_library_search_path("crate", "crate").run_fail();
33+
rustc().input("c.rs").specific_library_search_path("dependency", "crate").run();
34+
rustc().input("c.rs").specific_library_search_path("all", "crate").run();
3635

3736
rustc()
3837
.input("d.rs")
39-
.specific_library_search_path("dependency", rmake_out_path("native"))
38+
.specific_library_search_path("dependency", "native")
4039
.run_fail();
4140
rustc()
4241
.input("d.rs")
43-
.specific_library_search_path("crate", rmake_out_path("native"))
42+
.specific_library_search_path("crate", "native")
4443
.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();
44+
rustc().input("d.rs").specific_library_search_path("native", "native").run();
45+
rustc().input("d.rs").specific_library_search_path("all", "native").run();
4746

4847
// Deduplication tests.
49-
fs_wrapper::create_dir_all(rmake_out_path("e1"));
50-
fs_wrapper::create_dir_all(rmake_out_path("e2"));
48+
fs_wrapper::create_dir_all("e1");
49+
fs_wrapper::create_dir_all("e2");
5150

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();
51+
rustc().input("e.rs").output("e1/libe.rlib")).run();
52+
rustc().input("e.rs").output("e2/libe.rlib")).run();
5453
// If the library hash is correct, compilation should succeed.
5554
rustc()
5655
.input("f.rs")
57-
.library_search_path(rmake_out_path("e1"))
58-
.library_search_path(rmake_out_path("e2"))
56+
.library_search_path("e1")
57+
.library_search_path("e2")
5958
.run();
6059
rustc()
6160
.input("f.rs")
62-
.specific_library_search_path("crate", rmake_out_path("e1"))
63-
.library_search_path(rmake_out_path("e2"))
61+
.specific_library_search_path("crate", "e1")
62+
.library_search_path("e2")
6463
.run();
6564
rustc()
6665
.input("f.rs")
67-
.specific_library_search_path("crate", rmake_out_path("e1"))
68-
.specific_library_search_path("crate", rmake_out_path("e2"))
66+
.specific_library_search_path("crate", "e1")
67+
.specific_library_search_path("crate", "e2")
6968
.run();
7069
// If the library has a different hash, errors should occur.
71-
rustc().input("e2.rs").output(rmake_out_path("e2/libe.rlib")).run();
70+
rustc().input("e2.rs").output("e2/libe.rlib")).run();
7271
rustc()
7372
.input("f.rs")
74-
.library_search_path(rmake_out_path("e1"))
75-
.library_search_path(rmake_out_path("e2"))
73+
.library_search_path("e1")
74+
.library_search_path("e2")
7675
.run_fail();
7776
rustc()
7877
.input("f.rs")
79-
.specific_library_search_path("crate", rmake_out_path("e1"))
80-
.library_search_path(rmake_out_path("e2"))
78+
.specific_library_search_path("crate", "e1")
79+
.library_search_path("e2")
8180
.run_fail();
8281
rustc()
8382
.input("f.rs")
84-
.specific_library_search_path("crate", rmake_out_path("e1"))
85-
.specific_library_search_path("crate", rmake_out_path("e2"))
83+
.specific_library_search_path("crate", "e1")
84+
.specific_library_search_path("crate", "e2")
8685
.run_fail();
8786
// Native and dependency paths do not cause errors.
8887
rustc()
8988
.input("f.rs")
90-
.specific_library_search_path("native", rmake_out_path("e1"))
91-
.library_search_path(rmake_out_path("e2"))
89+
.specific_library_search_path("native", "e1")
90+
.library_search_path("e2")
9291
.run();
9392
rustc()
9493
.input("f.rs")
95-
.specific_library_search_path("dependency", rmake_out_path("e1"))
96-
.library_search_path(rmake_out_path("e2"))
94+
.specific_library_search_path("dependency", "e1")
95+
.library_search_path("e2")
9796
.run();
9897
rustc()
9998
.input("f.rs")
100-
.specific_library_search_path("dependency", rmake_out_path("e1"))
101-
.specific_library_search_path("crate", rmake_out_path("e2"))
99+
.specific_library_search_path("dependency", "e1")
100+
.specific_library_search_path("crate", "e2")
102101
.run();
103102
}

tests/run-make/dump-mono-stats/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ use run_make_support::{cwd, fs_wrapper, rustc};
88

99
fn main() {
1010
rustc().crate_type("lib").input("foo.rs").dump_mono_stats(cwd()).arg("-Zdump-mono-stats-format=json").run();
11-
assert!(fs_wrapper::read_to_string("foo.mono_items.json").contains("\"name\":\"bar\"");
11+
assert!(fs_wrapper::read_to_string("foo.mono_items.json").contains(r#""name":"bar""#));
1212
}

tests/run-make/prune-link-args/Makefile

-10
This file was deleted.

tests/run-make/prune-link-args/empty.rs

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Passing link-args with an unexpected space
2+
// could result in the flag being parsed and receiving
3+
// an unexpected, empty linker argument. This test
4+
// ensures successful compilation even when a space is
5+
// present.
6+
// See https://github.com/rust-lang/rust/pull/10749
7+
8+
//@ check-pass
9+
//@ ignore-cross-compile
10+
11+
//@ compile-flags: -C link-args="lc "
12+
// Notice the space at the end, which emulates the output of pkg-config
13+
14+
fn main() {}

0 commit comments

Comments
 (0)