From f5687ec1479c5c6760dc3b14f442b348c8cbdfa6 Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Thu, 10 Feb 2005 03:46:56 +0000 Subject: [PATCH] * testsuite/config-sub.sh (run_config_sub): New function. Compute $rc within the function and return it. * testsuite/config-guess.sh (run_config_guess): Likewise. --- ChangeLog | 6 +++++ testsuite/config-guess.sh | 55 +++++++++++++++++++++------------------ testsuite/config-sub.sh | 39 +++++++++++++++------------ 3 files changed, 59 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99f2561..fbf3b37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-02-10 Ben Elliston + + * testsuite/config-sub.sh (run_config_sub): New function. Compute + $rc within the function and return it. + * testsuite/config-guess.sh (run_config_guess): Likewise. + 2005-02-10 Ben Elliston * config.guess (amd64:CYGWIN*:*:*): New. diff --git a/testsuite/config-guess.sh b/testsuite/config-guess.sh index 719f750..3f51030 100644 --- a/testsuite/config-guess.sh +++ b/testsuite/config-guess.sh @@ -1,38 +1,43 @@ #!/bin/sh # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2004, 2005 Free Software Foundation, Inc. # Contributed by Ben Elliston . # -# This test reads 5-tuples from config-guess.data: the components of the simulated -# uname(1) output and the expected GNU system triplet. +# This test reads 5-tuples from config-guess.data: the components of +# the simulated uname(1) output and the expected GNU system triplet. verbose=false -rc=0 export PATH=`pwd`:$PATH IFS=" " # tab -sed 's/ */ /g' < config-guess.data | - while read machine release system version triplet ; do - sed \ - -e "s,@MACHINE@,$machine," \ - -e "s,@RELEASE@,$release," \ - -e "s,@SYSTEM@,$system," \ - -e "s,@VERSION@,$version," < uname.in > uname - chmod +x uname - output=`sh ../config.guess 2>/dev/null` - if test $? != 0 ; then - echo "FAIL: unable to guess $machine:$release:$system:$version" - rc=1 - continue - fi - if test $output != $triplet ; then - echo "FAIL: $output (expected $triplet)" - rc=1 - continue - fi - $verbose && echo "PASS: $triplet" -done +function run_config_guess () +{ + rc=0 + while read machine release system version triplet ; do + sed \ + -e "s,@MACHINE@,$machine," \ + -e "s,@RELEASE@,$release," \ + -e "s,@SYSTEM@,$system," \ + -e "s,@VERSION@,$version," < uname.in > uname + chmod +x uname + output=`sh ../config.guess 2>/dev/null` + if test $? != 0 ; then + echo "FAIL: unable to guess $machine:$release:$system:$version" + rc=1 + continue + fi + if test $output != $triplet ; then + echo "FAIL: $output (expected $triplet)" + rc=1 + continue + fi + $verbose && echo "PASS: $triplet" + done + return $rc +} +sed 's/ */ /g' < config-guess.data | run_config_guess +rc=$? if test $rc -eq 0 ; then $verbose || echo "PASS: config.guess checks" else diff --git a/testsuite/config-sub.sh b/testsuite/config-sub.sh index 7b3b666..03b6420 100644 --- a/testsuite/config-sub.sh +++ b/testsuite/config-sub.sh @@ -1,28 +1,35 @@ #!/bin/sh # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2004, 2005 Free Software Foundation, Inc. # Contributed by Ben Elliston . # -# This test reads pairs from config-sub.data: an alias and its canonical triplet. -# The config.sub scripts is invoked and the test checks that the alias expands to the -# expected canonical triplet. +# This test reads pairs from config-sub.data: an alias and its +# canonical triplet. The config.sub scripts is invoked and the test +# checks that the alias expands to the expected canonical triplet. verbose=false -rc=0 -while read alias canonical ; do - output=`sh ../config.sub $alias` - if test $output != $canonical ; then - echo "FAIL: $alias -> $output, but expected $canonical" - rc=1 - else - $verbose && echo "PASS: $alias" - fi -done < config-sub.data +function run_config_sub () +{ + rc=0 + while read alias canonical ; do + output=`sh ../config.sub $alias` + if test $output != $canonical ; then + echo "FAIL: $alias -> $output, but expected $canonical" + rc=1 + else + $verbose && echo "PASS: $alias" + fi + done < config-sub.data + return $rc +} + +run_config_sub +rc=$? if test $rc -eq 0 ; then - $verbose || echo "PASS: config.sub checks" + $verbose || echo "PASS: config.sub checks" else - test $rc -eq 1 && echo "Unexpected failures." + test $rc -eq 1 && echo "Unexpected failures." fi exit $rc