diff --git a/Makefile b/Makefile index 7f439fb84..f225731a3 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,9 @@ CCANDIR := ccan # Where we keep the BOLT RFCs BOLTDIR := ../lightning-rfc/ +# If you don't have (working) valgrind. +#NO_VALGRIND := 1 + # Bitcoin uses DER for signatures (Add BIP68 & HAS_CSV if it's supported) BITCOIN_FEATURES := \ -DHAS_BIP68=1 \ @@ -187,7 +190,7 @@ $(HELPER_OBJS) $(BITCOIN_OBJS) $(TEST_PROGRAMS:=.o): $(BITCOIN_HEADERS) $(CORE_H daemon-test-%: daemon/test/scripts/shutdown.sh 2>/dev/null || true - daemon/test/test.sh --$* + NO_VALGRIND=$(NO_VALGRIND) daemon/test/test.sh --$* # These don't work in parallel, so chain the deps daemon-test-steal: daemon-test-dump-onchain @@ -211,7 +214,7 @@ test-onion4: test/test_onion test/onion_key set -e; TMPF=/tmp/onion.$$$$; python test/test_onion.py generate $$(test/onion_key --pub `seq 20`) > $$TMPF; for k in `seq 20`; do python test/test_onion.py decode $$(test/onion_key --priv $$k) $$(test/onion_key --pub $$k) < $$TMPF > $$TMPF.unwrap; mv $$TMPF.unwrap $$TMPF; done; rm -f $$TMPF test-protocol: test/test_protocol - set -e; TMP=`mktemp`; for f in test/commits/*.script; do if ! test/test_protocol < $$f > $$TMP; then echo "test/test_protocol < $$f FAILED" >&2; exit 1; fi; diff -u $$TMP $$f.expected; done; rm $$TMP + set -e; TMP=`mktemp`; [ -n "$(NO_VALGRIND)" ] || PREFIX="valgrind -q --error-exitcode=7"; for f in test/commits/*.script; do if ! $$PREFIX test/test_protocol < $$f > $$TMP; then echo "test/test_protocol < $$f FAILED" >&2; exit 1; fi; diff -u $$TMP $$f.expected; done; rm $$TMP check: daemon-tests test-onion test-protocol bitcoin-tests diff --git a/daemon/test/test.sh b/daemon/test/test.sh index 9012d10e5..ecf9b1122 100755 --- a/daemon/test/test.sh +++ b/daemon/test/test.sh @@ -28,13 +28,13 @@ NO_HTLCS_FEE=$((338 * $FEE_RATE / 2000 * 2000)) ONE_HTLCS_FEE=$(( (338 + 32) * $FEE_RATE / 2000 * 2000)) EXTRA_FEE=$(($ONE_HTLCS_FEE - $NO_HTLCS_FEE)) -# Always use valgrind. -PREFIX="valgrind -q --error-exitcode=7" +# Always use valgrind if available. +[ -n "$NO_VALGRIND" ] || PREFIX="valgrind -q --error-exitcode=7" while [ $# != 0 ]; do case x"$1" in x"--valgrind-vgdb") - PREFIX="valgrind --vgdb-error=1" + [ -n "$NO_VALGRIND" ] || PREFIX="valgrind --vgdb-error=1" REDIR1="/dev/tty" REDIRERR1="/dev/tty" REDIR2="/dev/tty"