syntax-checks.mk


Log

Author Commit Date CI Message
Stefano Lattarini dc5aff42 2012-06-30T23:26:17 maintcheck: test scripts should be executable, check for that * syntax-checks.mk (sc_tests_executable): Here, in this new check. (syntax_check_rules): Add it. * Makefile.am (dist-hook): Drop, no need to make test cases executable anymore. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini c2a52bf0 2012-06-24T10:36:15 tests: simpler workaround for shells losing the exit status in exit trap Now that we can assume our tests are run by a decent POSIX shell, we can simplify our workaround aimed at having the exit status propagated correctly to the code in the exit trap. Unfortunately, we cannot dispense with such a workaround altogether, because it's still required by some shells we need to support (at least Solaris 10 /bin/ksh and /usr/xpg4/bin/sh). For more information about the need of that workaround, see the entry about 'trap' in the section "Limitations of Shell Builtins" in the Autoconf manual: <http://www.gnu.org/software/autoconf/manual/autoconf.html#trap> The new workaround has been tested successfully with the following shells: - Bash 4.1 - Bash 3.2 - Bash 3.0 - Bash 2.05b - dash 0.5.5.1 - dash 0.5.2 - AT&T Ksh 93u (from official Debian package) - MirBSD Korn Shell 40.2 (from official Debian package) - Solaris 9, 10 and 11 /bin/ksh - Solaris 9, 10 and 11 /usr/xpg4/bin/sh - NetBSD 5.1 /bin/sh - NetBSD 5.1 /bin/ksh * t/ax/test-init.sh (Exit): Rename ... (_am_exit): ... like this. (exit): New alias for '_am_exit'. We cannot simply redefine 'exit' as a shell function, because some shells (dash 0.5.5.1, Solaris 10 /bin/ksh and /usr/xpg4/bin/sh) do not allow it. (_am_exit, trap): Add extra escaping for 'exit' calls, to ensure we really invoke the 'exit' builtin and not our alias with the same name. * configure.ac: Check that the shell selected to run our testsuite supports aliases named like shell builtins. * t/REAMDE: Adjust. * All tests: Adjust, by simply using 'exit' instead of 'Exit'. * t/self-check-explicit-skips.sh: Adjust: the first usage of 'exit' after it has been redefined as an alias must be on a new line w.r.t. that where the alias is defined, in order for the redefinition to be honored. * syntax-checks.mk (sc_tests_Exit_not_exit): Delete. (sc_tests_exit_not_Exit): New. (syntax_check_rules): Adjust. (sc_tests_automake_fails): Simplify the recipe a little. * Several tests: Remove now useless spurious quoting once required to placate the 'sc_tests_Exit_not_exit' maintainer check. * gen-testsuite-part: Likewise. Also, avoid uses of 'Exit' in the generated scripts. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini e5343765 2012-06-23T00:06:10 maintcheck: guard against `...` for command substitution in test cases But still allow them in configure.ac, Makefile.am and shell scripts created or used inside test cases itself, because Autoconf (as of version 2.69) does not yet ensure that $CONFIG_SHELL will be set to a proper POSIX shell. * syntax-checks.mk (sc_tests_command_subst): New check. (syntax-check_rules): Add it. * t/tap-global-log.sh: Minimal tweakings to avoid triggering the new maintainer check. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 13dd512d 2012-06-22T18:15:21 tests: prefer using 'is_newest' over 'ls -t' hacks To verify that a file 'new' is newer than the file 'old', it's much cleaner to use "is_newest new old" rather than the more clumsy "ls -t". Adjust several of our tests accordingly. * syntax-checks.mk (sc_tests_ls_t): New check, guard against uses of "ls -t" and similar. (syntax_check_rules): Add it. * t/maken.sh: Adjust. * t/autohdr4.sh: Likewise. * t/extradep2.sh: Likewise. * t/lex-depend-cxx.sh: Likewise. * t/extradep.sh: Likewise. * t/yacc-depend2.sh: Likewise. * t/yacc-pr204.sh: Likewise. * t/lex-pr204.sh: Likewise. * t/yacc8.sh: Likewise. * t/acloca13.sh: Likewise. * t/lex-depend.sh: Likewise, and enhance. * t/acloca14.sh: Likewise. * t/aclocal7.sh: Likewise. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 3a1a8c6d 2012-06-22T11:40:39 tests: automatic re-execution works for non-POSIX shells too Some inferior shells are too greedy in parsing their input. If a non-POSIX Bourne shell (like Solaris 10 /bin/sh) was used to launch one of our test scripts, it would fail unconditionally, because it unexpectedly saw some (by it) unsupported constructs, notwithstanding such constructs being placed *after* the code implementing automatic test re-execution with a better shell. In conclusion, the shell bailed out like this: $ /bin/sh t/ar.sh $ t/ar.sh: syntax error at line 257: `is_newest_files=$' unexpected By moving all the potentially problematic code in a separate file, to be sourced only after the code for automatic re-execution with a better shell, we ensure that inferior shell cannot see such code by mistake. * defs: All code after automatic shell re-execution moved out ... * t/ax/test-init.sh: ... to this new file. * syntax-checks.mk (xdefs): Add it. * Makefile.am (dist_check_DATA): Add it. Also move in 'defs' from a less explicit 'check_DATA' declaration. (nodist_check_DATA): Move in 'defs-static' from a less explicit 'check_DATA' declaration. (check_DATA): Remove. * t/self-check-sanity.sh: Remove, it was actually too hacky and brittle, sanity-checking situations we don0t actually care about. * t/list-of-tests.mk: Adjust. * t/self-check-explicit-skips.sh: Adjust, and fix a botched heading comments while we are at it. * t/self-check-reexec.tap: Adjust. * t/self-check-cleanup.tap: Likewise. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 511b6896 2012-06-11T21:21:32 maintcheck: fix failures, both real and spurious * syntax-checks.mk (sc_rm_minus_f): Whitelist the 't/subobj-clean*-pr10697.sh' tests. * t/subobj-clean-pr10697.sh: When redefining PATH, use '$PATH_SEPARATOR', not hard-coded ':'. * t/subobj-clean-lt-pr10697.sh: Likewise. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 6bd70f6a 2012-05-25T18:49:07 [ng] maintcheck: some tweaks and fixlets * syntax-checks.mk (sc_no_brace_variable_expansions): Do not complain about ${MAKEVAR} usages in comments: they might be legitimate. This change is not strictly required for mainline automake, but will help in the Automake-NG branch. * sc_tests_here_document_format: Relax a bit, so that usages like "cout << "string" << endl;" in the test scripts (usages which can be used in here documents defining C++ sources) are not flagged as uses of bad delimiters for here documents. This change is not strictly required for mainline automake, but will help in the Automake-NG branch, and will anyway be more future proof w.r.t. possible future testsuite additions. (sc_tests_Exit_not_exit): Do not whitelist lines containing $PERL explicitly (that was only required for one test); instead ... * t/ext2.sh: ... use "exit (1)" instead of "exit 1" in the perl invocation of the guilty script. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 7b142a7b 2012-05-15T16:12:09 tests: use 'parallel-tests' Automake option by default This will help our transition from 'serial-tests' to 'parallel-tests' as the default test suite driver enabled by a TESTS assignment in the input Makefile.am. Note that that change of default will only take place in master, though. * defs: Pass the 'parallel-tests' option to the AM_INIT_AUTOMAKE invocation in the created 'configure.ac' stub, unless the variable 'am_serial_tests' is set to "yes". Don't pay attention anymore to the 'am_parallel_tests' variable, that's obsolete now. * defs-static.in: Warn if the 'am_serial_tests' variable is set in the environment; conversely, don't warn anymore about 'am_parallel_tests' being set in the environment. * Makefile.am (AM_TESTS_ENVIRONMENT): Nullify the 'am_serial_tests' variable instead of the now-obsolete 'am_parallel_tests' one. * syntax-checks.mk (sc_tests_obsolete_variables): Also warn against uses of 'am_parallel_tests', which is now deprecated in favor of 'am_serial_tests'. Similarly, if a use of 'parallel_tests' is seen, suggest using 'am_serial_tests' instead, not 'am_parallel_tests'. * gen-testsuite-part: Now that we use the 'parallel-tests' by default in our tests, we need to completely change the logic and semantics of generation of sibling tests for those tests that check the Automake generated testsuite harness itself. Do that, and give a complete explanation of the new logic and semantics in the relevant comments. * t/README: Update. * Lots of test cases: Adjust. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 67b86e08 2012-05-05T02:01:20 maintcheck: reduce code duplication, increase coverage * syntax-checks.mk: Move ... (sc_tests_plain_aclocal, sc_tests_plain_autoconf, sc_tests_plain_perl, sc_tests_plain_autoupdate, sc_tests_plain_automake, sc_tests_plain_make, sc_tests_plain_autoheader, sc_tests_plain_autoreconf, sc_tests_plain_autom4te): ... all these targets ... (sc_tests_plain_egrep_fgrep): ... and part of this target ... (sc_tests_plain_check_rules): ... into this variable, and reimplement their recipes ... ($(sc_tests_plain_check_rules)): ... with this static pattern rule. Enhance the coverage they offer a little since we are at it. (sc_m4_am_plain_egrep_fgrep): New rule, the part of the old 'sc_tests_plain_egrep_fgrep' rule that checked for use of 'fgrep' and 'egrep' in *.am and *.m4 fragments (rather than in test scripts). (syntax_check_rules): Update. * t/dist-formats.tap: Fix bad use of "make" instead of "$MAKE" revealed by the extra coverage. * t/cond5.sh, t/auxdir-autodetect.sh: Cosmetic changes to avoid spuriously triggering the maintainer checks due to the enhanced coverage. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 7a1eb9ff 2012-04-02T17:05:42 AM_PROG_MKDIR_P: deprecate, to be removed in Automake 1.13 Support for the obsolescent 'AM_PROG_MKDIR_P' macro (and its output variable '$(mkdir_p)') has already been deprecated in the documentation. It's now time to make its use actively emit warnings in the 'obsolete' category as well. * automake.in (scan_autoconf_traces): Warn about 'AM_PROG_MKDIR_P' obsolescent if that macro is seen. * m4/mkdirp.m4 (AM_PROG_MKDIR_P): Warn about its own obsolescence. * m4/init.m4: Require 'AC_PROG_MKDIR_P', not 'AM_PROG_MKDIR_P'. * t/mkdirp-deprecation.sh: New test. * t/list-of-tests.mk: Add it. * syntax-check.mk (sc_mkdir_p): Delete this check as obsolete. (syntax_check_rules): Remove it. * t/gettext-macros.sh: Ensure the gettext-requiring tests will call aclocal and automake with the 'obsolete' warnings disabled, since even recent versions of gettext used the now-deprecated 'AM_PROG_MKDIR_P' m4 macro. * NEWS: Update. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 41f418b0 2012-04-18T15:08:37 maintainer-check: fix definition of $(ams) again * syntax-checks.mk (ams): The previous change 'v1.11b-36-g127adfb' solved one problem in the definition of this variable, but also caused it contain the names of all the left-behind 't/*.dir' temporary test directories. Fix that. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 127adfb5 2012-04-18T13:40:59 maintainer-check: do not hang * syntax-checks.mk (ams): The definition of this variable was invoking the 'find' utility in an incorrect way, which resulted into the variable being empty, thus reducing coverage in some maintainer check and making other hang. Fix this. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 8036e5a1 2012-04-11T21:01:39 maintcheck: avoid yet more spurious failures (2) Some maintainer checks were too greedy in processing 'Makefile.am' files, looking for them even in temporary directories left behind by the test cases, thus causing occasional spurious failures. * syntax-checks.mk (ams): Ignore 'Makefile.am' files in the temporary test directories. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini ee6eb9fa 2012-04-11T19:18:21 maintcheck: fix spurious failures * syntax-check.mk (sc_mkinstalldirs): Now the 'mkinstalldirs' is listed in the top-level 'Makefile.am', not in 'lib/Makefile.am'; adjust the "whitelist" accordingly. (sc_ensure_testsuite_has_run): The 'test-suite.log' file created by "make check" is now placed in the top-level directory, not in the 't/' subdirectory. Adjust by using '$(TEST_SUITE_LOG)' instead of an hand-crafted path for the 'test-suite.log' file. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 8e02441b 2012-04-06T15:20:54 maint: no more make recursion in Automake's build system We finally merge testsuite-related part of the Automake build system with the top-level one. See also yesterday's commit 'v1.11-2124-ga4b0f4b', "maint: remove most recursion in automake's own build system". * t/gen-testsuite-part: Move ... * gen-testsuite-part: ... here, with required adjustments. * t/defs-static.in: Move ... * defs-static.in: ... here, with required adjustments. In particular ... ($testsrcdir, $testbuilddir): Removed. ($top_testsrcdir): Renamed ... ($am_top_srcdir): ... to this. ($top_testbuilddir): Renamed ... ($am_top_builddir): ... to this. * t/defs: Move ... * defs: ... here, and adjust as required. * t/Makefile.am: Merge ... * Makefile.am: ... in here, with related adjustments and simplifications. * bootstrap: Adjust as required. * syntax-checks.mk: Likewise. * .gitignore: Likewise. * t/ax/tap-setup.sh: Likewise. * t/get-sysconf.sh: Likewise. * t/help-multilib.sh: Likewise. * t/multlib.sh: Likewise. * t/parallel-tests2.sh: Likewise. * t/self-check-cleanup.tap: Likewise. * t/self-check-exit.tap: Likewise. * t/self-check-dir.tap: Likewise. * t/self-check-explicit-skips.sh: Likewise. * t/self-check-reexec.tap: Likewise. * t/self-check-sanity.sh: Likewise. * t/yacc-d-cxx.sh: Likewise. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 8a5096d1 2012-04-06T13:12:25 tests: rename 'tests/' => 't/', '*.test' => '*.sh' When we (soon) convert the Automake testsuite to a non-recursive make setup, we'll have to fix the entries of $(TESTS) to be prepended with the subdirectory they are in; this will increase the length of $(TESTS), and thus increase the possibility of exceeding the command-line length limits on some systems (most notably, MinGW/MSYS). See automake bug#7868 for more information. Thus we rename the 'tests/' subdirectory to 't/', and each 'x.test' script in there to 'x.sh'; this way, the $(TESTS) entry 'foo.test' will become 't/foo.sh', which have the same number of characters. * tests/: Rename ... * t/: ... to this. * t/*.test: Rename ... * t/*.sh: ... to this. * t/.gitignore: Removed as obsolete. * t/defs: Adjust. * t/gen-testsuite-part: Likewise. * t/list-of-tests.mk: Likewise. * t/ccnoco.sh: Likewise. * t/ccnoco3.sh: Likewise. * t/self-check-cleanup.tap: Likewise. * t/self-check-dir.tap: Likewise. * t/self-check-me.tap: Likewise. * t/self-check-reexec.tap: Likewise. * README: Likewise. * bootstrap: Likewise * configure.ac: Likewise. * Makefile.am: Likewise. * .gitignore: Likewise. * syntax-check.mk: Likewise. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 23f0543e 2012-04-05T21:20:29 tests: move most helper scripts and files into the 'ax' subdirectory * tests/defs-static.in ($am_testauxdir): New variable. * tests/testsuite-summary-checks.sh: Moved ... * tests/ax/testsuite-summary-checks.sh: ... here. * tests/trivial-test-driver: Moved ... * tests/ax/trivial-test-driver: ... here. * tests/tap-summary-aux.sh: Moved ... * tests/ax/tap-summary-aux.sh: ... here. * tests/distcheck-hook-m4.am: Moved ... * tests/ax/distcheck-hook-m4.am: ... here. * tests/prove-runner: Moved ... * tests/ax/prove-runner: ... here. * tests/depcomp.sh: Moved ... * tests/ax/depcomp.sh: ... here. * tests/tap-setup.sh: Moved ... * tests/ax/tap-setup.sh: ... here. * tests/tap-functions.sh: Moved ... * tests/ax/tap-functions.sh: ... here. * tests/plain-functions.sh: Moved ... * tests/ax/plain-functions.sh: ... here. * tests/extract-testsuite-summary: Moved ... * tests/ax/extract-testsuite-summary.pl: .. . here. * tests/gen-testsuite-part: Adjusted accordingly. * tests/Makefile.am: Likewise. * tests/defs: Likewise. * syntax-check.mk: Likewise. * Several tests: Likewise. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Stefano Lattarini 57d09886 2012-03-02T22:50:21 maintcheck: fix few spurious failures * syntax-checks.mk: Fix some spurious failures by tightening and/or tweaking few checks so that some false positives end up whitelisted.
Stefano Lattarini c4f2b64c 2012-02-23T22:06:14 maintcheck: remove an obsolete check * syntax-checks.mk (sc_perl_local_no_parens): Remove, we don't even allow the use of local but for the '$_' and '$~' special variables. (syntax_check_rules): Adjust.
Stefano Lattarini 2d951983 2012-02-23T19:21:00 build: do not quote `like this', as per GCS recommendation This patch converts the files implementing the automake's own build system to the use of new quoting format 'like this' or "like this" rather than `like this'. * bootstrap, configure.ac, syntax-checks.mk, Makefile.am, lib/Makefile.am, m4/Makefile.am, syntax-checks.mk: Update quoting format throughout, in comments and diagnostic. Some minor related rewordings and reformatting since we are at it.
Stefano Lattarini db973eaa 2012-02-21T19:47:36 tests: prefer 'configure.ac' over 'configure.in' With this change, our testsuite now uses 'configure.ac' as the name for the typical autoconf input, instead of the obsolescent 'configure.in' (which has been deprecated for several years, at least since autoconf 2.50). Most of the test cases changed by this commit have been automatically modified with this sed command (using GNU sed): sed -i 's/\<configure\(\\\?\)\.in\>/configure\1.ac/g' * syntax-checks.mk (sc_tests_no_configure_in): New syntax check. (syntax_check_rules): Add it. * tests/defs: Create stub for autoconf input in 'configure.ac', not in 'configure.in'. Adjust comments. ($AUTOCONF, $AUTOHEADER, $AUTORECONF): Remove workaround for the infamous debian autoconf wrapper: we don't need such workaround anymore now that we name our autoconf input as 'configure.ac'. For more information, see commit v1.11-564-g63da492 "test defs: hack to support autoconf-wrapper programs" of 16-12-2011. * tests/README: Use 'configure.ac', not 'configure.in'. * Many many tests: Likewise. * tests/backcompat3.test: Adjust to avoid spurious failures. * tests/backcompat5.test: Likewise. * tests/missing6.test: Likewise. * tests/backcompat6.test: Likewise, and extend a bit since we are at it.
Stefano Lattarini 622a348e 2012-02-17T13:14:57 tests: TAP-based tests should error if no plan was specified After this change, it will still be OK for TAP-based tests not to report any explicit TAP plan -- but they should state *explicitly* that they want to do so, by calling the 'plan_' function with a proper argument (currently, either "later" or "unknonwn"). Motivated by a recent issue introduced by yesterday's commit 'v1.11-1959-g0699a84' (pointed out by Peter Rosin, and fixed by follow-up commit 'v1.11-1961-gea44190'). * tests/tap-functions.sh (plan_): Get rid of '$have_tap_plan_', and refactor use and initialization of '$planned_' in a way that will allow client script to get more information on which kind of plan (if any) has been declared by the former 'plan_' invocation. (skip_all_): Adjust. * tests/defs (exit trap): Only print the "lazy" TAP plan if 'plan_' has requested that *explicitly*. * syntax-check.mk (sc_tests_tap_plan): Remove: it's obsolete now, since a TAP-based test that doesn't call 'plan_' explicitly won't print any TAP plan, and the TAP driver will catch that and report an error. (syntax_check_rules): Adjust.
Stefano Lattarini f76cb63c 2012-02-16T18:44:13 maintcheck: whitelist some false positives Instead of tweaking or dumbing down some of our sources or tests in order not to make them spuriously trigger few maintainer checks, we tweak such checks instead. * syntax-checks.mk (sc_tests_overriding_macros_on_cmdline): Also allow the variable 'exp' to be overridden on the make command line. Whitelist the test 'make-dryrun.test' where appropriate. (sc_mkinstalldirs): When whitelisting the 'mkinstalldirs' occurrence in 'lib/Makefile.am', do not look for the exact line number: it is obviously too fragile.
Stefano Lattarini ef20e28b 2012-01-28T13:23:16 maintcheck: fix real and spurious warnings * lib/Makefile.am (install-data-hook): Correctly quote $(DESTDIR) occurrences. * Makefile.am (install-exec-hook, uninstall-hook): Likewise. (autodiffs): Prefer '$(am__cd)' to plain 'cd', where warranted. * doc/Makefile.am ($(srcdir)/amhello-1.0.tar.gz): Likewise. Also, prefer using AC_SUBST'd $(abs_top_builddir) over obtaining it at runtime from $(top_builddir). * syntax-check.mk (sc_mkinstalldirs): Tweak to whitelist known harmless occurrences of the checked-against usages. (sc_no_for_variable_in_macro): Likewise. * tests/CheckListOfTests.am (maintainer-check-list-of-tests): Tweak to avoid spuriously triggering the 'sc_no_for_variable_in_macro' maintainer check. Prefer '$(am__cd)' to plain 'cd' when warranted.
Stefano Lattarini 25d3adb1 2012-01-28T12:38:07 maintcheck: take advantage of some GNU make features We can do so now that our maintainer checks require GNU make unconditionally. * syntax-check.mk (ams, xtests): Redefine as "immediate variables", using the GNU make $(shell ...) builtin. (maintainer-check-list-of-tests): Take advantage of GNU make "-C" option. Don't use $(AM_MAKEFLAGS), we shouldn't need it with GNU make.
Stefano Lattarini e508e09d 2012-01-28T10:05:18 build: require GNU make in order to run the maintainer checks This is not a real regression in portability, since most maintainer check rules already assumed GNU grep, and were anyway only meant to run on the developers' systems (where we can safely assume the presence of GNU make). This change will allow us to take advantage, in future changes, of more GNU make features, thus simplifying or optimizing some of our maintainer rules. * GNUmakefile: New, including 'Makefile' and 'syntax-checks.mk'. * configure.ac (AC_CONFIG_LINKS): Link it in the builddir. * Makefile.am (EXTRA_DIST): Distribute 'GNUmakefile' and 'syntax-checks.mk'. Move all syntax-check rules and auxiliary variables into ... * syntax-checks.mk: ... this new file, with some adjustments.