[augeas-devel] [PATCH] enable automake-1.11 features: colorized and parallel tests, etc.
Jim Meyering
jim at meyering.net
Mon Jun 15 14:31:11 UTC 2009
Now that automake-1.11 will soon be hitting F9, F10, F11,
you may want to use some of its features.
Parallel tests is can be useful when you run parallel
"make check" on a multi-core system.
E.g., consider running "make -j9 check" on a quad-core system:
It took about 70 seconds before the changes.
Adding automake's parallel-tests option shaved off only 5 or 10s
due to the fact that so much time was spent in a single test:
test-lenses.sh
After splitting test-lenses.sh into its 54 separately-runnable tests,
and moving long-running tests "up" in the list, so that they start sooner,
a parallel "make check" completes in under 30 seconds.
Oddly, sometimes lens-grub.sh takes over 50(!) seconds and makes the total
test time approach 70s. Other times it completes in just 5 seconds.
Here's some evidence:
$ for i in $(seq 10); do
env time --format %e \
./augparse --nostdinc -I ../lenses ../lenses/tests/test_grub.aug
done
7.74
46.69
7.03
6.03
4.59
8.08
5.61
25.45
8.41
27.95
--------------------------------
automake's colorized-tests option is ok.
Colors "PASS" in green and "FAIL" in red.
Other colors for XPASS and XFAIL. No big deal.
Likewise, I like silent-rules, but it's no big deal.
----------
Along the way, I noticed that "make distcheck" was failing due to
fa_sym.version not being distributed. That's the 3rd patch below.
----------
As to whether it's ok to depend on automake-1.11, realize that
the only people who will need it are those who build from a
cloned directory. If you build from a tarball, you don't need
any version of automake. And if you're developing, you can
be expected to use the latest versions of autoconf and automake.
Jim
--------
>From 5b02afacbe1c57a6d3391651c8a36375e2d86ff3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 15 Jun 2009 11:41:15 +0200
Subject: [PATCH 1/3] enable automake-1.11 features: colorized and parallel tests, etc.
Also enable automake's new "silent-rules" feature.
Use "make V=1" to see the usual, verbose-mode commands.
* configure.ac: Require automake-1.11.
Enable color-tests parallel-tests. Use AM_SILENT_RULES([yes])
---
configure.ac | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8eb08c9..91f2c85 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,8 @@ AC_INIT(augeas, 0.5.1)
AC_CONFIG_SRCDIR([src/augeas.c])
AC_CONFIG_AUX_DIR([build/aux])
AM_CONFIG_HEADER([config.h])
-AM_INIT_AUTOMAKE([-Wno-portability])
+AM_INIT_AUTOMAKE([-Wno-portability 1.11 color-tests parallel-tests])
+AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
dnl Check for NaturalDocs
--
1.6.3.2.406.gd6a466
>From 525a0463bcc73e78c4ab2fc6731f1f9f5a79ce76 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 15 Jun 2009 14:28:15 +0200
Subject: [PATCH 2/3] tests: divide test-lenses.sh into its 54 independent tests
This permits these tests to be run in parallel.
* tests/lens-test-1: New file.
* tests/Makefile.am (lens_tests): Define.
(check-lens-tests): New rule, to ensure that the above stays in
sync with reality.
(check): Depend on check-lens-tests.
($(lens_tests)): New rule. Generate these files.
(check_SCRIPTS): Remove test-lenses.sh. Add $(lens_tests).
(EXTRA_DIST): Add lens-test-1.
* tests/test-lenses.sh: Remove file.
---
tests/Makefile.am | 99 ++++++++++++++++++++++++++++++++++++++++++++++----
tests/lens-test-1 | 12 ++++++
tests/test-lenses.sh | 38 -------------------
3 files changed, 104 insertions(+), 45 deletions(-)
create mode 100755 tests/lens-test-1
delete mode 100755 tests/test-lenses.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1f5d1ef..8c13bcf 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -9,13 +9,98 @@ AM_CFLAGS = $(AUGEAS_CFLAGS) $(WARN_CFLAGS) $(GNULIB_CFLAGS) \
valgrind: fatest
libtool --mode=execute valgrind --quiet --leak-check=full ./fatest
-check_SCRIPTS=test-lenses.sh test-interpreter.sh test-get.sh \
- test-put-symlink.sh test-save-empty.sh test-mv.sh \
- test-bug-1.sh test-idempotent.sh test-preserve.sh \
- test-events-saved.sh test-save-mode.sh test-unlink-error.sh
+lens_tests = \
+ lens-sudoers.sh \
+ lens-aliases.sh \
+ lens-aptpreferences.sh \
+ lens-aptsource.sh \
+ lens-bbhosts.sh \
+ lens-cron.sh \
+ lens-darkice.sh \
+ lens-dhclient.sh \
+ lens-dnsmasq.sh \
+ lens-dpkg.sh \
+ lens-dput.sh \
+ lens-exports.sh \
+ lens-fstab.sh \
+ lens-gdm.sh \
+ lens-group.sh \
+ lens-hosts.sh \
+ lens-inifile.sh \
+ lens-inittab.sh \
+ lens-interfaces.sh \
+ lens-iptables.sh \
+ lens-krb5.sh \
+ lens-ldap.sh \
+ lens-limits.sh \
+ lens-logrotate.sh \
+ lens-lokkit.sh \
+ lens-modprobe.sh \
+ lens-monit.sh \
+ lens-ntp.sh \
+ lens-openvpn.sh \
+ lens-pam.sh \
+ lens-passwd.sh \
+ lens-pbuilder.sh \
+ lens-php.sh \
+ lens-phpvars.sh \
+ lens-postfix_main.sh \
+ lens-postfix_master.sh \
+ lens-puppet.sh \
+ lens-rsyncd.sh \
+ lens-rx.sh \
+ lens-samba.sh \
+ lens-services.sh \
+ lens-shellvars.sh \
+ lens-slapd.sh \
+ lens-soma.sh \
+ lens-spacevars.sh \
+ lens-squid.sh \
+ lens-sshd.sh \
+ lens-sysctl.sh \
+ lens-vsftpd.sh \
+ lens-webmin.sh \
+ lens-xinetd.sh \
+ lens-xorg.sh \
+ lens-grub.sh \
+ lens-yum.sh
-EXTRA_DIST=augtest $(AUGTESTS) root \
- $(check_SCRIPTS) $(wildcard modules/*.aug) xpath.tests
+ME = tests/Makefile.am
+
+# Ensure that the above list stays up to date:
+# Construct two lists: list of lens-*.sh from lens_tests = ... above,
+# and the list of ../lenses/tests/test_*.aug names.
+# If they're not the same, print the new or removed names and fail.
+check: check-lens-tests
+.PHONY: check-lens-tests
+_v = lens_tests
+check-lens-tests:
+ @u=$$({ sed -n '/^$(_v) =[ ]*\\$$/,/[^\]$$/p' \
+ $(srcdir)/Makefile.am \
+ | sed 's/^ *//;/^\$$.*/d;/^$(_v) =/d' \
+ | sed 's,\.sh.*\\,.sh,'; \
+ ls -1 $(srcdir)/../lenses/tests/test_*.aug \
+ | sed 's,.*/test_\([^./]*\)\.aug$$,lens-\1.sh,'; \
+ } | LC_ALL=C sort | uniq -u); \
+ test "x$$u" = x && : \
+ || { printf '%s\n' "$$u" >&2; \
+ echo '$(ME): new test(s)? update lens_tests' >&2; exit 1; }
+
+DISTCLEANFILES = $(lens_tests)
+$(lens_tests): lens-test-1
+ $(LN_S) $< $@
+
+check_SCRIPTS = \
+ test-interpreter.sh \
+ $(lens_tests) \
+ test-get.sh \
+ test-put-symlink.sh test-save-empty.sh test-mv.sh \
+ test-bug-1.sh test-idempotent.sh test-preserve.sh \
+ test-events-saved.sh test-save-mode.sh test-unlink-error.sh
+
+EXTRA_DIST = \
+ augtest $(AUGTESTS) root lens-test-1 \
+ $(check_SCRIPTS) $(wildcard modules/*.aug) xpath.tests
noinst_SCRIPTS = $(check_SCRIPTS)
@@ -26,7 +111,7 @@ TESTS_ENVIRONMENT = \
abs_top_builddir='$(abs_top_builddir)' \
abs_top_srcdir='$(abs_top_srcdir)'
-TESTS = $(check_SCRIPTS) $(check_PROGRAMS) augtest
+TESTS = augtest $(check_SCRIPTS) $(check_PROGRAMS)
INCLUDES = -I$(top_srcdir)/src
diff --git a/tests/lens-test-1 b/tests/lens-test-1
new file mode 100755
index 0000000..0accbf5
--- /dev/null
+++ b/tests/lens-test-1
@@ -0,0 +1,12 @@
+#! /bin/sh
+# Run one lens test.
+# Derive names of inputs from the name of this script.
+
+TOPDIR=$(cd $(dirname $0)/.. && pwd)
+[ -n "$abs_top_srcdir" ] || top_srcdir=$TOPDIR
+LENS_DIR=$abs_top_srcdir/lenses
+
+me=$(echo "$0"|sed 's,.*/lens-\(.*\)\.sh$,\1,')
+
+t=$LENS_DIR/tests/test_$me.aug
+exec augparse --nostdinc -I "$LENS_DIR" "$t"
diff --git a/tests/test-lenses.sh b/tests/test-lenses.sh
deleted file mode 100755
index acba64c..0000000
--- a/tests/test-lenses.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#! /bin/sh
-
-set -e
-
-VERBOSE=n
-if [ "x$1" = "x-v" ]; then
- VERBOSE=y
-fi
-
-TOPDIR=$(cd $(dirname $0)/.. && pwd)
-[ -n "$abs_top_srcdir" ] || top_srcdir=$TOPDIR
-
-
-LENS_DIR=$abs_top_srcdir/lenses
-TESTS=$LENS_DIR/tests/test_*.aug
-
-LOG=$(mktemp /tmp/test-lenses.XXXXXX)
-trap 'rm "$LOG"' EXIT
-
-result=0
-for t in $TESTS
-do
- printf "%-30s ... " $(basename "$t" .aug)
- set +e
- augparse --nostdinc -I "$LENS_DIR" "$t" > "$LOG" 2>&1
- ret=$?
- set -e
- if [ ! $ret -eq 0 ]; then
- echo FAIL
- result=1
- elif [ $ret -eq 0 ]; then
- echo PASS
- fi
- if [ "$VERBOSE" = "y" ] ; then
- cat "$LOG"
- fi
-done
-exit $result
--
1.6.3.2.406.gd6a466
>From 41b9645110b5f0e1b740f64ef9bb444e1666e405 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 15 Jun 2009 14:47:22 +0200
Subject: [PATCH 3/3] build: fix "make distcheck" failure
* src/Makefile.am (EXTRA_DIST): Add fa_sym.version.
---
src/Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index e7a472b..738fda1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,7 +6,7 @@ AM_CFLAGS = @AUGEAS_CFLAGS@ @WARN_CFLAGS@ $(GNULIB_CFLAGS)
AM_YFLAGS=-d -p spec_
-EXTRA_DIST=try augeas_sym.version
+EXTRA_DIST = try augeas_sym.version fa_sym.version
BUILT_SOURCES = datadir.h
--
1.6.3.2.406.gd6a466
More information about the augeas-devel
mailing list