1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-05-30 06:16:58 +02:00
Files
coreutils/tests/misc/timeout-parameters
T

74 lines
1.8 KiB
Bash
Raw Normal View History

2008-03-28 11:05:55 +00:00
#!/bin/sh
# Validate timeout parameter combinations
# Copyright (C) 2008-2011 Free Software Foundation, Inc.
2008-03-28 11:05:55 +00:00
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# 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=.}/init.sh"; path_prepend_ ../src
print_ver_ timeout
getlimits_
2008-03-28 11:05:55 +00:00
2009-10-23 08:54:53 -06:00
# internal errors are 125, distinct from execution failure
2008-03-28 11:05:55 +00:00
# invalid timeout
2009-10-23 08:54:53 -06:00
timeout invalid sleep 0
test $? = 125 || fail=1
2008-03-28 11:05:55 +00:00
2010-03-15 23:03:30 +00:00
# invalid kill delay
timeout --kill-after=invalid 1 sleep 0
test $? = 125 || fail=1
2008-03-28 11:05:55 +00:00
# invalid timeout suffix
2009-10-23 08:54:53 -06:00
timeout 42D sleep 0
test $? = 125 || fail=1
2008-03-28 11:05:55 +00:00
# timeout overflow
2009-10-23 08:54:53 -06:00
timeout $UINT_OFLOW sleep 0
test $? = 0 || fail=1
2008-03-28 11:05:55 +00:00
# timeout overflow
2009-10-23 08:54:53 -06:00
timeout $(expr $UINT_MAX / 86400 + 1)d sleep 0
test $? = 0 || fail=1
# timeout overflow
timeout 999999999999999999999999999999999999999999999999999999999999d sleep 0
test $? = 0 || fail=1
# floating point notation
timeout 2.34 sleep 0
test $? = 0 || fail=1
# floating point notation
timeout 2.34e+5d sleep 0
test $? = 0 || fail=1
2008-03-28 11:05:55 +00:00
2011-07-18 10:49:17 +01:00
# nanoseconds potentially supported
timeout .999999999 sleep 0 || fail=1
2008-03-28 11:05:55 +00:00
# invalid signal spec
2009-10-23 08:54:53 -06:00
timeout --signal=invalid 1 sleep 0
test $? = 125 || fail=1
2008-03-28 11:05:55 +00:00
# invalid command
timeout 10 .
2009-10-23 08:54:53 -06:00
test $? = 126 || fail=1
2008-03-28 11:05:55 +00:00
2009-10-23 08:54:53 -06:00
# no such command
timeout 10 no_such
2009-10-23 08:54:53 -06:00
test $? = 127 || fail=1
2008-03-28 11:05:55 +00:00
Exit $fail