aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-10-27 22:42:44 -0700
committerGavin Andresen <gavinandresen@gmail.com>2013-10-27 22:42:44 -0700
commitcd1fc2434ce80f50242e41b5e675f6d0b36045ad (patch)
treee0729ec1713fa42a00d14c2fb41c201fa09ec7c9
parentaa5822f9c3a71818231101b414bd90f5eb40f356 (diff)
parenta27253dc007faaa37efa090a26c2515522efc141 (diff)
Merge pull request #3164 from TheBlueMatt/master
Re-enable BitcoindComparisonTool on pull-tester
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac17
-rwxr-xr-xqa/pull-tester/build-tests.sh.in14
-rwxr-xr-xqa/pull-tester/pull-tester.py9
-rwxr-xr-xqa/pull-tester/run-bitcoind-for-test.sh.in2
-rw-r--r--src/main.cpp4
-rw-r--r--src/main.h7
7 files changed, 44 insertions, 15 deletions
diff --git a/Makefile.am b/Makefile.am
index dc0e6d8f76..bb950ee9f1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -118,7 +118,8 @@ test_bitcoin_filtered.info: test_bitcoin.info
$(LCOV) -r $< "/usr/include/*" -o $@
block_test.info: test_bitcoin_filtered.info
- -@TIMEOUT=15 qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -Xmx2G -jar $(JAVA_COMPARISON_TOOL) 1 18444
+ $(MKDIR_P) qa/tmp
+ -@TIMEOUT=15 qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -jar $(JAVA_COMPARISON_TOOL) qa/tmp/compTool 0 18444
$(LCOV) -c -d $(abs_builddir)/src --t BitcoinJBlockTest -o $@
$(LCOV) -z -d $(abs_builddir)/src
$(LCOV) -z -d $(abs_builddir)/src/leveldb
@@ -146,7 +147,8 @@ endif
if USE_COMPARISON_TOOL
check-local:
- @qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -Xmx2G -jar $(JAVA_COMPARISON_TOOL) 1 18444
+ $(MKDIR_P) qa/tmp
+ @qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -jar $(JAVA_COMPARISON_TOOL) qa/tmp/compTool $(COMPARISON_TOOL_REORG_TESTS) 18444
endif
EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/pull-tester.sh $(WINDOWS_PACKAGING) $(OSX_PACKAGING)
diff --git a/configure.ac b/configure.ac
index 905acd573c..f6d870f332 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,10 +69,15 @@ AC_ARG_ENABLE(tests,
[use_tests=yes])
AC_ARG_WITH([comparison-tool],
- AS_HELP_STRING([with-comparison-tool],[path to java comparison tool (requires --enable-tests)]),
+ AS_HELP_STRING([--with-comparison-tool],[path to java comparison tool (requires --enable-tests)]),
[use_comparison_tool=$withval],
[use_comparison_tool=no])
+AC_ARG_ENABLE([comparison-tool-reorg-tests],
+ AS_HELP_STRING([--enable-comparison-tool-reorg-tests],[enable expensive reorg tests in the comparison tool (default no)]),
+ [use_comparison_tool_reorg_tests=$enableval],
+ [use_comparison_tool_reorg_tests=no])
+
AC_ARG_WITH([qrencode],
[AS_HELP_STRING([--with-qrencode],
[enable QR code support (default is yes if qt is enabled and libqrencode is found)])],
@@ -235,6 +240,15 @@ if test x$use_comparison_tool != xno; then
AC_SUBST(JAVA_COMPARISON_TOOL, $use_comparison_tool)
fi
+if test x$use_comparison_tool_reorg_tests != xno; then
+ if test x$use_comparison_tool == x; then
+ AC_MSG_ERROR("comparison tool reorg tests but comparison tool was not specified")
+ fi
+ AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 1)
+else
+ AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 0)
+fi
+
if test x$use_lcov == xyes; then
if test x$LCOV == x; then
AC_MSG_ERROR("lcov testing requested but lcov not found")
@@ -678,6 +692,7 @@ AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes])
AM_CONDITIONAL([USE_LCOV],[test x$use_lcov == xyes])
AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno])
+AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno])
AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])
diff --git a/qa/pull-tester/build-tests.sh.in b/qa/pull-tester/build-tests.sh.in
index 461e7be048..9640bcaf67 100755
--- a/qa/pull-tester/build-tests.sh.in
+++ b/qa/pull-tester/build-tests.sh.in
@@ -9,8 +9,9 @@ set -o xtrace
MINGWPREFIX=$1
JAVA_COMPARISON_TOOL=$2
-JOBS=${3-1}
-OUT_DIR=${4-}
+RUN_LARGE_REORGS=$3
+JOBS=${4-1}
+OUT_DIR=${5-}
if [ $# -lt 2 ]; then
echo "Usage: $0 [mingw-prefix] [java-comparison-tool] <make jobs> <save output dir>"
@@ -32,10 +33,11 @@ cd @abs_top_srcdir@
make distdir
mv $DISTDIR linux-build
cd linux-build
-# TODO: re-enable blockchain tester tool, as of 11 Oct 2013 is it not working properly
-# on the pull-tester machine.
-#./configure --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL"
-./configure --disable-silent-rules --disable-ccache
+if [ $RUN_LARGE_REORGS = 1 ]; then
+ ./configure --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL" --enable-comparison-tool-reorg-tests
+else
+ ./configure --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL"
+fi
make -j$JOBS
# link interesting binaries to parent out/ directory, if it exists. Do this before
diff --git a/qa/pull-tester/pull-tester.py b/qa/pull-tester/pull-tester.py
index 34dd74c7e0..6a7c45ccd1 100755
--- a/qa/pull-tester/pull-tester.py
+++ b/qa/pull-tester/pull-tester.py
@@ -67,7 +67,12 @@ Contact BlueMatt on freenode if something looks broken."""
auth=(os.environ['GITHUB_USER'], os.environ["GITHUB_AUTH_TOKEN"]))
if success == True:
- post_data = { "body" : "Automatic sanity-testing: PASSED, see " + linkUrl + " for binaries and test log." + common_message}
+ if needTests:
+ message = "Automatic sanity-testing: PLEASE ADD TEST-CASES, though technically passed. See " + linkUrl + " for binaries and test log."
+ else:
+ message = "Automatic sanity-testing: PASSED, see " + linkUrl + " for binaries and test log."
+
+ post_data = { "body" : message + common_message}
elif inMerge:
post_data = { "body" : "Automatic sanity-testing: FAILED MERGE, see " + linkUrl + " for test log." + """
@@ -113,7 +118,7 @@ def testpull(number, comment_url, clone_url, commit):
run("chown -R ${BUILD_USER}:${BUILD_GROUP} ${CHROOT_COPY}/${OUT_DIR}", fail_hard=False)
script = os.environ["BUILD_PATH"]+"/qa/pull-tester/pull-tester.sh"
- script += " ${BUILD_PATH} ${MINGW_DEPS_DIR} ${SCRIPTS_DIR}/BitcoindComparisonTool.jar 6 ${OUT_DIR}"
+ script += " ${BUILD_PATH} ${MINGW_DEPS_DIR} ${SCRIPTS_DIR}/BitcoindComparisonTool_jar/BitcoindComparisonTool.jar 0 6 ${OUT_DIR}"
returncode = run("chroot ${CHROOT_COPY} sudo -u ${BUILD_USER} -H timeout ${TEST_TIMEOUT} "+script,
fail_hard=False, stdout=out, stderr=out)
diff --git a/qa/pull-tester/run-bitcoind-for-test.sh.in b/qa/pull-tester/run-bitcoind-for-test.sh.in
index e02fef3b56..e8bcb4bf7a 100755
--- a/qa/pull-tester/run-bitcoind-for-test.sh.in
+++ b/qa/pull-tester/run-bitcoind-for-test.sh.in
@@ -5,7 +5,7 @@ mkdir -p "$DATADIR"/regtest
touch "$DATADIR/regtest/debug.log"
tail -q -n 1 -F "$DATADIR/regtest/debug.log" | grep -m 1 -q "Done loading" &
WAITER=$!
-"@abs_top_builddir@/src/bitcoind@EXEEXT@" -connect=0.0.0.0 -datadir="$DATADIR" -rpcuser=user -rpcpassword=pass -listen -keypool=3 -debug -logtimestamps -port=18444 -regtest &
+"@abs_top_builddir@/src/bitcoind@EXEEXT@" -connect=0.0.0.0 -datadir="$DATADIR" -rpcuser=user -rpcpassword=pass -listen -keypool=3 -debug -debug=net -logtimestamps -port=18444 -regtest &
BITCOIND=$!
#Install a watchdog.
diff --git a/src/main.cpp b/src/main.cpp
index 6ffbc5a44e..56bd7a5cfd 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2355,7 +2355,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
uniqueTx.insert(block.GetTxHash(i));
}
if (uniqueTx.size() != block.vtx.size())
- return state.DoS(100, error("CheckBlock() : duplicate transaction"));
+ return state.DoS(100, error("CheckBlock() : duplicate transaction"), true);
unsigned int nSigOps = 0;
BOOST_FOREACH(const CTransaction& tx, block.vtx)
@@ -3783,7 +3783,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
LOCK(cs_main);
CValidationState state;
- if (ProcessBlock(state, pfrom, &block))
+ if (ProcessBlock(state, pfrom, &block) || state.CorruptionPossible())
mapAlreadyAskedFor.erase(inv);
int nDoS = 0;
if (state.IsInvalid(nDoS))
diff --git a/src/main.h b/src/main.h
index 76de47071e..2a67747b47 100644
--- a/src/main.h
+++ b/src/main.h
@@ -946,13 +946,15 @@ private:
MODE_ERROR, // run-time error
} mode;
int nDoS;
+ bool corruptionPossible;
public:
CValidationState() : mode(MODE_VALID), nDoS(0) {}
- bool DoS(int level, bool ret = false) {
+ bool DoS(int level, bool ret = false, bool corruptionIn = false) {
if (mode == MODE_ERROR)
return ret;
nDoS += level;
mode = MODE_INVALID;
+ corruptionPossible = corruptionIn;
return ret;
}
bool Invalid(bool ret = false) {
@@ -982,6 +984,9 @@ public:
}
return false;
}
+ bool CorruptionPossible() {
+ return corruptionPossible;
+ }
};
/** An in-memory indexed chain of blocks. */