[PATCH] fwts-test: arg-show-tests-0001: reset tty after forcing column width
Colin King
colin.king at canonical.com
Mon May 16 08:30:00 UTC 2016
From: Colin Ian King <colin.king at canonical.com>
We should only run this test if we can reset the width to 80 colummns
and we need to reset the tty width back at the end of the test
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
fwts-test/arg-show-tests-0001/test-0001.sh | 14 +++++++++++++-
fwts-test/arg-show-tests-0001/test-0002.sh | 14 +++++++++++++-
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/fwts-test/arg-show-tests-0001/test-0001.sh b/fwts-test/arg-show-tests-0001/test-0001.sh
index 537af53..a62071c 100755
--- a/fwts-test/arg-show-tests-0001/test-0001.sh
+++ b/fwts-test/arg-show-tests-0001/test-0001.sh
@@ -13,7 +13,16 @@ if [ $? -eq 1 ]; then
exit 77
fi
-stty cols 80
+cols=$(stty -a | tr ';' '\n' | grep "columns" | cut -d' ' -f3) 2> /dev/null
+#
+# If we can't set the tty then we can't test
+#
+stty cols 80 2> /dev/null
+if [ $? -eq 1 ]; then
+ tset 2> /dev/null
+ echo SKIP: $TEST, $NAME
+ exit 77
+fi
$FWTS -s > $TMPLOG
diff $TMPLOG $FWTSTESTDIR/arg-show-tests-0001/arg-show-tests-0001.log >> $FAILURE_LOG
ret=$?
@@ -23,5 +32,8 @@ else
echo FAILED: $TEST, $NAME
fi
+stty cols 80 2> /dev/null
+tset 2> /dev/null
+
rm $TMPLOG
exit $ret
diff --git a/fwts-test/arg-show-tests-0001/test-0002.sh b/fwts-test/arg-show-tests-0001/test-0002.sh
index 2382b4c..f92fd8f 100755
--- a/fwts-test/arg-show-tests-0001/test-0002.sh
+++ b/fwts-test/arg-show-tests-0001/test-0002.sh
@@ -13,7 +13,16 @@ if [ $? -eq 1 ]; then
exit 77
fi
-stty cols 80
+cols=$(stty -a | tr ';' '\n' | grep "columns" | cut -d' ' -f3) 2> /dev/null
+#
+# If we can't set the tty then we can't test
+#
+stty cols 80 2> /dev/null
+if [ $? -eq 1 ]; then
+ tset 2> /dev/null
+ echo SKIP: $TEST, $NAME
+ exit 77
+fi
$FWTS -s > $TMPLOG
diff $TMPLOG $FWTSTESTDIR/arg-show-tests-0001/arg-show-tests-0001.log >> $FAILURE_LOG
ret=$?
@@ -23,5 +32,8 @@ else
echo FAILED: $TEST, $NAME
fi
+stty cols 80 2> /dev/null
+tset 2> /dev/null
+
rm $TMPLOG
exit $ret
--
2.8.1
More information about the fwts-devel
mailing list