about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/run-make/target-cpu-native/Makefile20
-rw-r--r--tests/run-make/target-cpu-native/rmake.rs16
2 files changed, 16 insertions, 20 deletions
diff --git a/tests/run-make/target-cpu-native/Makefile b/tests/run-make/target-cpu-native/Makefile
deleted file mode 100644
index eb3ca1e13aa..00000000000
--- a/tests/run-make/target-cpu-native/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-include ../tools.mk
-
-# only-linux
-# only-x86_64
-#
-# I *really* don't want to deal with a cross-platform way to compare file sizes,
-# tests in `make` sort of are awful
-
-all: $(TMPDIR)/out.log
-	# Make sure no warnings about "unknown CPU `native`" were emitted
-	if [ "$$(wc -c $(TMPDIR)/out.log | cut -d' ' -f 1)" = "0" ]; then \
-	  echo no warnings generated; \
-	else \
-	  exit 1; \
-	fi
-
-
-$(TMPDIR)/out.log:
-	$(RUSTC) foo.rs -C target-cpu=native 2>&1 | tee $(TMPDIR)/out.log
-	$(call RUN,foo)
diff --git a/tests/run-make/target-cpu-native/rmake.rs b/tests/run-make/target-cpu-native/rmake.rs
new file mode 100644
index 00000000000..c5bd0245051
--- /dev/null
+++ b/tests/run-make/target-cpu-native/rmake.rs
@@ -0,0 +1,16 @@
+// target-cpu is a codegen flag that generates code for the processor of the host machine
+// running the compilation. This test is a sanity test that this flag does not cause any
+// warnings when used, and that binaries produced by it can also be successfully executed.
+// See https://github.com/rust-lang/rust/pull/23238
+
+// FIXME(Oneirical): only-linux only-x86_64
+
+use run_make_support::{run, rustc};
+
+fn main() {
+    let out = rustc().input("foo.rs").arg("-Ctarget-cpu=native").run().stderr_utf8();
+    run("foo");
+    // There should be zero warnings emitted - the bug would cause "unknown CPU `native`"
+    // to be printed out.
+    assert_eq!(out.len(), 0);
+}