From e870ab86dcf2bf85da5fd81883bb437d9cc6e90f Mon Sep 17 00:00:00 2001 From: Oneirical Date: Tue, 16 Jul 2024 13:05:12 -0400 Subject: [PATCH 1/3] rewrite and rename issue-14698 to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - .../foo.rs | 0 tests/run-make/invalid-tmpdir-env-var/rmake.rs | 18 ++++++++++++++++++ tests/run-make/issue-14698/Makefile | 4 ---- 4 files changed, 18 insertions(+), 5 deletions(-) rename tests/run-make/{issue-14698 => invalid-tmpdir-env-var}/foo.rs (100%) create mode 100644 tests/run-make/invalid-tmpdir-env-var/rmake.rs delete mode 100644 tests/run-make/issue-14698/Makefile diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 6b3533c25785f..cc959fa24a6d5 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -28,7 +28,6 @@ run-make/incr-add-rust-src-component/Makefile run-make/incr-foreign-head-span/Makefile run-make/interdependent-c-libraries/Makefile run-make/issue-107094/Makefile -run-make/issue-14698/Makefile run-make/issue-15460/Makefile run-make/issue-33329/Makefile run-make/issue-35164/Makefile diff --git a/tests/run-make/issue-14698/foo.rs b/tests/run-make/invalid-tmpdir-env-var/foo.rs similarity index 100% rename from tests/run-make/issue-14698/foo.rs rename to tests/run-make/invalid-tmpdir-env-var/foo.rs diff --git a/tests/run-make/invalid-tmpdir-env-var/rmake.rs b/tests/run-make/invalid-tmpdir-env-var/rmake.rs new file mode 100644 index 0000000000000..d4258775a11d1 --- /dev/null +++ b/tests/run-make/invalid-tmpdir-env-var/rmake.rs @@ -0,0 +1,18 @@ +// When the TMP or TMPDIR variable is set to an invalid or non-existing directory, +// this used to cause an internal compiler error (ICE). After the addition of proper +// error handling in #28430, this test checks that the expected message is printed. +// See https://github.com/rust-lang/rust/issues/14698 + +use run_make_support::rustc; + +// NOTE: This is not a UI test despite its simplicity, as the error message contains a path +// with some variability that is difficult to normalize + +fn main() { + rustc() + .input("foo.rs") + .env("TMP", "fake") + .env("TMPDIR", "fake") + .run_fail() + .assert_stderr_contains("couldn't create a temp dir"); +} diff --git a/tests/run-make/issue-14698/Makefile b/tests/run-make/issue-14698/Makefile deleted file mode 100644 index a1cfb5abab541..0000000000000 --- a/tests/run-make/issue-14698/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - TMP=fake TMPDIR=fake $(RUSTC) foo.rs 2>&1 | $(CGREP) "couldn't create a temp dir:" From 613a7a79e7ce7f733e622040d45e392c159d13e3 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Tue, 16 Jul 2024 13:13:52 -0400 Subject: [PATCH 2/3] rewrite and rename issue-33329 to ui test --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/issue-33329/Makefile | 5 ----- tests/run-make/issue-33329/main.rs | 1 - tests/ui/errors/wrong-target-spec.rs | 3 +++ tests/ui/errors/wrong-target-spec.stderr | 2 ++ 5 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 tests/run-make/issue-33329/Makefile delete mode 100644 tests/run-make/issue-33329/main.rs create mode 100644 tests/ui/errors/wrong-target-spec.rs create mode 100644 tests/ui/errors/wrong-target-spec.stderr diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index cc959fa24a6d5..87760469b320e 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -29,7 +29,6 @@ run-make/incr-foreign-head-span/Makefile run-make/interdependent-c-libraries/Makefile run-make/issue-107094/Makefile run-make/issue-15460/Makefile -run-make/issue-33329/Makefile run-make/issue-35164/Makefile run-make/issue-36710/Makefile run-make/issue-47551/Makefile diff --git a/tests/run-make/issue-33329/Makefile b/tests/run-make/issue-33329/Makefile deleted file mode 100644 index 9c149440d8ec4..0000000000000 --- a/tests/run-make/issue-33329/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --target x86_64_unknown-linux-musl main.rs 2>&1 | $(CGREP) \ - "error: Error loading target specification: Could not find specification for target" diff --git a/tests/run-make/issue-33329/main.rs b/tests/run-make/issue-33329/main.rs deleted file mode 100644 index f328e4d9d04c3..0000000000000 --- a/tests/run-make/issue-33329/main.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/ui/errors/wrong-target-spec.rs b/tests/ui/errors/wrong-target-spec.rs new file mode 100644 index 0000000000000..d1d0fcc5fa0bd --- /dev/null +++ b/tests/ui/errors/wrong-target-spec.rs @@ -0,0 +1,3 @@ +//@ compile-flags: --target x86_64_unknown-linux-musl + +fn main() {} diff --git a/tests/ui/errors/wrong-target-spec.stderr b/tests/ui/errors/wrong-target-spec.stderr new file mode 100644 index 0000000000000..8b06f404078d0 --- /dev/null +++ b/tests/ui/errors/wrong-target-spec.stderr @@ -0,0 +1,2 @@ +error: Error loading target specification: Could not find specification for target "x86_64_unknown-linux-musl". Run `rustc --print target-list` for a list of built-in targets + From 8990df7d13871b388cbb51add034eb301e68956b Mon Sep 17 00:00:00 2001 From: Oneirical Date: Tue, 16 Jul 2024 13:24:19 -0400 Subject: [PATCH 3/3] rewrite and rename issue-107094 to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - .../run-make/invalid-tmpdir-env-var/rmake.rs | 22 ++++++++++--------- tests/run-make/issue-107094/Makefile | 7 ------ .../version-verbose-commit-hash/rmake.rs | 20 +++++++++++++++++ tests/ui/errors/wrong-target-spec.rs | 5 +++++ 5 files changed, 37 insertions(+), 18 deletions(-) delete mode 100644 tests/run-make/issue-107094/Makefile create mode 100644 tests/run-make/version-verbose-commit-hash/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 87760469b320e..d6da40d3d78f0 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -27,7 +27,6 @@ run-make/foreign-rust-exceptions/Makefile run-make/incr-add-rust-src-component/Makefile run-make/incr-foreign-head-span/Makefile run-make/interdependent-c-libraries/Makefile -run-make/issue-107094/Makefile run-make/issue-15460/Makefile run-make/issue-35164/Makefile run-make/issue-36710/Makefile diff --git a/tests/run-make/invalid-tmpdir-env-var/rmake.rs b/tests/run-make/invalid-tmpdir-env-var/rmake.rs index d4258775a11d1..db44debb319eb 100644 --- a/tests/run-make/invalid-tmpdir-env-var/rmake.rs +++ b/tests/run-make/invalid-tmpdir-env-var/rmake.rs @@ -1,18 +1,20 @@ -// When the TMP or TMPDIR variable is set to an invalid or non-existing directory, -// this used to cause an internal compiler error (ICE). After the addition of proper -// error handling in #28430, this test checks that the expected message is printed. +// When the TMP (on Windows) or TMPDIR (on Unix) variable is set to an invalid +// or non-existing directory, this used to cause an internal compiler error (ICE). After the +// addition of proper error handling in #28430, this test checks that the expected message is +// printed. // See https://github.com/rust-lang/rust/issues/14698 -use run_make_support::rustc; +use run_make_support::{is_windows, rustc}; // NOTE: This is not a UI test despite its simplicity, as the error message contains a path // with some variability that is difficult to normalize fn main() { - rustc() - .input("foo.rs") - .env("TMP", "fake") - .env("TMPDIR", "fake") - .run_fail() - .assert_stderr_contains("couldn't create a temp dir"); + let mut rustc = rustc(); + if is_windows() { + rustc.env("TMP", "fake"); + } else { + rustc.env("TMPDIR", "fake"); + } + rustc.input("foo.rs").run_fail().assert_stderr_contains("couldn't create a temp dir"); } diff --git a/tests/run-make/issue-107094/Makefile b/tests/run-make/issue-107094/Makefile deleted file mode 100644 index d614e3e1055c0..0000000000000 --- a/tests/run-make/issue-107094/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# needs-git-hash - -include ../tools.mk - -all: - $(BARE_RUSTC) --version --verbose | $(CGREP) -i -e "commit-hash: [0-9a-f]{40}" "commit-date: [0-9]{4}-[0-9]{2}-[0-9]{2}" - $(BARE_RUSTDOC) --version --verbose | $(CGREP) -i -e "commit-hash: [0-9a-f]{40}" "commit-date: [0-9]{4}-[0-9]{2}-[0-9]{2}" diff --git a/tests/run-make/version-verbose-commit-hash/rmake.rs b/tests/run-make/version-verbose-commit-hash/rmake.rs new file mode 100644 index 0000000000000..733c0e2cdb14f --- /dev/null +++ b/tests/run-make/version-verbose-commit-hash/rmake.rs @@ -0,0 +1,20 @@ +// `--version --verbose` should display the git-commit hashes of rustc and rustdoc, but this +// functionality was lost due to #104184. After this feature was returned by #109981, this +// test ensures it will not be broken again. +// See https://github.com/rust-lang/rust/issues/107094 + +//@ needs-git-hash + +use run_make_support::{bare_rustc, bare_rustdoc, regex}; + +fn main() { + let out_rustc = + bare_rustc().arg("--version").arg("--verbose").run().stdout_utf8().to_lowercase(); + let out_rustdoc = + bare_rustdoc().arg("--version").arg("--verbose").run().stdout_utf8().to_lowercase(); + let re = + regex::Regex::new(r#"commit-hash: [0-9a-f]{40}\ncommit-date: [0-9]{4}-[0-9]{2}-[0-9]{2}"#) + .unwrap(); + assert!(re.is_match(&out_rustc)); + assert!(re.is_match(&out_rustdoc)); +} diff --git a/tests/ui/errors/wrong-target-spec.rs b/tests/ui/errors/wrong-target-spec.rs index d1d0fcc5fa0bd..bc9038c1fab54 100644 --- a/tests/ui/errors/wrong-target-spec.rs +++ b/tests/ui/errors/wrong-target-spec.rs @@ -1,3 +1,8 @@ +// The attentive may note the underscores in the target triple, making it invalid. This test +// checks that such invalid target specs are rejected by the compiler. +// See https://github.com/rust-lang/rust/issues/33329 + +//@ needs-llvm-components: x86 //@ compile-flags: --target x86_64_unknown-linux-musl fn main() {}