From e060274e55a5b09fe6ace6dfe72ca0cca663b711 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Fri, 9 Feb 2024 05:48:24 +0100 Subject: [PATCH 1/4] tests: Fix typo unix_sigpipe-error.rs -> unix_sigpipe-sig_ign.rs There is no error expected. It's simply the "regular" test for sig_ign. So rename it. --- .../{unix_sigpipe-error.rs => unix_sigpipe-sig_ign.rs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/ui/attributes/unix_sigpipe/{unix_sigpipe-error.rs => unix_sigpipe-sig_ign.rs} (100%) diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-error.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_ign.rs similarity index 100% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe-error.rs rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_ign.rs From a1cb3dba840fd56a7f9a0c90346a1fcddc641f9c Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Fri, 9 Feb 2024 06:44:56 +0100 Subject: [PATCH 2/4] tests: Rename unix_sigpipe.rs to unix_sigpipe-bare.rs for clarity The test is for the "bare" variant of the attribute that looks like this: #[unix_sigpipe] which is not allowed, because it must look like this: #[unix_sigpipe = "sig_ign"] --- .../unix_sigpipe/{unix_sigpipe.rs => unix_sigpipe-bare.rs} | 0 .../{unix_sigpipe.stderr => unix_sigpipe-bare.stderr} | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/ui/attributes/unix_sigpipe/{unix_sigpipe.rs => unix_sigpipe-bare.rs} (100%) rename tests/ui/attributes/unix_sigpipe/{unix_sigpipe.stderr => unix_sigpipe-bare.stderr} (83%) diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.rs similarity index 100% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe.rs rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.rs diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.stderr similarity index 83% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe.stderr rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.stderr index b18ec9abc3745..56218ed499ece 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.stderr @@ -1,5 +1,5 @@ error: valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` - --> $DIR/unix_sigpipe.rs:3:1 + --> $DIR/unix_sigpipe-bare.rs:3:1 | LL | #[unix_sigpipe] | ^^^^^^^^^^^^^^^ From d14f15862d2ac7111f70efe82882fb3575167a53 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Fri, 9 Feb 2024 08:47:47 +0100 Subject: [PATCH 3/4] tests: Combine unix_sigpipe-not-used.rs and unix_sigpipe-only-feature.rs The only difference between the files is the presence/absence of #![feature(unix_sigpipe)] attribute. Avoid duplication by using revisions instead. --- .../unix_sigpipe/unix_sigpipe-not-used.rs | 3 +++ .../unix_sigpipe/unix_sigpipe-only-feature.rs | 13 ------------- 2 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 tests/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs index 778e06cb3effe..b0044f5e91999 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs @@ -1,6 +1,9 @@ +//@ revisions: with_feature without_feature //@ run-pass //@ aux-build:sigpipe-utils.rs +#![cfg_attr(with_feature, feature(unix_sigpipe))] + fn main() { extern crate sigpipe_utils; diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs deleted file mode 100644 index 6bbe4a8d0d688..0000000000000 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass -//@ aux-build:sigpipe-utils.rs - -#![feature(unix_sigpipe)] - -fn main() { - extern crate sigpipe_utils; - - // Only #![feature(unix_sigpipe)] is enabled, not #[unix_sigpipe = "..."]. - // This shall not change any behavior, so we still expect SIGPIPE to be - // ignored - sigpipe_utils::assert_sigpipe_handler(sigpipe_utils::SignalHandler::Ignore); -} From 948b1d68abdf6ccde608831401dfe35af4a8cb04 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Fri, 9 Feb 2024 07:57:27 +0100 Subject: [PATCH 4/4] tests: Add unix_sigpipe-different-duplicates.rs test variant To make sure that #[unix_sigpipe = "x"] #[unix_sigpipe = "y"] behaves like #[unix_sigpipe = "x"] #[unix_sigpipe = "x"] --- .../unix_sigpipe-different-duplicates.rs | 5 +++++ .../unix_sigpipe-different-duplicates.stderr | 14 ++++++++++++++ .../unix_sigpipe/unix_sigpipe-duplicates.rs | 2 +- .../unix_sigpipe/unix_sigpipe-duplicates.stderr | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.rs create mode 100644 tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.stderr diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.rs new file mode 100644 index 0000000000000..294cb38526bd0 --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.rs @@ -0,0 +1,5 @@ +#![feature(unix_sigpipe)] + +#[unix_sigpipe = "sig_ign"] +#[unix_sigpipe = "inherit"] //~ error: multiple `unix_sigpipe` attributes +fn main() {} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.stderr new file mode 100644 index 0000000000000..c2a3b9f45f9ac --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.stderr @@ -0,0 +1,14 @@ +error: multiple `unix_sigpipe` attributes + --> $DIR/unix_sigpipe-different-duplicates.rs:4:1 + | +LL | #[unix_sigpipe = "inherit"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unix_sigpipe-different-duplicates.rs:3:1 + | +LL | #[unix_sigpipe = "sig_ign"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs index 294cb38526bd0..eccb23021b6b8 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs @@ -1,5 +1,5 @@ #![feature(unix_sigpipe)] -#[unix_sigpipe = "sig_ign"] +#[unix_sigpipe = "inherit"] #[unix_sigpipe = "inherit"] //~ error: multiple `unix_sigpipe` attributes fn main() {} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr index 931aae96b0ff7..c86e54a1e532f 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr @@ -7,7 +7,7 @@ LL | #[unix_sigpipe = "inherit"] note: attribute also specified here --> $DIR/unix_sigpipe-duplicates.rs:3:1 | -LL | #[unix_sigpipe = "sig_ign"] +LL | #[unix_sigpipe = "inherit"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error