lttng-ust: checkout sources in a subdirectory
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 18 May 2016 21:16:42 +0000 (17:16 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Wed, 18 May 2016 21:16:42 +0000 (17:16 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
jobs/lttng-ust.yaml
scripts/common/coverity.sh
scripts/lttng-ust/build.sh
scripts/lttng-ust/scan-build.sh

index f25d9570a2afbec62f12b223f7ee1690ebf4e480..e24d1823bd186c017dca3c037ccb0733d0379784 100644 (file)
@@ -25,6 +25,7 @@
           browser-url: https://github.com/{github_user}/{github_name}
           branches:
             - origin/{version}
+          basedir: src/lttng-ust
 
     triggers:
       - pollscm:
@@ -78,7 +79,7 @@
     # 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:
index 4c519c3d62f501a14ab7021f5bc30e4b0d7eb3b2..37b23fc69f4bbb0a72c5bf06600736b608b7ee6d 100755 (executable)
 # 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:-}"
@@ -55,7 +87,7 @@ fi
 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:-}"
@@ -105,11 +137,14 @@ fi
 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
@@ -117,11 +152,11 @@ echo -e "\033[33;1mRunning Coverity Scan Analysis Tool...\033[0m"
 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"
index 3b890c28d362a4bd6138e8915ce68ba4bbb1c772..21094f56bdcb1eca5b9e0cab640c95fb6ff539e8 100755 (executable)
@@ -1,6 +1,7 @@
 #!/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
 *)
@@ -71,8 +75,10 @@ python-agent)
     ;;
 esac
 
+# Enter the source directory
+cd "$SRCDIR"
 
-# Run bootstrap prior to configure
+# Run bootstrap in the source directory prior to configure
 ./bootstrap
 
 
@@ -83,14 +89,14 @@ esac
 #
 # 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)
@@ -98,7 +104,7 @@ dist)
     BUILD_PATH=`mktemp -d`
 
     # Initial configure and generate tarball
-    ./configure
+    $SRCDIR/configure
     $MAKE dist
 
     mkdir -p $BUILD_PATH
@@ -112,9 +118,8 @@ dist)
     ;;
 
 *)
-    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
 
@@ -123,31 +128,23 @@ $MAKE -j `$NPROC` V=1
 $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
 
index da98d40dfa68f001d7c082e40cab838a631b9d84..39933e3e58fd8e771a96b96da3c713e03ec33eb0 100755 (executable)
@@ -1,6 +1,7 @@
 #!/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/"
@@ -38,37 +45,41 @@ export CPPFLAGS="-I$URCU_INCS"
 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}
This page took 0.028089 seconds and 4 git commands to generate.