# HG changeset patch # User Jim Meyering # Date 1270488638 -7200 # Node ID 371266bf04b60ed8b6972fb5f033a92210b54d12 # Parent 1e97362a0b842ffae779ee2f313fffd2c182fc4b 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. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-04-05 Jim Meyering + 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 --- 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 --- 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 @@ 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 < exp <1 () invalid X argument \`-1' 1k->1024 () @@ -44,8 +41,6 @@ MiB->1048576 () EOF -diff t-xstrtoumax.xo t-xstrtoumax.tmp || result=1 +compare exp out || result=1 -rm -fr $tmpfiles - -exit $result +Exit $result