From caddc46054b720bd88757b0c15de1d305216fa77 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 17 Oct 2009 22:42:56 -0700 Subject: tests: fix issues with non-portable shell constructs At least these tests all run with dash now, but ksh93 or bash is still recommended for pipefail --- t/lib-graceful.sh | 1 - t/lib-input-trailer.sh | 1 - t/t1002-thread-pool-graceful.sh | 3 ++- t/t1101-thread-pool-input-trailer.sh | 3 ++- t/t2002-thread-spawn-graceful.sh | 3 ++- t/t2101-thread-spawn-input-trailer.sh | 3 ++- t/t3002-revactor-graceful.sh | 3 ++- t/t3101-revactor-rack-input-trailer.sh | 3 ++- t/t4002-rev-graceful.sh | 3 ++- t/t4101-rev-rack-input-trailer.sh | 3 ++- t/test-lib.sh | 13 ++++++++++++- 11 files changed, 28 insertions(+), 11 deletions(-) diff --git a/t/lib-graceful.sh b/t/lib-graceful.sh index 2403bd0..a40d3ae 100644 --- a/t/lib-graceful.sh +++ b/t/lib-graceful.sh @@ -1,4 +1,3 @@ -model=$1 . ./test-lib.sh echo "graceful test for model=$model" require_for_model diff --git a/t/lib-input-trailer.sh b/t/lib-input-trailer.sh index 4a946d4..1375aa7 100644 --- a/t/lib-input-trailer.sh +++ b/t/lib-input-trailer.sh @@ -1,4 +1,3 @@ -model=$1 . ./test-lib.sh test -r random_blob || die "random_blob required, run with 'make $0'" echo "input trailer test model=$model" diff --git a/t/t1002-thread-pool-graceful.sh b/t/t1002-thread-pool-graceful.sh index c5d1f87..12eb210 100755 --- a/t/t1002-thread-pool-graceful.sh +++ b/t/t1002-thread-pool-graceful.sh @@ -1,2 +1,3 @@ #!/bin/sh -. ./lib-graceful.sh ThreadPool +model=ThreadPool +. ./lib-graceful.sh diff --git a/t/t1101-thread-pool-input-trailer.sh b/t/t1101-thread-pool-input-trailer.sh index ba9ef9d..59d5dc5 100755 --- a/t/t1101-thread-pool-input-trailer.sh +++ b/t/t1101-thread-pool-input-trailer.sh @@ -1,2 +1,3 @@ #!/bin/sh -. ./lib-input-trailer.sh ThreadPool +model=ThreadPool +. ./lib-input-trailer.sh diff --git a/t/t2002-thread-spawn-graceful.sh b/t/t2002-thread-spawn-graceful.sh index b263306..6cb373c 100755 --- a/t/t2002-thread-spawn-graceful.sh +++ b/t/t2002-thread-spawn-graceful.sh @@ -1,2 +1,3 @@ #!/bin/sh -. ./lib-graceful.sh ThreadSpawn +model=ThreadSpawn +. ./lib-graceful.sh diff --git a/t/t2101-thread-spawn-input-trailer.sh b/t/t2101-thread-spawn-input-trailer.sh index 6839a22..80b4e2c 100755 --- a/t/t2101-thread-spawn-input-trailer.sh +++ b/t/t2101-thread-spawn-input-trailer.sh @@ -1,2 +1,3 @@ #!/bin/sh -. ./lib-input-trailer.sh ThreadSpawn +model=ThreadSpawn +. ./lib-input-trailer.sh diff --git a/t/t3002-revactor-graceful.sh b/t/t3002-revactor-graceful.sh index 8696e06..4739f4a 100755 --- a/t/t3002-revactor-graceful.sh +++ b/t/t3002-revactor-graceful.sh @@ -1,2 +1,3 @@ #!/bin/sh -. ./lib-graceful.sh Revactor +model=Revactor +. ./lib-graceful.sh diff --git a/t/t3101-revactor-rack-input-trailer.sh b/t/t3101-revactor-rack-input-trailer.sh index 1da9820..3d19931 100755 --- a/t/t3101-revactor-rack-input-trailer.sh +++ b/t/t3101-revactor-rack-input-trailer.sh @@ -1,2 +1,3 @@ #!/bin/sh -. ./lib-input-trailer.sh Revactor +model=Revactor +. ./lib-input-trailer.sh diff --git a/t/t4002-rev-graceful.sh b/t/t4002-rev-graceful.sh index 788bc6b..650abc1 100755 --- a/t/t4002-rev-graceful.sh +++ b/t/t4002-rev-graceful.sh @@ -1,2 +1,3 @@ #!/bin/sh -. ./lib-graceful.sh Rev +model=Rev +. ./lib-graceful.sh diff --git a/t/t4101-rev-rack-input-trailer.sh b/t/t4101-rev-rack-input-trailer.sh index d360e53..ccf270a 100755 --- a/t/t4101-rev-rack-input-trailer.sh +++ b/t/t4101-rev-rack-input-trailer.sh @@ -1,2 +1,3 @@ #!/bin/sh -. ./lib-input-trailer.sh Rev +model=Rev +. ./lib-input-trailer.sh diff --git a/t/test-lib.sh b/t/test-lib.sh index 29b57f7..5b9a90a 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1,7 +1,18 @@ #!/bin/sh # Copyright (c) 2009 Rainbows! developers -set -o pipefail >/dev/null 2>&1 || : # non-POSIX, but useful in ksh/bash +# pipefail is non-POSIX, but useful in ksh/bash +( + set +e + set -o pipefail +) +if test $? -eq 0 +then + set -o pipefail +else + echo >&2 "WARNING: your shell does not understand pipefail" +fi + set -e set -u T=$(basename $0) -- cgit v1.2.3-24-ge0c7