From 3ec5c0492ccd011258cc11bedb8fa8bc291e918a Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 23 Sep 2014 01:51:05 +0000 Subject: [PATCH] tests: cleanup checks for basic programs * tests/init.sh: Check for cat and rm. * tests/getdents.test: Check for awk. * tests/ptrace_setoptions.test: Check for grep. * tests/net-fd.test: Do not check for rm. * tests/net.test: Likewise. * tests/scm_rights-fd.test: Likewise. * tests/stat.test: Likewise. * tests/uio.test: Likewise. --- tests/count.test | 2 +- tests/detach-running.test | 2 +- tests/detach-sleeping.test | 2 +- tests/detach-stopped.test | 2 +- tests/getdents.test | 1 + tests/init.sh | 9 ++++++--- tests/net-fd.test | 1 - tests/net-yy.test | 2 +- tests/net.test | 1 - tests/ptrace_setoptions.test | 2 ++ tests/scm_rights-fd.test | 1 - tests/stat.test | 1 - tests/uio.test | 1 - 13 files changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/count.test b/tests/count.test index e9eafd91..b94eebae 100755 --- a/tests/count.test +++ b/tests/count.test @@ -4,8 +4,8 @@ . "${srcdir=.}/init.sh" -check_prog sleep check_prog grep +check_prog sleep make_log() { diff --git a/tests/detach-running.test b/tests/detach-running.test index e3b33f9c..3b607d8b 100755 --- a/tests/detach-running.test +++ b/tests/detach-running.test @@ -4,8 +4,8 @@ . "${srcdir=.}/init.sh" -check_prog sleep check_prog grep +check_prog sleep set -e diff --git a/tests/detach-sleeping.test b/tests/detach-sleeping.test index 241d5157..571c345e 100755 --- a/tests/detach-sleeping.test +++ b/tests/detach-sleeping.test @@ -4,8 +4,8 @@ . "${srcdir=.}/init.sh" -check_prog sleep check_prog grep +check_prog sleep set -e diff --git a/tests/detach-stopped.test b/tests/detach-stopped.test index c41bc047..b5cf364b 100755 --- a/tests/detach-stopped.test +++ b/tests/detach-stopped.test @@ -4,8 +4,8 @@ . "${srcdir=.}/init.sh" -check_prog sleep check_prog grep +check_prog sleep $STRACE -d -enone / > /dev/null 2> $LOG if grep -F -x "PTRACE_SEIZE doesn't work" $LOG > /dev/null; then diff --git a/tests/getdents.test b/tests/getdents.test index 7fb81b83..5f86ac16 100755 --- a/tests/getdents.test +++ b/tests/getdents.test @@ -4,6 +4,7 @@ . "${srcdir=.}/init.sh" +check_prog awk check_prog grep check_prog ls check_prog mkdir diff --git a/tests/init.sh b/tests/init.sh index 3976a1ea..418272b8 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -2,9 +2,6 @@ ME_="${0##*/}" -LOG="$ME_.tmp" -rm -f "$LOG" - warn_() { printf >&2 '%s\n' "$*"; } fail_() { warn_ "$ME_: failed test: $*"; exit 1; } skip_() { warn_ "$ME_: skipped test: $*"; exit 77; } @@ -17,6 +14,12 @@ check_prog() framework_skip_ "$* is not available" } +check_prog cat +check_prog rm + +LOG="$ME_.tmp" +rm -f "$LOG" + : "${STRACE:=../strace}" : "${TIMEOUT_DURATION:=60}" : "${SLEEP_A_BIT:=sleep 1}" diff --git a/tests/net-fd.test b/tests/net-fd.test index fc0d3cd0..0f0eb5cc 100755 --- a/tests/net-fd.test +++ b/tests/net-fd.test @@ -9,7 +9,6 @@ framework_skip_ '/proc/self/fd/ is not available' check_prog grep -check_prog rm rm -f $LOG.* diff --git a/tests/net-yy.test b/tests/net-yy.test index 8b6c0982..85c2ede2 100755 --- a/tests/net-yy.test +++ b/tests/net-yy.test @@ -8,8 +8,8 @@ [ -d /proc/self/fd/ ] || framework_skip_ '/proc/self/fd/ is not available' -check_prog sed check_prog awk +check_prog sed rm -f $LOG.* $LOG-* diff --git a/tests/net.test b/tests/net.test index de1dae14..f0eff0c1 100755 --- a/tests/net.test +++ b/tests/net.test @@ -5,7 +5,6 @@ . "${srcdir=.}/init.sh" check_prog grep -check_prog rm rm -f $LOG.* diff --git a/tests/ptrace_setoptions.test b/tests/ptrace_setoptions.test index e574e24a..87651b80 100755 --- a/tests/ptrace_setoptions.test +++ b/tests/ptrace_setoptions.test @@ -5,6 +5,8 @@ . "${srcdir=.}/init.sh" +check_prog grep + [ "$(uname -s)" = Linux ] || skip_ 'The kernel is not a Linux kernel' case "$(uname -r)" in diff --git a/tests/scm_rights-fd.test b/tests/scm_rights-fd.test index 5a847dac..ecf44750 100755 --- a/tests/scm_rights-fd.test +++ b/tests/scm_rights-fd.test @@ -9,7 +9,6 @@ framework_skip_ '/proc/self/fd/ is not available' check_prog grep -check_prog rm rm -f $LOG.* diff --git a/tests/stat.test b/tests/stat.test index 4176df0e..5c2a5780 100755 --- a/tests/stat.test +++ b/tests/stat.test @@ -7,7 +7,6 @@ check_prog dd check_prog find check_prog grep -check_prog rm umask 022 truncate_cmd='dd seek=46118400000 obs=1 count=0 if=/dev/null of=sample' diff --git a/tests/uio.test b/tests/uio.test index 313761f5..0e8b3155 100755 --- a/tests/uio.test +++ b/tests/uio.test @@ -5,7 +5,6 @@ . "${srcdir=.}/init.sh" check_prog grep -check_prog rm ./uio || { if [ $? -eq 77 ]; then