summaryrefslogtreecommitdiff
path: root/t/ax
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2013-05-18 15:23:20 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2013-05-18 19:26:52 +0200
commit0cca184f65b5397d9e52f32365ab962d5af2f7ea (patch)
tree4496970adac77c2b11ebb5b7393d6764f38adc55 /t/ax
parent9c468420a8ff18940ab2e9d47d096788ed5801f0 (diff)
parent0256f1d66ff28cfcef895eb72b15e40e6de442e0 (diff)
downloadautomake-0cca184f65b5397d9e52f32365ab962d5af2f7ea.tar.gz
Merge branch 'micro' into maint
* micro: lisp: fix a failure with Solaris /usr/xpg4/bin/sh tests: sanitize 'unset' usages tests: fix some botched/outdated comments tests: use perl, not find+rm, to remove temporary directories Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't/ax')
-rw-r--r--t/ax/am-test-lib.sh10
-rw-r--r--t/ax/deltree.pl19
-rw-r--r--t/ax/test-defs.in8
-rw-r--r--t/ax/test-lib.sh24
4 files changed, 43 insertions, 18 deletions
diff --git a/t/ax/am-test-lib.sh b/t/ax/am-test-lib.sh
index 91a18ccc4..f35ccd5de 100644
--- a/t/ax/am-test-lib.sh
+++ b/t/ax/am-test-lib.sh
@@ -34,11 +34,6 @@ distdir=$me-1.0
## Environment cleanup. ##
## ---------------------- ##
-# Temporarily disable this, since some shells (e.g., older version
-# of Bash) can return a non-zero exit status upon the when a non-set
-# variable is unset.
-set +e
-
# Unset some make-related variables that may cause $MAKE to act like
# a recursively invoked sub-make. Any $MAKE invocation in a test is
# conceptually an independent invocation, not part of the main
@@ -85,9 +80,6 @@ for pfx in TEST_ SH_ TAP_ ''; do
done
unset pfx
-# Re-enable, it had been temporarily disabled above.
-set -e
-
# cross_compiling
# ---------------
# Tell whether we are cross-compiling. This is especially useful to skip
@@ -805,7 +797,7 @@ process_requirements ()
*" $am_tool"*) . ./t/$am_tool-macros.dir/get.sh;;
esac
done
- am_tool=; unset am_tool
+ unset am_tool
}
## ---------------------------------------------------------------- ##
diff --git a/t/ax/deltree.pl b/t/ax/deltree.pl
new file mode 100644
index 000000000..70607662f
--- /dev/null
+++ b/t/ax/deltree.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/env perl
+# deltree: recursively removes file and directory,
+# trying to handle permissions and other complications.
+
+use strict;
+use warnings FATAL => 'all';
+use File::Path qw/rmtree/;
+
+my $exit_status = 0;
+local $SIG{__WARN__} = sub { warn "@_"; $exit_status = 1; };
+
+foreach my $path (@ARGV) {
+ local $@ = undef;
+ rmtree ($path);
+}
+
+exit $exit_status;
+
+# vim: ft=perl ts=4 sw=4 et
diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in
index 9662c792b..c716cab97 100644
--- a/t/ax/test-defs.in
+++ b/t/ax/test-defs.in
@@ -107,7 +107,7 @@ AUTORECONF=${AM_TESTSUITE_AUTORECONF-${AUTORECONF-'@am_AUTORECONF@'}}
AUTOHEADER=${AM_TESTSUITE_AUTOHEADER-${AUTOHEADER-'@am_AUTOHEADER@'}}
AUTOUPDATE=${AM_TESTSUITE_AUTOUPDATE-${AUTOUPDATE-'@am_AUTOUPDATE@'}}
-# Tests who want complete control over aclocal or automake command-line
+# Tests which want complete control over aclocal or automake command-line
# options should use $am_original_ACLOCAL or $am_original_AUTOMAKE. The
# "test -z" tests take care not to re-initialize them if 'test-defs.sh'
# is re-sourced, as we want that file to remain really idempotent.
@@ -118,9 +118,9 @@ if test -z "$am_original_ACLOCAL"; then
am_original_ACLOCAL=${AM_TESTSUITE_ACLOCAL-${ACLOCAL-"aclocal-$APIVERSION"}}
fi
-# Use -Werror because this also turns some Perl warnings into error.
-# Tests for which this is inappropriate should use -Wno-error.
-# Tests who want complete control over aclocal command-line options
+# Use -Werror by default. Tests for which this is inappropriate should
+# use -Wno-error.
+# Tests which want complete control over aclocal command-line options
# should use $am_original_ACLOCAL instead.
ACLOCAL="$am_original_ACLOCAL -Werror"
diff --git a/t/ax/test-lib.sh b/t/ax/test-lib.sh
index a3c16eed8..ee83dcff3 100644
--- a/t/ax/test-lib.sh
+++ b/t/ax/test-lib.sh
@@ -92,7 +92,7 @@ _am_exit ()
set +e
# See comments in the exit trap for the reason we do this.
test 77 = $1 && am__test_skipped=yes
- # Spurious escaping to ensure we do not call our 'exit' alias.
+ # Extra escaping to ensure we do not call our 'exit' alias.
(\exit $1); \exit $1
}
# Avoid interferences from the environment
@@ -101,6 +101,23 @@ am__test_skipped=no
# just inside a function definition. Weird, but real.
alias exit=_am_exit
+# In some shells (e.g., Solaris 10 /bin/ksh, or NetBSD 5.1 /bin/sh),
+# "unset VAR" returns a non-zero exit status in case the VAR variable
+# is already unset. This doesn't interact well with our usage of
+# "set -e" in the testsuite. This function and the alias below help
+# to work around the issue.
+_am_unset ()
+{
+ for _am_v
+ do
+ # Extra escaping (here and below) to ensure we do not call our
+ # 'unset' alias.
+ eval ${_am_v}=dummy && \unset ${_am_v} || exit 1
+ done
+ \unset _am_v
+}
+alias unset=_am_unset
+
## ------------------------------------ ##
## General testsuite shell functions. ##
## ------------------------------------ ##
@@ -174,10 +191,7 @@ seq_ ()
rm_rf_ ()
{
test $# -gt 0 || return 0
- # Ignore failures in find, we are only interested in failures of the
- # final rm.
- find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
- rm -rf "$@"
+ $PERL "$am_testaux_srcdir"/deltree.pl "$@"
}
commented_sed_unindent_prog='