I had already converted tests/test-xstrtol.sh. This continues the process with the other test-xstrto*.sh scripts as well as the atexit tests, even though that module is marked as obsolete.
>From 5c92acef552620a440dc134faf6d1f7fd14f825f Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Mon, 5 Apr 2010 16:12:55 +0200 Subject: [PATCH 1/4] atexit-tests: convert to use init.sh * modules/atexit-tests (Files): Add tests/init.sh. * tests/test-atexit.sh: Invoke "$srcdir/init.sh" and path_prepend_. Use Exit, not exit. Remove uses of $EXEEXT and "./" to run a program in the current dir. --- ChangeLog | 6 ++++++ modules/atexit-tests | 1 + tests/test-atexit.sh | 20 ++++++++------------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a42bbc..7160aa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -97,6 +97,12 @@ 2010-04-05 Jim Meyering <meyer...@redhat.com> + atexit-tests: convert to use init.sh + * modules/atexit-tests (Files): Add tests/init.sh. + * tests/test-atexit.sh: Invoke "$srcdir/init.sh" and path_prepend_. + Use Exit, not exit. + Remove uses of $EXEEXT and "./" to run a program in the current dir. + init.sh: fix typo * tests/init.sh: Restore omitted ":" before stderr_fileno_ initialization. diff --git a/modules/atexit-tests b/modules/atexit-tests index 82d6ae4..1d1f0d0 100644 --- a/modules/atexit-tests +++ b/modules/atexit-tests @@ -1,4 +1,5 @@ Files: +tests/init.sh tests/signature.h tests/test-atexit.sh tests/test-atexit.c diff --git a/tests/test-atexit.sh b/tests/test-atexit.sh index 49c7729..05f23eb 100755 --- a/tests/test-atexit.sh +++ b/tests/test-atexit.sh @@ -1,32 +1,28 @@ #!/bin/sh +: ${srcdir=.} +. "$srcdir/init.sh"; path_prepend_ . -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles="$tmpfiles t-atexit.tmp" # Check that an atexit handler is called when main() returns normally. echo > t-atexit.tmp -./test-atexit${EXEEXT} +test-atexit if test -f t-atexit.tmp; then - exit 1 + Exit 1 fi # Check that an atexit handler is called when the program is left # through exit(0). echo > t-atexit.tmp -./test-atexit${EXEEXT} 0 +test-atexit 0 if test -f t-atexit.tmp; then - exit 1 + Exit 1 fi # Check that an atexit handler is called when the program is left # through exit(1). echo > t-atexit.tmp -./test-atexit${EXEEXT} 1 +test-atexit 1 if test -f t-atexit.tmp; then - exit 1 + Exit 1 fi -rm -fr $tmpfiles - exit 0 -- 1.7.0.4.552.gc303 >From 0165705e67e7d536829336acc7eaac9601cef382 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Mon, 5 Apr 2010 16:32:41 +0200 Subject: [PATCH 2/4] xstrtol-tests: convert to use init.sh * modules/xstrtol-tests (Files): Add tests/init.sh. * tests/test-xstrtol.sh: Invoke "$srcdir/init.sh" and path_prepend_. Use Exit, not exit. Remove uses of $EXEEXT and "./" to run a program in the current dir. --- ChangeLog | 6 +++++ modules/xstrtol-tests | 1 + tests/test-xstrtol.sh | 55 ++++++++++++++++++++++-------------------------- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7160aa0..4fb322c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -97,6 +97,12 @@ 2010-04-05 Jim Meyering <meyer...@redhat.com> + xstrtol-tests: convert to use init.sh + * modules/xstrtol-tests (Files): Add tests/init.sh. + * tests/test-xstrtol.sh: Invoke "$srcdir/init.sh" and path_prepend_. + Use Exit, not exit. + Remove uses of $EXEEXT and "./" to run a program in the current dir. + atexit-tests: convert to use init.sh * modules/atexit-tests (Files): Add tests/init.sh. * tests/test-atexit.sh: Invoke "$srcdir/init.sh" and path_prepend_. diff --git a/modules/xstrtol-tests b/modules/xstrtol-tests index 664015b..1fa29ab 100644 --- a/modules/xstrtol-tests +++ b/modules/xstrtol-tests @@ -1,4 +1,5 @@ Files: +tests/init.sh tests/test-xstrtol.c tests/test-xstrtoul.c tests/test-xstrtol.sh diff --git a/tests/test-xstrtol.sh b/tests/test-xstrtol.sh index c56c675..1a2f7ca 100755 --- a/tests/test-xstrtol.sh +++ b/tests/test-xstrtol.sh @@ -1,35 +1,32 @@ #!/bin/sh +: ${srcdir=.} +. "$srcdir/init.sh"; path_prepend_ . -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles="t-xstrtol.tmp t-xstrtol.xo" -: > t-xstrtol.tmp too_big=99999999999999999999999999999999999999999999999999999999999999999999 result=0 # test xstrtol -./test-xstrtol${EXEEXT} 1 >> t-xstrtol.tmp 2>&1 || result=1 -./test-xstrtol${EXEEXT} -1 >> t-xstrtol.tmp 2>&1 || result=1 -./test-xstrtol${EXEEXT} 1k >> t-xstrtol.tmp 2>&1 || result=1 -./test-xstrtol${EXEEXT} ${too_big}h >> t-xstrtol.tmp 2>&1 && result=1 -./test-xstrtol${EXEEXT} $too_big >> t-xstrtol.tmp 2>&1 && result=1 -./test-xstrtol${EXEEXT} x >> t-xstrtol.tmp 2>&1 && result=1 -./test-xstrtol${EXEEXT} 9x >> t-xstrtol.tmp 2>&1 && result=1 -./test-xstrtol${EXEEXT} 010 >> t-xstrtol.tmp 2>&1 || result=1 +test-xstrtol 1 >> out 2>&1 || result=1 +test-xstrtol -1 >> out 2>&1 || result=1 +test-xstrtol 1k >> out 2>&1 || result=1 +test-xstrtol ${too_big}h >> out 2>&1 && result=1 +test-xstrtol $too_big >> out 2>&1 && result=1 +test-xstrtol x >> out 2>&1 && result=1 +test-xstrtol 9x >> out 2>&1 && result=1 +test-xstrtol 010 >> out 2>&1 || result=1 # suffix without integer is valid -./test-xstrtol${EXEEXT} MiB >> t-xstrtol.tmp 2>&1 || result=1 +test-xstrtol MiB >> out 2>&1 || result=1 # test xstrtoul -./test-xstrtoul${EXEEXT} 1 >> t-xstrtol.tmp 2>&1 || result=1 -./test-xstrtoul${EXEEXT} -1 >> t-xstrtol.tmp 2>&1 && result=1 -./test-xstrtoul${EXEEXT} 1k >> t-xstrtol.tmp 2>&1 || result=1 -./test-xstrtoul${EXEEXT} ${too_big}h >> t-xstrtol.tmp 2>&1 && result=1 -./test-xstrtoul${EXEEXT} $too_big >> t-xstrtol.tmp 2>&1 && result=1 -./test-xstrtoul${EXEEXT} x >> t-xstrtol.tmp 2>&1 && result=1 -./test-xstrtoul${EXEEXT} 9x >> t-xstrtol.tmp 2>&1 && result=1 -./test-xstrtoul${EXEEXT} 010 >> t-xstrtol.tmp 2>&1 || result=1 -./test-xstrtoul${EXEEXT} MiB >> t-xstrtol.tmp 2>&1 || result=1 +test-xstrtoul 1 >> out 2>&1 || result=1 +test-xstrtoul -1 >> out 2>&1 && result=1 +test-xstrtoul 1k >> out 2>&1 || result=1 +test-xstrtoul ${too_big}h >> out 2>&1 && result=1 +test-xstrtoul $too_big >> out 2>&1 && result=1 +test-xstrtoul x >> out 2>&1 && result=1 +test-xstrtoul 9x >> out 2>&1 && result=1 +test-xstrtoul 010 >> out 2>&1 || result=1 +test-xstrtoul MiB >> out 2>&1 || result=1 # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. @@ -40,11 +37,11 @@ else fi # normalize output -LC_ALL=C tr -d "$cr" < t-xstrtol.tmp > t-xstrtol.xo -mv t-xstrtol.xo t-xstrtol.tmp +LC_ALL=C tr -d "$cr" < out > k +mv k out # compare expected output -cat > t-xstrtol.xo <<EOF +cat > expected <<EOF 1->1 () -1->-1 () 1k->1024 () @@ -65,8 +62,6 @@ invalid suffix in X argument \`9x' MiB->1048576 () EOF -diff t-xstrtol.xo t-xstrtol.tmp || result=1 - -rm -fr $tmpfiles +compare expected out || result=1 -exit $result +Exit $result -- 1.7.0.4.552.gc303 >From 9c76fbeeb87c32677893b78bf89bdf29ce9eb199 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Mon, 5 Apr 2010 18:27:15 +0200 Subject: [PATCH 3/4] xstrtoimax-tests: convert to use init.sh * modules/xstrtoimax-tests (Files): Add tests/init.sh. * tests/test-xstrtoimax.sh: Invoke "$srcdir/init.sh" and path_prepend_. Use Exit, not exit. Remove uses of $EXEEXT and "./" to run a program in the current dir. --- ChangeLog | 8 ++++++++ modules/xstrtoimax-tests | 1 + tests/test-xstrtoimax.sh | 37 ++++++++++++++++--------------------- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4fb322c..3674d5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-04-05 Jim Meyering <meyer...@redhat.com> + + xstrtoimax-tests: convert to use init.sh + * modules/xstrtoimax-tests (Files): Add tests/init.sh. + * tests/test-xstrtoimax.sh: Invoke "$srcdir/init.sh" and path_prepend_. + Use Exit, not exit. + Remove uses of $EXEEXT and "./" to run a program in the current dir. + 2010-04-05 Bruno Haible <br...@clisp.org> sys_socket: Avoid #define replacements in C++ mode. diff --git a/modules/xstrtoimax-tests b/modules/xstrtoimax-tests index cf7acfd..ea8e1ba 100644 --- a/modules/xstrtoimax-tests +++ b/modules/xstrtoimax-tests @@ -1,4 +1,5 @@ Files: +tests/init.sh tests/test-xstrtoimax.c tests/test-xstrtoimax.sh diff --git a/tests/test-xstrtoimax.sh b/tests/test-xstrtoimax.sh index e6a5e5d..3e3b06c 100755 --- a/tests/test-xstrtoimax.sh +++ b/tests/test-xstrtoimax.sh @@ -1,23 +1,20 @@ #!/bin/sh +: ${srcdir=.} +. "$srcdir/init.sh"; path_prepend_ . -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles="t-xstrtoimax.tmp t-xstrtoimax.xo" -: > t-xstrtoimax.tmp too_big=99999999999999999999999999999999999999999999999999999999999999999999 result=0 # test xstrtoimax -./test-xstrtoimax${EXEEXT} 1 >> t-xstrtoimax.tmp 2>&1 || result=1 -./test-xstrtoimax${EXEEXT} -1 >> t-xstrtoimax.tmp 2>&1 || result=1 -./test-xstrtoimax${EXEEXT} 1k >> t-xstrtoimax.tmp 2>&1 || result=1 -./test-xstrtoimax${EXEEXT} ${too_big}h >> t-xstrtoimax.tmp 2>&1 && result=1 -./test-xstrtoimax${EXEEXT} $too_big >> t-xstrtoimax.tmp 2>&1 && result=1 -./test-xstrtoimax${EXEEXT} x >> t-xstrtoimax.tmp 2>&1 && result=1 -./test-xstrtoimax${EXEEXT} 9x >> t-xstrtoimax.tmp 2>&1 && result=1 -./test-xstrtoimax${EXEEXT} 010 >> t-xstrtoimax.tmp 2>&1 || result=1 -./test-xstrtoimax${EXEEXT} MiB >> t-xstrtoimax.tmp 2>&1 || result=1 +test-xstrtoimax 1 >> out 2>&1 || result=1 +test-xstrtoimax -1 >> out 2>&1 || result=1 +test-xstrtoimax 1k >> out 2>&1 || result=1 +test-xstrtoimax ${too_big}h >> out 2>&1 && result=1 +test-xstrtoimax $too_big >> out 2>&1 && result=1 +test-xstrtoimax x >> out 2>&1 && result=1 +test-xstrtoimax 9x >> out 2>&1 && result=1 +test-xstrtoimax 010 >> out 2>&1 || result=1 +test-xstrtoimax MiB >> out 2>&1 || result=1 # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. @@ -28,11 +25,11 @@ else fi # normalize output -LC_ALL=C tr -d "$cr" < t-xstrtoimax.tmp > t-xstrtoimax.xo -mv t-xstrtoimax.xo t-xstrtoimax.tmp +LC_ALL=C tr -d "$cr" < out > k +mv k out # compare expected output -cat > t-xstrtoimax.xo <<EOF +cat > exp <<EOF 1->1 () -1->-1 () 1k->1024 () @@ -44,8 +41,6 @@ invalid suffix in X argument \`9x' MiB->1048576 () EOF -diff t-xstrtoimax.xo t-xstrtoimax.tmp || result=1 - -rm -fr $tmpfiles +compare exp out || result=1 -exit $result +Exit $result -- 1.7.0.4.552.gc303 >From fb814d4cf9834324f0c05bcd04899003933933fa Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Mon, 5 Apr 2010 19:30:38 +0200 Subject: [PATCH 4/4] xstrtoumax-tests: convert to use init.sh * modules/xstrtoumax-tests (Files): Add tests/init.sh. * tests/test-xstrtoumax.sh: Invoke "$srcdir/init.sh" and path_prepend_. Use Exit, not exit. Remove uses of $EXEEXT and "./" to run a program in the current dir. --- ChangeLog | 6 ++++++ modules/xstrtoumax-tests | 1 + tests/test-xstrtoumax.sh | 37 ++++++++++++++++--------------------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3674d5a..60709b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-04-05 Jim Meyering <meyer...@redhat.com> + xstrtoumax-tests: convert to use init.sh + * modules/xstrtoumax-tests (Files): Add tests/init.sh. + * tests/test-xstrtoumax.sh: Invoke "$srcdir/init.sh" and path_prepend_. + Use Exit, not exit. + Remove uses of $EXEEXT and "./" to run a program in the current dir. + xstrtoimax-tests: convert to use init.sh * modules/xstrtoimax-tests (Files): Add tests/init.sh. * tests/test-xstrtoimax.sh: Invoke "$srcdir/init.sh" and path_prepend_. diff --git a/modules/xstrtoumax-tests b/modules/xstrtoumax-tests index 67b30c5..5d49c4b 100644 --- a/modules/xstrtoumax-tests +++ b/modules/xstrtoumax-tests @@ -1,4 +1,5 @@ Files: +tests/init.sh tests/test-xstrtoumax.c tests/test-xstrtoumax.sh diff --git a/tests/test-xstrtoumax.sh b/tests/test-xstrtoumax.sh index 12a7ba9..68abb93 100755 --- a/tests/test-xstrtoumax.sh +++ b/tests/test-xstrtoumax.sh @@ -1,23 +1,20 @@ #!/bin/sh +: ${srcdir=.} +. "$srcdir/init.sh"; path_prepend_ . -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles="t-xstrtoumax.tmp t-xstrtoumax.xo" -: > t-xstrtoumax.tmp too_big=99999999999999999999999999999999999999999999999999999999999999999999 result=0 # test xstrtoumax -./test-xstrtoumax${EXEEXT} 1 >> t-xstrtoumax.tmp 2>&1 || result=1 -./test-xstrtoumax${EXEEXT} -1 >> t-xstrtoumax.tmp 2>&1 && result=1 -./test-xstrtoumax${EXEEXT} 1k >> t-xstrtoumax.tmp 2>&1 || result=1 -./test-xstrtoumax${EXEEXT} ${too_big}h >> t-xstrtoumax.tmp 2>&1 && result=1 -./test-xstrtoumax${EXEEXT} $too_big >> t-xstrtoumax.tmp 2>&1 && result=1 -./test-xstrtoumax${EXEEXT} x >> t-xstrtoumax.tmp 2>&1 && result=1 -./test-xstrtoumax${EXEEXT} 9x >> t-xstrtoumax.tmp 2>&1 && result=1 -./test-xstrtoumax${EXEEXT} 010 >> t-xstrtoumax.tmp 2>&1 || result=1 -./test-xstrtoumax${EXEEXT} MiB >> t-xstrtoumax.tmp 2>&1 || result=1 +test-xstrtoumax 1 >> out 2>&1 || result=1 +test-xstrtoumax -1 >> out 2>&1 && result=1 +test-xstrtoumax 1k >> out 2>&1 || result=1 +test-xstrtoumax ${too_big}h >> out 2>&1 && result=1 +test-xstrtoumax $too_big >> out 2>&1 && result=1 +test-xstrtoumax x >> out 2>&1 && result=1 +test-xstrtoumax 9x >> out 2>&1 && result=1 +test-xstrtoumax 010 >> out 2>&1 || result=1 +test-xstrtoumax MiB >> out 2>&1 || result=1 # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr # does not understand '\r'. @@ -28,11 +25,11 @@ else fi # normalize output -LC_ALL=C tr -d "$cr" < t-xstrtoumax.tmp > t-xstrtoumax.xo -mv t-xstrtoumax.xo t-xstrtoumax.tmp +LC_ALL=C tr -d "$cr" < out > k +mv k out # compare expected output -cat > t-xstrtoumax.xo <<EOF +cat > exp <<EOF 1->1 () invalid X argument \`-1' 1k->1024 () @@ -44,8 +41,6 @@ invalid suffix in X argument \`9x' MiB->1048576 () EOF -diff t-xstrtoumax.xo t-xstrtoumax.tmp || result=1 - -rm -fr $tmpfiles +compare exp out || result=1 -exit $result +Exit $result -- 1.7.0.4.552.gc303