aboutsummaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2020-02-14 10:34:17 +1000
committerteor <teor@torproject.org>2020-02-17 13:47:34 +1000
commit225613fcc22958706e55e55ce1295eca3e28971e (patch)
tree775cd099c5e6e59c67db938df3157ce032643cde /Makefile.am
parenteaeda21da168e04b70659a0e17077114dd419ba6 (diff)
downloadtor-225613fcc22958706e55e55ce1295eca3e28971e.tar.gz
tor-225613fcc22958706e55e55ce1295eca3e28971e.zip
Makefile: Quote test-network variable expansions
Also: * wrap some long lines * replace an instance of "test ... -a ..." with "test ... && test ..." Part of 33280.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am73
1 files changed, 48 insertions, 25 deletions
diff --git a/Makefile.am b/Makefile.am
index 72ea34380d..d43b4b0a0a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -281,8 +281,10 @@ check-local: \
need-chutney-path:
@if test ! -d "$$CHUTNEY_PATH"; then \
echo '$$CHUTNEY_PATH was not set.'; \
- if test -d $(top_srcdir)/../chutney -a -x $(top_srcdir)/../chutney/chutney; then \
- echo "Assuming test-network.sh will find" $(top_srcdir)/../chutney; \
+ if test -d "$(top_srcdir)/../chutney" && \
+ test -x "$(top_srcdir)/../chutney/chutney"; then \
+ echo "Assuming test-network.sh will find" \
+ "$(top_srcdir)/../chutney"; \
else \
echo; \
echo "To run these tests, git clone https://git.torproject.org/chutney.git ; export CHUTNEY_PATH=\`pwd\`/chutney"; \
@@ -295,8 +297,10 @@ 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 ipv6_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK_IPV6)"
+ @$(MAKE) test-network-ipv4-impl \
+ ipv4_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK)"
+ @$(MAKE) test-network-ipv6-impl \
+ ipv6_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK_IPV6)"
@$(MAKE) test-network-results
# Run all available tests using automake's test-driver
@@ -304,9 +308,12 @@ 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 ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)"
+ @$(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
# Run IPv4 and mixed tests using automake's test-driver
@@ -315,7 +322,8 @@ 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 mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)"
+ @$(MAKE) test-network-mixed-impl \
+ mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)"
@$(MAKE) test-network-results
# Run IPv6 tests using automake's test-driver
@@ -323,18 +331,22 @@ test-network-ipv4:
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-ipv6-impl \
+ ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)"
@$(MAKE) test-network-results
# Make the test network log directory, if it does not exist
.PHONY: 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
.PHONY: test-network-clean
+# 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
+ 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
@@ -349,13 +361,16 @@ test-network-ipv4-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)."; \
+ echo "tor-stable found, running mixed flavors:" \
+ "$(mixed_flavors)."; \
flavors="$$flavors $(mixed_flavors)"; \
else \
- echo "tor-stable not found, skipping mixed flavors: $(mixed_flavors)."; \
+ 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"
+ $(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)
@@ -370,30 +385,35 @@ test-network-ipv6-impl:
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)."; \
+ 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)."; \
+ 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"
+ $(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
.PHONY: 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 \
echo "SKIP: $$f"; \
done; \
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 \
+ $(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" \
$(TEST_NETWORK_ALL_DRIVER_FLAGS) \
- $(top_srcdir)/src/test/test-network.sh \
- --flavor $$f $(TEST_NETWORK_FLAGS); \
- $(top_srcdir)/src/test/test-network.sh \
+ "$(top_srcdir)/src/test/test-network.sh" \
+ --flavor "$$f" $(TEST_NETWORK_FLAGS); \
+ "$(top_srcdir)/src/test/test-network.sh" \
$(TEST_NETWORK_SHOW_WARNINGS_FOR_LAST_RUN_FLAGS); \
done
@@ -402,9 +422,12 @@ 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
+# We need to grep all matching files, so we can't quote the glob part of the
+# grep arguments
test-network-results:
- @echo "Log and result files are available in $(TEST_NETWORK_ALL_LOG_DIR)."
- @! grep -q FAIL $(TEST_NETWORK_ALL_LOG_DIR)/*.trs
+ @echo \
+ "Log and result files are available in $(TEST_NETWORK_ALL_LOG_DIR)."
+ @! grep -q FAIL "$(TEST_NETWORK_ALL_LOG_DIR)"/*.trs
need-stem-path:
@if test ! -d "$$STEM_SOURCE_DIR"; then \