From 3a5af445e2a3af83cd2e7e68b2d4c0d1dc8079b5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 17 Oct 2009 22:42:56 -0700 Subject: tests: DRY setting of the "model" environment var --- t/t1002-thread-pool-graceful.sh | 1 - t/t1101-thread-pool-input-trailer.sh | 1 - t/t2002-thread-spawn-graceful.sh | 1 - t/t2101-thread-spawn-input-trailer.sh | 1 - t/t3002-revactor-graceful.sh | 1 - t/t3101-revactor-rack-input-trailer.sh | 1 - t/t4002-rev-graceful.sh | 1 - t/t4003-rev-parser-error.sh | 1 - t/t4101-rev-rack-input-trailer.sh | 1 - t/test-lib.sh | 13 ++++++++++++- 10 files changed, 12 insertions(+), 10 deletions(-) diff --git a/t/t1002-thread-pool-graceful.sh b/t/t1002-thread-pool-graceful.sh index 12eb210..e3c266b 100755 --- a/t/t1002-thread-pool-graceful.sh +++ b/t/t1002-thread-pool-graceful.sh @@ -1,3 +1,2 @@ #!/bin/sh -model=ThreadPool . ./lib-graceful.sh diff --git a/t/t1101-thread-pool-input-trailer.sh b/t/t1101-thread-pool-input-trailer.sh index 59d5dc5..e297cc9 100755 --- a/t/t1101-thread-pool-input-trailer.sh +++ b/t/t1101-thread-pool-input-trailer.sh @@ -1,3 +1,2 @@ #!/bin/sh -model=ThreadPool . ./lib-input-trailer.sh diff --git a/t/t2002-thread-spawn-graceful.sh b/t/t2002-thread-spawn-graceful.sh index 6cb373c..e3c266b 100755 --- a/t/t2002-thread-spawn-graceful.sh +++ b/t/t2002-thread-spawn-graceful.sh @@ -1,3 +1,2 @@ #!/bin/sh -model=ThreadSpawn . ./lib-graceful.sh diff --git a/t/t2101-thread-spawn-input-trailer.sh b/t/t2101-thread-spawn-input-trailer.sh index 80b4e2c..e297cc9 100755 --- a/t/t2101-thread-spawn-input-trailer.sh +++ b/t/t2101-thread-spawn-input-trailer.sh @@ -1,3 +1,2 @@ #!/bin/sh -model=ThreadSpawn . ./lib-input-trailer.sh diff --git a/t/t3002-revactor-graceful.sh b/t/t3002-revactor-graceful.sh index 4739f4a..e3c266b 100755 --- a/t/t3002-revactor-graceful.sh +++ b/t/t3002-revactor-graceful.sh @@ -1,3 +1,2 @@ #!/bin/sh -model=Revactor . ./lib-graceful.sh diff --git a/t/t3101-revactor-rack-input-trailer.sh b/t/t3101-revactor-rack-input-trailer.sh index 3d19931..e297cc9 100755 --- a/t/t3101-revactor-rack-input-trailer.sh +++ b/t/t3101-revactor-rack-input-trailer.sh @@ -1,3 +1,2 @@ #!/bin/sh -model=Revactor . ./lib-input-trailer.sh diff --git a/t/t4002-rev-graceful.sh b/t/t4002-rev-graceful.sh index 650abc1..e3c266b 100755 --- a/t/t4002-rev-graceful.sh +++ b/t/t4002-rev-graceful.sh @@ -1,3 +1,2 @@ #!/bin/sh -model=Rev . ./lib-graceful.sh diff --git a/t/t4003-rev-parser-error.sh b/t/t4003-rev-parser-error.sh index bcb129a..04df895 100755 --- a/t/t4003-rev-parser-error.sh +++ b/t/t4003-rev-parser-error.sh @@ -1,3 +1,2 @@ #!/bin/sh -model=Rev . ./lib-parser-error.sh diff --git a/t/t4101-rev-rack-input-trailer.sh b/t/t4101-rev-rack-input-trailer.sh index ccf270a..e297cc9 100755 --- a/t/t4101-rev-rack-input-trailer.sh +++ b/t/t4101-rev-rack-input-trailer.sh @@ -1,3 +1,2 @@ #!/bin/sh -model=Rev . ./lib-input-trailer.sh diff --git a/t/test-lib.sh b/t/test-lib.sh index 5b9a90a..687ad3f 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -14,8 +14,19 @@ else fi set -e -set -u + T=$(basename $0) +if test -z "$model" +then + case $T in + t1???-thread-pool-*.sh) model=ThreadPool ;; + t2???-thread-spawn-*.sh) model=ThreadSpawn ;; + t3???-revactor-*.sh) model=Revactor ;; + t4???-rev-*.sh) model=Rev ;; + esac +fi + +set -u ruby="${ruby-ruby}" # ensure a sane environment -- cgit v1.2.3-24-ge0c7