Gitweb:        
http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=63274de1dd018dd374abf2aa20acb5b9e47e0313
Commit:        63274de1dd018dd374abf2aa20acb5b9e47e0313
Parent:        6bb97a7e3c733116ea2cd54a473550a9f2dd900b
Author:        Jim Meyering <[email protected]>
AuthorDate:    Mon Jun 15 14:28:15 2009 +0200
Committer:     David Lutterkort <[email protected]>
CommitterDate: Fri Jun 26 21:52:56 2009 -0700

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/.gitignore: suppress lens-*.sh files
---
 tests/.gitignore     |    1 +
 tests/Makefile.am    |   99 ++++++++++++++++++++++++++++++++++++++++++++++----
 tests/lens-test-1    |   12 ++++++
 tests/test-lenses.sh |   38 -------------------
 4 files changed, 105 insertions(+), 45 deletions(-)

diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..c6c59c8
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1 @@
+lens-*.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..6f2a09f
--- /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" ] || abs_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

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to