From a4cfedb07defccd91a1b8290ab57be337bfd04b4 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Sat, 5 Dec 2009 09:24:54 -0700 Subject: [PATCH] test-xalloc-die: fix test for mingw When cross-compiling on mingw to target mingw, argv[0] still includes a .exe suffix. Rather than worry about ${EXEEXT}, just add a sed post-process. Also, simplify the script by using tests/init.sh. * modules/xalloc-die-tests (Files): Add tests/init.sh. * tests/test-xalloc-die.sh: Rewrite to use init.sh. Strip directory and .exe suffix off argv[0] output. Signed-off-by: Eric Blake --- ChangeLog | 5 +++++ modules/xalloc-die-tests | 1 + tests/test-xalloc-die.sh | 33 ++++++++------------------------- 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5328a68f9..c3d6d7374 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-12-05 Eric Blake + test-xalloc-die: fix test for mingw + * modules/xalloc-die-tests (Files): Add tests/init.sh. + * tests/test-xalloc-die.sh: Rewrite to use init.sh. Strip + directory and .exe suffix off argv[0] output. + test-fseeko: fix test for mingw * tests/test-fseeko.c (fseek): Redefine GL_LINK_WARNING, rather than undefining fseek, so test will pass on mingw. diff --git a/modules/xalloc-die-tests b/modules/xalloc-die-tests index d28c95ffb..30dc3028f 100644 --- a/modules/xalloc-die-tests +++ b/modules/xalloc-die-tests @@ -1,6 +1,7 @@ Files: tests/test-xalloc-die.c tests/test-xalloc-die.sh +tests/init.sh Depends-on: progname diff --git a/tests/test-xalloc-die.sh b/tests/test-xalloc-die.sh index 8a3002282..28cce6d36 100755 --- a/tests/test-xalloc-die.sh +++ b/tests/test-xalloc-die.sh @@ -16,38 +16,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -tmpfiles="" -trap '__st=$?; rm -fr $tmpfiles; exit $__st' 0 -trap '__st=$?; (exit $__st); exit $__st' 1 2 3 15 +. "${srcdir=.}/init.sh" --set-path=. -if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then - compare() { diff -u "$@"; } -elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then - compare() { cmp -s "$@"; } -else - compare() { cmp "$@"; } -fi - -tmpout=t-xalloc-die.tmp-stderr -tmperr=t-xalloc-die.tmp-stdout -tmpfiles="$tmpout $tmperr ${tmperr}2" - -PATH=".:$PATH" -export PATH -test-xalloc-die 2> ${tmperr} > ${tmpout} +test-xalloc-die 2> err > out case $? in 1) ;; - *) (exit 1); exit 1 ;; + *) Exit 1;; esac -tr -d '\015' < $tmperr > ${tmperr}2 || { (exit 1); exit 1; } +tr -d '\015' < err \ + | sed 's,.*test-xalloc-die[.ex]*:,test-xalloc-die:,' > err2 || Exit 1 -compare - ${tmperr}2 <<\EOF || { (exit 1); exit 1; } +compare - err2 <<\EOF || Exit 1 test-xalloc-die: memory exhausted EOF -test -s $tmpout && { (exit 1); exit 1; } - -rm -fr $tmpfiles +test -s out && Exit 1 -exit 0 +Exit $fail -- 2.11.0