Page MenuHomeFreeBSD

atf-check: Add shortcut for not-exit:0
Needs ReviewPublic

Authored by des on Wed, Jul 8, 7:17 AM.

Details

Reviewers
None
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.Wed, Jul 8, 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.