tests/test-xalloc-die.sh: Deal with EOL differences, and more.
authorSimon Josefsson <simon@josefsson.org>
Tue, 17 Nov 2009 18:58:12 +0000 (19:58 +0100)
committerSimon Josefsson <simon@josefsson.org>
Tue, 17 Nov 2009 18:58:12 +0000 (19:58 +0100)
ChangeLog
tests/test-xalloc-die.sh

index 4dbb0d3..0989d4e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-17  Simon Josefsson  <simon@josefsson.org>
+
+       * tests/test-xalloc-die.sh: Add license.  Check that nothing is
+       printed to stdout.  Deal with EOL differences.
+
 2009-11-17  Eric Blake  <ebb9@byu.net>
 
        unsetenv: work around Solaris bug
index b181ccb..dc9bc37 100755 (executable)
@@ -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 <http://www.gnu.org/licenses/>.
 
 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