aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Hart <dvhltc@us.ibm.com>2009-11-17 15:57:18 -0800
committerDarren Hart <dvhltc@us.ibm.com>2009-11-17 15:57:18 -0800
commit75d24c0f07ffc1827b46e276fd585b678bd1eb01 (patch)
tree9e31cf0a65cb53d02f5939ab6545380023a90fc6
parentf26619a0decd0b2241d792dcda00eb8f2db4581d (diff)
downloadfutextest-75d24c0f07ffc1827b46e276fd585b678bd1eb01.tar.gz
Use binary variable in bash to pass USE_COLOR to subdir run.sh scripts
Bash doesn't distinguish between unset variables and zero-length strings. Use a binary variable USE_COLOR to pass color test results instead. Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
-rwxr-xr-xfunctional/run.sh13
-rwxr-xr-xperformance/run.sh13
-rwxr-xr-xrun.sh7
-rwxr-xr-xstress/run.sh12
4 files changed, 42 insertions, 3 deletions
diff --git a/functional/run.sh b/functional/run.sh
index d377c5f..959b389 100755
--- a/functional/run.sh
+++ b/functional/run.sh
@@ -32,6 +32,19 @@
#
###############################################################################
+# Test for a color capable console
+if [ -z "$USE_COLOR" ]; then
+ tput setf 7
+ if [ $? -eq 0 ]; then
+ USE_COLOR=1
+ tput sgr0
+ fi
+fi
+if [ "$USE_COLOR" -eq 1 ]; then
+ COLOR="-c"
+fi
+
+
echo
# requeue pi testing
# without timeouts
diff --git a/performance/run.sh b/performance/run.sh
index 655fc39..c5acf10 100755
--- a/performance/run.sh
+++ b/performance/run.sh
@@ -32,4 +32,17 @@
#
###############################################################################
+# Test for a color capable console
+if [ -z "$USE_COLOR" ]; then
+ tput setf 7
+ if [ $? -eq 0 ]; then
+ USE_COLOR=1
+ tput sgr0
+ fi
+fi
+if [ "$USE_COLOR" -eq 1 ]; then
+ COLOR="-c"
+fi
+
+
exit 0
diff --git a/run.sh b/run.sh
index a85f821..553d234 100755
--- a/run.sh
+++ b/run.sh
@@ -33,13 +33,14 @@
#
###############################################################################
-COLOR=""
+# Test for a color capable shell and pass the result to the subdir scripts
+USE_COLOR=0
tput setf 7
if [ $? -eq 0 ]; then
- COLOR="-c"
+ USE_COLOR=1
tput sgr0
fi
-export COLOR
+export USE_COLOR
(cd functional; ./run.sh)
(cd performance; ./run.sh)
diff --git a/stress/run.sh b/stress/run.sh
index 655fc39..fb4317b 100755
--- a/stress/run.sh
+++ b/stress/run.sh
@@ -32,4 +32,16 @@
#
###############################################################################
+# Test for a color capable console
+if [ -z "$USE_COLOR" ]; then
+ tput setf 7
+ if [ $? -eq 0 ]; then
+ USE_COLOR=1
+ tput sgr0
+ fi
+fi
+if [ "$USE_COLOR" -eq 1 ]; then
+ COLOR="-c"
+fi
+
exit 0