Browse Source

build: Add support for running the test suite in parallel

Add a new test variable TEST_PARALLEL, and set it from debian/rules when
we've got the parallel=N tag in DEB_BUILD_OPTIONS.
Guillem Jover 9 years ago
parent
commit
c23a8958fd
3 changed files with 11 additions and 1 deletions
  1. 3 0
      check.am
  2. 1 0
      debian/changelog
  3. 7 1
      debian/rules

+ 3 - 0
check.am

@@ -1,6 +1,7 @@
 # Variables to be defined:
 #
 #  TEST_VERBOSE - set to 0 (default) or 1 to control test suite verbosity
+#  TEST_PARALLEL - set to 1 (default) or N to control the parallel jobs
 #  TEST_ENV_VARS - environment variables to be set for the test suite
 #  TEST_COVERAGE - set to the perl module in charge of getting test coverage
 #  test_tmpdir - test suite temporary directory
@@ -9,12 +10,14 @@
 #  test_data - list of test data files
 
 TEST_VERBOSE ?= 0
+TEST_PARALLEL ?= 1
 
 TEST_RUNNER = '\
 	my $$harness = TAP::Harness->new({ \
 	    lib => [ "$(top_srcdir)/scripts", "$(top_srcdir)/dselect/methods"  ], \
 	    color => 1, \
 	    verbosity => $(TEST_VERBOSE), \
+	    jobs => $(TEST_PARALLEL), \
 	    failures => 1, \
 	}); \
 	my $$aggregate = $$harness->runtests(@ARGV); \

+ 1 - 0
debian/changelog

@@ -16,6 +16,7 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
       As at least gcc and clang do not warn on -Wno-* warning flags, only
       when some unrelated warning needs to be emitted.
     - Bump po4a version to 0.43 (we are using --porefs wrap option).
+    - Add support for running the test suite in parallel.
 
   [ Updated manpages translations ]
   * German (Helge Kreutzmann).

+ 7 - 1
debian/rules

@@ -37,6 +37,12 @@ ifeq (,$(filter maintainer-build,$(DEB_BUILD_OPTIONS)))
 	confflags += --disable-silent-rules
 endif
 
+# Enable parallel test suite
+NUMJOBS = 1
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+endif
+
 D := $(CURDIR)/debian/tmp
 
 # Create configure script if necessary, automake handles rebuilding it.
@@ -75,7 +81,7 @@ check: build
 	dh_testdir
 
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-	cd build-tree && $(MAKE) VERBOSE=1 check
+	cd build-tree && $(MAKE) VERBOSE=1 TEST_PARALLEL=$(NUMJOBS) check
 endif
 
 # Install the package underneath debian/tmp