Merge remote-tracking branch 'tor-github/pr/1744'

This commit is contained in:
teor 2020-02-19 10:09:29 +10:00
commit 4dd594d33c
No known key found for this signature in database
GPG Key ID: 10FEAA0E7075672A
3 changed files with 108 additions and 90 deletions

View File

@ -297,83 +297,118 @@ need-chutney-path:
# Run some basic tests using automake's test-driver # Run some basic tests using automake's test-driver
.PHONY: test-network .PHONY: test-network
# Make prints all these recursive invocations by default, but those extra lines # Hide directory path logs from submakes using $(MAKE) -s
# break up the chutney flavor statuses
.SILENT: test-network
test-network: test-network:
@$(MAKE) test-network-mkdir @$(MAKE) -s test-network-mkdir
@$(MAKE) test-network-clean @$(MAKE) -s test-network-clean
@$(MAKE) test-network-ipv4-impl \ @$(MAKE) -s test-network-run \
ipv4_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK)" ipv4_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK)" \
@$(MAKE) test-network-ipv6-impl \
ipv6_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK_IPV6)" 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 # Run all available tests using automake's test-driver
.PHONY: test-network-all .PHONY: test-network-all
.SILENT: test-network-all # Hide directory path logs from submakes using $(MAKE) -s
test-network-all: test-network-all:
@$(MAKE) test-network-mkdir @$(MAKE) -s test-network-mkdir
@$(MAKE) test-network-clean @$(MAKE) -s test-network-clean
@$(MAKE) test-network-ipv4-impl \ @$(MAKE) -s test-network-run \
ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" \
@$(MAKE) test-network-mixed-impl \ mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)" \
mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)" ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" \
@$(MAKE) test-network-ipv6-impl \ ipv6_mixed_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6_MIXED)"
ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" @$(MAKE) -s test-network-results
@$(MAKE) test-network-results
# Run IPv4 and mixed tests using automake's test-driver # Run IPv4 and mixed tests using automake's test-driver
.PHONY: test-network-ipv4 .PHONY: test-network-ipv4
.SILENT: test-network-ipv4 # Hide directory path logs from submakes using $(MAKE) -s
test-network-ipv4: test-network-ipv4:
@$(MAKE) test-network-mkdir @$(MAKE) -s test-network-mkdir
@$(MAKE) test-network-clean @$(MAKE) -s test-network-clean
@$(MAKE) test-network-ipv4-impl ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" @$(MAKE) -s test-network-run \
@$(MAKE) test-network-mixed-impl \ ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" \
mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)" mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)"
@$(MAKE) test-network-results @$(MAKE) -s test-network-results
# Run IPv6 tests using automake's test-driver # Run IPv6 tests using automake's test-driver
.PHONY: test-network-ipv6 .PHONY: test-network-ipv6
.SILENT: test-network-ipv6 # Hide directory path logs from submakes using $(MAKE) -s
test-network-ipv6: test-network-ipv6:
@$(MAKE) test-network-mkdir @$(MAKE) -s test-network-mkdir
@$(MAKE) test-network-clean @$(MAKE) -s test-network-clean
@$(MAKE) test-network-ipv6-impl \ @$(MAKE) -s test-network-run \
ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" \
@$(MAKE) test-network-results ipv6_mixed_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6_MIXED)"
@$(MAKE) -s test-network-results
# Make the test network log directory, if it does not exist # Make the test network log directory, if it does not exist
.PHONY: test-network-mkdir .PHONY: test-network-mkdir
.SILENT: test-network-mkdir
test-network-mkdir: test-network-mkdir:
@mkdir -p "$(TEST_NETWORK_ALL_LOG_DIR)" @mkdir -p "$(TEST_NETWORK_ALL_LOG_DIR)"
# Clean the test network log directory # Clean the test network log directory
.PHONY: test-network-clean .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 # We need to remove all matching files, so we can't quote the glob part of the
# rm arguments # rm arguments
test-network-clean: test-network-clean:
rm -f "$(TEST_NETWORK_ALL_LOG_DIR)"/*.log \ rm -f "$(TEST_NETWORK_ALL_LOG_DIR)"/*.log \
"$(TEST_NETWORK_ALL_LOG_DIR)"/*.trs "$(TEST_NETWORK_ALL_LOG_DIR)"/*.trs
# Run the IPv4-only test flavors # Run tests using automake's test-driver
# - $(ipv4_flavors) contains the tests to run # When checking if a set of test can be run, log the type of test, and the
.PHONY: test-network-ipv4-impl # list of tests that will be run (or skipped).
.SILENT: test-network-ipv4-impl #
test-network-ipv4-impl: # Run the IPv4 tests in $(ipv4_flavors), unconditionally
@$(MAKE) test-network-run flavors="$(ipv4_flavors)" skip_flavors="" # - 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)
# Run the mixed tests in $(mixed_flavors), if a tor-stable binary is available # 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 # - only run mixed tests if we have a tor-stable binary
# - $(mixed_flavors) contains the tests to run (or skip) # Run the IPv6 mixed tests in $(ipv6_mixed_flavors), if IPv6 and mixed are run
.PHONY: test-network-mixed-impl # - see above for details about IPv6 and mixed
.SILENT: test-network-mixed-impl .PHONY: test-network-run
test-network-mixed-impl: # 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
@flavors=""; \ @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 \ 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:" \ echo "tor-stable found, running mixed flavors:" \
"$(mixed_flavors)."; \ "$(mixed_flavors)."; \
flavors="$$flavors $(mixed_flavors)"; \ flavors="$$flavors $(mixed_flavors)"; \
@ -382,46 +417,23 @@ test-network-mixed-impl:
"$(mixed_flavors)."; \ "$(mixed_flavors)."; \
skip_flavors="$$skip_flavors $(mixed_flavors)"; \ skip_flavors="$$skip_flavors $(mixed_flavors)"; \
fi; \ fi; \
$(MAKE) test-network-run flavors="$$flavors" \
skip_flavors="$$skip_flavors"
# 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; \ fi; \
$(MAKE) test-network-run flavors="$$flavors" \ if test -n "$(ipv6_mixed_flavors)"; then \
skip_flavors="$$skip_flavors" if test "$$test_network_ipv6" = "true" && \
test "$$test_network_mixed" = "true"; then \
# Run tests using automake's test-driver echo "Running IPv6 mixed flavors:" \
# - $(flavors) contains the tests to run "$(ipv6_mixed_flavors)."; \
# - $(skip_flavors) contains the tests to skip flavors="$$flavors $(ipv6_mixed_flavors)"; \
.PHONY: test-network-run else \
.SILENT: test-network-run echo "Skipping IPv6 mixed flavors:" \
# We need the word splitting in the "for" lines, so we can't quote "$(ipv6_mixed_flavors)."; \
# $(skip_flavors) or $(flavors) skip_flavors="$$skip_flavors $(ipv6_mixed_flavors)"; \
test-network-run: need-chutney-path test-driver $(TESTING_TOR_BINARY) src/tools/tor-gencert fi; \
@for f in $(skip_flavors); do \ fi; \
for f in $$skip_flavors; do \
echo "SKIP: $$f"; \ echo "SKIP: $$f"; \
done; \ done; \
for f in $(flavors); do \ for f in $$flavors; do \
$(SHELL) "$(top_srcdir)/test-driver" --test-name "$$f" \ $(SHELL) "$(top_srcdir)/test-driver" --test-name "$$f" \
--log-file "$(TEST_NETWORK_ALL_LOG_DIR)/$$f.log" \ --log-file "$(TEST_NETWORK_ALL_LOG_DIR)/$$f.log" \
--trs-file "$(TEST_NETWORK_ALL_LOG_DIR)/$$f.trs" \ --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 # (otherwise, warnings go to the logs, and people don't see them unless
# there is a network failure) # there is a network failure)
.PHONY: test-network-results .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 # We need to grep all matching files, so we can't quote the glob part of the
# grep arguments # grep arguments
test-network-results: test-network-results:

5
changes/ticket33334 Normal file
View File

@ -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.

View File

@ -66,18 +66,20 @@ TESTS += src/test/test src/test/test-slow src/test/test-memwipe \
# this test only uses IPv4 # this test only uses IPv4
TEST_CHUTNEY_FLAVOR_QUICK = bridges+hs-v23 TEST_CHUTNEY_FLAVOR_QUICK = bridges+hs-v23
# only run if we can ping6 ::1 (localhost) # 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 # run a basic set of tests, which only use IPv4
TEST_CHUTNEY_FLAVORS = basic-min bridges-min hs-v2-min hs-v3-min \ TEST_CHUTNEY_FLAVORS = basic-min bridges-min hs-v23-min single-onion-v23
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 \ TEST_CHUTNEY_FLAVORS_IPV6 = bridges+ipv6-min ipv6-exit-min hs-v23-ipv6-md \
single-onion-v23-ipv6-md single-onion-v23-ipv6-md
# only run if we can find a stable (or simply another) version of tor # 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 ### This is a lovely feature, but it requires automake >= 1.12, and Tor
### doesn't require that yet. ### doesn't require that yet.