]> granicus.if.org Git - pdns/commitdiff
automake: Use parallel test harness to prevent a parallel make issue
authorThomas D <whissi@whissi.de>
Fri, 13 Feb 2015 00:22:54 +0000 (01:22 +0100)
committerThomas D <whissi@whissi.de>
Tue, 17 Feb 2015 09:15:03 +0000 (10:15 +0100)
The http, post and json test are using the same TCP port. Because of
that we need to specify an execution order or we will get errors like

  INFO  WEBrick 1.3.1
  INFO  ruby 2.0.0 (2014-11-13) [x86_64-linux]
  WARN  TCPServer Error: Address already in use - bind(2)
  WARN  TCPServer Error: Address already in use - bind(2)
  /usr/lib64/ruby/2.0.0/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
          from /usr/lib64/ruby/2.0.0/webrick/utils.rb:85:in `new'
          from /usr/lib64/ruby/2.0.0/webrick/utils.rb:85:in `block in create_listeners'
          from /usr/lib64/ruby/2.0.0/webrick/utils.rb:82:in `each'
          from /usr/lib64/ruby/2.0.0/webrick/utils.rb:82:in `create_listeners'
          from /usr/lib64/ruby/2.0.0/webrick/server.rb:132:in `listen'
          from /usr/lib64/ruby/2.0.0/webrick/server.rb:113:in `initialize'
          from /usr/lib64/ruby/2.0.0/webrick/httpserver.rb:45:in `initialize'
          from ./unittest_http.rb:184:in `new'
          from ./unittest_http.rb:184:in `<main>'

when running the tests in parallel (`make -j5 check`).

modules/remotebackend/Makefile.am
modules/remotebackend/testrunner.sh

index bb26c251d58299a539529955ecfc08bfd044767e..c6b0cd6147a363d760fc1a0014bc1a1b73b74693 100644 (file)
@@ -22,12 +22,12 @@ EXTRA_DIST = \
        Gemfile.lock
 
 EXTRA_PROGRAMS = \
-       test_remotebackend_pipe \
-       test_remotebackend_unix \
-       test_remotebackend_http \
-       test_remotebackend_post \
-       test_remotebackend_json \
-       test_remotebackend_zeromq
+       remotebackend_pipe.test \
+       remotebackend_unix.test \
+       remotebackend_http.test \
+       remotebackend_post.test \
+       remotebackend_json.test \
+       remotebackend_zeromq.test
 
 EXTRA_LTLIBRARIES = libtestremotebackend.la
 
@@ -53,16 +53,31 @@ libremotebackend_la_LIBADD += $(LIBZMQ_LIBS)
 endif
 
 if UNIT_TESTS
-TESTS_ENVIRONMENT = \
-       env BOOST_TEST_LOG_LEVEL=message REMOTEBACKEND_ZEROMQ=$(REMOTEBACKEND_ZEROMQ) ./testrunner.sh
+AM_TESTS_ENVIRONMENT = \
+       BOOST_TEST_LOG_LEVEL=message; \
+       export BOOST_TEST_LOG_LEVEL; \
+       REMOTEBACKEND_ZEROMQ=$(REMOTEBACKEND_ZEROMQ); \
+       export REMOTEBACKEND_ZEROMQ;
+
+TEST_EXTENSIONS = .test
+
+TEST_LOG_COMPILER = $(abs_srcdir)/testrunner.sh
 
 TESTS = \
-       test_remotebackend_pipe \
-       test_remotebackend_unix \
-       test_remotebackend_http \
-       test_remotebackend_post \
-       test_remotebackend_json \
-       test_remotebackend_zeromq
+       remotebackend_pipe.test \
+       remotebackend_unix.test \
+       remotebackend_http.test \
+       remotebackend_post.test \
+       remotebackend_json.test \
+       remotebackend_zeromq.test
+
+## The http, post and json test are using the same TCP port.
+## To prevent "Address already in use - bind(2) (Errno::EADDRINUSE)"
+## errors when running `make check` in parallel, we need to specify
+## an order
+remotebackend_post.log: remotebackend_http.log
+
+remotebackend_json.log: remotebackend_http.log remotebackend_post.log
 endif
 
 BUILT_SOURCES = ../../pdns/dnslabeltext.cc
@@ -132,45 +147,44 @@ libtestremotebackend_la_CPPFLAGS += \
        $(P11KIT1_CFLAGS)
 endif
 
-test_remotebackend_http_SOURCES = \
+remotebackend_http_test_SOURCES = \
        test-remotebackend.cc \
        test-remotebackend-http.cc \
        test-remotebackend-keys.hh
 
-test_remotebackend_http_LDADD = libtestremotebackend.la
+remotebackend_http_test_LDADD = libtestremotebackend.la
 
-test_remotebackend_json_SOURCES = \
+remotebackend_json_test_SOURCES = \
        test-remotebackend.cc \
        test-remotebackend-json.cc \
        test-remotebackend-keys.hh
 
-test_remotebackend_json_LDADD = libtestremotebackend.la
+remotebackend_json_test_LDADD = libtestremotebackend.la
 
-test_remotebackend_pipe_SOURCES = \
+remotebackend_pipe_test_SOURCES = \
        test-remotebackend.cc \
        test-remotebackend-pipe.cc \
        test-remotebackend-keys.hh 
 
-test_remotebackend_pipe_LDADD = libtestremotebackend.la
+remotebackend_pipe_test_LDADD = libtestremotebackend.la
 
-test_remotebackend_post_SOURCES = \
+remotebackend_post_test_SOURCES = \
        test-remotebackend.cc \
        test-remotebackend-post.cc \
        test-remotebackend-keys.hh
 
-test_remotebackend_post_LDADD = libtestremotebackend.la
+remotebackend_post_test_LDADD = libtestremotebackend.la
 
-test_remotebackend_unix_SOURCES = \
+remotebackend_unix_test_SOURCES = \
        test-remotebackend.cc \
        test-remotebackend-unix.cc \
        test-remotebackend-keys.hh
 
-test_remotebackend_unix_LDADD = libtestremotebackend.la
+remotebackend_unix_test_LDADD = libtestremotebackend.la
 
-test_remotebackend_zeromq_SOURCES = \
+remotebackend_zeromq_test_SOURCES = \
        test-remotebackend.cc \
        test-remotebackend-zeromq.cc \
        test-remotebackend-keys.hh
 
-test_remotebackend_zeromq_LDADD = libtestremotebackend.la
-
+remotebackend_zeromq_test_LDADD = libtestremotebackend.la
index 1e04dd819a556ac9640eb96862a4e0906cf2041c..cf2b8c05fe7e5dbeec189d68bb913aef401cd84c 100755 (executable)
@@ -112,37 +112,37 @@ function run_test() {
 mode=`basename "$mode"`
 
 case "$mode" in
-  test_remotebackend_pipe)
+  remotebackend_pipe.test)
     run_test
   ;;
-  test_remotebackend_unix)
+  remotebackend_unix.test)
     start_unix
     run_test
     stop_unix
   ;;
-  test_remotebackend_http)
+  remotebackend_http.test)
     start_web "http"
     run_test
     stop_web
   ;;
-  test_remotebackend_post)
+  remotebackend_post.test)
     start_web "post"
     run_test
     stop_web
   ;;
-  test_remotebackend_json)
+  remotebackend_json.test)
     start_web "json"
     run_test
     stop_web
   ;;
-  test_remotebackend_zeromq)
-    start_zeromq 
+  remotebackend_zeromq.test)
+    start_zeromq
     run_test
     stop_zeromq
   ;;
   *)
-     echo "Usage: $0 test_remotebackend_(pipe|unix|http|post|json|zeromq)"
-     exit 1
+    echo "Usage: $0 remotebackend_(pipe|unix|http|post|json|zeromq).test"
+    exit 1
   ;;
 esac