Mercurial > hg > octave-nkf > gnulib-hg
view tests/test-xstrtoimax.sh @ 12404:44954971957b
init.sh: avoid Solaris 10 /bin/sh portability problem
Solaris 10's /bin/sh does not pass '.' arguments 2..N to the
sourced script:
$ printf 'echo "$@"\n' > f; /bin/sh -c '. ./f bar'
$ printf 'echo "$@"\n' > f; bash -c '. ./f bar'
bar
tests/init.sh relied on that, accepting a --set-path=DIR argument,
and two tests used that idiom.
* tests/init.sh: Update suggested usage comments.
(path_prepend_): New function, to be used in place of
the --src-path=DIR option.
Disallow empty strings and strings containing ":".
(setup_): Move PATH-prepending code into path_prepend_.
* tests/test-pread.sh: Adapt to new usage.
* tests/test-xalloc-die.sh: Likewise.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Tue, 08 Dec 2009 20:37:50 +0100 |
parents | 44e4e306d7c5 |
children | 1e97362a0b84 |
line wrap: on
line source
#!/bin/sh 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 # 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 LC_ALL=C tr -d "$cr" < t-xstrtoimax.tmp > t-xstrtoimax.xo mv t-xstrtoimax.xo t-xstrtoimax.tmp # compare expected output cat > t-xstrtoimax.xo <<EOF 1->1 () -1->-1 () 1k->1024 () invalid suffix in X argument \`${too_big}h' X argument \`$too_big' too large invalid X argument \`x' invalid suffix in X argument \`9x' 010->8 () MiB->1048576 () EOF diff t-xstrtoimax.xo t-xstrtoimax.tmp || result=1 rm -fr $tmpfiles exit $result