Merge pull request #5355 from kumpera/fix_58379
[mono.git] / scripts / ci / run-jenkins.sh
1 #!/bin/bash -e
2
3 export MONO_REPO_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )"
4 export TESTCMD=${MONO_REPO_ROOT}/scripts/ci/run-step.sh
5
6 export TEST_HARNESS_VERBOSE=1
7
8 make_timeout=300m
9
10 if [[ $CI_TAGS == *'collect-coverage'* ]]; then
11     # Collect coverage for further use by lcov and similar tools.
12     # Coverage must be collected with -O0 and debug information.
13     export CFLAGS="-ggdb3 --coverage -O0"
14     # Collect coverage on all optimizations
15     export MONO_ENV_OPTIONS="$MONO_ENV_OPTIONS -O=all"
16 elif [[ ${CI_TAGS} == *'clang-sanitizer'* ]]; then
17         export CC="clang"
18         export CXX="clang++"
19         export CFLAGS="-g -O1 -fsanitize=thread -fsanitize-blacklist=${MONO_REPO_ROOT}/scripts/ci/clang-thread-sanitizer-blacklist -mllvm -tsan-instrument-atomics=false"
20         export LDFLAGS="-fsanitize=thread"
21         # TSAN_OPTIONS are used by programs that were compiled with Clang's ThreadSanitizer
22         # see https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags for more details
23         export TSAN_OPTIONS="history_size=7:exitcode=0:force_seq_cst_atomics=1"
24         make_timeout=30m
25 elif [[ ${label} == w* ]]; then
26     # Passing -ggdb3 on Cygwin breaks linking against libmonosgen-x.y.dll
27     export CFLAGS="-g -O2"
28 else
29     export CFLAGS="-ggdb3 -O2"
30 fi
31
32 if [[ ${label} == 'osx-i386' ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib --build=i386-apple-darwin11.2.0"; fi
33 if [[ ${label} == 'osx-amd64' ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib "; fi
34 if [[ ${label} == 'w32' ]]; then PLATFORM=Win32; EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --host=i686-w64-mingw32"; export MONO_EXECUTABLE="${MONO_REPO_ROOT}/msvc/build/sgen/Win32/bin/Release/mono-sgen.exe"; fi
35 if [[ ${label} == 'w64' ]]; then PLATFORM=x64; EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --host=x86_64-w64-mingw32 --disable-boehm"; export MONO_EXECUTABLE="${MONO_REPO_ROOT}/msvc/build/sgen/x64/bin/Release/mono-sgen.exe"; fi
36
37 if [[ ${CI_TAGS} == *'coop-gc'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-cooperative-gc=yes"; fi
38
39 if [[ ${CI_TAGS} == *'checked-coop'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-checked-build=gc,thread"; fi
40 if [[ ${CI_TAGS} == *'checked-all'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-checked-build=all"; fi
41
42 if [[ ${CI_TAGS} == *'mcs-compiler'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-csc=mcs"; fi
43 if [[ ${CI_TAGS} == *'disable-mcs-build'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --disable-mcs-build"; fi
44
45 if   [[ ${CI_TAGS} == *'fullaot_llvm'* ]];       then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=fullaot ";
46 elif [[ ${CI_TAGS} == *'hybridaot_llvm'* ]];     then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=hybridaot";
47 elif [[ ${CI_TAGS} == *'aot_llvm'* ]];           then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=aot ";
48 elif [[ ${CI_TAGS} == *'fullaot'* ]];            then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=fullaot";
49 elif [[ ${CI_TAGS} == *'hybridaot'* ]];          then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=hybridaot";
50 elif [[ ${CI_TAGS} == *'winaot'* ]];             then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=winaot";
51 elif [[ ${CI_TAGS} == *'aot'* ]];                then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=aot";
52 elif [[ ${CI_TAGS} == *'bitcode'* ]];            then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=bitcode";
53 elif [[ ${CI_TAGS} == *'interpreter'* ]];        then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-interpreter";
54 elif [[ ${CI_TAGS} == *'acceptance-tests'* ]];   then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --prefix=${MONO_REPO_ROOT}/tmp/mono-acceptance-tests --with-sgen-default-concurrent=yes";
55 elif [[ ${label} != w* ]] && [[ ${label} != 'debian-8-ppc64el' ]] && [[ ${label} != 'centos-s390x' ]] && [[ ${CI_TAGS} != *'monolite'* ]];
56     then
57     # only enable the concurrent collector by default on main unix archs
58     EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-sgen-default-concurrent=yes"
59
60     if [[ ${label} == 'ubuntu-1404-amd64' ]]; then
61         # only enable build of the additional profiles on one architecture to save time
62         EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=all"
63         # when building profiles like monotouch/monodroid which don't build System.Drawing.dll in the Mono repo we need
64         # to build the facades against _something_ to satisfy the typeforwards. In CI we can cheat a little and pass
65         # them System.Drawing.dll from the 'build' profile since we don't test those profiles here (we just ensure they compile).
66         export EXTERNAL_FACADE_DRAWING_REFERENCE=${MONO_REPO_ROOT}/mcs/class/lib/build/System.Drawing.dll
67     fi
68 fi
69
70 if [ -x "/usr/bin/dpkg-architecture" ];
71         then
72         EXTRA_CONF_FLAGS="$EXTRA_CONF_FLAGS --host=`/usr/bin/dpkg-architecture -qDEB_HOST_GNU_TYPE`"
73         #force build arch = dpkg arch, sometimes misdetected
74         mkdir -p ~/.config/.mono/
75         wget -qO- https://download.mono-project.com/test/new-certs.tgz| tar zx -C ~/.config/.mono/
76 fi
77
78 ${TESTCMD} --label=configure --timeout=60m --fatal ./autogen.sh $EXTRA_CONF_FLAGS
79 if [[ ${label} == 'w32' ]];
80     then
81         # only build boehm on w32 (only windows platform supporting boehm).
82     ${TESTCMD} --label=make-msvc --timeout=60m --fatal /cygdrive/c/Program\ Files\ \(x86\)/MSBuild/14.0/Bin/MSBuild.exe /p:PlatformToolset=v140 /p:Platform=${PLATFORM} /p:Configuration=Release /p:MONO_TARGET_GC=boehm msvc/mono.sln
83 fi
84 if [[ ${label} == w* ]];
85     then
86     ${TESTCMD} --label=make-msvc-sgen --timeout=60m --fatal /cygdrive/c/Program\ Files\ \(x86\)/MSBuild/14.0/Bin/MSBuild.exe /p:PlatformToolset=v140 /p:Platform=${PLATFORM} /p:Configuration=Release /p:MONO_TARGET_GC=sgen msvc/mono.sln
87 fi
88
89 if [[ ${CI_TAGS} == *'winaot'* ]];
90     then
91     # The AOT compiler on Windows requires Visual Studio's clang.exe and link.exe in $PATH
92     # and we must make sure Visual Studio's link.exe comes before Cygwin's link.exe
93     VC_ROOT="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC"
94     export PATH="$VC_ROOT/ClangC2/bin/amd64:$VC_ROOT/bin/amd64":$PATH
95 fi
96
97 if [[ ${CI_TAGS} == *'monolite'* ]]; then make get-monolite-latest; fi
98
99 make_parallelism=-j4
100 if [[ ${label} == 'debian-8-ppc64el' ]]; then make_parallelism=-j1; fi
101
102 ${TESTCMD} --label=make --timeout=${make_timeout} --fatal make ${make_parallelism} -w V=1
103
104 if [[ ${CI_TAGS} == *'checked-coop'* ]]; then export MONO_CHECK_MODE=gc,thread; fi
105 if [[ ${CI_TAGS} == *'checked-all'* ]]; then export MONO_CHECK_MODE=all; fi
106
107 if [[ ${CI_TAGS} == *'acceptance-tests'* ]];
108     then
109         $(dirname "${BASH_SOURCE[0]}")/run-test-acceptance-tests.sh
110 elif [[ ${CI_TAGS} == *'profiler-stress-tests'* ]];
111     then
112     $(dirname "${BASH_SOURCE[0]}")/run-test-profiler-stress-tests.sh
113 elif [[ ${CI_TAGS} == *'stress-tests'* ]];
114     then
115     $(dirname "${BASH_SOURCE[0]}")/run-test-stress-tests.sh
116 elif [[ ${CI_TAGS} == *'interpreter'* ]];
117     then
118     $(dirname "${BASH_SOURCE[0]}")/run-test-interpreter.sh
119 elif [[ ${CI_TAGS} == *'mcs-compiler'* ]];
120     then
121     $(dirname "${BASH_SOURCE[0]}")/run-test-mcs.sh
122 elif [[ ${CI_TAGS} == *'no-tests'* ]];
123     then
124         exit 0
125 else
126         make check-ci
127 fi