case "$COVERITY_SCAN_PROJECT_NAME" in
babeltrace)
CONF_OPTS="--enable-python-bindings --enable-python-bindings-doc"
+ BUILD_TYPE="autotools"
;;
liburcu)
CONF_OPTS=""
+ BUILD_TYPE="autotools"
;;
lttng-modules)
CONF_OPTS=""
+ BUILD_TYPE="autotools"
;;
lttng-tools)
CONF_OPTS=""
+ BUILD_TYPE="autotools"
;;
lttng-ust)
CONF_OPTS="--enable-java-agent-all --enable-python-agent"
+ BUILD_TYPE="autotools"
export CLASSPATH="/usr/share/java/log4j-1.2.jar"
;;
+lttng-scope|ctf-java|libdelorean-java|jabberwocky)
+ CONF_OPTS=""
+ BUILD_TYPE="maven"
+ MVN_BIN="$HOME/tools/hudson.tasks.Maven_MavenInstallation/default/bin/mvn"
+ ;;
+linux-rseq)
+ CONF_OPTS=""
+ BUILD_TYPE="linux-rseq"
+ ;;
*)
echo "Generic project, no configure options."
CONF_OPTS=""
+ BUILD_TYPE="autotools"
;;
esac
export KERNELDIR="$WORKSPACE/src/linux"
fi
+# Hack to get coverity with gcc >= 7
+#
+# We have to define the _Float* types as those are not defined by coverity and as result
+# the codes linking agains those (pretty much anything linking against stdlib.h and math.h)
+# won't be covered.
+echo "
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _Float128 long double
+#define _Float64x long double
+#define _Float64 double
+#define _Float32x double
+#define _Float32 float
+
+#ifdef __cplusplus
+}
+#endif" >> /tmp/coverity.h
+
+export CPPFLAGS="-include /tmp/coverity.h ${CPPFLAGS:-}"
+
# Verify upload is permitted
set +x
COVERITY_SCAN_VERSION=$(git describe --always | sed 's|-|.|g')
-# Prepare build dir
-if [ -f "./bootstrap" ]; then
- ./bootstrap
- ./configure $CONF_OPTS
-fi
-
# Build
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
+case "$BUILD_TYPE" in
+maven)
+ cov-configure --java
+ cov-build --dir "$RESULTS_DIR" $COVERITY_SCAN_BUILD_OPTIONS "$MVN_BIN" \
+ -s "$MVN_SETTINGS" \
+ -Dmaven.repo.local="$WORKSPACE/.repository" \
+ -Dmaven.compiler.fork=true \
+ -Dmaven.compiler.forceJavaCompilerUse=true \
+ -Dmaven.test.skip=true \
+ -DskipTests \
+ clean verify
+ ;;
+autotools)
+ # Prepare build dir for autotools based projects
+ if [ -f "./bootstrap" ]; then
+ ./bootstrap
+ ./configure $CONF_OPTS
+ fi
+
+ cov-build --dir "$RESULTS_DIR" $COVERITY_SCAN_BUILD_OPTIONS make -j"$NPROC" V=1
+ ;;
+linux-rseq)
+ make defconfig
+ cov-build --dir "$RESULTS_DIR" $COVERITY_SCAN_BUILD_OPTIONS make -j"$NPROC" kernel/rseq.o kernel/cpu_opv.o V=1
+ ;;
+*)
+ echo "Unsupported build type: $BUILD_TYPE"
+ exit 1
+ ;;
+esac
+
+
+
cov-import-scm --dir "$RESULTS_DIR" --scm git --log "$RESULTS_DIR/scm_log.txt"
cd "${WORKSPACE}"
"$UPLOAD_URL")
set -x
status_code=$(echo "$response" | sed -n '$p')
-if [ "$status_code" != "201" ]; then
+if [ "${status_code:0:1}" == "2" ]; then
+ echo -e "\033[33;1mCoverity Scan upload successful.\033[0m"
+else
TEXT=$(echo "$response" | sed '$d')
echo -e "\033[33;1mCoverity Scan upload failed: $TEXT.\033[0m"
exit 1