summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/arch7
-rwxr-xr-xtests/misc/stdbuf26
-rwxr-xr-xtests/misc/timeout2
-rwxr-xr-xtests/misc/timeout-parameters28
4 files changed, 36 insertions, 27 deletions
diff --git a/tests/misc/arch b/tests/misc/arch
index 9a437568d..04bce0e1a 100755
--- a/tests/misc/arch
+++ b/tests/misc/arch
@@ -17,12 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
-
-# skip this test if arch isn't being built.
-case " $built_programs " in
- *" arch "*) ;;
- *) skip_test_ 'not building arch';;
-esac
+require_built_ arch
if test "$VERBOSE" = yes; then
set -x
diff --git a/tests/misc/stdbuf b/tests/misc/stdbuf
index 337504028..33bc658ea 100755
--- a/tests/misc/stdbuf
+++ b/tests/misc/stdbuf
@@ -16,20 +16,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+. $srcdir/test-lib.sh
+getlimits_
+require_built_ stdbuf
+
if test "$VERBOSE" = yes; then
set -x
stdbuf --version
fi
-. $srcdir/test-lib.sh
-getlimits_
-
-# skip this test if stdbuf isn't being built.
-case " $built_programs " in
- *" stdbuf "*) ;;
- *) skip_test_ 'stdbuf not built';;
-esac
-
# stdbuf fails when the absolute top build dir name contains e.g., space, TAB, NL
lf='
'
@@ -52,10 +47,17 @@ stdbuf -o1 true || fail=1 # verify size syntax
stdbuf -oK true || fail=1 # verify size syntax
stdbuf -o0 true || fail=1 # verify unbuffered syntax
stdbuf -oL true || fail=1 # verify line buffered syntax
-stdbuf -ol true && fail=1 # Capital 'L' required
-stdbuf -o$SIZE_OFLOW true && fail=1 # size too large
-stdbuf -iL true && fail=1 # line buffering stdin disallowed
+stdbuf -ol true # Capital 'L' required
+test $? = 125 || fail=1 # Internal error is a particular status
+stdbuf -o$SIZE_OFLOW true # size too large
+test $? = 125 || fail=1
+stdbuf -iL true # line buffering stdin disallowed
+test $? = 125 || fail=1
stdbuf -i0 -o0 -e0 true || fail=1 #check all files
+stdbuf -o1 . # invalid command
+test $? = 126 || fail=1
+stdbuf -o1 ... # no such command
+test $? = 127 || fail=1
# Ensure line buffering stdout takes effect
printf '1\n' > exp
diff --git a/tests/misc/timeout b/tests/misc/timeout
index 36fdb73a5..08734e6f2 100755
--- a/tests/misc/timeout
+++ b/tests/misc/timeout
@@ -36,6 +36,8 @@ timeout 0 true || fail=1
# exit status propagation
timeout 1 false && fail=1
+timeout 1 sh -c 'exit 2'
+test $? = 2 || fail=1
# timeout
timeout 1 sleep 2
diff --git a/tests/misc/timeout-parameters b/tests/misc/timeout-parameters
index cf344b962..52d4c8aee 100755
--- a/tests/misc/timeout-parameters
+++ b/tests/misc/timeout-parameters
@@ -26,28 +26,38 @@ getlimits_
fail=0
+# internal errors are 125, distinct from execution failure
+
# --help and --version must be specified alone
-timeout --help --version && fail=1
+timeout --help --version
+test $? = 125 || fail=1
# invalid timeout
-timeout invalid sleep 0 && fail=1
+timeout invalid sleep 0
+test $? = 125 || fail=1
# invalid timeout suffix
-timeout 42D sleep 0 && fail=1
+timeout 42D sleep 0
+test $? = 125 || fail=1
# timeout overflow
-timeout $UINT_OFLOW sleep 0 && fail=1
+timeout $UINT_OFLOW sleep 0
+test $? = 125 || fail=1
# timeout overflow
-timeout $(expr $UINT_MAX / 86400 + 1)d sleep 0 && fail=1
+timeout $(expr $UINT_MAX / 86400 + 1)d sleep 0
+test $? = 125 || fail=1
# invalid signal spec
-timeout --signal=invalid 1 sleep 0 && fail=1
+timeout --signal=invalid 1 sleep 0
+test $? = 125 || fail=1
# invalid command
-timeout 1 . && fail=1
+timeout 1 .
+test $? = 126 || fail=1
-# non existant command
-timeout 1 ... && fail=1
+# no such command
+timeout 1 ...
+test $? = 127 || fail=1
Exit $fail