Skip to content

Commit

Permalink
Merge pull request #3164 from TheBlueMatt/master
Browse files Browse the repository at this point in the history
Re-enable BitcoindComparisonTool on pull-tester
  • Loading branch information
gavinandresen committed Oct 28, 2013
2 parents aa5822f + a27253d commit cd1fc24
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 15 deletions.
6 changes: 4 additions & 2 deletions Makefile.am
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
17 changes: 16 additions & 1 deletion configure.ac
Expand Up @@ -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)])],
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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])
Expand Down
14 changes: 8 additions & 6 deletions qa/pull-tester/build-tests.sh.in
Expand Up @@ -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>"
Expand All @@ -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
Expand Down
9 changes: 7 additions & 2 deletions qa/pull-tester/pull-tester.py
Expand Up @@ -67,7 +67,12 @@ def commentOn(commentUrl, success, inMerge, needTests, linkUrl):
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." + """
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion qa/pull-tester/run-bitcoind-for-test.sh.in
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down
7 changes: 6 additions & 1 deletion src/main.h
Expand Up @@ -946,13 +946,15 @@ class CValidationState {
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) {
Expand Down Expand Up @@ -982,6 +984,9 @@ class CValidationState {
}
return false;
}
bool CorruptionPossible() {
return corruptionPossible;
}
};

/** An in-memory indexed chain of blocks. */
Expand Down

0 comments on commit cd1fc24

Please sign in to comment.