jjb: lttng-tools: Add TAP results to release jobs
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 22 May 2020 20:19:10 +0000 (16:19 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Fri, 22 May 2020 20:19:10 +0000 (16:19 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
jobs/lttng-tools.yaml
scripts/lttng-tools/release.sh

index a9c0c59aa3391cb2ea39fe5ce0d3e7e579b0bda7..2776043bc18c44424ece8ee73aa3e66e48a0a138 100644 (file)
           url: git://github.com/{github_user}/{github_name}.git
           browser: githubweb
           browser-url: https://github.com/{github_user}/{github_name}
+          refspec: '+refs/tags/*:refs/remotes/origin/tags/*'
           branches:
             - '*/tags/{version}.*'
           basedir: src/lttng-tools
               build-steps:
                   - shell:
                       !include-raw-escape: scripts/lttng-tools/hang_processes.sh
+      - tap:
+          results: 'tap/**/*.*'
+          fail-if-no-results: true
+          failed-tests-mark-build-as-failure: true
+          todo-is-failure: false
       - warnings:
           console-log-parsers:
             - 'GNU Make + GNU C Compiler (gcc)'
index a2b61ca77e09dfcaa5a8120e7ef9f002d6e5f333..0bd5c5ca9ec8051e4043e415c009f3a1d27d798b 100644 (file)
@@ -71,6 +71,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 +90,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 +137,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 +151,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 +168,7 @@ fi
 # Generate release tarball
 ./configure
 make dist
-cp "./$TARBALL_FILE" "$PREFIX/"
+cp "./$TARBALL_FILE" "$OUTDIR/"
 
 
 # Allow core dumps
@@ -171,27 +179,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
This page took 0.027141 seconds and 4 git commands to generate.