From 0dd127a791127e72661cb78efec26a2fdd4ec4ba Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Fri, 11 Oct 2013 11:33:27 +1000 Subject: [PATCH 1/2] Rework pull-tester scripts, disable blockchain tester Re-organize the pull-tester scripts a bit. And disables running the blockchain tester, it is not working properly on the pull-tester machine for reasons I cannot explain (fails to start). --- qa/pull-tester/build-tests.sh.in | 42 +++++++++++++++++++++++++++----- qa/pull-tester/pull-tester.py | 16 ++++++------ 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/qa/pull-tester/build-tests.sh.in b/qa/pull-tester/build-tests.sh.in index 85d9d55bb..6ae9e9606 100755 --- a/qa/pull-tester/build-tests.sh.in +++ b/qa/pull-tester/build-tests.sh.in @@ -3,44 +3,74 @@ # Param2: Path to java comparison tool # Param3: Number of make jobs. Defaults to 1. +# Exit immediately if anything fails: set -e set -o xtrace MINGWPREFIX=$1 JAVA_COMPARISON_TOOL=$2 JOBS=${3-1} +OUT_DIR=${4-} if [ $# -lt 2 ]; then - echo "Usage: $0 [mingw-prefix] [java-comparison-tool] " + echo "Usage: $0 [mingw-prefix] [java-comparison-tool] " exit 1 fi DISTDIR=@PACKAGE@-@VERSION@ -# Test win32 build first (it breaks the most often) +# Cross-compile for windows first (breaking the mingw/windows build is most common) cd @abs_top_srcdir@ make distdir mv $DISTDIR win32-build cd win32-build ./configure --disable-silent-rules --disable-ccache --prefix=$MINGWPREFIX --host=i586-mingw32msvc --with-qt-bindir=$MINGWPREFIX/host/bin --with-qt-plugindir=$MINGWPREFIX/plugins --with-qt-incdir=$MINGWPREFIX/include --with-boost=$MINGWPREFIX --with-protoc-bindir=$MINGWPREFIX/host/bin CPPFLAGS=-I$MINGWPREFIX/include LDFLAGS=-L$MINGWPREFIX/lib make -j$JOBS -make check -# ... then linux build, with blockchain-tester: +# And compile for Linux: cd @abs_top_srcdir@ make distdir mv $DISTDIR linux-build cd linux-build -./configure --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL" +# 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 make -j$JOBS + +# link interesting binaries to parent out/ directory, if it exists. Do this before +# running unit tests (we want bad binaries to be easy to find) +if [ -d "$OUT_DIR" -a -w "$OUT_DIR" ]; then + set +e + # Windows: + cp @abs_top_srcdir@/win32-build/src/bitcoind.exe $OUT_DIR/bitcoind.exe + cp @abs_top_srcdir@/win32-build/src/test/test_bitcoin.exe $OUT_DIR/test_bitcoin.exe + cp @abs_top_srcdir@/win32-build/src/qt/bitcoind-qt.exe $OUT_DIR/bitcoin-qt.exe + # Linux: + cp @abs_top_srcdir@/linux-build/src/bitcoind $OUT_DIR/bitcoind + cp @abs_top_srcdir@/linux-build/src/test/test_bitcoin $OUT_DIR/test_bitcoin + cp @abs_top_srcdir@/linux-build/src/qt/bitcoind-qt $OUT_DIR/bitcoin-qt + set -e +fi + +# Run unit tests and blockchain-tester on Linux: +cd @abs_top_srcdir@/linux-build make check +# Clean up builds (pull-tester machine doesn't have infinite disk space) +cd @abs_top_srcdir@/linux-build +make clean +cd @abs_top_srcdir@/win32-build +make clean + # Test code coverage cd @abs_top_srcdir@ make distdir mv $DISTDIR linux-coverage-build cd linux-coverage-build -./configure --enable-lcov --with-comparison-tool="$JAVA_COMPARISON_TOOL" +# TODO: re-enable blockchain tester tool +#./configure --enable-lcov --with-comparison-tool="$JAVA_COMPARISON_TOOL" +./configure --enable-lcov make -j$JOBS make cov diff --git a/qa/pull-tester/pull-tester.py b/qa/pull-tester/pull-tester.py index fe50177a2..34dd74c7e 100755 --- a/qa/pull-tester/pull-tester.py +++ b/qa/pull-tester/pull-tester.py @@ -38,7 +38,7 @@ def checkout_pull(clone_url, commit, out): # Init build_dir=os.environ["BUILD_DIR"] run("umount ${CHROOT_COPY}/proc", fail_hard=False) - run("rsync --delete -apv ${CHROOT_MASTER} ${CHROOT_COPY}") + run("rsync --delete -apv ${CHROOT_MASTER}/ ${CHROOT_COPY}") run("rm -rf ${CHROOT_COPY}${SCRIPTS_DIR}") run("cp -a ${SCRIPTS_DIR} ${CHROOT_COPY}${SCRIPTS_DIR}") # Merge onto upstream/master @@ -108,17 +108,18 @@ def testpull(number, comment_url, clone_url, commit): open(os.environ["TESTED_DB"], "a").write(commit + "\n") return - # New: pull-tester.sh script(s) are in the tree: + run("rm -rf ${CHROOT_COPY}/${OUT_DIR}", fail_hard=False); + run("mkdir -p ${CHROOT_COPY}/${OUT_DIR}", fail_hard=False); + 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 1" + script += " ${BUILD_PATH} ${MINGW_DEPS_DIR} ${SCRIPTS_DIR}/BitcoindComparisonTool.jar 6 ${OUT_DIR}" returncode = run("chroot ${CHROOT_COPY} sudo -u ${BUILD_USER} -H timeout ${TEST_TIMEOUT} "+script, fail_hard=False, stdout=out, stderr=out) + run("mv ${CHROOT_COPY}/${OUT_DIR} " + dir) run("mv ${BUILD_DIR} " + dir) - # TODO: FIXME - # Idea: have run-script save interesting output... - # run("cp /mnt/chroot-tmp/home/ubuntu/.bitcoin/regtest/debug.log " + dir) - # os.system("chmod +r " + dir + "/debug.log") + if returncode == 42: print("Successfully tested pull (needs tests) - sending comment to: " + comment_url) commentOn(comment_url, True, False, True, resultsurl) @@ -147,6 +148,7 @@ environ_default("MINGW_DEPS_DIR", "/mnt/w32deps") environ_default("SCRIPTS_DIR", "/mnt/test-scripts") environ_default("CHROOT_COPY", "/mnt/chroot-tmp") environ_default("CHROOT_MASTER", "/mnt/chroot") +environ_default("OUT_DIR", "/mnt/out") environ_default("BUILD_PATH", "/mnt/bitcoin") os.environ["BUILD_DIR"] = os.environ["CHROOT_COPY"] + os.environ["BUILD_PATH"] environ_default("RESULTS_DIR", "/mnt/www/pull-tester") From 38a94488cebffc41ae57d3519bc253938b75aa44 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Fri, 11 Oct 2013 12:32:17 +1000 Subject: [PATCH 2/2] Disable code-coverage builds for now Not working on the pull-tester machine, 'make cov' hangs there. --- qa/pull-tester/build-tests.sh.in | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/qa/pull-tester/build-tests.sh.in b/qa/pull-tester/build-tests.sh.in index 6ae9e9606..461e7be04 100755 --- a/qa/pull-tester/build-tests.sh.in +++ b/qa/pull-tester/build-tests.sh.in @@ -63,14 +63,12 @@ make clean cd @abs_top_srcdir@/win32-build make clean -# Test code coverage -cd @abs_top_srcdir@ -make distdir -mv $DISTDIR linux-coverage-build -cd linux-coverage-build -# TODO: re-enable blockchain tester tool -#./configure --enable-lcov --with-comparison-tool="$JAVA_COMPARISON_TOOL" -./configure --enable-lcov -make -j$JOBS -make cov - +# TODO: Fix code coverage builds on pull-tester machine +# # Test code coverage +# cd @abs_top_srcdir@ +# make distdir +# mv $DISTDIR linux-coverage-build +# cd linux-coverage-build +# ./configure --enable-lcov --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL" +# make -j$JOBS +# make cov