From 2151822bd054a0c728194a6f47678f25d3ada8a8 Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 17 Feb 2020 14:26:41 +1000 Subject: [PATCH 1/5] Makefile: Refactor and tweak test-network The refactor is simpler, and supports IPv6 mixed networks. The refactor also slightly changes the order of the IPv6 and mixed checks. But it's closer to the original order before 33280. And if all the network lists that need a network type are empty, we don't check if we can run that network type. (And if a network list is empty, we don't say we're going to run an empty list.) Part of 33334. --- Makefile.am | 137 +++++++++++++++++++++++++++++----------------------- 1 file changed, 76 insertions(+), 61 deletions(-) diff --git a/Makefile.am b/Makefile.am index 45dab1e6b4..7e57570a06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -303,9 +303,8 @@ need-chutney-path: 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) test-network-run \ + ipv4_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK)" \ ipv6_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK_IPV6)" @$(MAKE) test-network-results @@ -315,11 +314,9 @@ test-network: 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 \ + @$(MAKE) test-network-run \ + ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" \ + mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)" \ ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" @$(MAKE) test-network-results @@ -329,8 +326,8 @@ test-network-all: 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) test-network-run \ + ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" \ mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)" @$(MAKE) test-network-results @@ -340,7 +337,7 @@ test-network-ipv4: test-network-ipv6: @$(MAKE) test-network-mkdir @$(MAKE) test-network-clean - @$(MAKE) test-network-ipv6-impl \ + @$(MAKE) test-network-run \ ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" @$(MAKE) test-network-results @@ -359,69 +356,87 @@ 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" \ From 85eb170923bdc7b42db971fd35e59281333931a2 Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 17 Feb 2020 14:49:13 +1000 Subject: [PATCH 2/5] Makefile: Add v3 onion services to the mixed network This network is used in make test-network-all and test-network-ipv4. Part of 33334. --- src/test/include.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/include.am b/src/test/include.am index fdd1195fdf..9b5376d87f 100644 --- a/src/test/include.am +++ b/src/test/include.am @@ -72,12 +72,12 @@ TEST_CHUTNEY_FLAVOR_QUICK_IPV6 = client-ipv6-only-md TEST_CHUTNEY_FLAVORS = basic-min bridges-min hs-v2-min hs-v3-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 ### This is a lovely feature, but it requires automake >= 1.12, and Tor ### doesn't require that yet. From da280a430906349fd697860fbe326de86eccd36d Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 17 Feb 2020 14:50:24 +1000 Subject: [PATCH 3/5] Makefile: Add an IPv6 mixed chutney network This network is used in make test-network-all and test-network-ipv6. Closes 33334. --- Makefile.am | 6 ++++-- changes/ticket33334 | 5 +++++ src/test/include.am | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changes/ticket33334 diff --git a/Makefile.am b/Makefile.am index 7e57570a06..0284885654 100644 --- a/Makefile.am +++ b/Makefile.am @@ -317,7 +317,8 @@ test-network-all: @$(MAKE) test-network-run \ ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" \ mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)" \ - ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" + ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" \ + ipv6_mixed_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6_MIXED)" @$(MAKE) test-network-results # Run IPv4 and mixed tests using automake's test-driver @@ -338,7 +339,8 @@ test-network-ipv6: @$(MAKE) test-network-mkdir @$(MAKE) test-network-clean @$(MAKE) test-network-run \ - ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" + ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" \ + ipv6_mixed_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6_MIXED)" @$(MAKE) test-network-results # Make the test network log directory, if it does not exist 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 9b5376d87f..302771374b 100644 --- a/src/test/include.am +++ b/src/test/include.am @@ -79,6 +79,9 @@ TEST_CHUTNEY_FLAVORS_IPV6 = bridges+ipv6-min ipv6-exit-min hs-v23-ipv6-md \ # only run if we can find a stable (or simply another) version of tor 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. ### From aebae8225b910262b37c6b7a24bc144b0823a6e0 Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 17 Feb 2020 22:03:09 +1000 Subject: [PATCH 4/5] Makefile: Silence some submake logs in test-network These logs split up the chutney SKIP, PASS, and FAIL messages, and they don't actually contain any useful information. Cleanup after 33334. --- Makefile.am | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0284885654..b9bae2395c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -297,61 +297,57 @@ 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-run \ + @$(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-run \ + @$(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) test-network-results + @$(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-run \ + @$(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-run \ + @$(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) test-network-results + @$(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: @@ -375,7 +371,6 @@ test-network-clean: # 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 @@ -454,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: From 6e76570ede710dffcaef798e1dd537cd78480861 Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 19 Feb 2020 09:29:02 +1000 Subject: [PATCH 5/5] Makefile: Tweak the test-network* chuttney networks In "make test-network", add tests for single onion services v2 and v3. In "make test-network-all", test onion services v2 and v3 in the same network. Part of 33334. --- src/test/include.am | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/include.am b/src/test/include.am index 302771374b..9eb8dc2ab1 100644 --- a/src/test/include.am +++ b/src/test/include.am @@ -66,11 +66,10 @@ 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 ping ::1 (localhost) TEST_CHUTNEY_FLAVORS_IPV6 = bridges+ipv6-min ipv6-exit-min hs-v23-ipv6-md \