Skip to content

Commit

Permalink
Rollup merge of rust-lang#121527 - Enselic:unix_sigpipe-tests-fixes, …
Browse files Browse the repository at this point in the history
…r=davidtwco

unix_sigpipe: Simple fixes and improvements in tests

In rust-lang#120832 I included 5 preparatory commits.

It will take a while before discussions there and in rust-lang#62569 is settled, so here is a PR that splits out 4 of the commits that are easy to review, to get them out of the way.

r? `@davidtwco` who already approved these commits in rust-lang#120832 (but I have tweaked them a bit and rebased them since then).

For the convenience of my reviewer, here are the full commit messages of the commits:
<details>
<summary>Click to expand</summary>

```
commit 948b1d6 (HEAD -> unix_sigpipe-tests-fixes, origin/unix_sigpipe-tests-fixes)
Author: Martin Nordholts <[email protected]>
Date:   Fri Feb 9 07:57:27 2024 +0100

    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"]

commit d14f158
Author: Martin Nordholts <[email protected]>
Date:   Fri Feb 9 08:47:47 2024 +0100

    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.

commit a1cb3db
Author: Martin Nordholts <[email protected]>
Date:   Fri Feb 9 06:44:56 2024 +0100

    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"]

commit e060274
Author: Martin Nordholts <[email protected]>
Date:   Fri Feb 9 05:48:24 2024 +0100

    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.
```

</details>

Tracking issue: rust-lang#97889
  • Loading branch information
GuillaumeGomez authored Feb 28, 2024
2 parents 1638501 + 948b1d6 commit 3d25d44
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -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]
| ^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#![feature(unix_sigpipe)]

#[unix_sigpipe = "sig_ign"]
#[unix_sigpipe = "inherit"] //~ error: multiple `unix_sigpipe` attributes
fn main() {}
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(unix_sigpipe)]

#[unix_sigpipe = "sig_ign"]
#[unix_sigpipe = "inherit"]
#[unix_sigpipe = "inherit"] //~ error: multiple `unix_sigpipe` attributes
fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
13 changes: 0 additions & 13 deletions tests/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs

This file was deleted.

0 comments on commit 3d25d44

Please sign in to comment.