X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=syntax-checks.mk;h=032e7be775106418b28527fd9f1ce4a6ac331bd8;hb=106428fe4e73d5f9f5e7cc2e44a1e9b3b85606c1;hp=0549bc8ff1313784b41204c8f4f99097f038d6f3;hpb=13dd512dae7f338426dfb152bc77c4c5fdd25278;p=platform%2Fupstream%2Fautomake.git diff --git a/syntax-checks.mk b/syntax-checks.mk index 0549bc8..032e7be 100644 --- a/syntax-checks.mk +++ b/syntax-checks.mk @@ -27,11 +27,15 @@ xtests := $(shell \ fi; \ for d in $$dirs; do \ for s in tap sh; do \ - ls $$d/t/*.$$s $$d/t/ax/*.$$s 2>/dev/null; \ + ls $$d/t/ax/*.$$s $$d/t/*.$$s $$d/contrib/t/*.$$s 2>/dev/null; \ done; \ done | sort) -xdefs = $(srcdir)/t/ax/test-init.sh $(srcdir)/defs $(srcdir)/defs-static.in +xdefs = \ + $(srcdir)/t/ax/am-test-lib.sh \ + $(srcdir)/t/ax/test-lib.sh \ + $(srcdir)/t/ax/test-defs.in \ + $(srcdir)/defs ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print) @@ -39,7 +43,6 @@ ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print) # guaranteed to work on my machine. syntax_check_rules = \ $(sc_tests_plain_check_rules) \ -sc_test_names \ sc_diff_automake_in_automake \ sc_diff_aclocal_in_automake \ sc_perl_syntax \ @@ -56,14 +59,17 @@ sc_perl_at_uscore_in_scalar_context \ sc_perl_local \ sc_AMDEP_TRUE_in_automake_in \ sc_tests_make_without_am_makeflags \ +$(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 \ @@ -74,69 +80,6 @@ sc_unquoted_DESTDIR \ sc_tabs_in_texi \ sc_at_in_texi -## Look for test whose names can cause spurious failures when used as -## first argument to AC_INIT (chiefly because they might contain an -## m4/m4sugar builtin or macro name). -m4_builtins = \ - __gnu__ \ - __unix__ \ - bpatsubst \ - bregexp \ - builtin \ - changecom \ - changequote \ - changeword \ - debugfile \ - debugmode \ - decr \ - define \ - defn \ - divert \ - divnum \ - dnl \ - dumpdef \ - errprint \ - esyscmd \ - eval \ - format \ - ifdef \ - ifelse \ - include \ - incr \ - index \ - indir \ - len \ - m4exit \ - m4wrap \ - maketemp \ - mkstemp \ - patsubst \ - popdef \ - pushdef \ - regexp \ - shift \ - sinclude \ - substr \ - symbols \ - syscmd \ - sysval \ - traceoff \ - traceon \ - translit \ - undefine \ - undivert -sc_test_names: - @m4_builtin_rx=`echo $(m4_builtins) | sed 's/ /|/g'`; \ - m4_macro_rx="\\<($$m4_builtin_rx)\\>|\\<_?(A[CUMHS]|m4)_"; \ - if { \ - for t in $(xtests); do echo $$t; done \ - | LC_ALL=C grep -E "$$m4_macro_rx"; \ - }; then \ - echo "the names of the tests above can be problematic" 1>&2; \ - echo "Avoid test names that contain names of m4 macros" 1>&2; \ - exit 1; \ - fi - ## These check avoids accidental configure substitutions in the source. ## There are exactly 9 lines that should be modified from automake.in to ## automake, and 10 lines that should be modified from aclocal.in to @@ -278,6 +221,7 @@ sc_tests_make_without_am_makeflags: sc_tests_obsolete_variables: @vars=" \ using_tap \ + am_using_tap \ test_prefer_config_shell \ original_AUTOMAKE \ original_ACLOCAL \ @@ -301,6 +245,19 @@ sc_tests_obsolete_variables: exit 1; \ else :; fi +## Look out for obsolete requirements specified in the test cases. +sc_obsolete_requirements_rules = sc_no_texi2dvi-o sc_no_makeinfo-html +modern-requirement.texi2dvi-o = texi2dvi +modern-requirement.makeinfo-html = makeinfo + +$(sc_obsolete_requirements_rules): sc_no_% : + @if grep -E 'required=.*\b$*\b' $(xtests); then \ + echo "Requirement '$*' is obsolete and shouldn't" \ + "be used anymore." >&2; \ + echo "You should use '$(modern-requirement.$*)' instead." >&2; \ + exit 1; \ + fi + ## Tests should never call some programs directly, but only through the ## corresponding variable (e.g., '$MAKE', not 'make'). This will allow ## the programs to be overridden at configure time (for less brittleness) @@ -341,27 +298,45 @@ sc_tests_here_document_format: 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 @@ -427,6 +402,19 @@ sc_tests_ls_t: 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.