Skip to content

Commit

Permalink
Rework pull-tester scripts, disable blockchain tester
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
gavinandresen committed Oct 11, 2013
1 parent 26002aa commit 0dd127a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
42 changes: 36 additions & 6 deletions qa/pull-tester/build-tests.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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] <make jobs>"
echo "Usage: $0 [mingw-prefix] [java-comparison-tool] <make jobs> <save output dir>"
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

16 changes: 9 additions & 7 deletions qa/pull-tester/pull-tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -147,6 +148,7 @@ def environ_default(setting, value):
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")
Expand Down

0 comments on commit 0dd127a

Please sign in to comment.