X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest-xstrtol.sh;h=1a2f7ca90fe0732bdd81cde298625aa79dc56bf0;hb=1aeca770e12bdc87d6cfe0e43cc2f37a910213a0;hp=70022236a0f81614e894cbf0b04a293d7447ca80;hpb=e9c57721db5e7cf2a19d93761d8c13e0c9701953;p=gnulib.git diff --git a/tests/test-xstrtol.sh b/tests/test-xstrtol.sh index 70022236a..1a2f7ca90 100755 --- a/tests/test-xstrtol.sh +++ b/tests/test-xstrtol.sh @@ -1,42 +1,47 @@ #!/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'. +if echo solaris | tr -d '\r' | grep solais > /dev/null; then + cr='\015' +else + cr='\r' +fi # normalize output -sed -e 's/^[^:]*: //' < 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 < expected <1 () -1->-1 () 1k->1024 () @@ -57,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