Mercurial > hg > octave-nkf > gnulib-hg
changeset 16080:c1ab9249172f
test-exclude2.sh, test-exclude5.sh: fail if test-exclude fails
These shell scripts ignored failure of the binary test-exclude,
so making the latter return 77 didn't cause them to be skipped.
* tests/test-exclude5.sh: Exit with test-exclude's error status
when that program fails. Revamp to use init.sh.
* tests/test-exclude2.sh: Likewise.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Sat, 12 Nov 2011 16:48:09 +0100 |
parents | 8f032b981dec |
children | ab4fc7286686 |
files | ChangeLog tests/test-exclude2.sh tests/test-exclude5.sh |
diffstat | 3 files changed, 43 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-11-12 Jim Meyering <meyering@redhat.com> + test-exclude2.sh, test-exclude5.sh: fail if test-exclude fails + These shell scripts ignored failure of the binary test-exclude, + so making the latter return 77 didn't cause them to be skipped. + * tests/test-exclude5.sh: Exit with test-exclude's error status + when that program fails. Revamp to use init.sh. + * tests/test-exclude2.sh: Likewise. + test-exclude: fix a typo * tests/test-exclude.c (main): Test for "leading_dir", not "leading-dir".
--- a/tests/test-exclude2.sh +++ b/tests/test-exclude2.sh @@ -16,11 +16,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -TMP=excltmp.$$ -LIST=flist.$$ -ERR=0 +. "${srcdir=.}/init.sh"; path_prepend_ . -cat > $LIST <<EOT +fail=0 + +cat > in <<EOT foo* bar Baz @@ -28,7 +28,7 @@ # Test case-insensitive literal matches -cat > $TMP <<EOT +cat > expected <<EOT foo: 0 foo*: 1 bar: 1 @@ -37,9 +37,17 @@ bar/qux: 0 EOT -./test-exclude$EXEEXT -casefold $LIST -- foo 'foo*' bar foobar baz bar/qux | - tr -d '\015' | - diff -c $TMP - || ERR=1 +test-exclude -casefold in -- foo 'foo*' bar foobar baz bar/qux > out \ + || exit $? + +# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr +# does not understand '\r'. +case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac -rm -f $TMP $LIST -exit $ERR +# normalize output +LC_ALL=C tr -d "$cr" < out > k +mv k out + +compare expected out || fail=1 + +Exit $fail
--- a/tests/test-exclude5.sh +++ b/tests/test-exclude5.sh @@ -16,28 +16,36 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -TMP=excltmp.$$ -LIST=flist.$$ -ERR=0 +. "${srcdir=.}/init.sh"; path_prepend_ . + +fail=0 # Test FNM_LEADING_DIR -cat > $LIST <<EOT +cat > in <<EOT foo* bar Baz EOT -cat > $TMP <<EOT +cat > expected <<EOT bar: 1 bar/qux: 1 barz: 0 foo/bar: 1 EOT -./test-exclude$EXEEXT -leading_dir $LIST -- bar bar/qux barz foo/bar | - tr -d '\015' | - diff -c $TMP - || ERR=1 +test-exclude -leading_dir in -- bar bar/qux barz foo/bar > out \ + || exit $? + +# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr +# does not understand '\r'. +case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac -rm -f $TMP $LIST -exit $ERR +# normalize output +LC_ALL=C tr -d "$cr" < out > k +mv k out + +compare expected out || fail=1 + +Exit $fail