[ci] Small improvements for run-jenkins and collect-coverage. (#5669)
authorvkargov <kargov@gmail.com>
Mon, 2 Oct 2017 22:16:39 +0000 (15:16 -0700)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 2 Oct 2017 22:16:39 +0000 (00:16 +0200)
* [ci] Allow setting custom mono flags for test runs via MONO_TEST_FLAGS.

* [ci] Make the handling of CFLAGS a bit more flexible in run-jenkins.sh.

* [ci] Generalize collect-coverage to handle more targets.

scripts/ci/collect-coverage.sh
scripts/ci/run-jenkins.sh

index f600c3ace39acb3db11090fee9c33d3e3de325c8..6fdb428d7dd4b000bf49e05c09c28d3b2a54cfae 100755 (executable)
@@ -3,10 +3,11 @@
 # This script is meant to be executed on all "slave" machines that run coverage collection.
 
 COV_DIR=coverage
-COV_INFO="$COV_DIR/$JOB_NAME.info"
+COV_NAME="$(echo $JOB_NAME | sed 's#/#-#g').info"
+COV_INFO="$COV_DIR/$COV_NAME"
 
 # Build Mono and collect coverage on the test suite.
-CI_TAGS=collect-coverage,monolite scripts/ci/run-jenkins.sh
+CI_TAGS="collect-coverage,monolite,$CI_TAGS" scripts/ci/run-jenkins.sh
 
 # Place the coverage info file into the coverage directory.
 # Multiple such files can be assembled to create a unified coverage report that spans multiple architectures and operating systems.
@@ -14,7 +15,7 @@ mkdir "$COV_DIR"
 scripts/ci/run-step.sh --label=coverage-lcov --timeout=20m lcov --no-external -c -d mono -d support -d tools -o "$COV_INFO"
 
 # Generate HTML coverage report in the lcov directory at the root of the project.
-scripts/ci/run-step.sh --label=coverage-genhtml --timeout=20m genhtml "$COV_INFO" -o lcov
+scripts/ci/run-step.sh --label=coverage-genhtml --timeout=20m genhtml -f -s "$COV_INFO" -o lcov
 
 # Make the paths relative so that they could be assembled from different Jenkins workspaces.
 sed -Eie "s#^SF:$WORKSPACE/?#SF:#" "$COV_INFO"
index bdecfae3efb974b15ed2b08a787f2b04716aa4ab..ca0cca115eb2ac8fd889b4583b32d02727074133 100755 (executable)
@@ -10,23 +10,25 @@ make_timeout=300m
 if [[ $CI_TAGS == *'collect-coverage'* ]]; then
     # Collect coverage for further use by lcov and similar tools.
     # Coverage must be collected with -O0 and debug information.
-    export CFLAGS="-ggdb3 --coverage -O0"
-    # Collect coverage on all optimizations
-    export MONO_ENV_OPTIONS="$MONO_ENV_OPTIONS -O=all"
-elif [[ ${CI_TAGS} == *'clang-sanitizer'* ]]; then
+    export CFLAGS="$CFLAGS -ggdb3 --coverage -O0"
+fi
+
+if [[ ${CI_TAGS} == *'clang-sanitizer'* ]]; then
        export CC="clang"
        export CXX="clang++"
-       export CFLAGS="-g -O1 -fsanitize=thread -fsanitize-blacklist=${MONO_REPO_ROOT}/scripts/ci/clang-thread-sanitizer-blacklist -mllvm -tsan-instrument-atomics=false"
+       export CFLAGS="$CFLAGS -g -O1 -fsanitize=thread -fsanitize-blacklist=${MONO_REPO_ROOT}/scripts/ci/clang-thread-sanitizer-blacklist -mllvm -tsan-instrument-atomics=false"
        export LDFLAGS="-fsanitize=thread"
        # TSAN_OPTIONS are used by programs that were compiled with Clang's ThreadSanitizer
        # see https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags for more details
        export TSAN_OPTIONS="history_size=7:exitcode=0:force_seq_cst_atomics=1"
        make_timeout=30m
-elif [[ ${label} == w* ]]; then
+fi
+
+if [[ ${label} == w* ]]; then
     # Passing -ggdb3 on Cygwin breaks linking against libmonosgen-x.y.dll
-    export CFLAGS="-g -O2"
+    export CFLAGS="$CFLAGS -g -O2"
 else
-    export CFLAGS="-ggdb3 -O2"
+    export CFLAGS="$CFLAGS -ggdb3 -O2"
 fi
 
 if [[ $CI_TAGS == *'retry-flaky-tests'* ]]; then
@@ -108,6 +110,8 @@ ${TESTCMD} --label=make --timeout=${make_timeout} --fatal make ${make_parallelis
 if [[ ${CI_TAGS} == *'checked-coop'* ]]; then export MONO_CHECK_MODE=gc,thread; fi
 if [[ ${CI_TAGS} == *'checked-all'* ]]; then export MONO_CHECK_MODE=all; fi
 
+export MONO_ENV_OPTIONS="$MONO_ENV_OPTIONS $MONO_TEST_ENV_OPTIONS"
+
 if [[ ${CI_TAGS} == *'acceptance-tests'* ]];
     then
        $(dirname "${BASH_SOURCE[0]}")/run-test-acceptance-tests.sh