automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-NG] [PATCH 07/17] [ng] check: separate serial an parallel harn


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 07/17] [ng] check: separate serial an parallel harnesses in distinct '.am' files
Date: Tue, 22 May 2012 22:48:45 +0200

This is just code reordering.  No semantic change is intended.

* lib/am/check.am: Split out ...
* lib/am/parallel-tests.am, lib/am/serial-tests.am: ... into these
two files.
* automake.in (handle_tests): Adjust.
* Makefile.am (dist_am_DATA): Likewise.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 Makefile.am                            |    3 +-
 automake.in                            |   14 ++--
 lib/am/{check.am => parallel-tests.am} |  126 +-----------------------------
 lib/am/serial-tests.am                 |  134 ++++++++++++++++++++++++++++++++
 4 files changed, 146 insertions(+), 131 deletions(-)
 rename lib/am/{check.am => parallel-tests.am} (76%)
 create mode 100644 lib/am/serial-tests.am

diff --git a/Makefile.am b/Makefile.am
index 0da444a..001053c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -223,7 +223,8 @@ EXTRA_DIST += lib/Automake/Config.in
 ## --------------------- ##
 
 dist_am_DATA = \
-  lib/am/check.am \
+  lib/am/serial-tests.am \
+  lib/am/parallel-tests.am \
   lib/am/check2.am \
   lib/am/color-tests.am \
   lib/am/clean-hdr.am \
diff --git a/automake.in b/automake.in
index ff9bb54..032d70b 100644
--- a/automake.in
+++ b/automake.in
@@ -4631,13 +4631,13 @@ sub handle_tests
   if (var ('TESTS'))
     {
       push (@check_tests, 'check-TESTS');
-      $output_rules .= &file_contents ('check', new Automake::Location,
-                                      COLOR => !! option 'color-tests',
-                                      SERIAL_TESTS => !! option 'serial-tests',
-                                       CHECK_DEPS => "@check");
+
       if (option 'serial-tests')
         {
-          1; # Nothing to do, for now.
+          $output_rules .=
+            file_contents ('serial-tests', new Automake::Location,
+                           COLOR => !! option 'color-tests',
+                           CHECK_DEPS => "@check");
         }
       else
         {
@@ -4661,6 +4661,10 @@ sub handle_tests
                     "invalid test extensions: @invalid_test_suffixes";
             }
           @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes;
+          $output_rules .=
+            file_contents ('parallel-tests', new Automake::Location,
+                           COLOR => !! option 'color-tests',
+                           CHECK_DEPS => "@check");
           # It is *imperative* that the empty 'suffix goes last.
           # Otherwise, a declaration like "TESTS = all.test" would cause GNU
           # make to mistakenly try to build the 'all.log' and 'all.trs' files
diff --git a/lib/am/check.am b/lib/am/parallel-tests.am
similarity index 76%
rename from lib/am/check.am
rename to lib/am/parallel-tests.am
index 5a3cff2..fc33bff 100644
--- a/lib/am/check.am
+++ b/lib/am/parallel-tests.am
@@ -16,10 +16,6 @@
 
 include color-tests.am
 
-.PHONY: check-TESTS
-
-if !%?SERIAL_TESTS%
-
 ## New parallel test driver.
 ##
 ## The first version of the code here was adapted from check.mk, which was
@@ -323,6 +319,7 @@ check-TESTS:
 ## we rely on .PHONY to work portably.
        @rm -f $(TEST_SUITE_LOG)
        $(MAKE) $(TEST_SUITE_LOG)
+.PHONY: check-TESTS
 
 ## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc.
 ## It must also depend on the 'all' target.  See automake bug#11252.
@@ -338,124 +335,3 @@ recheck: all %CHECK_DEPS%
 .PHONY: recheck
 
 AM_RECURSIVE_TARGETS += check recheck
-
-else %?SERIAL_TESTS%
-
-## Obsolescent serial testsuite driver.
-
-if %?HANDLE-EXEEXT%
-## This is suboptimal, but we need to preserve the order of $(TESTS).
-am__check_cook_with_exeext_1 = \
-    $(if $(filter $(am__all_progs), $1), $1$(EXEEXT), $1)
-am__check_cook_with_exeext = $(strip \
-  $(if $(EXEEXT), $(foreach am__t, $1, $(call $(0)_1, $(am__t))), $1))
-else !%?HANDLE-EXEEXT%
-am__check_cook_with_exeext = $(strip $1)
-endif !%?HANDLE-EXEEXT%
-
-# TESTS can contain compiled programs, in which case we might have
-# to account for $(EXEEXT) appending.  For matching purposes, we
-# need to adjust XFAIL_TESTS as well.
-am__cooked_tests = $(call am__check_cook_with_exeext, $(TESTS))
-am__cooked_xfail_tests = $(call am__check_cook_with_exeext, $(XFAIL_TESTS))
-
-check-TESTS: $(am__cooked_tests)
-       @failed=0; all=0; xfail=0; xpass=0; skip=0; \
-       srcdir=$(srcdir); export srcdir; \
-       list='$(am__cooked_tests)'; \
-       $(am__tty_colors); \
-       is_xfail_test () { \
-         case " $(strip $(am__cooked_xfail_tests)) " in \
-           *" $$tst "*) return 0;; \
-           *) return 1;; \
-         esac; \
-       }; \
-       if test -n "$$list"; then \
-         for tst in $$list; do \
-           if test -f ./$$tst; then dir=./; \
-           else dir="$(srcdir)/"; fi; \
-           if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
-## Success
-             all=`expr $$all + 1`; \
-             if is_xfail_test; then \
-               xpass=`expr $$xpass + 1`; \
-               failed=`expr $$failed + 1`; \
-               col=$$red; res=XPASS; \
-             else \
-               col=$$grn; res=PASS; \
-             fi; \
-           elif test $$? -ne 77; then \
-## Failure
-             all=`expr $$all + 1`; \
-             if is_xfail_test; then \
-               xfail=`expr $$xfail + 1`; \
-               col=$$lgn; res=XFAIL; \
-             else \
-               failed=`expr $$failed + 1`; \
-               col=$$red; res=FAIL; \
-             fi; \
-           else \
-## Skipped
-             skip=`expr $$skip + 1`; \
-             col=$$blu; res=SKIP; \
-           fi; \
-           echo "$${col}$$res$${std}: $$tst"; \
-         done; \
-## Prepare the banner
-         if test "$$all" -eq 1; then \
-           tests="test"; \
-           All=""; \
-         else \
-           tests="tests"; \
-           All="All "; \
-         fi; \
-         if test "$$failed" -eq 0; then \
-           if test "$$xfail" -eq 0; then \
-             banner="$$All$$all $$tests passed"; \
-           else \
-             if test "$$xfail" -eq 1; then failures=failure; else 
failures=failures; fi; \
-             banner="$$All$$all $$tests behaved as expected ($$xfail expected 
$$failures)"; \
-           fi; \
-         else \
-           if test "$$xpass" -eq 0; then \
-             banner="$$failed of $$all $$tests failed"; \
-           else \
-             if test "$$xpass" -eq 1; then passes=pass; else passes=passes; 
fi; \
-             banner="$$failed of $$all $$tests did not behave as expected 
($$xpass unexpected $$passes)"; \
-           fi; \
-         fi; \
-## DASHES should contain the largest line of the banner.
-         dashes="$$banner"; \
-         skipped=""; \
-         if test "$$skip" -ne 0; then \
-           if test "$$skip" -eq 1; then \
-             skipped="($$skip test was not run)"; \
-           else \
-             skipped="($$skip tests were not run)"; \
-           fi; \
-           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
-             dashes="$$skipped"; \
-         fi; \
-         report=""; \
-         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
-           report="Please report to $(PACKAGE_BUGREPORT)"; \
-           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
-             dashes="$$report"; \
-         fi; \
-         dashes=`echo "$$dashes" | sed s/./=/g`; \
-         if test "$$failed" -eq 0; then \
-           col="$$grn"; \
-         else \
-           col="$$red"; \
-         fi; \
-## Multi line coloring is problematic with "less -R", so we really need
-## to color each line individually.
-         echo "$${col}$$dashes$${std}"; \
-         echo "$${col}$$banner$${std}"; \
-         test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
-         test -z "$$report" || echo "$${col}$$report$${std}"; \
-         echo "$${col}$$dashes$${std}"; \
-         test "$$failed" -eq 0; \
-       else :; fi
-
-endif %?SERIAL_TESTS%
diff --git a/lib/am/serial-tests.am b/lib/am/serial-tests.am
new file mode 100644
index 0000000..b6a7184
--- /dev/null
+++ b/lib/am/serial-tests.am
@@ -0,0 +1,134 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright (C) 2001-2012 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
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+include color-tests.am
+
+## Obsolescent serial testsuite driver.
+
+if %?HANDLE-EXEEXT%
+## This is suboptimal, but we need to preserve the order of $(TESTS).
+am__check_cook_with_exeext_1 = \
+    $(if $(filter $(am__all_progs), $1), $1$(EXEEXT), $1)
+am__check_cook_with_exeext = $(strip \
+  $(if $(EXEEXT), $(foreach am__t, $1, $(call $(0)_1, $(am__t))), $1))
+else !%?HANDLE-EXEEXT%
+am__check_cook_with_exeext = $(strip $1)
+endif !%?HANDLE-EXEEXT%
+
+# TESTS can contain compiled programs, in which case we might have
+# to account for $(EXEEXT) appending.  For matching purposes, we
+# need to adjust XFAIL_TESTS as well.
+am__cooked_tests = $(call am__check_cook_with_exeext, $(TESTS))
+am__cooked_xfail_tests = $(call am__check_cook_with_exeext, $(XFAIL_TESTS))
+
+check-TESTS: $(am__cooked_tests)
+       @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+       srcdir=$(srcdir); export srcdir; \
+       list='$(am__cooked_tests)'; \
+       $(am__tty_colors); \
+       is_xfail_test () { \
+         case " $(strip $(am__cooked_xfail_tests)) " in \
+           *" $$tst "*) return 0;; \
+           *) return 1;; \
+         esac; \
+       }; \
+       if test -n "$$list"; then \
+         for tst in $$list; do \
+           if test -f ./$$tst; then dir=./; \
+           else dir="$(srcdir)/"; fi; \
+           if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
+## Success
+             all=`expr $$all + 1`; \
+             if is_xfail_test; then \
+               xpass=`expr $$xpass + 1`; \
+               failed=`expr $$failed + 1`; \
+               col=$$red; res=XPASS; \
+             else \
+               col=$$grn; res=PASS; \
+             fi; \
+           elif test $$? -ne 77; then \
+## Failure
+             all=`expr $$all + 1`; \
+             if is_xfail_test; then \
+               xfail=`expr $$xfail + 1`; \
+               col=$$lgn; res=XFAIL; \
+             else \
+               failed=`expr $$failed + 1`; \
+               col=$$red; res=FAIL; \
+             fi; \
+           else \
+## Skipped
+             skip=`expr $$skip + 1`; \
+             col=$$blu; res=SKIP; \
+           fi; \
+           echo "$${col}$$res$${std}: $$tst"; \
+         done; \
+## Prepare the banner
+         if test "$$all" -eq 1; then \
+           tests="test"; \
+           All=""; \
+         else \
+           tests="tests"; \
+           All="All "; \
+         fi; \
+         if test "$$failed" -eq 0; then \
+           if test "$$xfail" -eq 0; then \
+             banner="$$All$$all $$tests passed"; \
+           else \
+             if test "$$xfail" -eq 1; then failures=failure; else 
failures=failures; fi; \
+             banner="$$All$$all $$tests behaved as expected ($$xfail expected 
$$failures)"; \
+           fi; \
+         else \
+           if test "$$xpass" -eq 0; then \
+             banner="$$failed of $$all $$tests failed"; \
+           else \
+             if test "$$xpass" -eq 1; then passes=pass; else passes=passes; 
fi; \
+             banner="$$failed of $$all $$tests did not behave as expected 
($$xpass unexpected $$passes)"; \
+           fi; \
+         fi; \
+## DASHES should contain the largest line of the banner.
+         dashes="$$banner"; \
+         skipped=""; \
+         if test "$$skip" -ne 0; then \
+           if test "$$skip" -eq 1; then \
+             skipped="($$skip test was not run)"; \
+           else \
+             skipped="($$skip tests were not run)"; \
+           fi; \
+           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$skipped"; \
+         fi; \
+         report=""; \
+         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+           report="Please report to $(PACKAGE_BUGREPORT)"; \
+           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$report"; \
+         fi; \
+         dashes=`echo "$$dashes" | sed s/./=/g`; \
+         if test "$$failed" -eq 0; then \
+           col="$$grn"; \
+         else \
+           col="$$red"; \
+         fi; \
+## Multi line coloring is problematic with "less -R", so we really need
+## to color each line individually.
+         echo "$${col}$$dashes$${std}"; \
+         echo "$${col}$$banner$${std}"; \
+         test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+         test -z "$$report" || echo "$${col}$$report$${std}"; \
+         echo "$${col}$$dashes$${std}"; \
+         test "$$failed" -eq 0; \
+       else :; fi
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]