summaryrefslogtreecommitdiff
path: root/tests/test-xstrtoumax.sh
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-04-05 19:30:38 +0200
committerJim Meyering <meyering@redhat.com>2010-04-05 19:30:38 +0200
commitfb814d4cf9834324f0c05bcd04899003933933fa (patch)
treed4e600e9d74796eeb8e38d04627a7142c810ef5c /tests/test-xstrtoumax.sh
parent9c76fbeeb87c32677893b78bf89bdf29ce9eb199 (diff)
downloadgnulib-fb814d4cf9834324f0c05bcd04899003933933fa.tar.gz
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.
Diffstat (limited to 'tests/test-xstrtoumax.sh')
-rwxr-xr-xtests/test-xstrtoumax.sh37
1 files changed, 16 insertions, 21 deletions
diff --git a/tests/test-xstrtoumax.sh b/tests/test-xstrtoumax.sh
index 12a7ba9f60..68abb93cb8 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