diff mbox

fwts-test: arg-show-tests-0001: reset tty after forcing column width

Message ID 1463387400-23774-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King May 16, 2016, 8:30 a.m. UTC
From: Colin Ian King <colin.king@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@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(-)

Comments

Alex Hung May 16, 2016, 8:44 a.m. UTC | #1
On 05/16/2016 04:30 PM, Colin King wrote:
> From: Colin Ian King <colin.king@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@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
>

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu May 17, 2016, 7:54 a.m. UTC | #2
On 05/16/2016 04:30 PM, Colin King wrote:
> From: Colin Ian King <colin.king@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@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
Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox

Patch

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