diff options
author | Jim Meyering <meyering@redhat.com> | 2010-04-05 16:32:41 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-04-05 19:27:05 +0200 |
commit | 0165705e67e7d536829336acc7eaac9601cef382 (patch) | |
tree | bd712b7e1b1a0e41aca8e2e9875798e352d8a3e6 /tests/test-xstrtol.sh | |
parent | 5c92acef552620a440dc134faf6d1f7fd14f825f (diff) | |
download | gnulib-0165705e67e7d536829336acc7eaac9601cef382.tar.gz |
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.
Diffstat (limited to 'tests/test-xstrtol.sh')
-rwxr-xr-x | tests/test-xstrtol.sh | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/tests/test-xstrtol.sh b/tests/test-xstrtol.sh index c56c675000..1a2f7ca90f 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 |