[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New tests: errexit, input from stdin.
From: |
Ralf Wildenhues |
Subject: |
New tests: errexit, input from stdin. |
Date: |
Sun, 13 Apr 2008 11:47:21 +0200 |
User-agent: |
Mutt/1.5.17+20080114 (2008-01-14) |
OK?
Thanks,
Ralf
2008-04-13 Ralf Wildenhues <address@hidden>
* tests/autotest.at (AT_CHECK_AT): Allow to pass additional
arguments to the inner suite.
(errexit, input from stdin): New tests.
diff --git a/tests/autotest.at b/tests/autotest.at
index 1f5ce0b..e6dc862 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -52,21 +52,22 @@ m4_popdef([AT_dir])dnl
]) # AT_CHECK_AT_PREP
# AT_CHECK_AT(TITLE, SUITE-CODE, [XFAIL-CONDITION], [STATUS = 0],
-# [STDOUT := ignore], STDERR, [POST-TEST-CODE])
-# ---------------------------------------------------------------
+# [STDOUT = ignore], STDERR, [POST-TEST-CODE], [SUITE-ARGS])
+# ----------------------------------------------------------------------
# Create a new test named TITLE that runs a minimal Autotest test suite,
-# SUITE-CODE. Call AT_XFAIL_IF with XFAIL-CONDITION. STATUS and STDERR pass
-# directly to the AT_CHECK that call the minimal test suite. STDOUT is not
-# used, but it is reserved for future use. Run POST-TEST-CODE
-# at the top level after the micro-suite has been run.
+# SUITE-CODE with additional SUITE-ARGS, once without and once with
+# '-v -x' added. Call AT_XFAIL_IF with XFAIL-CONDITION. Pass STDERR
+# directly to the AT_CHECK that calls the minimal test suite, STDOUT to
+# the AT_CHECK without '-v -x'; ignore stdout for the latter.
+# Run POST-TEST-CODE at the top level after the micro-suite has been run.
m4_define([AT_CHECK_AT],
[AT_SETUP([$1])
AT_XFAIL_IF([$3])
AT_CHECK_AT_PREP([micro-suite], [$2])
-AT_CHECK([$CONFIG_SHELL ./micro-suite], m4_default([$4], 0),
- [ignore], [$6])
-AT_CHECK([$CONFIG_SHELL ./micro-suite -v -x], m4_default([$4], 0),
+AT_CHECK([$CONFIG_SHELL ./micro-suite $8], m4_default([$4], 0),
+ m4_default([$5], [ignore]), [$6])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -v -x $8], m4_default([$4], 0),
[ignore], [$6])
$7
AT_CLEANUP
@@ -232,6 +233,18 @@ AT_CHECK_AT_TEST([Skip],
[], [], [], [],
[AT_CHECK([grep skipped micro-suite.log], [], [ignore])])
+AT_CHECK_AT_TEST([errexit],
+ [AT_CHECK([false])
+ AT_CLEANUP
+ AT_SETUP([test that should not be run])
+ AT_CHECK([:])],
+ [], [1], [stdout], [stderr],
+ [AT_CHECK([test -f micro-suite.log], [1])
+ touch micro-suite.log # shut up AT_CAPTURE_FILE.
+ AT_CHECK([grep "should not be run" stdout], [1])
+ AT_CHECK([grep "1 .* inhibited subsequent" stderr], [], [ignore])],
+ [--errexit])
+
AT_CHECK_AT_TEST([Literal multiline command],
[AT_CHECK([echo Auto'
'conf], 0, [Auto
@@ -362,6 +375,26 @@ conf
], [])])
+## ----------------- ##
+## Input from stdin. ##
+## ----------------- ##
+
+AT_SETUP([Input from stdin])
+
+AT_CHECK_AT_PREP([micro-suite],
+[[AT_INIT
+AT_SETUP([please enter hello<RETURN><EOF>])
+AT_CHECK([cat], [], [hello
+])
+AT_CLEANUP
+]])
+
+AT_CHECK([echo hello | $CONFIG_SHELL ./micro-suite], [], [ignore])
+AT_CHECK([$CONFIG_SHELL ./micro-suite </dev/null], [1], [ignore], [ignore])
+
+AT_CLEANUP
+
+
## ------------------------------- ##
## Funny characters in test names. ##
## ------------------------------- ##
- New tests: errexit, input from stdin.,
Ralf Wildenhues <=