3 export MONO_REPO_ROOT
="$( cd "$
( dirname "${BASH_SOURCE[0]}" )/..
/..
/" && pwd )"
4 export TESTCMD
=${MONO_REPO_ROOT}/scripts
/ci
/run-step.sh
6 export CI_CPU_COUNT
=$
(getconf _NPROCESSORS_ONLN ||
echo 4)
8 export TEST_HARNESS_VERBOSE
=1
12 if [[ ${CI_TAGS} == *'clang-sanitizer'* ]]; then
15 export CFLAGS
="$CFLAGS -g -O1 -fsanitize=thread -fsanitize-blacklist=${MONO_REPO_ROOT}/scripts/ci/clang-thread-sanitizer-blacklist -mllvm -tsan-instrument-atomics=false"
16 export LDFLAGS
="-fsanitize=thread"
17 # TSAN_OPTIONS are used by programs that were compiled with Clang's ThreadSanitizer
18 # see https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags for more details
19 export TSAN_OPTIONS
="history_size=7:exitcode=0:force_seq_cst_atomics=1"
23 if [[ ${CI_TAGS} == *'win-'* ]]; then
24 # Passing -ggdb3 on Cygwin breaks linking against libmonosgen-x.y.dll
25 export CFLAGS
="$CFLAGS -g -O2"
27 export EXTRA_CFLAGS
="$EXTRA_CFLAGS -ggdb3 -O2"
30 if [[ $CI_TAGS == *'collect-coverage'* ]]; then
31 # Collect coverage for further use by lcov and similar tools.
32 # Coverage must be collected with -O0 and debug information.
33 export CFLAGS
="$CFLAGS -ggdb3 --coverage -O0"
36 if [[ $CI_TAGS == *'retry-flaky-tests'* ]]; then
37 export MONO_FLAKY_TEST_RETRIES
=5
40 # We don't want to have to maintain symbolification blobs for CI
41 export EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --with-crash-privacy=no "
43 if [[ ${CI_TAGS} == *'osx-i386'* ]]; then EXTRA_CFLAGS
="$EXTRA_CFLAGS -m32 -arch i386 -mmacosx-version-min=10.9"; EXTRA_LDFLAGS
="$EXTRA_LDFLAGS -m32 -arch i386"; EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib --host=i386-apple-darwin13.0.0 --build=i386-apple-darwin13.0.0"; fi
44 if [[ ${CI_TAGS} == *'osx-amd64'* ]]; then EXTRA_CFLAGS
="$EXTRA_CFLAGS -m64 -arch x86_64 -mmacosx-version-min=10.9"; EXTRA_LDFLAGS
="$EXTRA_LDFLAGS -m64 -arch x86_64" EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib"; fi
45 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
46 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
48 if [[ ${CI_TAGS} == *'coop-suspend'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --disable-hybrid-suspend --enable-cooperative-suspend";
49 elif [[ ${CI_TAGS} == *'hybrid-suspend'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --enable-hybrid-suspend";
50 elif [[ ${CI_TAGS} == *'preemptive-suspend'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --disable-hybrid-suspend";
53 if [[ ${CI_TAGS} == *'checked-coop'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --enable-checked-build=gc,thread"; fi
54 if [[ ${CI_TAGS} == *'checked-all'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --enable-checked-build=all"; fi
56 if [[ ${CI_TAGS} == *'mcs-compiler'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --with-csc=mcs"; fi
57 if [[ ${CI_TAGS} == *'disable-mcs-build'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --disable-mcs-build"; fi
59 if [[ ${CI_TAGS} == *'fullaot_llvm'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime-preset=fullaot_llvm ";
60 elif [[ ${CI_TAGS} == *'hybridaot_llvm'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime-preset=hybridaot_llvm";
61 elif [[ ${CI_TAGS} == *'aot_llvm'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime-preset=aot_llvm ";
62 elif [[ ${CI_TAGS} == *'jit_llvm'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --enable-llvm=yes"; export MONO_ENV_OPTIONS
="$MONO_ENV_OPTIONS --llvm";
63 elif [[ ${CI_TAGS} == *'fullaotinterp'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --with-runtime-preset=fullaotinterp";
64 elif [[ ${CI_TAGS} == *'fullaot'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --with-runtime-preset=fullaot";
65 elif [[ ${CI_TAGS} == *'hybridaot'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --with-runtime-preset=hybridaot";
66 elif [[ ${CI_TAGS} == *'winaot'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --with-runtime-preset=winaot";
67 elif [[ ${CI_TAGS} == *'aot'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --with-runtime-preset=aot";
68 elif [[ ${CI_TAGS} == *'bitcode'* ]]; then EXTRA_CONF_FLAGS
="${EXTRA_CONF_FLAGS} --with-runtime-preset=bitcode"; export MONO_ENV_OPTIONS
="$MONO_ENV_OPTIONS --aot=clangxx=clang++-6.0";
69 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";
70 elif [[ ${CI_TAGS} == *'all-profiles'* ]]; then
71 # only enable build of the additional profiles on one config to save time
72 EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime-preset=all
"
73 # when building profiles like monotouch/monodroid which don't build System.Drawing.dll in the Mono repo we need
74 # to build the facades against _something_ to satisfy the typeforwards. In CI we can cheat a little and pass
75 # them System.Drawing.dll from the 'build' profile since we don't test those profiles here (we just ensure they compile).
76 export EXTERNAL_FACADE_DRAWING_REFERENCE=${MONO_REPO_ROOT}/mcs/class/lib/build/System.Drawing.dll
79 if [ -x "/usr
/bin
/dpkg-architecture
" ];
81 EXTRA_CONF_FLAGS="$EXTRA_CONF_FLAGS --host=`/usr/bin/dpkg-architecture -qDEB_HOST_GNU_TYPE`"
82 #force build arch = dpkg arch, sometimes misdetected
83 mkdir -p ~/.config/.mono/
84 wget -qO- https://download.mono-project.com/test/new-certs.tgz| tar zx -C ~/.config/.mono/
87 if [[ ${CI_TAGS} == *'cxx'* ]]; then
88 EXTRA_CONF_FLAGS="$EXTRA_CONF_FLAGS -enable-cxx"
89 MSBUILD_CXX="/p
:MONO_COMPILE_AS_CPP
=true
"
92 if [[ ${CI_TAGS} == *'win-'* ]];
94 mkdir -p ~/.config/.mono/
95 wget -qO- https://download.mono-project.com/test/new-certs.tgz| tar zx -C ~/.config/.mono/
98 if [[ ${CI_TAGS} == *'sdks-llvm'* ]]; then
99 ${TESTCMD} --label=archive --timeout=120m --fatal make -j ${CI_CPU_COUNT} --output-sync=recurse --trace -C sdks/builds archive-llvm-llvm{,win}{32,64} NINJA=
100 if [[ ${CI_TAGS} == *'osx-amd64'* ]]; then
101 ${TESTCMD} --label=archive-llvm36 --timeout=60m --fatal make -j ${CI_CPU_COUNT} --output-sync=recurse --trace -C sdks/builds archive-llvm36-llvm32 NINJA=
106 if [[ ${CI_TAGS} == *'sdks-ios'* ]];
108 echo "DISABLE_ANDROID
=1" > sdks/Make.config
109 echo "DISABLE_WASM
=1" >> sdks/Make.config
110 echo "DISABLE_DESKTOP
=1" >> sdks/Make.config
111 if [[ ${CI_TAGS} == *'cxx'* ]]; then
112 echo "ENABLE_CXX
=1" >> sdks/Make.config
114 export device_test_suites="Mono.Runtime.Tests System.Core
"
116 ${TESTCMD} --label=archive --timeout=180m --fatal make -j ${CI_CPU_COUNT} --output-sync=recurse --trace -C sdks/builds archive-ios NINJA=
118 if [[ ${CI_TAGS} != *'no-tests'* ]]; then
119 ${TESTCMD} --label=build-tests --timeout=10m --fatal make -C sdks/ios compile-tests
120 ${TESTCMD} --label=run-sim --timeout=20m make -C sdks/ios run-ios-sim-all
121 ${TESTCMD} --label=build-ios-dev --timeout=60m make -C sdks/ios build-ios-dev-all
122 if [[ ${CI_TAGS} == *'run-device-tests'* ]]; then
123 for suite in ${device_test_suites}; do ${TESTCMD} --label=run-ios-dev-${suite} --timeout=10m make -C sdks/ios run-ios-dev-${suite}; done
125 ${TESTCMD} --label=build-ios-dev-llvm --timeout=60m make -C sdks/ios build-ios-dev-llvm-all
126 if [[ ${CI_TAGS} == *'run-device-tests'* ]]; then
127 for suite in ${device_test_suites}; do ${TESTCMD} --label=run-ios-dev-llvm-${suite} --timeout=10m make -C sdks/ios run-ios-dev-${suite}; done
129 ${TESTCMD} --label=build-ios-dev-interp-only --timeout=60m make -C sdks/ios build-ios-dev-interp-only-all
130 if [[ ${CI_TAGS} == *'run-device-tests'* ]]; then
131 for suite in ${device_test_suites}; do ${TESTCMD} --label=run-ios-dev-interp-only-${suite} --timeout=10m make -C sdks/ios run-ios-dev-${suite}; done
133 ${TESTCMD} --label=build-ios-dev-interp-mixed --timeout=60m make -C sdks/ios build-ios-dev-interp-mixed-all
134 if [[ ${CI_TAGS} == *'run-device-tests'* ]]; then
135 for suite in ${device_test_suites}; do ${TESTCMD} --label=run-ios-dev-interp-mixed-${suite} --timeout=10m make -C sdks/ios run-ios-dev-${suite}; done
141 if [[ ${CI_TAGS} == *'sdks-android'* ]];
143 echo "DISABLE_IOS
=1" > sdks/Make.config
144 echo "DISABLE_WASM
=1" >> sdks/Make.config
145 echo "DISABLE_DESKTOP
=1" >> sdks/Make.config
146 echo "DISABLE_CCACHE
=1" >> sdks/Make.config
147 if [[ ${CI_TAGS} == *'cxx'* ]]; then
148 echo "ENABLE_CXX
=1" >> sdks/Make.config
151 # For some very strange reasons, `make -C sdks/android accept-android-license` get stuck when invoked through ${TESTCMD}
152 # but doesn't get stuck when called via the shell, so let's just call it here now.
153 ${TESTCMD} --label=provision-android --timeout=120m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds provision-android && make -C sdks/android accept-android-license
154 ${TESTCMD} --label=provision-mxe --timeout=240m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds provision-mxe
155 if [[ ${CI_TAGS} != *'debug'* ]]; then
156 ${TESTCMD} --label=archive --timeout=180m --fatal make -j ${CI_CPU_COUNT} --output-sync=recurse --trace -C sdks/builds archive-android NINJA= IGNORE_PROVISION_ANDROID=1 IGNORE_PROVISION_MXE=1
158 ${TESTCMD} --label=archive --timeout=180m --fatal make -j ${CI_CPU_COUNT} --output-sync=recurse --trace -C sdks/builds archive-android NINJA= IGNORE_PROVISION_ANDROID=1 IGNORE_PROVISION_MXE=1 CONFIGURATION=debug
161 if [[ ${CI_TAGS} != *'no-tests'* ]]; then
162 ${TESTCMD} --label=mini --timeout=60m make -C sdks/android check-mini
163 ${TESTCMD} --label=corlib --timeout=60m make -C sdks/android check-corlib
164 ${TESTCMD} --label=System --timeout=60m make -C sdks/android check-System
165 ${TESTCMD} --label=System.Core --timeout=60m make -C sdks/android check-System.Core
166 ${TESTCMD} --label=System.Data --timeout=60m make -C sdks/android check-System.Data
167 ${TESTCMD} --label=System.IO.Compression.FileSystem --timeout=60m make -C sdks/android check-System.IO.Compression.FileSystem
168 ${TESTCMD} --label=System.IO.Compression --timeout=60m make -C sdks/android check-System.IO.Compression
169 ${TESTCMD} --label=System.Json --timeout=60m make -C sdks/android check-System.Json
170 ${TESTCMD} --label=System.Net.Http --timeout=60m make -C sdks/android check-System.Net.Http
171 ${TESTCMD} --label=System.Numerics --timeout=60m make -C sdks/android check-System.Numerics
172 ${TESTCMD} --label=System.Runtime.Serialization --timeout=60m make -C sdks/android check-System.Runtime.Serialization
173 ${TESTCMD} --label=System.ServiceModel.Web --timeout=60m make -C sdks/android check-System.ServiceModel.Web
174 ${TESTCMD} --label=System.Transactions --timeout=60m make -C sdks/android check-System.Transactions
175 ${TESTCMD} --label=System.Xml --timeout=60m make -C sdks/android check-System.Xml
176 ${TESTCMD} --label=System.Xml.Linq --timeout=60m make -C sdks/android check-System.Xml.Linq
177 ${TESTCMD} --label=Mono.CSharp --timeout=60m make -C sdks/android check-Mono.CSharp
178 ${TESTCMD} --label=Mono.Data.Sqlite --timeout=60m make -C sdks/android check-Mono.Data.Sqlite
179 ${TESTCMD} --label=Mono.Data.Tds --timeout=60m make -C sdks/android check-Mono.Data.Tds
180 ${TESTCMD} --label=Mono.Security --timeout=60m make -C sdks/android check-Mono.Security
185 if [[ ${CI_TAGS} == *'webassembly'* ]] || [[ ${CI_TAGS} == *'wasm'* ]];
187 echo "DISABLE_ANDROID
=1" > sdks/Make.config
188 echo "DISABLE_IOS
=1" >> sdks/Make.config
189 echo "DISABLE_DESKTOP
=1" >> sdks/Make.config
190 echo "ENABLE_WASM_CROSS
=1" >> sdks/Make.config
191 if [[ ${CI_TAGS} == *'cxx'* ]]; then
192 echo "ENABLE_CXX
=1" >> sdks/Make.config
195 export aot_test_suites="System.Core
"
197 ${TESTCMD} --label=provision --timeout=20m --fatal make --output-sync=recurse --trace -C sdks/builds provision-wasm
198 ${TESTCMD} --label=archive --timeout=180m --fatal make -j ${CI_CPU_COUNT} --output-sync=recurse --trace -C sdks/builds archive-wasm NINJA=
200 if [[ ${CI_TAGS} != *'no-tests'* ]]; then
201 ${TESTCMD} --label=wasm-build --timeout=60m --fatal make -j ${CI_CPU_COUNT} -C sdks/wasm build
202 ${TESTCMD} --label=ch-mini-test --timeout=60m make -C sdks/wasm run-ch-mini
203 ${TESTCMD} --label=v8-mini-test --timeout=60m make -C sdks/wasm run-v8-mini
204 ${TESTCMD} --label=sm-mini-test --timeout=60m make -C sdks/wasm run-sm-mini
205 ${TESTCMD} --label=jsc-mini-test --timeout=60m make -C sdks/wasm run-jsc-mini
206 #The following tests are not passing yet, so enabling them would make us perma-red
207 #${TESTCMD} --label=mini-corlib --timeout=60m make -C sdks/wasm run-all-corlib
208 #${TESTCMD} --label=mini-system --timeout=60m make -C sdks/wasm run-all-system
209 # Chakra crashes with System.Core. See https://github.com/mono/mono/issues/8345
210 ${TESTCMD} --label=ch-system-core --timeout=60m make -C sdks/wasm run-ch-system-core
211 ${TESTCMD} --label=v8-system-core --timeout=60m make -C sdks/wasm run-v8-system-core
212 ${TESTCMD} --label=sm-system-core --timeout=60m make -C sdks/wasm run-sm-system-core
213 ${TESTCMD} --label=jsc-system-core --timeout=60m make -C sdks/wasm run-jsc-system-core
214 ${TESTCMD} --label=aot-mini --timeout=60m make -j ${CI_CPU_COUNT} -C sdks/wasm run-aot-mini
215 ${TESTCMD} --label=build-aot-all --timeout=60m make -j ${CI_CPU_COUNT} -C sdks/wasm build-aot-all
216 for suite in ${aot_test_suites}; do ${TESTCMD} --label=run-aot-${suite} --timeout=10m make -C sdks/wasm run-aot-${suite}; done
217 #${TESTCMD} --label=check-aot --timeout=60m make -C sdks/wasm check-aot
218 ${TESTCMD} --label=package --timeout=60m make -C sdks/wasm package
224 if [[ ${CI_TAGS} != *'mac-sdk'* ]]; # Mac SDK builds Mono itself
226 echo ./autogen.sh CFLAGS="$CFLAGS $EXTRA_CFLAGS" CXXFLAGS="$CXXFLAGS $EXTRA_CXXFLAGS" LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" $EXTRA_CONF_FLAGS
227 ${TESTCMD} --label=configure --timeout=60m --fatal ./autogen.sh CFLAGS="$CFLAGS $EXTRA_CFLAGS" CXXFLAGS="$CXXFLAGS $EXTRA_CXXFLAGS" LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" $EXTRA_CONF_FLAGS
229 if [[ ${CI_TAGS} == *'win-i386'* ]];
231 # only build boehm on w32 (only windows platform supporting boehm).
232 ${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 ${MSBUILD_CXX} /p:MONO_TARGET_GC=boehm msvc/mono.sln
234 if [[ ${CI_TAGS} == *'win-'* ]];
236 ${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 ${MSBUILD_CXX} /p:MONO_TARGET_GC=sgen msvc/mono.sln
239 if [[ ${CI_TAGS} == *'winaot'* ]];
241 # The AOT compiler on Windows requires Visual Studio's clang.exe and link.exe in $PATH
242 # and we must make sure Visual Studio's link.exe comes before Cygwin's link.exe
243 VC_ROOT="/cygdrive
/c
/Program Files
(x86
)/Microsoft Visual Studio
14.0/VC
"
244 export PATH="$VC_ROOT/ClangC
2/bin
/amd64
:$VC_ROOT/bin
/amd64
":$PATH
247 if [[ ${CI_TAGS} == *'monolite'* ]]; then make get-monolite-latest; fi
249 make_parallelism="-j ${CI_CPU_COUNT}"
250 if [[ ${CI_TAGS} == *'linux-ppc64el'* ]]; then make_parallelism=-j1; fi
253 if [[ ${CI_TAGS} == *'checked-all'* ]]; then make_continue=-k; fi
256 if [[ ${CI_TAGS} != *'mac-sdk'* ]]; # Mac SDK builds Mono itself
258 ${TESTCMD} --label=make --timeout=${make_timeout} --fatal make ${make_parallelism} ${make_continue} -w V=1
261 if [[ ${CI_TAGS} == *'checked-coop'* ]]; then export MONO_CHECK_MODE=gc,thread; fi
262 if [[ ${CI_TAGS} == *'checked-all'* ]]; then export MONO_CHECK_MODE=all; fi
264 export MONO_ENV_OPTIONS="$MONO_ENV_OPTIONS $MONO_TEST_ENV_OPTIONS"
266 if [[ ${CI_TAGS} == *'acceptance-tests'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-acceptance-tests.sh;
267 elif [[ ${CI_TAGS} == *'profiler-stress-tests'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-profiler-stress-tests.sh;
268 elif [[ ${CI_TAGS} == *'stress-tests'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-stress-tests.sh;
269 elif [[ ${CI_TAGS} == *'interpreter'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-interpreter.sh;
270 elif [[ ${CI_TAGS} == *'mcs-compiler'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-mcs.sh;
271 elif [[ ${CI_TAGS} == *'mac-sdk'* ]]; then ${MONO_REPO_ROOT}/scripts/ci/run-test-mac-sdk.sh;
272 elif [[ ${CI_TAGS} == *'no-tests'* ]]; then exit 0;
276 ${MONO_REPO_ROOT}/scripts/ci/run-upload-sentry.sh