From 627954483683885bd4e9b2b9dd759b5997b9a64f Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Mon, 16 May 2016 09:28:37 +0100 Subject: [PATCH 2/2] fwts-test: arg-show-tests-0001: reset tty after forcing column width 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 --- 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