Page MenuHomeFreeBSD

atf-check: Add shortcut for not-exit:0
AcceptedPublic

Authored by des on Jul 8 2026, 7:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Aug 18, 3:11 AM
Unknown Object (File)
Thu, Aug 13, 12:13 PM
Unknown Object (File)
Thu, Aug 13, 9:58 AM
Unknown Object (File)
Wed, Aug 12, 12:54 PM
Unknown Object (File)
Tue, Aug 11, 5:47 PM
Unknown Object (File)
Tue, Aug 11, 11:08 AM
Unknown Object (File)
Sun, Aug 9, 12:04 PM
Unknown Object (File)
Sun, Aug 2, 1:05 AM
Subscribers

Details

Reviewers
ngie
Group Reviewers
tests
Summary

Allow the command to be preceded by an exclamation point, which changes
the default expected result to a clean exit with a non-zero exit code.

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 74609
Build 71492: arc lint + arc unit

Event Timeline

des requested review of this revision.Jul 8 2026, 7:17 AM

This is a really nice, simple feature request -- I love it!

The concern I have about this change is that ! is a shell builtin operator and this could cause confusion/result in bugs if someone tries to fun the command on the command line in certain shells where ! has special meanings in different contexts (we can't always assume atf-sh is running /bin/sh, unfortunately..).

How about atf_check -s '!0' false instead? If things were done that way the negation operator could be extended to -e and -o without any sort of ambiguity/confusion.

The concern I have about this change is that ! is a shell builtin operator and this could cause confusion/result in bugs if someone tries to fun the command on the command line in certain shells where ! has special meanings in different contexts (we can't always assume atf-sh is running /bin/sh, unfortunately..).

Can you provide an example?

How about atf_check -s '!0' false instead? If things were done that way the negation operator could be extended to -e and -o without any sort of ambiguity/confusion.

No, that completely negates the point of the patch.

This still feels ambiguous in a non-desirable way to me, but I can see the value in making this possible so I want to give this the space to get more feedback instead of me serving as an unnecessary impediment.

  • Please send out a message with a brief summary of the proposed change/asking for feedback to hackers@ and testing@.
  • Please add tests for the new feature:
    • Positive case: '! false' in m_argv[0]: negation behavior should be applied.
    • Negative case: 'true !' in m_argv[1]: negation behavior should not be applied.
  • I would leave existing tests that could be simplified with the new feature as-is until enough time has been given to get feedback on the new feature.
  • I would set the MFC timer to a higher value like 2 weeks or a month.

added tests, which option do you prefer @ngie?

ngie added inline comments.
contrib/atf/atf-sh/atf_check_test.sh
217 ↗(On Diff #182733)

This seems possibly deserving of a comment: it might not be immediately clear to someone reading the test that true <foo> always succeeds.

This revision is now accepted and ready to land.Fri, Aug 7, 7:54 PM