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>
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