Skip to content

Commit

Permalink
Merge 1579747 into 4417ac8
Browse files Browse the repository at this point in the history
  • Loading branch information
nmathewson committed Feb 27, 2019
2 parents 4417ac8 + 1579747 commit 431fe6b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .travis.yml
Expand Up @@ -39,7 +39,11 @@ matrix:
## We run coverage with hardening off, which seems like enough
# - env: HARDENING_OPTIONS=""
## We check asciidoc with distcheck, to make sure we remove doc products
- env: DISTCHECK="yes" ASCIIDOC_OPTIONS=""
- env: DISTCHECK="yes" ASCIIDOC_OPTIONS="" SKIP_MAKE_CHECK="yes"
# We also try running a hardened clang build with chutney on Linux.
- env: CHUTNEY="yes" SKIP_MAKE_CHECK="yes"
compiler: clang
os: linux

## Uncomment to allow the build to report success (with non-required
## sub-builds continuing to run) if all required sub-builds have
Expand Down Expand Up @@ -142,7 +146,8 @@ install:
- if [[ "$COVERAGE_OPTIONS" != "" ]]; then pip install --user cpp-coveralls; fi
## If we're on OSX, and using asciidoc, configure asciidoc
- if [[ "$ASCIIDOC_OPTIONS" == "" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"; fi
##
## If we're running chutney, install it.
- if [[ "$CHUTNEY" != "" ]]; then git clone --depth 1 https://github.com/torproject/chutney.git ; export CHUTNEY_PATH="$(pwd)/chutney"; fi
## Finally, list installed package versions
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then dpkg-query --show; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list --versions; fi
Expand All @@ -153,15 +158,16 @@ script:
- echo "Configure flags are $CONFIGURE_FLAGS"
- ./configure $CONFIGURE_FLAGS
## We run `make check` because that's what https://jenkins.torproject.org does.
- if [[ "$DISTCHECK" == "" ]]; then make check; fi
- if [[ "$SKIP_MAKE_CHECK" == "" ]]; then make check; fi
- if [[ "$DISTCHECK" != "" ]]; then make distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS"; fi
- if [[ "$CHUTNEY" != "" ]]; then make test-network-forgiving; fi

after_failure:
## configure will leave a log file with more details of config failures.
## But the log is too long for travis' rendered view, so tail it.
- tail -1000 config.log || echo "tail failed"
## `make check` will leave a log file with more details of test failures.
- if [[ "$DISTCHECK" == "" ]]; then cat test-suite.log || echo "cat failed"; fi
- if [[ "$SKIP_MAKE_CHECK" == "" ]]; then cat test-suite.log || echo "cat failed"; fi
## `make distcheck` puts it somewhere different.
- if [[ "$DISTCHECK" != "" ]]; then make show-distdir-testlog || echo "make failed"; fi

Expand Down
5 changes: 5 additions & 0 deletions Makefile.am
Expand Up @@ -99,6 +99,11 @@ need-chutney-path:
test-network: need-chutney-path $(TESTING_TOR_BINARY) src/tools/tor-gencert
$(top_srcdir)/src/test/test-network.sh $(TEST_NETWORK_FLAGS)

test-network-forgiving: need-chutney-path $(TESTING_TOR_BINARY) src/tools/tor-gencert
@ export TEST_NETWORK_FLAGS="$(TEST_NETWORK_FLAGS)"; \
export tor_srcdir=$(top_srcdir); \
$(top_srcdir)/src/test/test-network-forgiving.sh $(TEST_NETWORK_FLAGS)

# Run all available tests using automake's test-driver
# only run IPv6 tests if we can ping6 ::1 (localhost)
# some IPv6 tests will fail without an IPv6 DNS server (see #16971 and #17011)
Expand Down
3 changes: 3 additions & 0 deletions changes/chutney_ci
@@ -0,0 +1,3 @@
o Minor features (continuous integration):
- Our Travis configuration now uses Chutney to run some network
integration tests automatically. Closes ticket 29280.
24 changes: 24 additions & 0 deletions src/test/test-network-forgiving.sh
@@ -0,0 +1,24 @@
#!/bin/sh

TEST_NET_RETRIES=${TEST_NET_RETRIES:-3}

n_tries=0
test_net_okay=0

while [ "${n_tries}" -lt "${TEST_NET_RETRIES}" ]; do
n_tries=$((n_tries + 1))
# shellcheck disable=SC2086
if "${top_srcdir:-.}/src/test/test-network.sh" ${TEST_NETWORK_FLAGS}; then
echo "Chutney ran successfully after ${n_tries} attempt(s)."
test_net_okay=1
break
fi
echo "Chutney failed on attempt ${n_tries}/${TEST_NET_RETRIES}."
done;

if [ "$test_net_okay" != 1 ]; then
echo "Too many chutney failures; failing."
exit 1;
fi

exit 0

0 comments on commit 431fe6b

Please sign in to comment.