diff options
| author | Oneirical <manchot@videotron.ca> | 2024-07-04 11:28:16 -0400 |
|---|---|---|
| committer | Oneirical <manchot@videotron.ca> | 2024-07-04 11:38:24 -0400 |
| commit | e45d72dee0cd4bc56b9c8946678e09daf17c9cf3 (patch) | |
| tree | ccf9fc917c87e33adf49fc978f9278fdaa50a7dd | |
| parent | 5cddb156d114d77bb5f9ba3876fb2dada7ad9276 (diff) | |
| download | rust-e45d72dee0cd4bc56b9c8946678e09daf17c9cf3.tar.gz rust-e45d72dee0cd4bc56b9c8946678e09daf17c9cf3.zip | |
rewrite target-cpu-native to rmake
| -rw-r--r-- | tests/run-make/target-cpu-native/Makefile | 20 | ||||
| -rw-r--r-- | tests/run-make/target-cpu-native/rmake.rs | 16 |
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); +} |
