Browse Source

Merge pull request #3164 from TheBlueMatt/master

Re-enable BitcoindComparisonTool on pull-tester
0.10
Gavin Andresen 11 years ago
parent
commit
cd1fc2434c
  1. 6
      Makefile.am
  2. 17
      configure.ac
  3. 14
      qa/pull-tester/build-tests.sh.in
  4. 9
      qa/pull-tester/pull-tester.py
  5. 2
      qa/pull-tester/run-bitcoind-for-test.sh.in
  6. 4
      src/main.cpp
  7. 7
      src/main.h

6
Makefile.am

@ -118,7 +118,8 @@ test_bitcoin_filtered.info: test_bitcoin.info @@ -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 @@ -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)

17
configure.ac

@ -69,10 +69,15 @@ AC_ARG_ENABLE(tests, @@ -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 @@ -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]) @@ -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])

14
qa/pull-tester/build-tests.sh.in

@ -9,8 +9,9 @@ set -o xtrace @@ -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@ @@ -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

9
qa/pull-tester/pull-tester.py

@ -67,7 +67,12 @@ Contact BlueMatt on freenode if something looks broken.""" @@ -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): @@ -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)

2
qa/pull-tester/run-bitcoind-for-test.sh.in

@ -5,7 +5,7 @@ mkdir -p "$DATADIR"/regtest @@ -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.

4
src/main.cpp

@ -2355,7 +2355,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo @@ -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) @@ -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))

7
src/main.h

@ -946,13 +946,15 @@ private: @@ -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: @@ -982,6 +984,9 @@ public:
}
return false;
}
bool CorruptionPossible() {
return corruptionPossible;
}
};
/** An in-memory indexed chain of blocks. */

Loading…
Cancel
Save