forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·369 lines (332 loc) · 11.3 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·369 lines (332 loc) · 11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
#!/usr/bin/env bash
function print_usage {
echo ''
echo 'CoreCLR test runner script.'
echo ''
echo 'Typical command line:'
echo ''
echo 'src/tests/run.sh <options>'
echo ''
echo 'Optional arguments:'
echo ' -h|--help : Show usage information.'
echo ' -v, --verbose : Show output from each test.'
echo ' <arch> : One of x64, x86, arm, arm64, loongarch64, riscv64, wasm. Defaults to current architecture.'
echo ' <build configuration> : One of debug, checked, release. Defaults to debug.'
echo ' android : Set build OS to Android.'
echo ' wasi : Set build OS to WASI.'
echo ' --test-env=<path> : Script to set environment variables for tests'
echo ' --testRootDir=<path> : Root directory of the test build (e.g. runtime/artifacts/tests/windows.x64.Debug).'
echo ' --coreRootDir=<path> : Directory to the CORE_ROOT location.'
echo ' --enableEventLogging : Enable event logging through LTTNG.'
echo ' --sequential : Run tests sequentially (default is to run in parallel).'
echo ' --runcrossgen2tests : Runs the ReadyToRun tests compiled with Crossgen2'
echo ' --synthesizepgo : Runs the tests allowing crossgen2 to synthesize PGO data'
echo ' --jitstress=<n> : Runs the tests with DOTNET_JitStress=n'
echo ' --jitstressregs=<n> : Runs the tests with DOTNET_JitStressRegs=n'
echo ' --jitminopts : Runs the tests with DOTNET_JITMinOpts=1'
echo ' --jitforcerelocs : Runs the tests with DOTNET_ForceRelocs=1'
echo ' --gcname=<n> : Runs the tests with DOTNET_GCName=n'
echo ' --gcstresslevel=<n> : Runs the tests with DOTNET_GCStress=n'
echo ' 0: None 1: GC on all allocs and '"'easy'"' places'
echo ' 2: GC on transitions to preemptive GC 4: GC on every allowable JITed instr'
echo ' 8: GC on every allowable NGEN instr 16: GC only on a unique stack trace'
echo ' --gcsimulator : Runs the GCSimulator tests'
echo ' --long-gc : Runs the long GC tests'
echo ' --useServerGC : Enable server GC for this test run'
echo ' --ilasmroundtrip : Runs ilasm round trip on the tests'
echo ' --link=<ILlink> : Runs the tests after linking via ILlink'
echo ' --printLastResultsOnly : Print the results of the last run'
echo ' --logsDir=<path> : Specify the logs directory (default: artifacts/log)'
echo ' --runincontext : Run each tests in an unloadable AssemblyLoadContext'
echo ' --tieringtest : Run each test to encourage tier1 rejitting'
echo ' --runnativeaottests : Run NativeAOT compiled tests'
echo ' --interpreter : Runs the tests with the interpreter enabled'
echo ' --node : Runs the tests with NodeJS (wasm only)'
echo ' --runner-filter=<pattern> : Only run merged runners whose name contains <pattern>'
echo ' --active-issue-details : Show per-issue breakdown of ActiveIssue-skipped tests'
echo ' --tree=<path> : Only run tests under the specified subtree (e.g. JIT/Regression)'
echo ' --limitedDumpGeneration : '
}
# Exit code constants
readonly EXIT_CODE_SUCCESS=0 # Script ran normally.
readonly EXIT_CODE_EXCEPTION=1 # Script exited because something exceptional happened (e.g. bad arguments, Ctrl-C interrupt).
readonly EXIT_CODE_TEST_FAILURE=2 # Script completed successfully, but one or more tests failed.
scriptPath="$(cd "$(dirname "$BASH_SOURCE[0]")"; pwd -P)"
repoRootDir="$(cd "$scriptPath"/../..; pwd -P)"
source "$repoRootDir/eng/common/native/init-os-and-arch.sh"
# Argument variables
buildArch="$arch"
buildOS=
buildConfiguration="Debug"
testRootDir=
coreRootDir=
logsDir=
testEnv=
gcsimulator=
longgc=
limitedCoreDumps=
verbose=0
ilasmroundtrip=
printLastResultsOnly=
runSequential=0
runincontext=0
tieringtest=0
nativeaottest=0
runnerFilter=
activeIssueDetails=
treeSubtree=
for i in "$@"
do
if [[ "$__nextTreeArg" == "1" ]]; then
treeSubtree="$i"
__nextTreeArg=
continue
fi
case $i in
-h|--help)
print_usage
exit $EXIT_CODE_SUCCESS
;;
-v|--verbose)
verbose=1
;;
x64)
buildArch="x64"
;;
x86)
buildArch="x86"
;;
arm)
buildArch="arm"
;;
arm64)
buildArch="arm64"
;;
loongarch64)
buildArch="loongarch64"
;;
riscv64)
buildArch="riscv64"
;;
wasm)
buildArch="wasm"
;;
android)
buildOS="android"
;;
wasi)
buildOS="wasi"
;;
debug|Debug)
buildConfiguration="Debug"
;;
checked|Checked)
buildConfiguration="Checked"
;;
release|Release)
buildConfiguration="Release"
;;
--printLastResultsOnly)
printLastResultsOnly=1
;;
--jitstress=*)
export DOTNET_JitStress=${i#*=}
;;
--jitstressregs=*)
export DOTNET_JitStressRegs=${i#*=}
;;
--jitminopts)
export DOTNET_JITMinOpts=1
;;
--jitforcerelocs)
export DOTNET_ForceRelocs=1
;;
--ilasmroundtrip)
((ilasmroundtrip = 1))
;;
--testRootDir=*)
testRootDir=${i#*=}
;;
--coreRootDir=*)
coreRootDir=${i#*=}
;;
--logsDir=*)
logsDir=${i#*=}
;;
--enableEventLogging)
export DOTNET_EnableEventLog=1
;;
--runcrossgen2tests)
export RunCrossGen2=1
;;
--synthesizepgo)
export CrossGen2SynthesizePgo=1
;;
--sequential)
runSequential=1
;;
--useServerGC)
export DOTNET_gcServer=1
;;
--long-gc)
((longgc = 1))
;;
--gcsimulator)
((gcsimulator = 1))
;;
--test-env=*)
testEnv=${i#*=}
;;
--gcstresslevel=*)
export DOTNET_GCStress=${i#*=}
;;
--gcname=*)
export DOTNET_GCName=${i#*=}
;;
--limitedDumpGeneration)
limitedCoreDumps=ON
;;
--runincontext)
runincontext=1
;;
--tieringtest)
tieringtest=1
;;
--runnativeaottests)
nativeaottest=1
;;
--tree=*|-tree=*)
treeSubtree=${i#*=}
;;
--tree:*|-tree:*)
treeSubtree=${i#*:}
;;
--tree|-tree)
__nextTreeArg=1
;;
--interpreter)
export RunInterpreter=1
;;
--node)
export RunWithNodeJS=1
;;
--runner-filter=*)
runnerFilter=${i#*=}
;;
--active-issue-details)
activeIssueDetails=1
;;
*)
echo "Unknown switch: $i"
print_usage
exit $EXIT_CODE_SUCCESS
;;
esac
done
# Set default for RunWithNodeJS when using wasm architecture
if [ "$buildArch" = "wasm" ] && [ -z "$RunWithNodeJS" ]; then
export RunWithNodeJS=1
fi
################################################################################
# Call run.py to run tests.
################################################################################
runtestPyArguments=("-arch" "${buildArch}" "-build_type" "${buildConfiguration}")
echo "Build Architecture : ${buildArch}"
echo "Build Configuration : ${buildConfiguration}"
if [ "$buildArch" = "wasm" -a -z "$buildOS" ]; then
buildOS="browser"
fi
if [ -n "$buildOS" ]; then
runtestPyArguments+=("-os" "$buildOS")
fi
if [ "$buildOS" = "android" ]; then
runtestPyArguments+=("-os" "android")
fi
if [[ -n "$testRootDir" ]]; then
runtestPyArguments+=("-test_location" "$testRootDir")
echo "Test Location : ${testRootDir}"
fi
if [[ -n "$coreRootDir" ]]; then
runtestPyArguments+=("-core_root" "$coreRootDir")
echo "CORE_ROOT : ${coreRootDir}"
fi
if [[ -n "$logsDir" ]]; then
runtestPyArguments+=("-logs_dir" "$logsDir")
echo "Logs directory : ${logsDir}"
fi
if [[ -n "${testEnv}" ]]; then
runtestPyArguments+=("-test_env" "${testEnv}")
echo "Test Env : ${testEnv}"
fi
echo ""
if [[ -n "$longgc" ]]; then
echo "Running Long GC tests"
runtestPyArguments+=("--long_gc")
fi
if [[ -n "$gcsimulator" ]]; then
echo "Running GC simulator tests"
runtestPyArguments+=("--gcsimulator")
fi
if [[ -n "$ilasmroundtrip" ]]; then
echo "Running Ilasm round trip"
runtestPyArguments+=("--ilasmroundtrip")
fi
if (($verbose!=0)); then
runtestPyArguments+=("--verbose")
fi
if [ "$runSequential" -ne 0 ]; then
echo "Run tests sequentially."
runtestPyArguments+=("--sequential")
fi
if [[ -n "$printLastResultsOnly" ]]; then
runtestPyArguments+=("--analyze_results_only")
fi
if [[ -n "$RunCrossGen2" ]]; then
runtestPyArguments+=("--run_crossgen2_tests")
fi
if [[ -n "$CrossGen2SynthesizePgo" ]]; then
runtestPyArguments+=("--synthesize_pgo")
fi
if [[ "$limitedCoreDumps" == "ON" ]]; then
runtestPyArguments+=("--limited_core_dumps")
fi
if [[ "$runincontext" -ne 0 ]]; then
echo "Running in an unloadable AssemblyLoadContext"
runtestPyArguments+=("--run_in_context")
fi
if [[ "$tieringtest" -ne 0 ]]; then
echo "Running to encourage tier1 rejitting"
runtestPyArguments+=("--tieringtest")
fi
if [[ "$nativeaottest" -ne 0 ]]; then
echo "Running NativeAOT compiled tests"
runtestPyArguments+=("--run_nativeaot_tests")
fi
if [[ -n "$RunInterpreter" ]]; then
echo "Running tests with the interpreter"
runtestPyArguments+=("--interpreter")
fi
if [[ -n "$RunWithNodeJS" ]]; then
echo "Running tests with NodeJS"
runtestPyArguments+=("--node")
fi
if [[ -n "$runnerFilter" ]]; then
echo "Runner filter : ${runnerFilter}"
runtestPyArguments+=("--runner_filter" "$runnerFilter")
fi
if [[ -n "$activeIssueDetails" ]]; then
runtestPyArguments+=("--active_issue_details")
fi
if [[ -n "$treeSubtree" ]]; then
echo "Running tests under subtree : ${treeSubtree}"
runtestPyArguments+=("--tree" "$treeSubtree")
fi
# Default to python3 if it is installed
__Python=python
if command -v python3 &>/dev/null; then
__Python=python3
fi
# Run the tests using cross platform run.py
echo "$__Python $repoRootDir/src/tests/run.py ${runtestPyArguments[@]}"
$__Python "$repoRootDir/src/tests/run.py" "${runtestPyArguments[@]}"
exit "$?"