Merge pull request #7958 from vargaz/ios-sdk-device-tests
[mono-project.git] / scripts / ci / run-jenkins.sh
blobb30c0853689fbae8369a1eafdc141cf3510f2166
1 #!/bin/bash -e
3 export MONO_REPO_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )"
4 export TESTCMD=${MONO_REPO_ROOT}/scripts/ci/run-step.sh
6 export TEST_HARNESS_VERBOSE=1
8 make_timeout=300m
10 if [[ ${CI_TAGS} == *'clang-sanitizer'* ]]; then
11 export CC="clang"
12 export CXX="clang++"
13 export CFLAGS="$CFLAGS -g -O1 -fsanitize=thread -fsanitize-blacklist=${MONO_REPO_ROOT}/scripts/ci/clang-thread-sanitizer-blacklist -mllvm -tsan-instrument-atomics=false"
14 export LDFLAGS="-fsanitize=thread"
15 # TSAN_OPTIONS are used by programs that were compiled with Clang's ThreadSanitizer
16 # see https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags for more details
17 export TSAN_OPTIONS="history_size=7:exitcode=0:force_seq_cst_atomics=1"
18 make_timeout=30m
21 if [[ ${CI_TAGS} == *'win-'* ]]; then
22 # Passing -ggdb3 on Cygwin breaks linking against libmonosgen-x.y.dll
23 export CFLAGS="$CFLAGS -g -O2"
24 else
25 export CFLAGS="$CFLAGS -ggdb3 -O2"
28 if [[ $CI_TAGS == *'collect-coverage'* ]]; then
29 # Collect coverage for further use by lcov and similar tools.
30 # Coverage must be collected with -O0 and debug information.
31 export CFLAGS="$CFLAGS -ggdb3 --coverage -O0"
34 if [[ $CI_TAGS == *'retry-flaky-tests'* ]]; then
35 export MONO_FLAKY_TEST_RETRIES=5
38 if [[ ${CI_TAGS} == *'osx-i386'* ]]; then CFLAGS="$CFLAGS -m32 -arch i386"; LDFLAGS="$LDFLAGS -m32 -arch i386"; EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib --host=i386-apple-darwin11.2.0 --build=i386-apple-darwin11.2.0"; fi
39 if [[ ${CI_TAGS} == *'osx-amd64'* ]]; then CFLAGS="$CFLAGS -m64 -arch x86_64"; LDFLAGS="$LDFLAGS -m64 -arch x86_64" EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib"; fi
40 if [[ ${CI_TAGS} == *'win-i386'* ]]; 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
41 if [[ ${CI_TAGS} == *'win-amd64'* ]]; 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
43 if [[ ${CI_TAGS} == *'coop-gc'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-cooperative-gc=yes"; fi
45 if [[ ${CI_TAGS} == *'checked-coop'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-checked-build=gc,thread"; fi
46 if [[ ${CI_TAGS} == *'checked-all'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-checked-build=all"; fi
48 if [[ ${CI_TAGS} == *'mcs-compiler'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-csc=mcs"; fi
49 if [[ ${CI_TAGS} == *'disable-mcs-build'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --disable-mcs-build"; fi
51 if [[ ${CI_TAGS} == *'fullaot_llvm'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=fullaot ";
52 elif [[ ${CI_TAGS} == *'hybridaot_llvm'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=hybridaot";
53 elif [[ ${CI_TAGS} == *'aot_llvm'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=aot ";
54 elif [[ ${CI_TAGS} == *'fullaot'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=fullaot";
55 elif [[ ${CI_TAGS} == *'hybridaot'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=hybridaot";
56 elif [[ ${CI_TAGS} == *'winaot'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=winaot";
57 elif [[ ${CI_TAGS} == *'aot'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=aot";
58 elif [[ ${CI_TAGS} == *'bitcode'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=bitcode";
59 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";
60 elif [[ ${CI_TAGS} == *'all-profiles'* ]]; then
61 # only enable build of the additional profiles on one config 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
69 if [ -x "/usr/bin/dpkg-architecture" ];
70 then
71 EXTRA_CONF_FLAGS="$EXTRA_CONF_FLAGS --host=`/usr/bin/dpkg-architecture -qDEB_HOST_GNU_TYPE`"
72 #force build arch = dpkg arch, sometimes misdetected
73 mkdir -p ~/.config/.mono/
74 wget -qO- https://download.mono-project.com/test/new-certs.tgz| tar zx -C ~/.config/.mono/
77 if [[ ${CI_TAGS} == *'win-'* ]];
78 then
79 mkdir -p ~/.config/.mono/
80 wget -qO- https://download.mono-project.com/test/new-certs.tgz| tar zx -C ~/.config/.mono/
83 if [[ ${CI_TAGS} == *'product-sdks-ios'* ]];
84 then
85 echo "DISABLE_ANDROID=1" > sdks/Make.config
86 echo "DISABLE_WASM=1" >> sdks/Make.config
87 ${TESTCMD} --label=runtimes --timeout=60m --fatal make -j4 -C sdks/builds package-ios-sim64 package-ios-target64
88 ${TESTCMD} --label=cross --timeout=60m --fatal make -j4 -C sdks/builds package-ios-cross64 package-ios-cross32
89 ${TESTCMD} --label=bcl --timeout=60m --fatal make -j4 -C sdks/builds package-bcl
90 ${TESTCMD} --label=build-tests --timeout=10m --fatal make -C sdks/ios compile-tests
91 ${TESTCMD} --label=run-sim --timeout=20m make -C sdks/ios run-ios-sim-all
92 ${TESTCMD} --label=build-ios-dev --timeout=60m make -C sdks/ios build-ios-dev-all
93 if [[ ${CI_TAGS} == *'run-device-tests'* ]]; then
94 for suite in Mono.Runtime.Tests System.Core; do ${TESTCMD} --label=run-ios-dev-${suite} --timeout=10m make -C sdks/ios run-ios-dev-${suite}; done
96 ${TESTCMD} --label=build-ios-dev-llvm --timeout=60m make -C sdks/ios build-ios-dev-llvm-all
97 ${TESTCMD} --label=package --timeout=60m tar cvzf mono-product-sdk-$GIT_COMMIT.tar.gz -C sdks/out/ bcl ios-llvm64 ios-llvm32 ios-cross32-release ios-cross64-release
98 exit 0
101 if [[ ${CI_TAGS} == *'product-sdks-android'* ]];
102 then
103 echo "ANDROID_TOOLCHAIN_DIR=$HOME/android-toolchain" > sdks/Make.config
104 echo "ANDROID_TOOLCHAIN_CACHE_DIR=$HOME/android-archives" >> sdks/Make.config
105 echo "MXE_PREFIX_DIR=$HOME/android-toolchain" >> sdks/Make.config
106 echo "IGNORE_PROVISION_ANDROID=1" >> sdks/Make.config
107 echo "IGNORE_PROVISION_MXE=1" >> sdks/Make.config
108 echo "DISABLE_CCACHE=1" >> sdks/Make.config
109 ${TESTCMD} --label=provision-android --timeout=120m --fatal make -j4 -C sdks/builds provision-android
110 ${TESTCMD} --label=provision-mxe --timeout=240m --fatal make -j4 -C sdks/builds provision-mxe
111 ${TESTCMD} --label=runtimes --timeout=120m --fatal make -j4 -C sdks/builds package-android-{armeabi,armeabi-v7a,arm64-v8a,x86,x86_64} package-android-host-{Darwin,mxe-Win64}
112 exit 0
115 if [[ ${CI_TAGS} == *'webassembly'* ]];
116 then
117 echo "DISABLE_ANDROID=1" > sdks/Make.config
118 echo "DISABLE_IOS=1" >> sdks/Make.config
119 ${TESTCMD} --label=runtimes --timeout=60m --fatal make -j4 -C sdks/builds package-wasm-interp
120 ${TESTCMD} --label=bcl --timeout=60m --fatal make -j4 -C sdks/builds package-bcl
121 ${TESTCMD} --label=wasm-build --timeout=60m --fatal make -j4 -C sdks/wasm build
122 ${TESTCMD} --label=mini-test --timeout=60m make -C sdks/wasm run-mini
123 #The following tests are not passing yet, so enabling them would make us perma-red
124 #${TESTCMD} --label=mini-corlib --timeout=60m make -C sdks/wasm run-corlib
125 #${TESTCMD} --label=mini-system --timeout=60m make -C sdks/wasm run-system
126 ${TESTCMD} --label=mini-system-core --timeout=60m make -C sdks/wasm run-system-core
127 ${TESTCMD} --label=package --timeout=60m make -C sdks/wasm package
128 exit 0
132 if [[ ${CI_TAGS} != *'mac-sdk'* ]]; # Mac SDK builds Mono itself
133 then
134 ${TESTCMD} --label=configure --timeout=60m --fatal ./autogen.sh $EXTRA_CONF_FLAGS
136 if [[ ${CI_TAGS} == *'win-i386'* ]];
137 then
138 # only build boehm on w32 (only windows platform supporting boehm).
139 ${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
141 if [[ ${CI_TAGS} == *'win-'* ]];
142 then
143 ${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
146 if [[ ${CI_TAGS} == *'winaot'* ]];
147 then
148 # The AOT compiler on Windows requires Visual Studio's clang.exe and link.exe in $PATH
149 # and we must make sure Visual Studio's link.exe comes before Cygwin's link.exe
150 VC_ROOT="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC"
151 export PATH="$VC_ROOT/ClangC2/bin/amd64:$VC_ROOT/bin/amd64":$PATH
154 if [[ ${CI_TAGS} == *'monolite'* ]]; then make get-monolite-latest; fi
156 make_parallelism=-j4
157 if [[ ${CI_TAGS} == *'linux-ppc64el'* ]]; then make_parallelism=-j1; fi
159 make_continue=
160 if [[ ${CI_TAGS} == *'checked-all'* ]]; then make_continue=-k; fi
162 if [[ ${CI_TAGS} != *'mac-sdk'* ]]; # Mac SDK builds Mono itself
163 then
164 ${TESTCMD} --label=make --timeout=${make_timeout} --fatal make ${make_parallelism} ${make_continue} -w V=1
167 if [[ ${CI_TAGS} == *'checked-coop'* ]]; then export MONO_CHECK_MODE=gc,thread; fi
168 if [[ ${CI_TAGS} == *'checked-all'* ]]; then export MONO_CHECK_MODE=all; fi
170 export MONO_ENV_OPTIONS="$MONO_ENV_OPTIONS $MONO_TEST_ENV_OPTIONS"
172 if [[ ${CI_TAGS} == *'acceptance-tests'* ]];
173 then
174 $(dirname "${BASH_SOURCE[0]}")/run-test-acceptance-tests.sh
175 elif [[ ${CI_TAGS} == *'profiler-stress-tests'* ]];
176 then
177 $(dirname "${BASH_SOURCE[0]}")/run-test-profiler-stress-tests.sh
178 elif [[ ${CI_TAGS} == *'stress-tests'* ]];
179 then
180 $(dirname "${BASH_SOURCE[0]}")/run-test-stress-tests.sh
181 elif [[ ${CI_TAGS} == *'interpreter'* ]];
182 then
183 $(dirname "${BASH_SOURCE[0]}")/run-test-interpreter.sh
184 elif [[ ${CI_TAGS} == *'mcs-compiler'* ]];
185 then
186 $(dirname "${BASH_SOURCE[0]}")/run-test-mcs.sh
187 elif [[ ${CI_TAGS} == *'mac-sdk'* ]];
188 then
189 $(dirname "${BASH_SOURCE[0]}")/run-test-mac-sdk.sh
190 elif [[ ${CI_TAGS} == *'no-tests'* ]];
191 then
192 exit 0
193 else
194 make check-ci