about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-06-29 14:07:21 +0200
committerGitHub <noreply@github.com>2024-06-29 14:07:21 +0200
commitc1fb4e59474253fa36728ef858fd4add740970f6 (patch)
tree193c125ea71096a6a0060f8015acd4efa1942964
parentc70a2e30dd3691313c43e27a94f442609e69869a (diff)
parent4ee077aa63cbcf0e4f398988939fdb6bb020c322 (diff)
downloadrust-c1fb4e59474253fa36728ef858fd4add740970f6.tar.gz
rust-c1fb4e59474253fa36728ef858fd4add740970f6.zip
Rollup merge of #127041 - GuillaumeGomez:run-make-override-aliased-flags, r=Kobzol
Migrate `run-make/override-aliased-flags` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

I voluntarily didn't use the helper methods to make it obvious what's tested.

r? `@jieyouxu`
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/override-aliased-flags/Makefile23
-rw-r--r--tests/run-make/override-aliased-flags/rmake.rs24
3 files changed, 24 insertions, 24 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 61616536b82..8cd7c264118 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -111,7 +111,6 @@ run-make/obey-crate-type-flag/Makefile
 run-make/optimization-remarks-dir-pgo/Makefile
 run-make/optimization-remarks-dir/Makefile
 run-make/output-type-permutations/Makefile
-run-make/override-aliased-flags/Makefile
 run-make/panic-abort-eh_frame/Makefile
 run-make/pass-linker-flags-flavor/Makefile
 run-make/pass-linker-flags-from-dep/Makefile
diff --git a/tests/run-make/override-aliased-flags/Makefile b/tests/run-make/override-aliased-flags/Makefile
deleted file mode 100644
index db1ff1ff981..00000000000
--- a/tests/run-make/override-aliased-flags/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-# FIXME: it would be good to check that it's actually the rightmost flags
-# that are used when multiple flags are specified, but I can't think of a
-# reliable way to check this.
-
-all:
-	# Test that `-O` and `-C opt-level` can be specified multiple times.
-	# The rightmost flag will be used over any previous flags.
-	$(RUSTC) -O -O main.rs
-	$(RUSTC) -O -C opt-level=0 main.rs
-	$(RUSTC) -C opt-level=0 -O main.rs
-	$(RUSTC) -C opt-level=0 -C opt-level=2 main.rs
-	$(RUSTC) -C opt-level=2 -C opt-level=0 main.rs
-
-	# Test that `-g` and `-C debuginfo` can be specified multiple times.
-	# The rightmost flag will be used over any previous flags.
-	$(RUSTC) -g -g main.rs
-	$(RUSTC) -g -C debuginfo=0 main.rs
-	$(RUSTC) -C debuginfo=0 -g main.rs
-	$(RUSTC) -C debuginfo=0 -C debuginfo=2 main.rs
-	$(RUSTC) -C debuginfo=2 -C debuginfo=0 main.rs
diff --git a/tests/run-make/override-aliased-flags/rmake.rs b/tests/run-make/override-aliased-flags/rmake.rs
new file mode 100644
index 00000000000..e610c04651e
--- /dev/null
+++ b/tests/run-make/override-aliased-flags/rmake.rs
@@ -0,0 +1,24 @@
+//@ ignore-cross-compile
+
+use run_make_support::rustc;
+
+// FIXME: it would be good to check that it's actually the rightmost flags
+// that are used when multiple flags are specified, but I can't think of a
+// reliable way to check this.
+fn main() {
+    // Test that `-O` and `-C opt-level` can be specified multiple times.
+    // The rightmost flag will be used over any previous flags.
+    rustc().arg("-O").arg("-O").input("main.rs").run();
+    rustc().arg("-O").arg("-C").arg("opt-level=0").input("main.rs").run();
+    rustc().arg("-C").arg("opt-level=0").arg("-O").input("main.rs").run();
+    rustc().arg("-C").arg("opt-level=0").arg("-C").arg("opt-level=2").input("main.rs").run();
+    rustc().arg("-C").arg("opt-level=2").arg("-C").arg("opt-level=0").input("main.rs").run();
+
+    // Test that `-g` and `-C debuginfo` can be specified multiple times.
+    // The rightmost flag will be used over any previous flags.
+    rustc().arg("-g").arg("-g").input("main.rs").run();
+    rustc().arg("-g").arg("-C").arg("debuginfo=0").input("main.rs").run();
+    rustc().arg("-C").arg("debuginfo=0").arg("-g").input("main.rs").run();
+    rustc().arg("-C").arg("debuginfo=0").arg("-C").arg("debuginfo=2").input("main.rs").run();
+    rustc().arg("-C").arg("debuginfo=2").arg("-C").arg("debuginfo=0").input("main.rs").run();
+}