From 3e00f5fce5b904dc642aff88abbcf75867263e0a Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Tue, 17 Nov 2009 19:58:12 +0100 Subject: [PATCH] tests/test-xalloc-die.sh: Deal with EOL differences, and more. --- ChangeLog | 5 +++++ tests/test-xalloc-die.sh | 31 ++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4dbb0d35a..0989d4e3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-17 Simon Josefsson + + * tests/test-xalloc-die.sh: Add license. Check that nothing is + printed to stdout. Deal with EOL differences. + 2009-11-17 Eric Blake unsetenv: work around Solaris bug diff --git a/tests/test-xalloc-die.sh b/tests/test-xalloc-die.sh index b181ccbce..dc9bc37a6 100755 --- a/tests/test-xalloc-die.sh +++ b/tests/test-xalloc-die.sh @@ -1,4 +1,20 @@ #!/bin/sh +# Test suite for xalloc_die. +# Copyright (C) 2009 Free Software Foundation, Inc. +# This file is part of the GNUlib Library. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# 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 @@ -12,19 +28,28 @@ else compare() { cmp "$@"; } fi -tmpfiles="t-xalloc-die.tmp" +tmpout=t-xalloc-die.tmp-stderr +tmperr=t-xalloc-die.tmp-stdout +tmpfiles="$tmpout $tmperr ${tmpout}2 ${tmperr}2" + PATH=".:$PATH" export PATH -test-xalloc-die${EXEEXT} 2> t-xalloc-die.tmp +test-xalloc-die${EXEEXT} 2> ${tmperr} > ${tmpout} case $? in 1) ;; *) (exit 1); exit 1 ;; esac -compare - t-xalloc-die.tmp <<\EOF || { (exit 1); exit 1; } +cat $tmperr | tr -d '\015' > ${tmperr}2 +cat $tmpout | tr -d '\015' > ${tmpout}2 + +compare - ${tmperr}2 <<\EOF || { (exit 1); exit 1; } test-xalloc-die: memory exhausted EOF +compare - ${tmpout}2 <<\EOF || { (exit 1); exit 1; } +EOF + rm -fr $tmpfiles exit 0 -- 2.11.0