Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162115412
D58099.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D58099.diff
View Options
diff --git a/contrib/atf/atf-sh/atf-check.1 b/contrib/atf/atf-sh/atf-check.1
--- a/contrib/atf/atf-sh/atf-check.1
+++ b/contrib/atf/atf-sh/atf-check.1
@@ -22,7 +22,7 @@
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.Dd June 21, 2020
+.Dd July 8, 2026
.Dt ATF-CHECK 1
.Os
.Sh NAME
@@ -34,6 +34,7 @@
.Op Fl o Ar action:arg ...
.Op Fl e Ar action:arg ...
.Op Fl x
+.Op \&!
.Ar command
.Sh DESCRIPTION
.Nm
@@ -58,6 +59,16 @@
.Ar empty
.Fl e
.Ar empty .
+If
+.Ar command
+is preceded by
+.Sq \&! ,
+it will default to
+.Fl s
+.Ar not-exit:0
+instead of
+.Fl s
+.Ar exit:0 .
Multiple checks for the same output channel are allowed and, if specified,
their results will be combined as a logical and (meaning that the output must
match all the provided checks).
@@ -153,7 +164,7 @@
atf_check 'true'
# Typical usage if failure is expected
-atf_check -s not-exit:0 'false'
+atf_check ! false
# Checking stdout/stderr
echo foobar >expout
diff --git a/contrib/atf/atf-sh/atf-check.cpp b/contrib/atf/atf-sh/atf-check.cpp
--- a/contrib/atf/atf-sh/atf-check.cpp
+++ b/contrib/atf/atf-sh/atf-check.cpp
@@ -898,13 +898,21 @@
int
atf_check::main(void)
{
+ bool negate = false;
+
+ while (m_argc > 0 && strcmp(m_argv[0], "!") == 0) {
+ negate = !negate;
+ m_argc--;
+ m_argv++;
+ }
+
if (m_argc < 1)
throw atf::application::usage_error("No command specified");
int status = EXIT_FAILURE;
if (m_status_checks.empty())
- m_status_checks.push_back(status_check(sc_exit, false, EXIT_SUCCESS));
+ m_status_checks.push_back(status_check(sc_exit, negate, EXIT_SUCCESS));
else if (m_status_checks.size() > 1) {
// TODO: Remove this restriction.
throw atf::application::usage_error("Cannot specify -s more than once");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jul 10, 10:31 PM (6 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34942179
Default Alt Text
D58099.diff (1 KB)
Attached To
Mode
D58099: atf-check: Add shortcut for not-exit:0
Attached
Detach File
Event Timeline
Log In to Comment