bug-gnulib
[Top][All Lists]
Advanced

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

Re: xalloc-die-tests


From: Jim Meyering
Subject: Re: xalloc-die-tests
Date: Tue, 17 Nov 2009 08:47:40 +0100

Eric Blake wrote:
> That failed to link when run in isolation (./gnulib-tool --with-tests
> --test xalloc-die).  Plus it leaked a message to stderr, which in turn
> showed that we were depending on unportable printf("%s",NULL) behavior.
> This cleans it up.

> diff --git a/tests/test-xalloc-die.sh b/tests/test-xalloc-die.sh
...
> +tmpfiles="t-xalloc-die.tmp"
> +./test-xalloc-die${EXEEXT} 2> t-xalloc-die.tmp
> +case $? in
> +  1) ;;
> +  *) (exit 1); exit 1 ;;
> +esac
> +
> +compare - t-xalloc-die.tmp <<\EOF || { (exit 1); exit 1; }
> +test-xalloc-die: memory exhausted
> +EOF

The above always fails for me:

    FAIL: test-xalloc-die.sh (exit: 1)
    ==================================

    --- -   2009-11-17 08:04:51.549049489 +0100
    +++ t-xalloc-die.tmp    2009-11-17 08:04:51.546155968 +0100
    @@ -1 +1 @@
    -test-xalloc-die: memory exhausted
    +./test-xalloc-die: memory exhausted

I've fixed it like this:
[noted the log/code mismatch in PATH setting -- corrected by follow-on patch]

>From 67bcb9c5ab3c175704db5cd355768b68aa83cb23 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 17 Nov 2009 08:42:58 +0100
Subject: [PATCH] test-xalloc-die.sh: fix a portability bug

* tests/test-xalloc-die.sh: Do not invoke via ./test-xalloc-die.
Instead, set PATH to start with "." and invoke via "test-xalloc-die".
Otherwise, argv[0] (as often seen in diagnostics) would be too
system-dependent, sometimes with, and sometimes without the leading "./".
---
 ChangeLog                |    6 ++++++
 tests/test-xalloc-die.sh |    4 +++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8b1853e..1bfb249 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-11-17  Jim Meyering  <address@hidden>

+       test-xalloc-die.sh: fix a portability bug
+       * tests/test-xalloc-die.sh: Do not invoke via ./test-xalloc-die.
+       Instead, set PATH to start with "." and invoke via "test-xalloc-die".
+       Otherwise, argv[0] (as often seen in diagnostics) would be too
+       system-dependent, sometimes with, and sometimes without the leading 
"./".
+
        version-etc-fsf: relax license to LGPLv3+
        * modules/version-etc-fsf (License): Relax license.

diff --git a/tests/test-xalloc-die.sh b/tests/test-xalloc-die.sh
index 340a500..53cdaeb 100755
--- a/tests/test-xalloc-die.sh
+++ b/tests/test-xalloc-die.sh
@@ -13,7 +13,9 @@ else
 fi

 tmpfiles="t-xalloc-die.tmp"
-./test-xalloc-die${EXEEXT} 2> t-xalloc-die.tmp
+PATH="$PATH:."
+export PATH
+test-xalloc-die${EXEEXT} 2> t-xalloc-die.tmp
 case $? in
   1) ;;
   *) (exit 1); exit 1 ;;
--
1.6.5.2.386.g2a326


>From eedd7fff3193f2e0b81841d873fbf199358f7e68 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 17 Nov 2009 08:46:29 +0100
Subject: [PATCH] test-xalloc-die.sh: make the code agree with the commit log

* tests/test-xalloc-die.sh: Put "." at the front of $PATH, not
at the end, just in case you happen to have a test-xalloc-die
program in some other PATH directory.
---
 ChangeLog                |    5 +++++
 tests/test-xalloc-die.sh |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1bfb249..f535c53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-11-17  Jim Meyering  <address@hidden>

+       test-xalloc-die.sh: make the code agree with the commit log
+       * tests/test-xalloc-die.sh: Put "." at the front of $PATH, not
+       at the end, just in case you happen to have a test-xalloc-die
+       program in some other PATH directory.
+
        test-xalloc-die.sh: fix a portability bug
        * tests/test-xalloc-die.sh: Do not invoke via ./test-xalloc-die.
        Instead, set PATH to start with "." and invoke via "test-xalloc-die".
diff --git a/tests/test-xalloc-die.sh b/tests/test-xalloc-die.sh
index 53cdaeb..b181ccb 100755
--- a/tests/test-xalloc-die.sh
+++ b/tests/test-xalloc-die.sh
@@ -13,7 +13,7 @@ else
 fi

 tmpfiles="t-xalloc-die.tmp"
-PATH="$PATH:."
+PATH=".:$PATH"
 export PATH
 test-xalloc-die${EXEEXT} 2> t-xalloc-die.tmp
 case $? in
--
1.6.5.2.386.g2a326




reply via email to

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