bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test-xalloc-die buglet


From: Eric Blake
Subject: Re: test-xalloc-die buglet
Date: Tue, 17 Nov 2009 22:13:37 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 11/17/2009 12:07 PM:
>> -compare - t-xalloc-die.tmp <<\EOF || { (exit 1); exit 1; }
>> +cat $tmperr | tr -d '\015' > ${tmperr}2
> 
> Useless use of cat.  Also, check for errors.  Try:
> 
> tr -d '\015' < $tmperr > ${tmperr}2 || { (exit 1); exit 1; }
> 
> Pointless.  If we expect the file to be empty, then there are no carriage 
> returns to strip.  It is better to collapse these lines into one:
> 
> test ! -s $tmpout || { (exit 1); exit 1; }

I'm applying this:

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksDgoEACgkQ84KuGfSFAYD5iACfXPNYjNZb4QJ7+neA4FsSzhsT
0CwAoNYyRtNKIqH/BoYrjeptHoAFfY8U
=kINx
-----END PGP SIGNATURE-----
>From 89fe4c9d24e052d1947575379792613eb82f37cb Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 17 Nov 2009 11:38:42 -0700
Subject: [PATCH] xalloc-die-tests: optimize

* tests/test-xalloc-die.sh: Reduce number of processes.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog                |    5 +++++
 tests/test-xalloc-die.sh |    8 +++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 33e9351..2889727 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-17  Eric Blake  <address@hidden>
+
+       xalloc-die-tests: optimize
+       * tests/test-xalloc-die.sh: Reduce number of processes.
+
 2009-11-17  Simon Josefsson  <address@hidden>

        * gnulib-tool: Support LGPLv3+ licenses in module files.  Tiny
diff --git a/tests/test-xalloc-die.sh b/tests/test-xalloc-die.sh
index dc9bc37..4b0d2c2 100755
--- a/tests/test-xalloc-die.sh
+++ b/tests/test-xalloc-die.sh
@@ -30,7 +30,7 @@ fi

 tmpout=t-xalloc-die.tmp-stderr
 tmperr=t-xalloc-die.tmp-stdout
-tmpfiles="$tmpout $tmperr ${tmpout}2 ${tmperr}2"
+tmpfiles="$tmpout $tmperr ${tmperr}2"

 PATH=".:$PATH"
 export PATH
@@ -40,15 +40,13 @@ case $? in
   *) (exit 1); exit 1 ;;
 esac

-cat $tmperr | tr -d '\015' > ${tmperr}2
-cat $tmpout | tr -d '\015' > ${tmpout}2
+tr -d '\015' < $tmperr > ${tmperr}2 || { (exit 1); exit 1; }

 compare - ${tmperr}2 <<\EOF || { (exit 1); exit 1; }
 test-xalloc-die: memory exhausted
 EOF

-compare - ${tmpout}2 <<\EOF || { (exit 1); exit 1; }
-EOF
+test -s $tmpout && { (exit 1); exit 1; }

 rm -fr $tmpfiles

-- 
1.6.5.rc1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]