diff --git a/Makefile.am b/Makefile.am index 45dab1e6b4..b9bae2395c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -297,131 +297,143 @@ need-chutney-path: # Run some basic tests using automake's test-driver .PHONY: test-network -# Make prints all these recursive invocations by default, but those extra lines -# break up the chutney flavor statuses -.SILENT: test-network +# Hide directory path logs from submakes using $(MAKE) -s test-network: - @$(MAKE) test-network-mkdir - @$(MAKE) test-network-clean - @$(MAKE) test-network-ipv4-impl \ - ipv4_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK)" - @$(MAKE) test-network-ipv6-impl \ + @$(MAKE) -s test-network-mkdir + @$(MAKE) -s test-network-clean + @$(MAKE) -s test-network-run \ + ipv4_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK)" \ ipv6_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK_IPV6)" - @$(MAKE) test-network-results + @$(MAKE) -s test-network-results # Run all available tests using automake's test-driver .PHONY: test-network-all -.SILENT: test-network-all +# Hide directory path logs from submakes using $(MAKE) -s test-network-all: - @$(MAKE) test-network-mkdir - @$(MAKE) test-network-clean - @$(MAKE) test-network-ipv4-impl \ - ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" - @$(MAKE) test-network-mixed-impl \ - mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)" - @$(MAKE) test-network-ipv6-impl \ - ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" - @$(MAKE) test-network-results + @$(MAKE) -s test-network-mkdir + @$(MAKE) -s test-network-clean + @$(MAKE) -s test-network-run \ + ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" \ + mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)" \ + ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" \ + ipv6_mixed_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6_MIXED)" + @$(MAKE) -s test-network-results # Run IPv4 and mixed tests using automake's test-driver .PHONY: test-network-ipv4 -.SILENT: test-network-ipv4 +# Hide directory path logs from submakes using $(MAKE) -s test-network-ipv4: - @$(MAKE) test-network-mkdir - @$(MAKE) test-network-clean - @$(MAKE) test-network-ipv4-impl ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" - @$(MAKE) test-network-mixed-impl \ + @$(MAKE) -s test-network-mkdir + @$(MAKE) -s test-network-clean + @$(MAKE) -s test-network-run \ + ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" \ mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)" - @$(MAKE) test-network-results + @$(MAKE) -s test-network-results # Run IPv6 tests using automake's test-driver .PHONY: test-network-ipv6 -.SILENT: test-network-ipv6 +# Hide directory path logs from submakes using $(MAKE) -s test-network-ipv6: - @$(MAKE) test-network-mkdir - @$(MAKE) test-network-clean - @$(MAKE) test-network-ipv6-impl \ - ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" - @$(MAKE) test-network-results + @$(MAKE) -s test-network-mkdir + @$(MAKE) -s test-network-clean + @$(MAKE) -s test-network-run \ + ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" \ + ipv6_mixed_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6_MIXED)" + @$(MAKE) -s test-network-results # Make the test network log directory, if it does not exist .PHONY: test-network-mkdir -.SILENT: test-network-mkdir test-network-mkdir: @mkdir -p "$(TEST_NETWORK_ALL_LOG_DIR)" # Clean the test network log directory .PHONY: test-network-clean -# We don't silence clean: we want to see the rm command # We need to remove all matching files, so we can't quote the glob part of the # rm arguments test-network-clean: rm -f "$(TEST_NETWORK_ALL_LOG_DIR)"/*.log \ "$(TEST_NETWORK_ALL_LOG_DIR)"/*.trs -# Run the IPv4-only test flavors -# - $(ipv4_flavors) contains the tests to run -.PHONY: test-network-ipv4-impl -.SILENT: test-network-ipv4-impl -test-network-ipv4-impl: - @$(MAKE) test-network-run flavors="$(ipv4_flavors)" skip_flavors="" - -# Run the mixed tests in $(mixed_flavors), if a tor-stable binary is available -# - only run mixed tests if we have a tor-stable binary -# - $(mixed_flavors) contains the tests to run (or skip) -.PHONY: test-network-mixed-impl -.SILENT: test-network-mixed-impl -test-network-mixed-impl: - @flavors=""; \ - if command -v tor-stable >/dev/null 2>&1; then \ - echo "tor-stable found, running mixed flavors:" \ - "$(mixed_flavors)."; \ - flavors="$$flavors $(mixed_flavors)"; \ - else \ - echo "tor-stable not found, skipping mixed flavors:" \ - "$(mixed_flavors)."; \ - skip_flavors="$$skip_flavors $(mixed_flavors)"; \ - fi; \ - $(MAKE) test-network-run flavors="$$flavors" \ - skip_flavors="$$skip_flavors" - +# Run tests using automake's test-driver +# When checking if a set of test can be run, log the type of test, and the +# list of tests that will be run (or skipped). +# +# Run the IPv4 tests in $(ipv4_flavors), unconditionally +# - tor relays and directory authorities require IPv4. # Run the IPv6 tests in $(ipv6_flavors), if IPv6 is available # - only run IPv6 tests if we can ping6 or ping -6 ::1 (localhost) # we try the syntax for BSD ping6, Linux ping6, and Linux ping -6, # because they're incompatible # - some IPv6 tests may fail without an IPv6 DNS server # (see #16971 and #17011) -# - $(ipv6_flavors) contains the tests to run (or skip) -.PHONY: test-network-ipv6-impl -.SILENT: test-network-ipv6-impl -test-network-ipv6-impl: - @flavors=""; \ - if ping6 -q -c 1 -o ::1 >/dev/null 2>&1 || \ - ping6 -q -c 1 -W 1 ::1 >/dev/null 2>&1 || \ - ping -6 -c 1 -W 1 ::1 >/dev/null 2>&1; then \ - echo "ping6 ::1 or ping ::1 succeeded, running IPv6" \ - "flavors: $(ipv6_flavors)."; \ - flavors="$$flavors $(ipv6_flavors)"; \ - else \ - echo "ping6 ::1 and ping ::1 failed, skipping IPv6 flavors:" \ - "$(ipv6_flavors)."; \ - skip_flavors="$$skip_flavors $(ipv6_flavors)"; \ - fi; \ - $(MAKE) test-network-run flavors="$$flavors" \ - skip_flavors="$$skip_flavors" - -# Run tests using automake's test-driver -# - $(flavors) contains the tests to run -# - $(skip_flavors) contains the tests to skip +# Run the mixed tests in $(mixed_flavors), if a tor-stable binary is available +# - only run mixed tests if we have a tor-stable binary +# Run the IPv6 mixed tests in $(ipv6_mixed_flavors), if IPv6 and mixed are run +# - see above for details about IPv6 and mixed .PHONY: test-network-run -.SILENT: test-network-run # We need the word splitting in the "for" lines, so we can't quote # $(skip_flavors) or $(flavors) test-network-run: need-chutney-path test-driver $(TESTING_TOR_BINARY) src/tools/tor-gencert - @for f in $(skip_flavors); do \ + @flavors=""; \ + skip_flavors=""; \ + if test -n "$(ipv4_flavors)"; then \ + echo "Running IPv4 flavors: $(ipv4_flavors)."; \ + flavors="$$flavors $(ipv4_flavors)"; \ + fi; \ + test_network_ipv6=false; \ + if test -n "$(ipv6_flavors)" || \ + test -n "$(ipv6_mixed_flavors)"; then \ + if ping6 -q -c 1 -o ::1 >/dev/null 2>&1 || \ + ping6 -q -c 1 -W 1 ::1 >/dev/null 2>&1 || \ + ping -6 -c 1 -W 1 ::1 >/dev/null 2>&1; then \ + test_network_ipv6=true; \ + fi; \ + fi; \ + if test -n "$(ipv6_flavors)"; then \ + if test "$$test_network_ipv6" = "true"; then \ + echo "ping6 ::1 or ping ::1 succeeded, running IPv6" \ + "flavors: $(ipv6_flavors)."; \ + flavors="$$flavors $(ipv6_flavors)"; \ + else \ + echo "ping6 ::1 and ping ::1 failed, skipping IPv6" \ + "flavors: $(ipv6_flavors)."; \ + skip_flavors="$$skip_flavors $(ipv6_flavors)"; \ + fi; \ + fi; \ + test_network_mixed=false; \ + if test -n "$(mixed_flavors)" || \ + test -n "$(ipv6_mixed_flavors)"; then \ + if command -v tor-stable >/dev/null 2>&1; then \ + test_network_mixed=true; \ + fi; \ + fi; \ + if test -n "$(mixed_flavors)"; then \ + if test "$$test_network_mixed" = "true"; then \ + echo "tor-stable found, running mixed flavors:" \ + "$(mixed_flavors)."; \ + flavors="$$flavors $(mixed_flavors)"; \ + else \ + echo "tor-stable not found, skipping mixed flavors:" \ + "$(mixed_flavors)."; \ + skip_flavors="$$skip_flavors $(mixed_flavors)"; \ + fi; \ + fi; \ + if test -n "$(ipv6_mixed_flavors)"; then \ + if test "$$test_network_ipv6" = "true" && \ + test "$$test_network_mixed" = "true"; then \ + echo "Running IPv6 mixed flavors:" \ + "$(ipv6_mixed_flavors)."; \ + flavors="$$flavors $(ipv6_mixed_flavors)"; \ + else \ + echo "Skipping IPv6 mixed flavors:" \ + "$(ipv6_mixed_flavors)."; \ + skip_flavors="$$skip_flavors $(ipv6_mixed_flavors)"; \ + fi; \ + fi; \ + for f in $$skip_flavors; do \ echo "SKIP: $$f"; \ done; \ - for f in $(flavors); do \ + for f in $$flavors; do \ $(SHELL) "$(top_srcdir)/test-driver" --test-name "$$f" \ --log-file "$(TEST_NETWORK_ALL_LOG_DIR)/$$f.log" \ --trs-file "$(TEST_NETWORK_ALL_LOG_DIR)/$$f.trs" \ @@ -437,7 +449,6 @@ test-network-run: need-chutney-path test-driver $(TESTING_TOR_BINARY) src/tools/ # (otherwise, warnings go to the logs, and people don't see them unless # there is a network failure) .PHONY: test-network-results -.SILENT: test-network-results # We need to grep all matching files, so we can't quote the glob part of the # grep arguments test-network-results: diff --git a/changes/ticket33334 b/changes/ticket33334 new file mode 100644 index 0000000000..ada3cb284c --- /dev/null +++ b/changes/ticket33334 @@ -0,0 +1,5 @@ + o Testing: + - Test v3 onion services to tor's mixed IPv4 chutney network. And add a + mixed IPv6 chutney network. These networks are used in the + test-network-all, test-network-ipv4, and test-network-ipv6 make targets. + Closes ticket 33334. diff --git a/src/test/include.am b/src/test/include.am index fdd1195fdf..9eb8dc2ab1 100644 --- a/src/test/include.am +++ b/src/test/include.am @@ -66,18 +66,20 @@ TESTS += src/test/test src/test/test-slow src/test/test-memwipe \ # this test only uses IPv4 TEST_CHUTNEY_FLAVOR_QUICK = bridges+hs-v23 # only run if we can ping6 ::1 (localhost) -TEST_CHUTNEY_FLAVOR_QUICK_IPV6 = client-ipv6-only-md +TEST_CHUTNEY_FLAVOR_QUICK_IPV6 = single-onion-v23-ipv6-md # run a basic set of tests, which only use IPv4 -TEST_CHUTNEY_FLAVORS = basic-min bridges-min hs-v2-min hs-v3-min \ - single-onion-v23 +TEST_CHUTNEY_FLAVORS = basic-min bridges-min hs-v23-min single-onion-v23 -# only run if we can ping6 ::1 (localhost) +# only run if we can ping ::1 (localhost) TEST_CHUTNEY_FLAVORS_IPV6 = bridges+ipv6-min ipv6-exit-min hs-v23-ipv6-md \ single-onion-v23-ipv6-md # only run if we can find a stable (or simply another) version of tor -TEST_CHUTNEY_FLAVORS_MIXED = mixed+hs-v2 +TEST_CHUTNEY_FLAVORS_MIXED = mixed+hs-v23 + +# only run if IPv6 and mixed networks are run +TEST_CHUTNEY_FLAVORS_IPV6_MIXED = mixed+hs-v23-ipv6 ### This is a lovely feature, but it requires automake >= 1.12, and Tor ### doesn't require that yet.