[Mono.Options] Fix test and add suite to CI (#4963)
[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 if [[ $CI_TAGS == *'collect-coverage'* ]]; then
9     # Collect coverage for further use by lcov and similar tools.
10     # Coverage must be collected with -O0 and debug information.
11     export CFLAGS="-ggdb3 --coverage -O0"
12     # Collect coverage on all optimizations
13     export MONO_ENV_OPTIONS="$MONO_ENV_OPTIONS -O=all"
14 elif [[ ${label} == w* ]]; then
15     # Passing -ggdb3 on Cygwin breaks linking against libmonosgen-x.y.dll
16     export CFLAGS="-g -O2"
17 else
18     export CFLAGS="-ggdb3 -O2"
19 fi
20
21 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
22 if [[ ${label} == 'osx-amd64' ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib "; fi
23 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
24 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
25
26 if [[ ${CI_TAGS} == *'coop-gc'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-cooperative-gc=yes"; fi
27
28 if [[ ${CI_TAGS} == *'checked-coop'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-checked-build=gc,thread"; fi
29 if [[ ${CI_TAGS} == *'checked-all'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-checked-build=all"; fi
30
31 if [[ ${CI_TAGS} == *'mcs-compiler'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-csc=mcs"; fi
32
33 if   [[ ${CI_TAGS} == *'fullaot_llvm'* ]];       then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=fullaot ";
34 elif [[ ${CI_TAGS} == *'hybridaot_llvm'* ]];     then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=hybridaot";
35 elif [[ ${CI_TAGS} == *'aot_llvm'* ]];           then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=aot ";
36 elif [[ ${CI_TAGS} == *'fullaot'* ]];            then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=fullaot";
37 elif [[ ${CI_TAGS} == *'hybridaot'* ]];          then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=hybridaot";
38 elif [[ ${CI_TAGS} == *'winaot'* ]];             then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=winaot";
39 elif [[ ${CI_TAGS} == *'aot'* ]];                then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=aot";
40 elif [[ ${CI_TAGS} == *'bitcode'* ]];            then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=bitcode";
41 elif [[ ${CI_TAGS} == *'interpreter'* ]];        then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-interpreter";
42 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";
43 elif [[ ${label} != w* ]] && [[ ${label} != 'debian-8-ppc64el' ]] && [[ ${label} != 'centos-s390x' ]] && [[ ${CI_TAGS} != *'monolite'* ]];
44     then
45     # only enable the concurrent collector by default on main unix archs
46     EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-sgen-default-concurrent=yes"
47
48     if [[ ${label} == 'ubuntu-1404-amd64' ]]; then
49         # only enable build of the additional profiles on one architecture to save time
50         EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=all"
51         # when building profiles like monotouch/monodroid which don't build System.Drawing.dll in the Mono repo we need
52         # to build the facades against _something_ to satisfy the typeforwards. In CI we can cheat a little and pass
53         # them System.Drawing.dll from the 'build' profile since we don't test those profiles here (we just ensure they compile).
54         export EXTERNAL_FACADE_DRAWING_REFERENCE=${MONO_REPO_ROOT}/mcs/class/lib/build/System.Drawing.dll
55     fi
56 fi
57
58 if [ -x "/usr/bin/dpkg-architecture" ];
59         then
60         EXTRA_CONF_FLAGS="$EXTRA_CONF_FLAGS --host=`/usr/bin/dpkg-architecture -qDEB_HOST_GNU_TYPE`"
61         #force build arch = dpkg arch, sometimes misdetected
62         mkdir -p ~/.config/.mono/
63         wget -qO- https://download.mono-project.com/test/new-certs.tgz| tar zx -C ~/.config/.mono/
64 fi
65
66 ${TESTCMD} --label=configure --timeout=60m --fatal ./autogen.sh $EXTRA_CONF_FLAGS
67 if [[ ${label} == 'w32' ]];
68     then
69         # only build boehm on w32 (only windows platform supporting boehm).
70     ${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
71 fi
72 if [[ ${label} == w* ]];
73     then
74     ${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
75 fi
76
77 if [[ ${CI_TAGS} == *'winaot'* ]];
78     then
79     # The AOT compiler on Windows requires Visual Studio's clang.exe and link.exe in $PATH
80     # and we must make sure Visual Studio's link.exe comes before Cygwin's link.exe
81     VC_ROOT="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC"
82     export PATH="$VC_ROOT/ClangC2/bin/amd64:$VC_ROOT/bin/amd64":$PATH
83 fi
84
85 if [[ ${CI_TAGS} == *'monolite'* ]]; then make get-monolite-latest; fi
86
87 make_parallelism=-j4
88 if [[ ${label} == 'debian-8-ppc64el' ]]; then make_parallelism=-j1; fi
89
90 ${TESTCMD} --label=make --timeout=300m --fatal make ${make_parallelism} -w V=1
91
92 if [[ ${CI_TAGS} == *'checked-coop'* ]]; then export MONO_CHECK_MODE=gc,thread; fi
93 if [[ ${CI_TAGS} == *'checked-all'* ]]; then export MONO_CHECK_MODE=all; fi
94
95 if [[ ${CI_TAGS} == *'acceptance-tests'* ]];
96     then
97         $(dirname "${BASH_SOURCE[0]}")/run-test-acceptance-tests.sh
98 elif [[ ${CI_TAGS} == *'profiler-stress-tests'* ]];
99     then
100     $(dirname "${BASH_SOURCE[0]}")/run-test-profiler-stress-tests.sh
101 elif [[ ${CI_TAGS} == *'stress-tests'* ]];
102     then
103     $(dirname "${BASH_SOURCE[0]}")/run-test-stress-tests.sh
104 elif [[ ${CI_TAGS} == *'interpreter'* ]];
105     then
106     $(dirname "${BASH_SOURCE[0]}")/run-test-interpreter.sh
107 elif [[ ${CI_TAGS} == *'mcs-compiler'* ]];
108     then
109     $(dirname "${BASH_SOURCE[0]}")/run-test-mcs.sh
110 elif [[ ${CI_TAGS} == *'no-tests'* ]];
111     then
112         exit 0
113 else
114         make check-ci
115 fi