Jim Meyering wrote: > That fix was not enough, and even had a typo. > With these further changes, I've now confirmed that those two > tests are indeed skipped on Solaris 10, which also lacks those > definitions. > ... >>From e500079a186434daeba99a1ea115690715fd56eb Mon Sep 17 00:00:00 2001 > From: Jim Meyering <meyer...@redhat.com> > Date: Sat, 12 Nov 2011 16:48:09 +0100 > Subject: [PATCH 2/2] 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. > --- > ChangeLog | 7 +++++++ > tests/test-exclude2.sh | 28 ++++++++++++++++++---------- > tests/test-exclude5.sh | 28 ++++++++++++++++++----------
That worked around the unwarranted test failures. This revamps the other very similar test-exclude?.sh scripts. Strangely, my next-to-last sanity-check test succeeded: ./gnulib-tool --create-testdir --with-tests --test exclude even though I hadn't listed tests/init.sh in the modules file. I've gone ahead and added it anyway. >From 293ba0481af81e296d922434983ebb23e79518e3 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 12 Nov 2011 17:12:59 +0100 Subject: [PATCH] revamp the other test-exclude?.sh scripts to use init.sh, too * tests/test-exclude1.sh: Use init.sh. * tests/test-exclude2.sh: Likewise. * tests/test-exclude3.sh: Likewise. * tests/test-exclude4.sh: Likewise. * tests/test-exclude5.sh: Likewise. * tests/test-exclude6.sh: Likewise. * tests/test-exclude7.sh: Likewise. * tests/test-exclude8.sh: Likewise. * modules/exclude-tests (Files): List init.sh. --- ChangeLog | 11 +++++++++++ modules/exclude-tests | 1 + tests/test-exclude1.sh | 25 +++++++++++++++---------- tests/test-exclude2.sh | 7 ++----- tests/test-exclude3.sh | 25 +++++++++++++++---------- tests/test-exclude4.sh | 25 +++++++++++++++---------- tests/test-exclude5.sh | 7 ++----- tests/test-exclude6.sh | 25 +++++++++++++++---------- tests/test-exclude7.sh | 27 +++++++++++++++------------ tests/test-exclude8.sh | 24 +++++++++++++++--------- 10 files changed, 106 insertions(+), 71 deletions(-) diff --git a/ChangeLog b/ChangeLog index d265d75..2794c4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-11-12 Jim Meyering <meyer...@redhat.com> + revamp the other test-exclude?.sh scripts to use init.sh, too + * tests/test-exclude1.sh: Use init.sh. + * tests/test-exclude2.sh: Likewise. + * tests/test-exclude3.sh: Likewise. + * tests/test-exclude4.sh: Likewise. + * tests/test-exclude5.sh: Likewise. + * tests/test-exclude6.sh: Likewise. + * tests/test-exclude7.sh: Likewise. + * tests/test-exclude8.sh: Likewise. + * modules/exclude-tests (Files): List init.sh. + 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. diff --git a/modules/exclude-tests b/modules/exclude-tests index 3dd0225..072a4e6 100644 --- a/modules/exclude-tests +++ b/modules/exclude-tests @@ -1,4 +1,5 @@ Files: +tests/init.sh tests/test-exclude.c tests/test-exclude1.sh tests/test-exclude2.sh diff --git a/tests/test-exclude1.sh b/tests/test-exclude1.sh index 9c5f709..d85c4c7 100755 --- a/tests/test-exclude1.sh +++ b/tests/test-exclude1.sh @@ -16,19 +16,18 @@ # 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 literal matches -cat > $LIST <<EOT +cat > in <<EOT foo* bar Baz EOT -cat > $TMP <<EOT +cat > expected <<EOT foo: 0 foo*: 1 bar: 1 @@ -37,9 +36,15 @@ baz: 0 bar/qux: 0 EOT -./test-exclude$EXEEXT $LIST -- foo 'foo*' bar foobar baz bar/qux | - tr -d '\015' | - diff -c $TMP - || ERR=1 +test-exclude in -- foo 'foo*' bar foobar baz bar/qux > out || exit $? -rm -f $TMP $LIST -exit $ERR +# 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 + +# normalize output +LC_ALL=C tr -d "$cr" < out > k && mv k out + +compare expected out || fail=1 + +Exit $fail diff --git a/tests/test-exclude2.sh b/tests/test-exclude2.sh index b38bb7f..33ee734 100755 --- a/tests/test-exclude2.sh +++ b/tests/test-exclude2.sh @@ -17,7 +17,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . - fail=0 cat > in <<EOT @@ -37,16 +36,14 @@ baz: 1 bar/qux: 0 EOT -test-exclude -casefold in -- foo 'foo*' bar foobar baz bar/qux > out \ - || exit $? +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 # normalize output -LC_ALL=C tr -d "$cr" < out > k -mv k out +LC_ALL=C tr -d "$cr" < out > k && mv k out compare expected out || fail=1 diff --git a/tests/test-exclude3.sh b/tests/test-exclude3.sh index 6b8512e..a9a4d23 100755 --- a/tests/test-exclude3.sh +++ b/tests/test-exclude3.sh @@ -16,19 +16,18 @@ # 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 include -cat > $LIST <<EOT +cat > in <<EOT foo* bar Baz EOT -cat > $TMP <<EOT +cat > expected <<EOT foo: 1 foo*: 0 bar: 0 @@ -37,9 +36,15 @@ baz: 1 bar/qux: 1 EOT -./test-exclude$EXEEXT -include $LIST -- foo 'foo*' bar foobar baz bar/qux | - tr -d '\015' | - diff -c $TMP - || ERR=1 +test-exclude -include in -- foo 'foo*' bar foobar baz bar/qux > out || exit $? -rm -f $TMP $LIST -exit $ERR +# 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 + +# normalize output +LC_ALL=C tr -d "$cr" < out > k && mv k out + +compare expected out || fail=1 + +Exit $fail diff --git a/tests/test-exclude4.sh b/tests/test-exclude4.sh index 99c4c9f..b3ecdae 100755 --- a/tests/test-exclude4.sh +++ b/tests/test-exclude4.sh @@ -16,25 +16,30 @@ # 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 wildcard matching -cat > $LIST <<EOT +cat > in <<EOT foo* bar Baz EOT -cat > $TMP <<EOT +cat > expected <<EOT foobar: 1 EOT -./test-exclude$EXEEXT -wildcards $LIST -- foobar | - tr -d '\015' | - diff -c $TMP - || ERR=1 +test-exclude -wildcards in -- foobar > out || exit $? -rm -f $TMP $LIST -exit $ERR +# 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 + +# normalize output +LC_ALL=C tr -d "$cr" < out > k && mv k out + +compare expected out || fail=1 + +Exit $fail diff --git a/tests/test-exclude5.sh b/tests/test-exclude5.sh index 3257963..d9558f7 100755 --- a/tests/test-exclude5.sh +++ b/tests/test-exclude5.sh @@ -17,7 +17,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ . - fail=0 # Test FNM_LEADING_DIR @@ -35,16 +34,14 @@ barz: 0 foo/bar: 1 EOT -test-exclude -leading_dir in -- bar bar/qux barz foo/bar > out \ - || exit $? +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 # normalize output -LC_ALL=C tr -d "$cr" < out > k -mv k out +LC_ALL=C tr -d "$cr" < out > k && mv k out compare expected out || fail=1 diff --git a/tests/test-exclude6.sh b/tests/test-exclude6.sh index eb4f5f1..b2093d6 100755 --- a/tests/test-exclude6.sh +++ b/tests/test-exclude6.sh @@ -16,26 +16,31 @@ # 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 anchored -cat > $LIST <<EOT +cat > in <<EOT foo* bar Baz EOT -cat > $TMP <<EOT +cat > expected <<EOT bar: 1 foo/bar: 0 EOT -./test-exclude$EXEEXT -anchored $LIST -- bar foo/bar | - tr -d '\015' | - diff -c $TMP - || ERR=1 +test-exclude -anchored in -- bar foo/bar > out || exit $? -rm -f $TMP $LIST -exit $ERR +# 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 + +# normalize output +LC_ALL=C tr -d "$cr" < out > k && mv k out + +compare expected out || fail=1 + +Exit $fail diff --git a/tests/test-exclude7.sh b/tests/test-exclude7.sh index 03ed2a6..f75b814 100755 --- a/tests/test-exclude7.sh +++ b/tests/test-exclude7.sh @@ -16,29 +16,32 @@ # 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 exclude precedence -cat > $LIST <<EOT +cat > in <<EOT foo* bar Baz EOT -cat > $TMP <<EOT +cat > expected <<EOT bar: 1 bar: 0 EOT -./test-exclude$EXEEXT $LIST -include $LIST -- bar | - tr -d '\015' >$TMP.1 -./test-exclude$EXEEXT -include $LIST -no-include $LIST -- bar | - tr -d '\015' >>$TMP.1 +test-exclude in -include in -- bar > out || exit $? +test-exclude -include in -no-include in -- bar >> out || exit $? -diff -c $TMP $TMP.1 || ERR=1 +# 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 $TMP.1 $LIST -exit $ERR +# normalize output +LC_ALL=C tr -d "$cr" < out > k && mv k out + +compare expected out || fail=1 + +Exit $fail diff --git a/tests/test-exclude8.sh b/tests/test-exclude8.sh index 9592070..b1b010e 100755 --- a/tests/test-exclude8.sh +++ b/tests/test-exclude8.sh @@ -16,25 +16,31 @@ # 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 escaped metacharacters. -cat > $LIST <<'EOT' +cat > in <<'EOT' f\*e b[a\*]r EOT -cat > $TMP <<'EOT' +cat > expected <<'EOT' f*e: 1 file: 0 bar: 1 EOT -./test-exclude$EXEEXT -wildcards $LIST -- 'f*e' 'file' 'bar' | - tr -d '\015' | diff -c $TMP - || ERR=1 +test-exclude -wildcards in -- 'f*e' 'file' 'bar' > out || exit $? -rm -f $TMP $LIST -exit $ERR +# 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 + +# normalize output +LC_ALL=C tr -d "$cr" < out > k && mv k out + +compare expected out || fail=1 + +Exit $fail -- 1.7.8.rc0.61.g8a042