maint: speed up make check (vc_exe_in_TESTS)
authorPádraig Brady <P@draigBrady.com>
Mon, 17 Oct 2011 10:20:01 +0000 (11:20 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 17 Oct 2011 10:56:10 +0000 (11:56 +0100)
* tests/check.mk (vc_exe_in_TESTS): The main change is to
not start a sed process for each file under tests/,
which was taking around 2.5s on a 2.1GHz i3-2310M.
Also adjust the rule to no longer use temporary files.

tests/check.mk

index d45c288..557d41a 100644 (file)
 _v = TESTS
 _w = root_tests
 vc_exe_in_TESTS: Makefile
-       $(AM_V_GEN)rm -f t1 t2;                                         \
-       if test -d $(top_srcdir)/.git && test $(srcdir) = .; then       \
-         { sed -n '/^$(_v) =[   ]*\\$$/,/[^\]$$/p'                     \
-               $(srcdir)/Makefile.am                                   \
-           | sed 's/^  *//;/^\$$.*/d;/^$(_v) =/d';                     \
-           sed -n '/^$(_w) =[   ]*\\$$/,/[^\]$$/p'                     \
-               $(srcdir)/Makefile.am                                   \
-           | sed 's/^  *//;/^\$$.*/d;/^$(_w) =/d'; }                   \
-           | tr -s '\012\\' '  ' | fmt -1 | sort -u > t1 &&            \
-         for f in `cd $(top_srcdir) && build-aux/vc-list-files $(subdir)`; do \
-           f=`echo $$f|sed 's!^$(subdir)/!!'`;                         \
+       $(AM_V_GEN)if test -d $(top_srcdir)/.git && test $(srcdir) = .; then \
+        {                                                              \
+         for list in $(_v) $(_w); do                                   \
+           sed -n "/^$$list =[  ]*\\\\$$/,/[^\]$$/p" Makefile.am |     \
+           sed -n 's/^  *\([^$$         ]\{1,\}\).*/\1/p';             \
+         done;                                                         \
+         for f in `cd $(top_srcdir) &&                                 \
+          build-aux/vc-list-files $(subdir) | sed 's!^$(subdir)/!!'`; do \
            test -f "$$f" && test -x "$$f" && echo "$$f";               \
-         done | sort -u > t2 &&                                        \
-         diff -u t1 t2 || exit 1;                                      \
-         rm -f t1 t2;                                                  \
+         done;                                                         \
+        } | sort | uniq -u | grep . && exit 1 ||:;                     \
        else :; fi
 
 check: vc_exe_in_TESTS