6 xunit_results_path
="$(pwd)/testResults.xml"
8 cd "$(dirname "$0")" ||
exit 1
11 MONO_CFG_DIR
="$r/_tmpinst/etc"
12 PATH
="$r/_tmpinst/bin:$PATH"
13 MONO_EXECUTABLE
=${MONO_EXECUTABLE:-"$r/mono-sgen"}
14 MONO_PATH
="$r/net_4_x"
15 export MONO_CFG_DIR MONO_PATH MONO_EXECUTABLE PATH
17 sed "s,\$test_root_dir,$r,g" "$r/_tmpinst/etc/mono/config.tmpl" > "$r/_tmpinst/etc/mono/config"
18 sed "s,\$test_root_dir,$r,g" "$r/tests/runtime/tests-config.tmpl" > "$r/tests/runtime/tests-config"
20 chmod +x
"${MONO_EXECUTABLE}"
21 echo "---------------------------------------------------------------------------------------"
22 "${MONO_EXECUTABLE}" --version
23 echo "---------------------------------------------------------------------------------------"
25 if [ "$test_suite" = "--xunit" ]; then
27 export MONO_PATH
="$r/net_4_x/tests:$MONO_PATH"
28 export REMOTE_EXECUTOR
="$r/net_4_x/tests/RemoteExecutorConsoleApp.exe"
29 case "$test_argument_1" in
30 *"Mono.Profiler.Log"*)
31 # necessary for the runtime to find libmono-profiler-log
32 export LD_LIBRARY_PATH
="$r:$LD_LIBRARY_PATH"
33 export DYLD_LIBRARY_PATH
="$r:$LD_LIBRARY_PATH"
38 ADDITIONAL_TRAITS
="-notrait category=nonosxtests"
41 ADDITIONAL_TRAITS
="-notrait category=nonlinuxtests"
45 "${MONO_EXECUTABLE}" --config "$r/_tmpinst/etc/mono/config" --debug "$r/net_4_x/xunit.console.exe" "$r/$test_argument_1" -noappdomain -noshadow -parallel none
-xml "${xunit_results_path}" -notrait category
=failing
-notrait category
=nonmonotests
-notrait Benchmark
=true
-notrait category
=outerloop
$ADDITIONAL_TRAITS
49 if [ "$test_suite" = "--nunit" ]; then
51 export MONO_PATH
="$r/net_4_x/tests:$MONO_PATH"
52 export MONO_SYSTEMWEB_CACHEDEPENDENCY_SHARED_FSW
=1
53 case "$test_argument_1" in
56 export MSBuildExtensionsPath
="$r/net_4_x/tests/xbuild/extensions"
57 export XBUILD_FRAMEWORK_FOLDERS_PATH
="$r/net_4_x/tests/xbuild/frameworks"
58 case "$test_argument_1" in
59 "xbuild_12"*) export MONO_PATH
="$r/xbuild_12:$r/xbuild_12/tests:$MONO_PATH" ;;
60 "xbuild_14"*) export MONO_PATH
="$r/xbuild_14:$r/xbuild_14/tests:$MONO_PATH" ;;
63 *"Mono.Messaging.RabbitMQ"*)
64 export MONO_MESSAGING_PROVIDER
=Mono.Messaging.RabbitMQ.RabbitMQMessagingProvider
,Mono.Messaging.RabbitMQ
66 *"System.Windows.Forms"*)
67 sudo apt
install -y xvfb xauth
68 XVFBRUN
="xvfb-run -a --"
69 ADDITIONAL_TEST_EXCLUDES
="NotWithXvfb" # TODO: find out why this works on Jenkins?
72 case "$test_argument_2" in
73 "--flaky-test-retries="*)
74 export MONO_FLAKY_TEST_RETRIES
=$
(echo "$test_argument_2" | cut
-d "=" -f2)
77 cp -f "$r/$test_argument_1.nunitlite.config" "$r/net_4_x/nunit-lite-console.exe.config"
78 MONO_REGISTRY_PATH
="$HOME/.mono/registry" MONO_TESTS_IN_PROGRESS
="yes" $XVFBRUN "${MONO_EXECUTABLE}" --config "$r/_tmpinst/etc/mono/config" --debug "$r/net_4_x/nunit-lite-console.exe" "$r/$test_argument_1" -exclude=NotWorking
,CAS
,$ADDITIONAL_TEST_EXCLUDES -labels -format:xunit
-result:"${xunit_results_path}"
82 if [ "$test_suite" = "--verify" ]; then
83 verifiable_files
=$
(find net_4_x
-maxdepth 1 -name "*.dll" -or -name "*.exe" |
grep -v System.Runtime.CompilerServices.Unsafe.dll |
grep -v Xunit.NetCore.Extensions.dll
)
85 for asm
in $verifiable_files; do
87 if [ ! -f "$asm" ]; then continue; fi
88 if "${MONO_EXECUTABLE}" --config "$r/_tmpinst/etc/mono/config" --compile-all --verify-all --security=verifiable
"$asm"; then
89 echo "$asm verified OK"
91 echo "$asm verification failed"
95 if [ "$ok" = "true" ]; then
96 echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><assemblies><assembly name=\"verify\" environment=\"Mono\" test-framework=\"custom\" run-date=\"$(date +%F)\" run-time=\"$(date +%T)\" total=\"1\" passed=\"1\" failed=\"0\" skipped=\"0\" errors=\"0\" time=\"0\"><collection total=\"1\" passed=\"1\" failed=\"0\" skipped=\"0\" name=\"Test collection for verify\" time=\"0\"><test name=\"verify.all\" type=\"verify\" method=\"all\" time=\"0\" result=\"Pass\"></test></collection></assembly></assemblies>" > "${xunit_results_path}";
99 echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><assemblies><assembly name=\"verify\" environment=\"Mono\" test-framework=\"custom\" run-date=\"$(date +%F)\" run-time=\"$(date +%T)\" total=\"1\" passed=\"0\" failed=\"1\" skipped=\"0\" errors=\"0\" time=\"0\"><collection total=\"1\" passed=\"0\" failed=\"1\" skipped=\"0\" name=\"Test collection for verify\" time=\"0\"><test name=\"verify.all\" type=\"verify\" method=\"all\" time=\"0\" result=\"Fail\"><failure exception-type=\"VerifyException\"><message><![CDATA[Verifying framework assemblies failed. Check the log for more details.]]></message></failure></test></collection></assembly></assemblies>" > "${xunit_results_path}";
104 if [ "$test_suite" = "--mcs" ]; then
105 cd tests
/mcs ||
exit 1
106 "${MONO_EXECUTABLE}" --config "$r/_tmpinst/etc/mono/config" --verify-all compiler-tester.exe
-mode:pos
-files:v4
-compiler:"$r/net_4_x/mcs.exe" -reference-dir:"$r/net_4_x" -issues:known-issues-net_4_x
-log:net_4_x.log
-il:ver-il-net_4_x.xml
-resultXml:"${xunit_results_path}" -compiler-options:"-d:NET_4_0;NET_4_5 -debug"
110 if [ "$test_suite" = "--mcs-errors" ]; then
111 cd tests
/mcs-errors ||
exit 1
112 "${MONO_EXECUTABLE}" --config "$r/_tmpinst/etc/mono/config" compiler-tester.exe
-mode:neg
-files:v4
-compiler:"$r/net_4_x/mcs.exe" -reference-dir:"$r/net_4_x" -issues:known-issues-net_4_x
-log:net_4_x.log
-resultXml:"${xunit_results_path}" -compiler-options:"-v --break-on-ice -d:NET_4_0;NET_4_5"
116 if [ "$test_suite" = "--aot-test" ]; then
121 tmpfile
=$
(mktemp
-t mono_aot_outputXXXXXX
) ||
exit 1
122 rm -f "test-aot-*.stdout" "test-aot-*.stderr" "${xunit_results_path}.cases.xml"
123 for assembly
in "$profile"/*.dll
; do
124 asm_name
=$
(basename "$assembly")
126 for conf
in "|regular" "--gc=boehm|boehm"; do
127 name
=$
(echo $conf | cut
-d\|
-f 2)
128 params
=$
(echo $conf | cut
-d\|
-f 1)
129 test_name
="${asm_name}|${name}"
131 if "${MONO_EXECUTABLE}" --config "$r/_tmpinst/etc/mono/config" $params --aot=outfile="$tmpfile" "$assembly" > "test-aot-${name}-${asm_name}.stdout" 2> "test-aot-${name}-${asm_name}.stderr"
133 passed
=$
((passed
+ 1))
136 failed
=$
((failed
+ 1))
137 failed_tests
="${failed_tests} $test_name"
140 echo "<test name=\"aot-test.$name.$asm_name\" type=\"aot-test.$name\" method=\"$asm_name\" time=\"0\" result=\"$resultstring\">" >> "${xunit_results_path}.cases.xml"
141 if [ "$resultstring" = "Fail" ]; then
142 echo "<failure exception-type=\"AotTestException\"><message><![CDATA[
144 $(cat "test-aot-
${name}-${asm_name}.stdout
")
146 $(cat "test-aot-
${name}-${asm_name}.stderr")]]></message><stack-trace></stack-trace></failure>" >> "${xunit_results_path}.cases.xml
"; fi
147 echo "</test>" >> "${xunit_results_path}.cases.xml
"
150 echo "<?xml version
=\"1.0\" encoding
=\"utf-8
\"?
>\
152 <assembly name
=\"aot-test
\" environment
=\"Mono
\" test-framework
=\"custom
\" run-date
=\"$
(date +%F
)\" run-time
=\"$
(date +%T
)\" total
=\"$
((passed
+ failed
))\" passed
=\"$passed\" failed
=\"$failed\" skipped
=\"0\" errors
=\"0\" time=\"0\">\
153 <collection total
=\"$
((passed
+ failed
))\" passed
=\"$passed\" failed
=\"$failed\" skipped
=\"0\" name
=\"Test collection
for aot-test
\" time=\"0\">\
154 $
(cat "${xunit_results_path}.cases.xml")
157 </assemblies
>" > "${xunit_results_path}";
159 echo "${passed} test(s
) passed.
${failed} test(s
) did not pass.
"
160 if [ "${failed}" != 0 ]; then
164 for i in ${failed_tests}; do
172 if [ "$test_suite" = "--mini" ]; then
173 cd tests/mini || exit 1
175 "${MONO_EXECUTABLE}" --config "$r/_tmpinst
/etc
/mono
/config
" --regression ./*.exe > regressiontests.out 2>&1
176 cat regressiontests.out
177 if grep -q "100% pass
" regressiontests.out; then
186 echo "<?xml version
=\"1.0\" encoding
=\"utf-8
\"?
>\
188 <assembly name
=\"mini.regression-tests
\" environment
=\"Mono
\" test-framework
=\"custom
\" run-date
=\"$
(date +%F
)\" run-time
=\"$
(date +%T
)\" total
=\"1\" passed
=\"$successcount\" failed
=\"$failurescount\" skipped
=\"0\" errors
=\"0\" time=\"0\">\
189 <collection total
=\"1\" passed
=\"$successcount\" failed
=\"$failurescount\" skipped
=\"0\" name
=\"Test collection
for mini.regression-tests
\" time=\"0\">\
190 <test name
=\"mini.regression-tests.all
\" type=\"mini.regression-tests
\" method
=\"all
\" time=\"0\" result
=\"$resultstring\">" > "${xunit_results_path}"
191 if [ "$resultstring" = "Fail
" ]; then echo "<failure exception-type
=\"MiniRegressionTestsException
\"><message
><![CDATA
[$
(cat regressiontests.out
)]]></message
><stack-trace
></stack-trace
></failure
>" >> "${xunit_results_path}"; fi
195 </assemblies
>" >> "${xunit_results_path}";
199 if [ "$test_suite" = "--symbolicate" ]; then
200 cd tests/symbolicate || exit 1
202 "${MONO_EXECUTABLE}" --config "$r/_tmpinst
/etc
/mono
/config
" --aot 2>&1 | grep -q "AOT compilation is not supported
" && echo "No AOT support
, skipping tests.
" && exit 0
205 for config in without-aot with-aot with-aot-msym; do
207 MSYM_DIR="$OUT_DIR/msymdir
"
208 STACKTRACE_FILE="$OUT_DIR/stacktrace.out
"
209 SYMBOLICATE_RAW_FILE="$OUT_DIR/symbolicate_raw.out
"
210 SYMBOLICATE_RESULT_FILE="$OUT_DIR/symbolicate.result
"
211 SYMBOLICATE_EXPECTED_FILE=symbolicate.expected
213 echo "Checking StackTraceDumper.exe
in configuration
$config...
"
218 cp StackTraceDumper.exe "$OUT_DIR"
219 cp StackTraceDumper.pdb "$OUT_DIR"
222 "${MONO_EXECUTABLE}" --config "$r/_tmpinst
/etc
/mono
/config
" "$r/net_4_x
/mono-symbolicate.exe
" store-symbols "$MSYM_DIR" "$OUT_DIR"
223 "${MONO_EXECUTABLE}" --config "$r/_tmpinst
/etc
/mono
/config
" "$r/net_4_x
/mono-symbolicate.exe
" store-symbols "$MSYM_DIR" "$r/net_4_x
"
225 if [ "$config" = "with-aot
" ]; then "${MONO_EXECUTABLE}" --config "$r/_tmpinst
/etc
/mono
/config
" -O=-inline --aot "$OUT_DIR/StackTraceDumper.exe
"; fi
226 if [ "$config" = "with-aot-msym
" ]; then "${MONO_EXECUTABLE}" --config "$r/_tmpinst
/etc
/mono
/config
" -O=-inline --aot=msym-dir="$MSYM_DIR" "$OUT_DIR/StackTraceDumper.exe
"; fi
229 "${MONO_EXECUTABLE}" --config "$r/_tmpinst
/etc
/mono
/config
" -O=-inline StackTraceDumper.exe > "$STACKTRACE_FILE"
230 "${MONO_EXECUTABLE}" --config "$r/_tmpinst
/etc
/mono
/config
" "$r/net_4_x
/mono-symbolicate.exe
" "$MSYM_DIR" "$STACKTRACE_FILE" > "$SYMBOLICATE_RAW_FILE"
231 tr "\\\\" "/" < "$SYMBOLICATE_RAW_FILE" | sed "s
,) .
* in .
*/mcs
/,) in mcs
/," | sed "s
,) .
* in .
*/external
/,) in external
/," | sed '/\[MVID\]/d' | sed '/\[AOTID\]/d' > "$SYMBOLICATE_RESULT_FILE"
233 DIFF=$(diff -up "$SYMBOLICATE_EXPECTED_FILE" "$SYMBOLICATE_RESULT_FILE")
234 if [ ! -z "$DIFF" ]; then
235 echo "ERROR
: Symbolicate tests failed.
"
236 echo "If
$SYMBOLICATE_RESULT_FILE is correct copy it to
$SYMBOLICATE_EXPECTED_FILE.
"
237 echo "Otherwise runtime sequence points need to be fixed.
"
246 if [ "$ok" = "true
" ]; then
247 echo "<?xml version
=\"1.0\" encoding
=\"utf-8
\"?
><assemblies
><assembly name
=\"symbolicate
\" environment
=\"Mono
\" test-framework
=\"custom
\" run-date
=\"$
(date +%F
)\" run-time
=\"$
(date +%T
)\" total
=\"1\" passed
=\"1\" failed
=\"0\" skipped
=\"0\" errors
=\"0\" time=\"0\"><collection total
=\"1\" passed
=\"1\" failed
=\"0\" skipped
=\"0\" name
=\"Test collection
for symbolicate
\" time=\"0\"><test name
=\"symbolicate.all
\" type=\"symbolicate
\" method
=\"all
\" time=\"0\" result
=\"Pass
\"></test></collection
></assembly
></assemblies
>" > "${xunit_results_path}";
250 echo "<?xml version
=\"1.0\" encoding
=\"utf-8
\"?
><assemblies
><assembly name
=\"symbolicate
\" environment
=\"Mono
\" test-framework
=\"custom
\" run-date
=\"$
(date +%F
)\" run-time
=\"$
(date +%T
)\" total
=\"1\" passed
=\"0\" failed
=\"1\" skipped
=\"0\" errors
=\"0\" time=\"0\"><collection total
=\"1\" passed
=\"0\" failed
=\"1\" skipped
=\"0\" name
=\"Test collection
for symbolicate
\" time=\"0\"><test name
=\"symbolicate.all
\" type=\"symbolicate
\" method
=\"all
\" time=\"0\" result
=\"Fail
\"><failure exception-type
=\"SymbolicateException
\"><message
><![CDATA
[Symbolicate tests failed. Check the log
for more details.
]]></message
></failure
></test></collection
></assembly
></assemblies
>" > "${xunit_results_path}";
256 if [ "$test_suite" = "--csi" ]; then
257 cd tests/csi || error 1
258 echo "Console.WriteLine
(\"hello world
: \" + DateTime.Now
)" > csi-test.csx
261 "${MONO_EXECUTABLE}" --config "$r/_tmpinst
/etc
/mono
/config
" csi.exe csi-test.csx > csi-test-output.txt || ok=false
262 cat csi-test-output.txt && grep -q "hello world
" csi-test-output.txt || ok=false
264 if [ "$ok" = "true
" ]; then
265 echo "<?xml version
=\"1.0\" encoding
=\"utf-8
\"?
><assemblies
><assembly name
=\"csi
\" environment
=\"Mono
\" test-framework
=\"custom
\" run-date
=\"$
(date +%F
)\" run-time
=\"$
(date +%T
)\" total
=\"1\" passed
=\"1\" failed
=\"0\" skipped
=\"0\" errors
=\"0\" time=\"0\"><collection total
=\"1\" passed
=\"1\" failed
=\"0\" skipped
=\"0\" name
=\"Test collection
for csi
\" time=\"0\"><test name
=\"csi.all
\" type=\"csi
\" method
=\"all
\" time=\"0\" result
=\"Pass
\"></test></collection
></assembly
></assemblies
>" > "${xunit_results_path}";
268 echo "<?xml version
=\"1.0\" encoding
=\"utf-8
\"?
><assemblies
><assembly name
=\"csi
\" environment
=\"Mono
\" test-framework
=\"custom
\" run-date
=\"$
(date +%F
)\" run-time
=\"$
(date +%T
)\" total
=\"1\" passed
=\"0\" failed
=\"1\" skipped
=\"0\" errors
=\"0\" time=\"0\"><collection total
=\"1\" passed
=\"0\" failed
=\"1\" skipped
=\"0\" name
=\"Test collection
for csi
\" time=\"0\"><test name
=\"csi.all
\" type=\"csi
\" method
=\"all
\" time=\"0\" result
=\"Fail
\"><failure exception-type
=\"CsiException
\"><message
><![CDATA
[csi.exe tests failed. Check the log
for more details.
]]></message
></failure
></test></collection
></assembly
></assemblies
>" > "${xunit_results_path}";
274 if [ "$test_suite" = "--profiler" ]; then
275 cd tests/profiler || exit 1
277 chmod +x "$r/mprof-report
"
278 perl ptestrunner.pl out-of-tree xunit "${xunit_results_path}"
282 if [ "$test_suite" = "--runtime" ]; then
283 cd tests/runtime || exit 1
285 # TODO: only ported runtest-managed for now
286 "${MONO_EXECUTABLE}" --config "$r/_tmpinst/etc/mono/config" --debug test-runner.exe --verbose --xunit "${xunit_results_path}" --config tests-config --runtime "${MONO_EXECUTABLE}" --mono-path "$r/net_4_x
" -j a --testsuite-name "runtime
" --timeout 300 --disabled "$DISABLED_TESTS" --input-file runtime-test-list.txt