X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=scripts%2Fcommon%2Fcoverity.sh;h=b5ca3690a0787a62c9512fc571c4436537b0db6d;hb=4d27af8f99434c6dcadf1d22430d4e8a27b8bee2;hp=e2282e1c3de73b67a6273adaa25d9888a277bb73;hpb=1c1cca412fd889887e6e0b53e55ad93a79641475;p=lttng-ci.git diff --git a/scripts/common/coverity.sh b/scripts/common/coverity.sh index e2282e1..b5ca369 100755 --- a/scripts/common/coverity.sh +++ b/scripts/common/coverity.sh @@ -1,7 +1,7 @@ #!/bin/bash -exu # -# Copyright (C) 2015 - Michael Jeanson -# Jonathan Rajotte-Julien +# Copyright (C) 2019 Michael Jeanson +# Copyright (C) 2015 Jonathan Rajotte-Julien # # 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 @@ -16,6 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# Required variables +WORKSPACE=${WORKSPACE:-} + # Coverity settings # The project name and token have to be provided trough env variables #COVERITY_SCAN_PROJECT_NAME="" @@ -25,6 +28,17 @@ 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" +DEPS_INC="$WORKSPACE/deps/build/include" +DEPS_LIB="$WORKSPACE/deps/build/lib" +DEPS_PKGCONFIG="$DEPS_LIB/pkgconfig" +DEPS_BIN="$WORKSPACE/deps/build/bin" + +export PATH="$DEPS_BIN:$PATH" +export LD_LIBRARY_PATH="$DEPS_LIB:${LD_LIBRARY_PATH:-}" +export PKG_CONFIG_PATH="$DEPS_PKGCONFIG" +export CPPFLAGS="-I$DEPS_INC" +export LDFLAGS="-L$DEPS_LIB" + SRCDIR="$WORKSPACE/src/${COVERITY_SCAN_PROJECT_NAME}" TMPDIR="$WORKSPACE/tmp" @@ -51,7 +65,7 @@ export TMPDIR case "$COVERITY_SCAN_PROJECT_NAME" in babeltrace) - CONF_OPTS="--enable-python-bindings --enable-python-bindings-doc" + CONF_OPTS="--enable-python-bindings --enable-python-bindings-doc --enable-python-plugins" BUILD_TYPE="autotools" ;; liburcu) @@ -87,53 +101,12 @@ linux-rseq) ;; 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:-}" -fi - - -# lttng-ust dependency -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:-}" -fi - if [ -d "$WORKSPACE/src/linux" ]; then 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:-}" - +# Enter the source directory +cd "$SRCDIR" # Verify upload is permitted # Added "--insecure" because Coverity can't be bothered to properly install SSL certificate chains @@ -175,8 +148,6 @@ 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') # Build @@ -205,7 +176,7 @@ autotools) linux-rseq) make defconfig make -j"$NPROC" prepare - cov-build --dir "$RESULTS_DIR" $COVERITY_SCAN_BUILD_OPTIONS make -j"$NPROC" kernel/rseq.o kernel/cpu_opv.o V=1 KCPPFLAGS="$CPPFLAGS" + cov-build --dir "$RESULTS_DIR" $COVERITY_SCAN_BUILD_OPTIONS make -j"$NPROC" kernel/rseq.o kernel/do_on_cpu/core.o kernel/do_on_cpu/interpreter.o kernel/do_on_cpu/validate.o V=1 ;; *) echo "Unsupported build type: $BUILD_TYPE"