* tests/init.sh (setup_): Set srcdir and builddir.
(BOURNE_SHELL): New variable.
* modules/acl-tests (Depends-on): Add 'test-framework-sh'.
* modules/file-has-acl-tests (Depends-on): Likewise.
* modules/copy-file-tests (Depends-on): Likewise.
* tests/test-set-mode-acl-1.sh: Use the test framework. Invoke shell
scripts through $BOURNE_SHELL.
* tests/test-set-mode-acl-2.sh: Likewise.
* tests/test-copy-acl-1.sh: Likewise.
* tests/test-copy-acl-2.sh: Likewise.
* tests/test-file-has-acl-1.sh: Likewise.
* tests/test-file-has-acl-2.sh: Likewise.
* tests/test-copy-file-1.sh: Likewise.
* tests/test-copy-file-2.sh: Likewise.
* tests/test-set-mode-acl.sh (builddir): Consider value set by the
invoker.
* tests/test-copy-acl.sh (builddir): Likewise.
* tests/test-file-has-acl.sh (builddir): Likewise.
* tests/test-copy-file.sh (builddir): Likewise.
* tests/test-vc-list-files-cvs.sh: Don't create shims for executables in
build-aux/. Instead, invoke shell scripts through $BOURNE_SHELL.
* tests/test-vc-list-files-git.sh: Likewise.
+2019-01-27 Bruno Haible <bruno@clisp.org>
+
+ tests: Accommodate a shell that is not in /bin/sh.
+ * tests/init.sh (setup_): Set srcdir and builddir.
+ (BOURNE_SHELL): New variable.
+ * modules/acl-tests (Depends-on): Add 'test-framework-sh'.
+ * modules/file-has-acl-tests (Depends-on): Likewise.
+ * modules/copy-file-tests (Depends-on): Likewise.
+ * tests/test-set-mode-acl-1.sh: Use the test framework. Invoke shell
+ scripts through $BOURNE_SHELL.
+ * tests/test-set-mode-acl-2.sh: Likewise.
+ * tests/test-copy-acl-1.sh: Likewise.
+ * tests/test-copy-acl-2.sh: Likewise.
+ * tests/test-file-has-acl-1.sh: Likewise.
+ * tests/test-file-has-acl-2.sh: Likewise.
+ * tests/test-copy-file-1.sh: Likewise.
+ * tests/test-copy-file-2.sh: Likewise.
+ * tests/test-set-mode-acl.sh (builddir): Consider value set by the
+ invoker.
+ * tests/test-copy-acl.sh (builddir): Likewise.
+ * tests/test-file-has-acl.sh (builddir): Likewise.
+ * tests/test-copy-file.sh (builddir): Likewise.
+ * tests/test-vc-list-files-cvs.sh: Don't create shims for executables in
+ build-aux/. Instead, invoke shell scripts through $BOURNE_SHELL.
+ * tests/test-vc-list-files-git.sh: Likewise.
+
2019-01-27 Bruno Haible <bruno@clisp.org>
tests: Fix some "unused variable" warnings.
read-file
unistd
xalloc
+test-framework-sh
configure.ac:
acl-tests
read-file
xalloc
+test-framework-sh
configure.ac:
Depends-on:
unistd
+test-framework-sh
configure.ac:
AC_CHECK_DECLS_ONCE([alarm])
initial_cwd_=$PWD
+ # Create and enter the temporary directory.
pfx_=`testdir_prefix_`
test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \
|| fail_ "failed to create temporary directory in $initial_cwd_"
cd "$test_dir_" || fail_ "failed to cd to temporary directory"
+ # Set variables srcdir, builddir, for the convenience of the test.
+ case $srcdir in
+ /* | ?:*) ;;
+ *) srcdir="../$srcdir" ;;
+ esac
+ builddir=".."
+ export srcdir builddir
# As autoconf-generated configure scripts do, ensure that IFS
# is defined initially, so that saving and restoring $IFS works.
fail_ "$err_"
}
+# The interpreter for Bourne-shell scripts.
+# No special standards compatibility requirements.
+# Some environments, such as Android, don't have /bin/sh.
+if test -f /bin/sh$EXEEXT; then
+ BOURNE_SHELL=/bin/sh
+else
+ BOURNE_SHELL=sh
+fi
+
# If you want to override the testdir_prefix_ function,
# or to add more utility functions, use this file.
test -f "$srcdir/init.cfg" \
# Test copy-acl on the file system of /var/tmp, which usually is a local
# file system.
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
if test -d /var/tmp; then
TMPDIR=/var/tmp
else
fi
export TMPDIR
-exec "${srcdir}/test-copy-acl.sh"
+$BOURNE_SHELL "${srcdir}/test-copy-acl.sh"
+
+Exit $?
# Test copy-acl on the file system of the build directory, which may be
# a local file system or NFS mounted.
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
TMPDIR=`pwd`
export TMPDIR
-exec "${srcdir}/test-copy-acl.sh"
+$BOURNE_SHELL "${srcdir}/test-copy-acl.sh"
+
+Exit $?
}
func_tmpdir
-builddir=`pwd`
+# builddir may already be set by the script that invokes this one.
+case "$builddir" in
+ '') builddir=`pwd` ;;
+ /* | ?:*) ;;
+ *) builddir=`pwd`/$builddir ;;
+esac
cd "$builddir" ||
{
echo "$0: cannot determine build directory (unreadable parent dir?)" >&2
# Test copy-file on the file system of /var/tmp, which usually is a local
# file system.
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
if test -d /var/tmp; then
TMPDIR=/var/tmp
else
fi
export TMPDIR
-"${srcdir}/test-copy-file.sh"
+$BOURNE_SHELL "${srcdir}/test-copy-file.sh"
ret1=$?
-NO_STDERR_OUTPUT=1 "${srcdir}/test-copy-file.sh"
+NO_STDERR_OUTPUT=1 $BOURNE_SHELL "${srcdir}/test-copy-file.sh"
ret2=$?
case $ret1 in
- 77 ) exit $ret2 ;;
- * ) exit $ret1 ;;
+ 77 ) Exit $ret2 ;;
+ * ) Exit $ret1 ;;
esac
# Test copy-file on the file system of the build directory, which may be
# a local file system or NFS mounted.
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
TMPDIR=`pwd`
export TMPDIR
-"${srcdir}/test-copy-file.sh"
+$BOURNE_SHELL "${srcdir}/test-copy-file.sh"
ret1=$?
-NO_STDERR_OUTPUT=1 "${srcdir}/test-copy-file.sh"
+NO_STDERR_OUTPUT=1 $BOURNE_SHELL "${srcdir}/test-copy-file.sh"
ret2=$?
case $ret1 in
- 77 ) exit $ret2 ;;
- * ) exit $ret1 ;;
+ 77 ) Exit $ret2 ;;
+ * ) Exit $ret1 ;;
esac
}
func_tmpdir
-builddir=`pwd`
+# builddir may already be set by the script that invokes this one.
+case "$builddir" in
+ '') builddir=`pwd` ;;
+ /* | ?:*) ;;
+ *) builddir=`pwd`/$builddir ;;
+esac
cd "$builddir" ||
{
echo "$0: cannot determine build directory (unreadable parent dir?)" >&2
# Test file-has-acl on the file system of /var/tmp, which usually is a local
# file system.
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
if test -d /var/tmp; then
TMPDIR=/var/tmp
else
fi
export TMPDIR
-exec "${srcdir}/test-file-has-acl.sh"
+$BOURNE_SHELL "${srcdir}/test-file-has-acl.sh"
+
+Exit $?
# Test file-has-acl on the file system of the build directory, which may be
# a local file system or NFS mounted.
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
TMPDIR=`pwd`
export TMPDIR
-exec "${srcdir}/test-file-has-acl.sh"
+$BOURNE_SHELL "${srcdir}/test-file-has-acl.sh"
+
+Exit $?
}
func_tmpdir
-builddir=`pwd`
+# builddir may already be set by the script that invokes this one.
+case "$builddir" in
+ '') builddir=`pwd` ;;
+ /* | ?:*) ;;
+ *) builddir=`pwd`/$builddir ;;
+esac
cd "$builddir" ||
{
echo "$0: cannot determine build directory (unreadable parent dir?)" >&2
# Test set-mode-acl on the file system of /var/tmp, which usually is a local
# file system.
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
if test -d /var/tmp; then
TMPDIR=/var/tmp
else
fi
export TMPDIR
-exec "${srcdir}/test-set-mode-acl.sh"
+$BOURNE_SHELL "${srcdir}/test-set-mode-acl.sh"
+
+Exit $?
# Test set-mode-acl on the file system of the build directory, which may be
# a local file system or NFS mounted.
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
TMPDIR=`pwd`
export TMPDIR
-exec "${srcdir}/test-set-mode-acl.sh"
+$BOURNE_SHELL "${srcdir}/test-set-mode-acl.sh"
+
+Exit $?
}
func_tmpdir
-builddir=`pwd`
+# builddir may already be set by the script that invokes this one.
+case "$builddir" in
+ '') builddir=`pwd` ;;
+ /* | ?:*) ;;
+ *) builddir=`pwd`/$builddir ;;
+esac
cd "$builddir" ||
{
echo "$0: cannot determine build directory (unreadable parent dir?)" >&2
# along with this program. If not, see <https://www.gnu.org/licenses/>. */
: ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" .
+. "$srcdir/init.sh"; path_prepend_ .
tmpdir=vc-cvs
repo=`pwd`/$tmpdir/repo
cvs -Q -d "$repo" import -m imp m M M0 &&
cvs -Q -d "$repo" co m && cd m &&
printf '%s\n' b c d/a > expected &&
- vc-list-files | sort > actual &&
+ $BOURNE_SHELL "$abs_aux_dir/vc-list-files" | sort > actual &&
compare expected actual &&
ok=1
test $ok = 0 && fail=1
# along with this program. If not, see <https://www.gnu.org/licenses/>. */
: ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" .
+. "$srcdir/init.sh"; path_prepend_ .
tmpdir=vc-git-$$
GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE
git add . > /dev/null &&
git commit -q -a -m log &&
printf '%s\n' b c d/a > expected &&
- vc-list-files > actual &&
+ $BOURNE_SHELL "$abs_aux_dir/vc-list-files" > actual &&
compare expected actual &&
fail=0