]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
When building with coverage, run chutney with coverage
authorNick Mathewson <nickm@torproject.org>
Mon, 3 Aug 2015 17:23:58 +0000 (13:23 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 3 Aug 2015 17:23:58 +0000 (13:23 -0400)
Previously, this required me to do stuff like
  'cp src/or/tor-cov src/or/tor' ,
which is pretty embarrassing.

Makefile.am
changes/chutney-coverage [new file with mode: 0644]
src/test/test-network.sh

index 784ff48dcd79c065109a465739df9a08bdc85446..5b4d59c514401718a92db235ff6dba57e83fc6b5 100644 (file)
@@ -36,9 +36,11 @@ EXTRA_DIST+= \
 if COVERAGE_ENABLED
 TEST_CFLAGS=-fno-inline -fprofile-arcs -ftest-coverage
 TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE
+TEST_NETWORK_FLAGS="--coverage"
 else
 TEST_CFLAGS=
 TEST_CPPFLAGS=-DTOR_UNIT_TESTS
+TEST_NETWORK_FLAGS=
 endif
 
 #install-data-local:
@@ -79,7 +81,7 @@ need-chutney-path:
 # Note that test-network requires a copy of Chutney in $CHUTNEY_PATH.
 # Chutney can be cloned from https://git.torproject.org/chutney.git .
 test-network: need-chutney-path all
-       $(top_srcdir)/src/test/test-network.sh
+       $(top_srcdir)/src/test/test-network.sh $(TEST_NETWORK_FLAGS)
 
 need-stem-path:
        @if test ! -d "$$STEM_SOURCE_DIR"; then \
diff --git a/changes/chutney-coverage b/changes/chutney-coverage
new file mode 100644 (file)
index 0000000..53983c8
--- /dev/null
@@ -0,0 +1,3 @@
+  o Testing:
+    - When building Tor with testing coverage enabled, run Chutney tests
+      (if any) using the 'tor-cov' coverage binary.
index 49bf03c0d376eab43dfcbe23866bd90006ee5fe3..cc74c0f823d4b9c4940d75b6743736224563f5ea 100755 (executable)
@@ -1,6 +1,7 @@
 #! /bin/sh
 
 ECHO_N="/bin/echo -n"
+use_coverage_binary=false
 
 until [ -z $1 ]
 do
@@ -41,7 +42,10 @@ do
     --hs-multi-client|--hs-multi-clients|--hs-client|--hs-clients)
       export CHUTNEY_HS_MULTI_CLIENT="$2"
       shift
-    ;;
+      ;;
+    --coverage)
+      use_coverage_binary=true
+      ;;
     *)
       echo "Sorry, I don't know what to do with '$1'."
       exit 2
@@ -59,9 +63,17 @@ myname=$(basename $0)
     echo "$myname: missing 'chutney' in CHUTNEY_PATH ($CHUTNEY_PATH)"
     exit 1
 }
+
 cd "$CHUTNEY_PATH"
 # For picking up the right tor binaries.
-PATH="$TOR_DIR/src/or:$TOR_DIR/src/tools:$PATH"
+tor_name=tor
+tor_gencert_name=tor-gencert
+if test "$use_coverage_binary" = true; then
+  tor_name=tor-cov
+fi
+export CHUTNEY_TOR="${TOR_DIR}/src/or/${tor_name}"
+export CHUTNEY_TOR_GENCERT="${TOR_DIR}/src/tools/${tor_gencert_name}"
+
 ./tools/bootstrap-network.sh $NETWORK_FLAVOUR || exit 2
 
 # Sleep some, waiting for the network to bootstrap.