$(sc_obsolete_requirements_rules) \
sc_tests_obsolete_variables \
sc_tests_here_document_format \
+sc_tests_command_subst \
sc_tests_Exit_not_exit \
sc_tests_automake_fails \
sc_tests_required_after_defs \
sc_tests_overriding_macros_on_cmdline \
sc_tests_plain_sleep \
sc_tests_ls_t \
+sc_tests_executable \
sc_m4_am_plain_egrep_fgrep \
sc_tests_no_configure_in \
sc_tests_PATH_SEPARATOR \
exit 1; \
fi
-## Tests should never call exit directly, but use Exit.
-## This is so that the exit status is transported correctly across the 0 trap.
-## Ignore comments and our testsuite's own self tests.
-sc_tests_Exit_not_exit:
- @found=false; for file in $(xtests); do \
- case $$file in */self-check-*) continue;; esac; \
- res=`sed -n -e '/^#/d' -e '/<<.*END/,/^END/b' -e '/<<.*EOF/,/^EOF/b' \
- -e '/exit [$$0-9]/p' $$file`; \
+## Our test case should use the $(...) POSIX form for command substitution,
+## rather than the older `...` form.
+## The point of ignoring text on here-documents is that we want to exempt
+## Makefile.am rules, configure.ac code and helper shell script created and
+## used by out shell scripts, because Autoconf (as of version 2.69) does not
+## yet ensure that $CONFIG_SHELL will be set to a proper POSIX shell.
+sc_tests_command_subst:
+ @found=false; \
+ scan () { \
+ sed -n -e '/^#/d' \
+ -e '/<<.*END/,/^END/b' -e '/<<.*EOF/,/^EOF/b' \
+ -e 's/\\`/\\{backtick}/' \
+ -e "s/[^\\]'\([^']*\`[^']*\)*'/'{quoted-text}'/g" \
+ -e '/`/p' $$*; \
+ }; \
+ for file in $(xtests); do \
+ res=`scan $$file`; \
if test -n "$$res"; then \
echo "$$file:$$res"; \
found=true; \
fi; \
done; \
if $$found; then \
- echo 'Do not call plain "exit", use "Exit" instead, in above tests.' 1>&2; \
+ echo 'Use $$(...), not `...`, for command substitutions.' >&2; \
+ exit 1; \
+ fi
+
+## Tests should no more call 'Exit', just 'exit'. That's because we
+## now have in place a better workaround to ensure the exit status is
+## transported correctly across the exit trap.
+sc_tests_Exit_not_exit:
+ @if grep 'Exit' $(xtests) $(xdefs) | grep -Ev '^[^:]+: *#' | grep .; then \
+ echo "Use 'exit', not 'Exit'; it's obsolete now." 1>&2; \
exit 1; \
fi
## Use AUTOMAKE_fails when appropriate
sc_tests_automake_fails:
- @if grep -v '^#' $(xtests) | grep '\$$AUTOMAKE.*&&.*[eE]xit'; then \
+ @if grep -v '^#' $(xtests) | grep '\$$AUTOMAKE.*&&.*exit'; then \
echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2; \
exit 1; \
fi
exit 1; \
fi
+## Test scripts must be executable.
+sc_tests_executable:
+ @st=0; \
+ for f in $(xtests); do \
+ case $$f in \
+ t/ax/*|./t/ax/*|$(srcdir)/t/ax/*);; \
+ *) test -x $$f || { echo "$$f: not executable" >&2; st=1; }; \
+ esac; \
+ done; \
+ test $$st -eq 0 || echo '$@: some test scripts are not executable' >&2; \
+ exit $$st;
+
+
## Never use 'sleep 1' to create files with different timestamps.
## Use '$sleep' instead. Some filesystems (e.g., Windows) have only
## a 2sec resolution.