X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=scripts%2Flttng-tools%2Frelease.sh;h=de65b7a830210635e01ed85cd3d325d7274091c6;hb=51c9c62db1805a4cdd96be18df4082f1ac5d81c5;hp=a2b61ca77e09dfcaa5a8120e7ef9f002d6e5f333;hpb=c95cf818753c9d8f6b6c16709c4c216117088dd0;p=lttng-ci.git diff --git a/scripts/lttng-tools/release.sh b/scripts/lttng-tools/release.sh index a2b61ca..de65b7a 100644 --- a/scripts/lttng-tools/release.sh +++ b/scripts/lttng-tools/release.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2015 Jonathan Rajotte-Julien # Copyright (C) 2020 Michael Jeanson @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Version compare functions vercomp () { set +u @@ -71,6 +73,9 @@ verne() { export TERM="xterm-256color" +# Required variables +WORKSPACE=${WORKSPACE:-} + DEPS_INC="$WORKSPACE/deps/build/include" DEPS_LIB="$WORKSPACE/deps/build/lib" DEPS_PKGCONFIG="$DEPS_LIB/pkgconfig" @@ -87,8 +92,10 @@ export JAVA_HOME="/usr/lib/jvm/default-java" export CLASSPATH="$DEPS_JAVA/*:/usr/share/java/*" SRCDIR="$WORKSPACE/src/lttng-tools" +OUTDIR="$WORKSPACE/out" TAPDIR="$WORKSPACE/tap" -PREFIX="$WORKSPACE/out" + +failed_tests=0 # Create tmp directory TMPDIR="$WORKSPACE/tmp" @@ -132,8 +139,8 @@ export PYTHONPATH="$UST_PYTHON2:$UST_PYTHON3" # Create build and tmp directories -rm -rf "$PREFIX" -mkdir -p "$PREFIX" +rm -rf "$OUTDIR" "$TAPDIR" +mkdir -p "$OUTDIR" "$TAPDIR" @@ -146,11 +153,14 @@ cd "$SRCDIR" # Get source version from configure script eval "$(grep '^PACKAGE_VERSION=' ./configure)" +PACKAGE_VERSION=${PACKAGE_VERSION//\-pre*/} + +CONF_OPTS=("--enable-python-bindings" "--enable-test-java-agent-all" "--enable-test-python-agent-all") TARBALL_FILE="lttng-tools-$PACKAGE_VERSION.tar.bz2" # Make sure the reported version matches the current git tag -GIT_TAG="$(git describe --exact-match --tags $(git log -n1 --pretty='%h')|| echo 'undefined')" +GIT_TAG="$(git describe --exact-match --tags "$(git log -n1 --pretty='%h')" || echo 'undefined')" if [ "v$PACKAGE_VERSION" != "$GIT_TAG" ]; then echo "Git checkout is not tagged or doesn't match the reported version." @@ -160,7 +170,7 @@ fi # Generate release tarball ./configure make dist -cp "./$TARBALL_FILE" "$PREFIX/" +cp "./$TARBALL_FILE" "$OUTDIR/" # Allow core dumps @@ -171,27 +181,54 @@ ulimit -c unlimited export LTTNG_SESSIOND_PATH="/bin/true" -# Do an in-tree test build +## Do an in-tree test build mkdir "$WORKSPACE/intree" cd "$WORKSPACE/intree" || exit 1 -tar xvf "$PREFIX/$TARBALL_FILE" --strip 1 -./configure --prefix="$(mktemp -d)" --enable-python-bindings --enable-test-java-agent-all --enable-test-python-agent-all + +tar xvf "$OUTDIR/$TARBALL_FILE" --strip 1 +./configure --prefix="$(mktemp -d)" "${CONF_OPTS[@]}" + +# BUILD! make -j "$(nproc)" V=1 -make check + make install + +# Run tests, don't fail now, we want to run the archiving steps +make --keep-going check || failed_tests=1 + +# Copy tap logs for the jenkins tap parser before cleaning the build dir +rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$TAPDIR/intree" + +# Clean the build directory make clean -# do an out-of-tree test build + +## Do an out-of-tree test build mkdir "$WORKSPACE/oot" mkdir "$WORKSPACE/oot/src" mkdir "$WORKSPACE/oot/build" cd "$WORKSPACE/oot/src" || exit 1 -tar xvf "$PREFIX/$TARBALL_FILE" --strip 1 + +tar xvf "$OUTDIR/$TARBALL_FILE" --strip 1 cd "$WORKSPACE/oot/build" || exit 1 -"$WORKSPACE/oot/src/configure" --prefix="$(mktemp -d)" --enable-python-bindings --enable-test-java-agent-all --enable-test-python-agent-all +"$WORKSPACE/oot/src/configure" --prefix="$(mktemp -d)" "${CONF_OPTS[@]}" + +# BUILD! make -j "$(nproc)" V=1 -make check + make install + +# Run tests, don't fail now, we want to run the archiving steps +make --keep-going check || failed_tests=1 + +# Copy tap logs for the jenkins tap parser before cleaning the build dir +rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$TAPDIR/oot" + +# Clean the build directory make clean + +# Exit with failure if any of the tests failed +exit $failed_tests + # EOF