browser-url: https://github.com/{github_user}/{github_name}
branches:
- origin/{version}
+ basedir: src/lttng-ust
triggers:
- pollscm:
# TODO: Scan for open tasks
publishers:
- tap:
- results: 'tap/**/*.tap'
+ results: 'tap/**/*.log'
failed-tests-mark-build-as-failure: true
todo-is-failure: false
- warnings:
publishers:
- workspace-cleanup
+ - archive:
+ artifacts: 'analysis-results.tgz,cov-int/**'
+ allow-empty: false
# TODO
- job-template:
# The project name and token have to be provided trough env variables
#COVERITY_SCAN_PROJECT_NAME=""
#COVERITY_SCAN_TOKEN=""
-COVERITY_SCAN_VERSION=`git describe --always | sed 's|-|.|g'`
COVERITY_SCAN_DESCRIPTION="Automated CI build"
COVERITY_SCAN_NOTIFICATION_EMAIL="ci-notification@lists.lttng.org"
COVERITY_SCAN_BUILD_OPTIONS=""
#COVERITY_SCAN_BUILD_OPTIONS="--return-emit-failures 8 --parse-error-threshold 85"
+SRCDIR="$WORKSPACE/src/${COVERITY_SCAN_PROJECT_NAME}"
+TMPDIR="$WORKSPACE/tmp"
+
NPROC=$(nproc)
PLATFORM=$(uname)
export CFLAGS="-O0 -g -DDEBUG"
-TOOL_ARCHIVE=/tmp/cov-analysis-${PLATFORM}.tgz
+TOOL_ARCHIVE="$TMPDIR/cov-analysis-${PLATFORM}.tgz"
TOOL_URL=https://scan.coverity.com/download/${PLATFORM}
-TOOL_BASE=/tmp/coverity-scan-analysis
+TOOL_BASE="$TMPDIR/coverity-scan-analysis"
UPLOAD_URL="https://scan.coverity.com/builds"
SCAN_URL="https://scan.coverity.com"
-RESULTS_DIR="cov-int"
+RESULTS_DIR_NAME="cov-int"
+RESULTS_DIR="$WORKSPACE/$RESULTS_DIR_NAME"
+RESULTS_ARCHIVE=analysis-results.tgz
+# Create tmp directory
+rm -rf "$TMPDIR"
+mkdir -p "$TMPDIR"
+
+export TMPDIR
+
+case "$COVERITY_SCAN_PROJECT_NAME" in
+babeltrace)
+ CONF_OPTS="--enable-python-bindings --enable-python-bindings-doc"
+ ;;
+liburcu)
+ CONF_OPTS=""
+ ;;
+lttng-modules)
+ CONF_OPTS=""
+ ;;
+lttng-tools)
+ CONF_OPTS=""
+ ;;
+lttng-ust)
+ CONF_OPTS="--enable-java-agent-all --enable-python-agent"
+ export CLASSPATH="/usr/share/java/log4j-1.2.jar"
+ ;;
+*)
+ echo "Generic project, no configure options."
+ CONF_OPTS=""
+ ;;
+esac
# liburcu dependency
if [ -d "$WORKSPACE/deps/liburcu" ]; then
URCU_INCS="$WORKSPACE/deps/liburcu/build/include/"
URCU_LIBS="$WORKSPACE/deps/liburcu/build/lib/"
-
+
export CPPFLAGS="-I$URCU_INCS ${CPPFLAGS:-}"
export LDFLAGS="-L$URCU_LIBS ${LDFLAGS:-}"
export LD_LIBRARY_PATH="$URCU_LIBS:${LD_LIBRARY_PATH:-}"
if [ -d "$WORKSPACE/deps/lttng-ust" ]; then
UST_INCS="$WORKSPACE/deps/lttng-ust/build/include/"
UST_LIBS="$WORKSPACE/deps/lttng-ust/build/lib/"
-
+
export CPPFLAGS="-I$UST_INCS ${CPPFLAGS:-}"
export LDFLAGS="-L$UST_LIBS ${LDFLAGS:-}"
export LD_LIBRARY_PATH="$UST_LIBS:${LD_LIBRARY_PATH:-}"
TOOL_DIR=`find $TOOL_BASE -type d -name 'cov-analysis*'`
export PATH=$TOOL_DIR/bin:$PATH
+cd "$SRCDIR"
+
+COVERITY_SCAN_VERSION=`git describe --always | sed 's|-|.|g'`
# Prepare build dir
if [ -f "./bootstrap" ]; then
./bootstrap
- ./configure
+ ./configure $CONF_OPTS
fi
# Build
cov-build --dir $RESULTS_DIR $COVERITY_SCAN_BUILD_OPTIONS make -j$NPROC V=1
cov-import-scm --dir $RESULTS_DIR --scm git --log $RESULTS_DIR/scm_log.txt
+cd "${WORKSPACE}"
+
# Tar results
echo -e "\033[33;1mTarring Coverity Scan Analysis results...\033[0m"
-RESULTS_ARCHIVE=analysis-results.tgz
-tar czf $RESULTS_ARCHIVE $RESULTS_DIR
-
+tar czf $RESULTS_ARCHIVE $RESULTS_DIR_NAME
# Upload results
echo -e "\033[33;1mUploading Coverity Scan Analysis results...\033[0m"
#!/bin/bash -exu
#
-# Copyright (C) 2015 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+# Copyright (C) 2015, Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+# 2016, Michael Jeanson <mjeanson@efficios.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Create build directory
-rm -rf $WORKSPACE/build
-mkdir -p $WORKSPACE/build
-
# liburcu
URCU_INCS="$WORKSPACE/deps/liburcu/build/include/"
URCU_LIBS="$WORKSPACE/deps/liburcu/build/lib/"
-
+SRCDIR="$WORKSPACE/src/lttng-ust"
+TMPDIR="$WORKSPACE/tmp"
PREFIX="$WORKSPACE/build"
+# Create build and tmp directories
+rm -rf "$PREFIX" "$TMPDIR"
+mkdir -p "$PREFIX" "$TMPDIR"
+
+export TMPDIR
+
# Set platform variables
case "$arch" in
*)
;;
esac
+# Enter the source directory
+cd "$SRCDIR"
-# Run bootstrap prior to configure
+# Run bootstrap in the source directory prior to configure
./bootstrap
#
# Make sure to move to the build_path and configure
# before continuing
-BUILD_PATH=$WORKSPACE
+BUILD_PATH=$SRCDIR
case "$build" in
oot)
echo "Out of tree build"
BUILD_PATH=$WORKSPACE/oot
mkdir -p $BUILD_PATH
cd $BUILD_PATH
- $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
+ $SRCDIR/configure --prefix=$PREFIX $CONF_OPTS
;;
dist)
BUILD_PATH=`mktemp -d`
# Initial configure and generate tarball
- ./configure
+ $SRCDIR/configure
$MAKE dist
mkdir -p $BUILD_PATH
;;
*)
- BUILD_PATH=$WORKSPACE
- echo "Standard tree build"
- $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
+ echo "Standard in-tree build"
+ $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS
;;
esac
$MAKE install
# Run tests
-rm -rf $WORKSPACE/tap
-mkdir -p $WORKSPACE/tap/unit
-
-cd $BUILD_PATH/tests
-
-prove --merge --exec '' - < $BUILD_PATH/tests/unit_tests --archive $WORKSPACE/tap/unit/ || true
-
-# TAP plugin is having a hard time with .yml files.
-rm -f $WORKSPACE/tap/unit/meta.yml
+$MAKE check
-# And also with files without extension, so rename all result to *.tap
-find $WORKSPACE/tap/unit/ -type f -exec mv {} {}.tap \;
+# Copy tap logs for the jenkins tap parser
+rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$WORKSPACE/tap"
-# Cleanup
+# Clean the build directory
$MAKE clean
# Cleanup rpath in executables and shared libraries
-find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \;
+find $PREFIX/lib -name "*.so" -exec chrpath --delete {} \;
# Remove libtool .la files
-find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \;
+find $PREFIX/lib -name "*.la" -exec rm -f {} \;
# Clean temp dir for dist build
if [ "$build" = "dist" ]; then
- cd $WORKSPACE
+ cd $SRCDIR
rm -rf $BUILD_PATH
fi
#!/bin/sh -exu
#
# Copyright (C) 2015 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+# 2016 - Michael Jeanson <mjeanson@efficios.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# do not exit immediately if any command fails
set +e
-
-# temp directory to store the scan-build report
-SCAN_BUILD_TMPDIR=$( mktemp -d /tmp/scan-build.XXXXXX )
-
-# directory to use for archiving the scan-build report
+
+SRCDIR="$WORKSPACE/src/lttng-ust"
+TMPDIR="$WORKSPACE/tmp"
+PREFIX="$WORKSPACE/build"
+
+# Directory to archive the scan-build report
SCAN_BUILD_ARCHIVE="${WORKSPACE}/scan-build-archive"
-# Create build directory
-rm -rf $WORKSPACE/build
-mkdir -p $WORKSPACE/build
+# Create build and tmp directories
+rm -rf "$PREFIX" "$TMPDIR"
+mkdir -p "$PREFIX" "$TMPDIR"
+
+export TMPDIR
+
+# temp directory to store the scan-build report
+SCAN_BUILD_TMPDIR=$( mktemp -d )
# liburcu
URCU_INCS="$WORKSPACE/deps/liburcu/build/include/"
export LDFLAGS="-L$URCU_LIBS"
export LD_LIBRARY_PATH="$URCU_LIBS:${LD_LIBRARY_PATH:-}"
-PREFIX="$WORKSPACE/build"
+# Enter the source directory
+cd "$SRCDIR"
+# Run bootstrap in the source directory prior to configure
./bootstrap
+
+
./configure --prefix=$PREFIX
-make clean
+
# generate the scan-build report
scan-build -k -o ${SCAN_BUILD_TMPDIR} make
-
+
# get the directory name of the report created by scan-build
SCAN_BUILD_REPORT=$( find ${SCAN_BUILD_TMPDIR} -maxdepth 1 -not -empty -not -name `basename ${SCAN_BUILD_TMPDIR}` )
rc=$?
-
+
if [ -z "${SCAN_BUILD_REPORT}" ]; then
echo ">>> No new bugs identified."
echo ">>> No scan-build report has been generated"
else
echo ">>> New scan-build report generated in ${SCAN_BUILD_REPORT}"
-
+
if [ ! -d "${SCAN_BUILD_ARCHIVE}" ]; then
echo ">>> Creating scan-build archive directory"
- install -d -o jenkins -g jenkins -m 0755 "${SCAN_BUILD_ARCHIVE}"
+ mkdir "${SCAN_BUILD_ARCHIVE}"
else
echo ">>> Removing any previous scan-build reports from ${SCAN_BUILD_ARCHIVE}"
- rm -f ${SCAN_BUILD_ARCHIVE}/*
+ rm -f "${SCAN_BUILD_ARCHIVE}/*"
fi
-
+
echo ">>> Archiving scan-build report to ${SCAN_BUILD_ARCHIVE}"
mv ${SCAN_BUILD_REPORT}/* ${SCAN_BUILD_ARCHIVE}/
-
+
echo ">>> Removing any temporary files and directories"
rm -rf "${SCAN_BUILD_TMPDIR}"
fi
-
+
exit ${rc}