2009-10-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ Perl coverage support using Devel::Cover.
+ This introduces makefile rules to run the testsuite with Perl
+ coverage enabled. It skips tests that use perl ithreads, by
+ unsetting AUTOMAKE_JOBS and setting WANT_NO_THREADS to make the
+ threaded tests skip.
+ * Makefile.am (PERL_COVERAGE_DB, PERL_COVERAGE_FLAGS)
+ (PERL_COVER): New variables.
+ (check-coverage, recheck-coverage, clean-coverage): New phony
+ targets.
+ (check-coverage-run, recheck-coverage-run): New phony helper
+ targets.
+ (clean-local): New, depend on clean-coverage.
+ * lib/Automake/tests/Condition-t.pl: Skip if WANT_NO_THREADS is
+ set.
+ * lib/Automake/tests/DisjConditions-t.pl: Likewise.
+ * tests/defs.in: New required entry 'perl-threads'.
+ * tests/parallel-am.test: Use it to skip if WANT_NO_THREADS is
+ set.
+ * tests/parallel-am2.test: Likewise.
+ * tests/parallel-am3.test: Likewise.
+
Add convenience `recheck' target to our toplevel Makefile.am.
* Makefile.am (recheck): New convenience target.
* tests/README: Give examples for running only failed or
* Use `keep_testdirs=yes' to keep test directories for successful
tests also.
+* Use perl coverage information to ensure your new code is thoroughly
+ tested by your new tests.
+
================================================================
= Release procedure
dist-hook:
cd $(distdir)/tests && chmod a+rx *.test
+
+# Perl coverage statistics.
+PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
+PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
+PERL_COVER = cover
+
+check-coverage-run recheck-coverage-run: all
+ $(mkinstalldirs) $(PERL_COVERAGE_DB)
+ PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
+ WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
+ $(MAKE) $(AM_MAKEFLAGS) `echo $@ | sed 's/-coverage-run//'`
+
+check-coverage-report:
+ @if test ! -d "$(PERL_COVERAGE_DB)"; then \
+ echo "No coverage database found in \`$(PERL_COVERAGE_DB)'." >&2; \
+ echo "Please run \`make check-coverage' first" >&2; \
+ exit 1; \
+ fi
+ $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
+
+# We don't use direct dependencies here because we'd like to be able
+# to invoke the report even after interrupted check-coverage.
+check-coverage: check-coverage-run
+ $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
+
+recheck-coverage: recheck-coverage-run
+ $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
+
+clean-coverage:
+ rm -rf "$(PERL_COVERAGE_DB)"
+clean-local: clean-coverage
+
+.PHONY: check-coverage recheck-coverage check-coverage-run \
+ recheck-coverage-run check-coverage-report clean-coverage
+
# Some simple checks, and then ordinary check. These are only really
# guaranteed to work on my machine.
syntax_check_rules = \
TEST_SUBDIRS = lib/Automake/tests tests
+# Perl coverage statistics.
+PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
+PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
+PERL_COVER = cover
+
# Some simple checks, and then ordinary check. These are only really
# guaranteed to work on my machine.
syntax_check_rules = \
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
-clean-am: clean-generic mostlyclean-am
+clean-am: clean-generic clean-local mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
- ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
- dist-hook dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
- distcheck distclean distclean-generic distclean-tags \
+ clean-local ctags ctags-recursive dist dist-all dist-bzip2 \
+ dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \
+ dist-zip distcheck distclean distclean-generic distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-binSCRIPTS \
install-data install-data-am install-dvi install-dvi-am \
dist-hook:
cd $(distdir)/tests && chmod a+rx *.test
+check-coverage-run recheck-coverage-run: all
+ $(mkinstalldirs) $(PERL_COVERAGE_DB)
+ PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
+ WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
+ $(MAKE) $(AM_MAKEFLAGS) `echo $@ | sed 's/-coverage-run//'`
+
+check-coverage-report:
+ @if test ! -d "$(PERL_COVERAGE_DB)"; then \
+ echo "No coverage database found in \`$(PERL_COVERAGE_DB)'." >&2; \
+ echo "Please run \`make check-coverage' first" >&2; \
+ exit 1; \
+ fi
+ $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
+
+# We don't use direct dependencies here because we'd like to be able
+# to invoke the report even after interrupted check-coverage.
+check-coverage: check-coverage-run
+ $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
+
+recheck-coverage: recheck-coverage-run
+ $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
+
+clean-coverage:
+ rm -rf "$(PERL_COVERAGE_DB)"
+clean-local: clean-coverage
+
+.PHONY: check-coverage recheck-coverage check-coverage-run \
+ recheck-coverage-run check-coverage-report clean-coverage
+
.PHONY: $(syntax_check_rules)
$(syntax_check_rules): automake aclocal
maintainer-check: $(syntax_check_rules)
-# Copyright (C) 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2008, 2009 Free Software Foundation,
+# Inc.
#
# This file is part of GNU Automake.
#
BEGIN {
use Config;
if (eval { require 5.007_002; } # for CLONE support
- && $Config{useithreads})
+ && $Config{useithreads}
+ && !$ENV{WANT_NO_THREADS})
{
require threads;
import threads;
-# Copyright (C) 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2008, 2009 Free Software Foundation,
+# Inc.
#
# This file is part of GNU Automake.
#
BEGIN {
use Config;
if (eval { require 5.007_002; } # for CLONE support
- && $Config{useithreads})
+ && $Config{useithreads}
+ && !$ENV{WANT_NO_THREADS})
{
require threads;
import threads;
rm -f $priv_check_temp
test $overwrite_status = 0 && exit 77
;;
+ perl-threads)
+ # Skip with Devel::Cover: it cannot cope with threads.
+ test "$WANT_NO_THREADS" = yes && exit 77
+ ;;
python)
# Python doesn't support --version, it has -V
echo "$me: running python -V"
#! /bin/sh
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This test checks (0), (1), and (2). See sister tests for further coverage.
+required=perl-threads
. ./defs || Exit 1
set -e
#! /bin/sh
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 4) warning and normal error output should be identical, in that duplicate
# warnings should be omitted in the same way as without threads,
+required=perl-threads
. ./defs || Exit 1
set -e
#! /bin/sh
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# with --add-missing, even with concurrent file requirements, and the
# installation of aux files should be race-free,
+required=perl-threads
. ./defs || Exit 1
set -e