[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests/init.sh: new file to be used via most *.sh tests
From: |
Jim Meyering |
Subject: |
Re: [PATCH] tests/init.sh: new file to be used via most *.sh tests |
Date: |
Thu, 26 Nov 2009 09:11:02 +0100 |
Bruno Haible wrote:
> Hi Jim,
>
>> +test -f $srcdir/init.cfg \
>> + && . $srcdir/init.cfg
>
> Directory names containing spaces are not so uncommon, especially on Cygwin.
> How about writing "$srcdir/init.cfg" ?
>
> Likewise in test-pread.sh.
srcdir is expected to come from automake, and there, it is guaranteed
to be sanitized. It is usually simply "." or ".." or the name of a
package's subdirectory like "src" or "lib".
However, since it can be set explicitly for manual invocation
of a test, I've done this:
>From 94a77054e5609e4365b25eb7c2cbcfc02d324d55 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 26 Nov 2009 09:10:04 +0100
Subject: [PATCH] init.sh: accommodate even those who specify bogus srcdir
manually
* tests/init.sh: Normally, srcdir is guaranteed by automake and
configure-time tests to be sanitized, so that there is no need to
use "$srcdir" in Makefile rules and shell scripts. Using $srcdir
(with no double quotes) suffices. However, since tests may be
invoked manually, and since you may explicitly set srcdir to the
name of a directory containing spaces, do quote its uses here.
* tests/test-pread.sh: Likewise.
Suggested by Bruno Haible.
---
ChangeLog | 10 ++++++++++
tests/init.sh | 4 ++--
tests/test-pread.sh | 2 +-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bcb4340..dacf782 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2009-11-26 Jim Meyering <address@hidden>
+ init.sh: accommodate even those who specify bogus srcdir manually
+ * tests/init.sh: Normally, srcdir is guaranteed by automake and
+ configure-time tests to be sanitized, so that there is no need to
+ use "$srcdir" in Makefile rules and shell scripts. Using $srcdir
+ (with no double quotes) suffices. However, since tests may be
+ invoked manually, and since you may explicitly set srcdir to the
+ name of a directory containing spaces, do quote its uses here.
+ * tests/test-pread.sh: Likewise.
+ Suggested by Bruno Haible.
+
test-pread.sh: avoid diagnostics for those who ignore SIGPIPE
* tests/test-pread.sh: Write no data into the pipe, because
test-pread actually reads none. This avoids a diagnostic,
diff --git a/tests/init.sh b/tests/init.sh
index 7d4879f..db2fa76 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -210,7 +210,7 @@ mktempd_()
# If you want to override the testdir_prefix_ function,
# or to add more utility functions, use this file.
-test -f $srcdir/init.cfg \
- && . $srcdir/init.cfg
+test -f "$srcdir/init.cfg" \
+ && . "$srcdir/init.cfg"
setup_ "$@"
diff --git a/tests/test-pread.sh b/tests/test-pread.sh
index d7824ad..59f8536 100755
--- a/tests/test-pread.sh
+++ b/tests/test-pread.sh
@@ -1,6 +1,6 @@
#!/bin/sh
: ${srcdir=.}
-. $srcdir/init.sh --set-path=.
+. "$srcdir/init.sh" --set-path=.
fail=0
: | test-pread || fail=1
--
1.6.6.rc0.54.gb073b
Re: [PATCH] tests/init.sh: new file to be used via most *.sh tests, Jim Meyering, 2009/11/26
Re: [PATCH] tests/init.sh: new file to be used via most *.sh tests, Ralf Wildenhues, 2009/11/27