1 // Import the utility functionality.
3 import jobs.generation.*
5 // The input project name (e.g. dotnet/coreclr)
6 def project = GithubProject
7 // The input branch name (e.g. master)
8 def branch = GithubBranchName
9 def projectFolder = Utilities.getFolderName(project) + '/' + Utilities.getFolderName(branch)
11 // Create a folder for JIT stress jobs and associated folder views
13 Utilities.addStandardFolderView(this, 'jitstress', project)
15 // Create a folder for testing via illink
17 Utilities.addStandardFolderView(this, 'illink', project)
19 def static getOSGroup(def os) {
20 def osGroupMap = ['Ubuntu' : 'Linux',
21 'Ubuntu16.04' : 'Linux',
22 'Ubuntu16.10' : 'Linux',
24 'Debian8.4' : 'Linux',
26 'CentOS7.1' : 'Linux',
29 'Windows_NT' : 'Windows_NT']
30 def osGroup = osGroupMap.get(os, null)
31 assert osGroup != null : "Could not find os group for ${os}"
35 // We use this class (vs variables) so that the static functions can access data here.
38 // We have very limited Windows ARM64 hardware (used for ARM/ARM64 testing) and Linux/arm32 and Linux/arm64 hardware.
39 // So only allow certain branches to use it.
40 def static LimitedHardwareBranches = [
43 // Innerloop build OS's
44 // The Windows_NT_BuildOnly OS is a way to speed up the Non-Windows builds by avoiding
45 // test execution in the build flow runs. It generates the exact same build
46 // as Windows_NT but without running the tests.
52 'Windows_NT_BuildOnly',
60 def static crossList = [
68 // This is a set of JIT stress modes combined with the set of variables that
69 // need to be set to actually enable that stress mode. The key of the map is the stress mode and
70 // the values are the environment variables
71 def static jitStressModeScenarios = [
72 'minopts' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JITMinOpts' : '1'],
73 'tieredcompilation' : ['COMPlus_TieredCompilation' : '1'], // this can be removed once tiered compilation is on by default
74 'no_tiered_compilation' : ['COMPlus_TieredCompilation' : '0'],
75 'no_tiered_compilation_innerloop': ['COMPlus_TieredCompilation' : '0'],
76 'forcerelocs' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_ForceRelocs' : '1'],
77 'jitstress1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '1'],
78 'jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2'],
79 'jitstress1_tiered' : ['COMPlus_TieredCompilation' : '1', 'COMPlus_JitStress' : '1'],
80 'jitstress2_tiered' : ['COMPlus_TieredCompilation' : '1', 'COMPlus_JitStress' : '2'],
81 'jitstressregs1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '1'],
82 'jitstressregs2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '2'],
83 'jitstressregs3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '3'],
84 'jitstressregs4' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '4'],
85 'jitstressregs8' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '8'],
86 'jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x10'],
87 'jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x80'],
88 'jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x1000'],
89 'jitstress2_jitstressregs1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '1'],
90 'jitstress2_jitstressregs2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '2'],
91 'jitstress2_jitstressregs3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '3'],
92 'jitstress2_jitstressregs4' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '4'],
93 'jitstress2_jitstressregs8' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '8'],
94 'jitstress2_jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x10'],
95 'jitstress2_jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x80'],
96 'jitstress2_jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x1000'],
97 'tailcallstress' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_TailcallStress' : '1'],
98 'jitsse2only' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableAVX' : '0', 'COMPlus_EnableSSE3_4' : '0'],
99 'jitnosimd' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_FeatureSIMD' : '0'],
100 'jitincompletehwintrinsic' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1'],
101 'jitx86hwintrinsicnoavx' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_EnableAVX' : '0'], // testing the legacy SSE encoding
102 'jitx86hwintrinsicnoavx2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_EnableAVX2' : '0'], // testing SNB/IVB
103 'jitx86hwintrinsicnosimd' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_FeatureSIMD' : '0'], // match "jitnosimd", may need to remove after decoupling HW intrinsic from FeatureSIMD
104 'jitnox86hwintrinsic' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_EnableSSE' : '0' , 'COMPlus_EnableSSE2' : '0' , 'COMPlus_EnableSSE3' : '0' , 'COMPlus_EnableSSSE3' : '0' , 'COMPlus_EnableSSE41' : '0' , 'COMPlus_EnableSSE42' : '0' , 'COMPlus_EnableAVX' : '0' , 'COMPlus_EnableAVX2' : '0' , 'COMPlus_EnableAES' : '0' , 'COMPlus_EnableBMI1' : '0' , 'COMPlus_EnableBMI2' : '0' , 'COMPlus_EnableFMA' : '0' , 'COMPlus_EnableLZCNT' : '0' , 'COMPlus_EnablePCLMULQDQ' : '0' , 'COMPlus_EnablePOPCNT' : '0'],
105 'corefx_baseline' : ['COMPlus_TieredCompilation' : '0'], // corefx baseline
106 'corefx_minopts' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JITMinOpts' : '1'],
107 'corefx_tieredcompilation' : ['COMPlus_TieredCompilation' : '1'], // this can be removed once tiered compilation is on by default
108 'corefx_jitstress1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '1'],
109 'corefx_jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2'],
110 'corefx_jitstressregs1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '1'],
111 'corefx_jitstressregs2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '2'],
112 'corefx_jitstressregs3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '3'],
113 'corefx_jitstressregs4' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '4'],
114 'corefx_jitstressregs8' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '8'],
115 'corefx_jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x10'],
116 'corefx_jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x80'],
117 'corefx_jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x1000'],
118 'gcstress0x3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0x3'],
119 'gcstress0xc' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC'],
120 'zapdisable' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0'],
121 'heapverify1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_HeapVerify' : '1'],
122 'gcstress0xc_zapdisable' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0'],
123 'gcstress0xc_zapdisable_jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0', 'COMPlus_JitStress' : '2'],
124 'gcstress0xc_zapdisable_heapverify1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0', 'COMPlus_HeapVerify' : '1'],
125 'gcstress0xc_jitstress1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_JitStress' : '1'],
126 'gcstress0xc_jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_JitStress' : '2'],
127 'gcstress0xc_minopts_heapverify1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_JITMinOpts' : '1', 'COMPlus_HeapVerify' : '1']
130 // This is a set of ReadyToRun stress scenarios
131 def static r2rStressScenarios = [
132 'r2r_jitstress1' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStress": "1"],
133 'r2r_jitstress2' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStress": "2"],
134 'r2r_jitstress1_tiered' : ['COMPlus_TieredCompilation' : '1', "COMPlus_JitStress": "1"],
135 'r2r_jitstress2_tiered' : ['COMPlus_TieredCompilation' : '1', "COMPlus_JitStress": "2"],
136 'r2r_jitstressregs1' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "1"],
137 'r2r_jitstressregs2' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "2"],
138 'r2r_jitstressregs3' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "3"],
139 'r2r_jitstressregs4' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "4"],
140 'r2r_jitstressregs8' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "8"],
141 'r2r_jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "0x10"],
142 'r2r_jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "0x80"],
143 'r2r_jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "0x1000"],
144 'r2r_jitminopts' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JITMinOpts": "1"],
145 'r2r_jitforcerelocs' : ['COMPlus_TieredCompilation' : '0', "COMPlus_ForceRelocs": "1"],
146 'r2r_gcstress15' : ['COMPlus_TieredCompilation' : '0', "COMPlus_GCStress": "0xF"],
147 'r2r_no_tiered_compilation' : ['COMPlus_TieredCompilation' : '0'],
150 // This is the basic set of scenarios
151 def static basicScenarios = [
159 // 'jitdiff', // jitdiff is currently disabled, until someone spends the effort to make it fully work
161 'gc_reliability_framework',
164 'crossgen_comparison',
167 def static allScenarios = basicScenarios + r2rStressScenarios.keySet() + jitStressModeScenarios.keySet()
169 // Valid PR trigger combinations.
170 def static prTriggeredValidInnerLoopCombos = [
188 'Windows_NT_BuildOnly': [
232 // A set of scenarios that are valid for arm/arm64 tests run on hardware. This is a map from valid scenario name
233 // to Tests.lst file categories to exclude.
235 // This list should contain a subset of the scenarios from `allScenarios`. Please keep this in the same order as that,
236 // and with the same values, with some commented out, for easier maintenance.
238 // Note that some scenarios that are commented out should be enabled, but haven't yet been.
240 def static validArmWindowsScenarios = [
250 // 'gc_reliability_framework'
252 // 'corefx_innerloop'
253 // 'crossgen_comparison'
257 'r2r_jitstress1_tiered',
258 'r2r_jitstress2_tiered',
259 'r2r_jitstressregs1',
260 'r2r_jitstressregs2',
261 'r2r_jitstressregs3',
262 'r2r_jitstressregs4',
263 'r2r_jitstressregs8',
264 'r2r_jitstressregs0x10',
265 'r2r_jitstressregs0x80',
266 'r2r_jitstressregs0x1000',
268 'r2r_jitforcerelocs',
270 'r2r_no_tiered_compilation',
273 'no_tiered_compilation',
274 'no_tiered_compilation_innerloop',
287 'jitstressregs0x1000',
288 'jitstress2_jitstressregs1',
289 'jitstress2_jitstressregs2',
290 'jitstress2_jitstressregs3',
291 'jitstress2_jitstressregs4',
292 'jitstress2_jitstressregs8',
293 'jitstress2_jitstressregs0x10',
294 'jitstress2_jitstressregs0x80',
295 'jitstress2_jitstressregs0x1000',
297 // 'jitsse2only' // Only relevant to xarch
298 'jitnosimd', // Only interesting on platforms where SIMD support exists.
299 // 'jitincompletehwintrinsic'
300 // 'jitx86hwintrinsicnoavx'
301 // 'jitx86hwintrinsicnoavx2'
302 // 'jitx86hwintrinsicnosimd'
303 // 'jitnox86hwintrinsic'
304 'corefx_baseline', // corefx tests don't use smarty
305 'corefx_minopts', // corefx tests don't use smarty
306 'corefx_tieredcompilation', // corefx tests don't use smarty
307 'corefx_jitstress1', // corefx tests don't use smarty
308 'corefx_jitstress2', // corefx tests don't use smarty
309 'corefx_jitstressregs1', // corefx tests don't use smarty
310 'corefx_jitstressregs2', // corefx tests don't use smarty
311 'corefx_jitstressregs3', // corefx tests don't use smarty
312 'corefx_jitstressregs4', // corefx tests don't use smarty
313 'corefx_jitstressregs8', // corefx tests don't use smarty
314 'corefx_jitstressregs0x10', // corefx tests don't use smarty
315 'corefx_jitstressregs0x80', // corefx tests don't use smarty
316 'corefx_jitstressregs0x1000', // corefx tests don't use smarty
321 'gcstress0xc_zapdisable',
322 'gcstress0xc_zapdisable_jitstress2',
323 'gcstress0xc_zapdisable_heapverify1',
324 'gcstress0xc_jitstress1',
325 'gcstress0xc_jitstress2',
326 'gcstress0xc_minopts_heapverify1',
329 // NOTE: the following scenarios are not defined in the 'allScenarios' list! Is this a bug?
332 'minopts_zapdisable',
333 'gcstress0x3_jitstress1',
334 'gcstress0x3_jitstress2',
335 'gcstress0x3_jitstressregs1',
336 'gcstress0x3_jitstressregs2',
337 'gcstress0x3_jitstressregs3',
338 'gcstress0x3_jitstressregs4',
339 'gcstress0x3_jitstressregs8',
340 'gcstress0x3_jitstressregs0x10',
341 'gcstress0x3_jitstressregs0x80',
342 'gcstress0x3_jitstressregs0x1000',
343 'gcstress0xc_jitstressregs1',
344 'gcstress0xc_jitstressregs2',
345 'gcstress0xc_jitstressregs3',
346 'gcstress0xc_jitstressregs4',
347 'gcstress0xc_jitstressregs8',
348 'gcstress0xc_jitstressregs0x10',
349 'gcstress0xc_jitstressregs0x80',
350 'gcstress0xc_jitstressregs0x1000'
353 def static validLinuxArmScenarios = [
363 // 'gc_reliability_framework'
365 // 'corefx_innerloop'
366 'crossgen_comparison',
370 'r2r_jitstress1_tiered',
371 'r2r_jitstress2_tiered',
372 'r2r_jitstressregs1',
373 'r2r_jitstressregs2',
374 'r2r_jitstressregs3',
375 'r2r_jitstressregs4',
376 'r2r_jitstressregs8',
377 'r2r_jitstressregs0x10',
378 'r2r_jitstressregs0x80',
379 'r2r_jitstressregs0x1000',
381 'r2r_jitforcerelocs',
383 'r2r_no_tiered_compilation',
386 'no_tiered_compilation',
387 'no_tiered_compilation_innerloop',
400 'jitstressregs0x1000',
401 'jitstress2_jitstressregs1',
402 'jitstress2_jitstressregs2',
403 'jitstress2_jitstressregs3',
404 'jitstress2_jitstressregs4',
405 'jitstress2_jitstressregs8',
406 'jitstress2_jitstressregs0x10',
407 'jitstress2_jitstressregs0x80',
408 'jitstress2_jitstressregs0x1000',
410 // 'jitsse2only' // Only relevant to xarch
411 // 'jitnosimd' // Only interesting on platforms where SIMD support exists.
412 // 'jitincompletehwintrinsic'
413 // 'jitx86hwintrinsicnoavx'
414 // 'jitx86hwintrinsicnoavx2'
415 // 'jitx86hwintrinsicnosimd'
416 // 'jitnox86hwintrinsic'
419 'corefx_tieredcompilation',
422 'corefx_jitstressregs1',
423 'corefx_jitstressregs2',
424 'corefx_jitstressregs3',
425 'corefx_jitstressregs4',
426 'corefx_jitstressregs8',
427 'corefx_jitstressregs0x10',
428 'corefx_jitstressregs0x80',
429 'corefx_jitstressregs0x1000',
434 'gcstress0xc_zapdisable',
435 'gcstress0xc_zapdisable_jitstress2',
436 'gcstress0xc_zapdisable_heapverify1',
437 'gcstress0xc_jitstress1',
438 'gcstress0xc_jitstress2',
439 'gcstress0xc_minopts_heapverify1'
442 def static validLinuxArm64Scenarios = [
452 // 'gc_reliability_framework'
454 // 'corefx_innerloop'
455 'crossgen_comparison',
459 'r2r_jitstress1_tiered',
460 'r2r_jitstress2_tiered',
461 'r2r_jitstressregs1',
462 'r2r_jitstressregs2',
463 'r2r_jitstressregs3',
464 'r2r_jitstressregs4',
465 'r2r_jitstressregs8',
466 'r2r_jitstressregs0x10',
467 'r2r_jitstressregs0x80',
468 'r2r_jitstressregs0x1000',
470 'r2r_jitforcerelocs',
472 'r2r_no_tiered_compilation',
475 'no_tiered_compilation',
476 'no_tiered_compilation_innerloop',
489 'jitstressregs0x1000',
490 'jitstress2_jitstressregs1',
491 'jitstress2_jitstressregs2',
492 'jitstress2_jitstressregs3',
493 'jitstress2_jitstressregs4',
494 'jitstress2_jitstressregs8',
495 'jitstress2_jitstressregs0x10',
496 'jitstress2_jitstressregs0x80',
497 'jitstress2_jitstressregs0x1000',
499 // 'jitsse2only' // Only relevant to xarch
500 'jitnosimd', // Only interesting on platforms where SIMD support exists.
501 // 'jitincompletehwintrinsic'
502 // 'jitx86hwintrinsicnoavx'
503 // 'jitx86hwintrinsicnoavx2'
504 // 'jitx86hwintrinsicnosimd'
505 // 'jitnox86hwintrinsic'
508 'corefx_tieredcompilation',
511 'corefx_jitstressregs1',
512 'corefx_jitstressregs2',
513 'corefx_jitstressregs3',
514 'corefx_jitstressregs4',
515 'corefx_jitstressregs8',
516 'corefx_jitstressregs0x10',
517 'corefx_jitstressregs0x80',
518 'corefx_jitstressregs0x1000',
523 'gcstress0xc_zapdisable',
524 'gcstress0xc_zapdisable_jitstress2',
525 'gcstress0xc_zapdisable_heapverify1',
526 'gcstress0xc_jitstress1',
527 'gcstress0xc_jitstress2',
528 'gcstress0xc_minopts_heapverify1'
531 def static configurationList = ['Debug', 'Checked', 'Release']
533 // This is the set of architectures
534 // Some of these are pseudo-architectures:
535 // armem -- ARM builds/runs using an emulator. Used for Tizen runs.
536 // x86_arm_altjit -- ARM runs on x86 using the ARM altjit
537 // x64_arm64_altjit -- ARM64 runs on x64 using the ARM64 altjit
538 def static architectureList = ['arm', 'armem', 'x86_arm_altjit', 'x64_arm64_altjit', 'arm64', 'x64', 'x86']
540 // This set of architectures that cross build on Windows and run on Windows ARM64 hardware.
541 def static armWindowsCrossArchitectureList = ['arm', 'arm64']
544 // **************************************************************
545 // Create some specific views
547 // These aren't using the Utilities.addStandardFolderView() function, because that creates
548 // views based on a single regular expression. These views will be generated by adding a
549 // specific set of jobs to them.
551 // Utilities.addStandardFolderView() also creates a lot of additional stuff around the
552 // view, like "Build Statistics", "Job Statistics", "Unstable Jobs". Until it is determined
553 // those are required, don't add them (which simplifies the view pages, as well).
554 // **************************************************************
557 def static MergeJobView = null
558 def static PeriodicJobView = null
559 def static ArchitectureViews = [:]
560 def static OSViews = [:]
563 // MergeJobView: include all jobs that execute when a PR change is merged.
564 Views.MergeJobView = listView('Merge') {
577 // PeriodicJobView: include all jobs that execute on a schedule
578 Views.PeriodicJobView = listView('Periodic') {
591 // Create a view for non-PR jobs for each architecture.
592 Constants.architectureList.each { architecture ->
593 Views.ArchitectureViews[architecture] = listView(architecture) {
607 // Create a view for non-PR jobs for each OS.
608 Constants.osList.each { os ->
609 // Don't create one for the special 'Windows_NT_BuildOnly'
610 if (os == 'Windows_NT_BuildOnly') {
613 Views.OSViews[os] = listView(os) {
627 def static addToMergeView(def job) {
628 Views.MergeJobView.with {
635 def static addToPeriodicView(def job) {
636 Views.PeriodicJobView.with {
643 def static addToViews(def job, def isFlowJob, def isPR, def architecture, def os, def configuration, def scenario) {
645 // No views want PR jobs currently.
649 // We don't want to include in view any job that is only used by a flow job (because we want the views to have only the
650 // "top-level" jobs. Build only jobs are such jobs.
651 if (os == 'Windows_NT_BuildOnly') {
656 // For non-flow jobs, which ones are only used by flow jobs?
657 if ((architecture == 'arm') || (architecture == 'arm64')) {
658 if (isCoreFxScenario(scenario)) {
659 // We have corefx-specific scenario builds for each of the runs, but these are driven by flow jobs.
663 // We're left with the basic normal/innerloop builds. We might want to remove these from the views also, if desired.
664 // However, there are a few, like the Debug Build, that is build only, not "Build and Test", that we should leave.
668 // Add to architecture view.
669 Views.ArchitectureViews[architecture].with {
676 Views.OSViews[os].with {
683 def static addPeriodicTriggerHelper(def job, String cronString, boolean alwaysRuns = false) {
684 addToPeriodicView(job)
685 Utilities.addPeriodicTrigger(job, cronString, alwaysRuns)
688 def static addGithubPushTriggerHelper(def job) {
690 Utilities.addGithubPushTrigger(job)
694 def static setMachineAffinity(def job, def os, def architecture, def options = null) {
695 assert os instanceof String
696 assert architecture instanceof String
698 def armArches = ['arm', 'armem', 'arm64']
700 if (!(architecture in armArches)) {
701 assert options == null
702 Utilities.setMachineAffinity(job, os, 'latest-or-auto')
707 // This is an arm(64) job.
709 // There are several options.
713 // Arm32 (Build) -> latest-arm64
714 // |-> os == "Windows_NT" && (architecture == "arm") && options['use_arm64_build_machine'] == true
715 // Arm32 (Test) -> arm64-windows_nt
716 // |-> os == "Windows_NT" && (architecture == "arm") && options['use_arm64_build_machine'] == false
718 // Arm64 (Build) -> latest-arm64
719 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == true
720 // Arm64 (Test) -> arm64-windows_nt
721 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == false
725 // Arm32 emulator (Build, Test) -> arm-cross-latest
726 // |-> os == "Tizen" && (architecture == "armem")
728 // Arm32 hardware (Flow) -> Ubuntu 16.04 latest-or-auto (don't use limited arm hardware)
729 // |-> os == "Ubuntu" && (architecture == "arm") && options['is_flow_job'] == true
730 // Arm32 hardware (Build) -> Ubuntu 16.04 latest-or-auto
731 // |-> os == "Ubuntu" && (architecture == "arm") && options['is_build_job'] == true
732 // Arm32 hardware (Test) -> Helix ubuntu.1404.arm32.open queue
733 // |-> os == "Ubuntu" && (architecture == "arm")
735 // Arm64 (Build) -> arm64-cross-latest
736 // |-> os != "Windows_NT" && architecture == "arm64" && options['is_build_job'] == true
737 // Arm64 (Test) -> Helix Ubuntu.1604.Arm64.Open queue
738 // |-> os != "Windows_NT" && architecture == "arm64"
740 // Note: we are no longer using Jenkins tags "arm64-huge-page-size", "arm64-small-page-size".
741 // Support for Linux arm64 large page size has been removed for now, as it wasn't being used.
743 // Note: we are no longer using Jenkins tag 'latest-arm64' for arm/arm64 Windows build machines. Instead,
744 // we are using public VS2017 arm/arm64 tools in a VM from Helix.
746 // This has to be a arm arch
747 assert architecture in armArches
748 if (os == "Windows_NT") {
749 // arm32/arm64 Windows jobs share the same machines for now
750 def isBuild = options['use_arm64_build_machine'] == true
752 if (isBuild == true) {
754 label('Windows.10.Amd64.ClientRS4.DevEx.Open')
757 Utilities.setMachineAffinity(job, 'windows.10.arm64.open')
760 assert os != 'Windows_NT'
762 if (architecture == 'armem') {
763 // arm emulator (Tizen). Build and test on same machine,
766 Utilities.setMachineAffinity(job, 'Ubuntu', 'arm-cross-latest')
769 // arm/arm64 Ubuntu on hardware.
770 assert architecture == 'arm' || architecture == 'arm64'
771 def isFlow = (options != null) && (options['is_flow_job'] == true)
772 def isBuild = (options != null) && (options['is_build_job'] == true)
773 if (isFlow || isBuild) {
774 // arm/arm64 Ubuntu build machine. Build uses docker, so the actual host OS is not
775 // very important. Therefore, use latest or auto. Flow jobs don't need to use arm hardware.
776 Utilities.setMachineAffinity(job, 'Ubuntu16.04', 'latest-or-auto')
778 // arm/arm64 Ubuntu test machine. Specify the Helix queue name here.
779 if (architecture == 'arm64') {
780 assert os == 'Ubuntu16.04'
782 label('Ubuntu.1604.Arm64.Open')
786 assert os == 'Ubuntu'
788 label('ubuntu.1404.arm32.open')
796 // setJobMachineAffinity: compute the machine affinity options for a job,
797 // then set the job with those affinity options.
798 def static setJobMachineAffinity(def architecture, def os, def isBuildJob, def isTestJob, def isFlowJob, def job)
800 assert (isBuildJob && !isTestJob && !isFlowJob) ||
801 (!isBuildJob && isTestJob && !isFlowJob) ||
802 (!isBuildJob && !isTestJob && isFlowJob)
804 def affinityOptions = null
805 def affinityArchitecture = architecture
807 if (os == "Windows_NT") {
808 if (architecture in Constants.armWindowsCrossArchitectureList) {
810 affinityOptions = [ "use_arm64_build_machine" : true ]
811 } else if (isTestJob) {
812 affinityOptions = [ "use_arm64_build_machine" : false ]
813 } else if (isFlowJob) {
814 // For the flow jobs set the machine affinity as x64
815 affinityArchitecture = 'x64'
820 if ((architecture == 'arm64') || (architecture == 'arm')) {
822 affinityOptions = ['is_build_job': true]
823 } else if (isFlowJob) {
824 affinityOptions = ['is_flow_job': true]
829 setMachineAffinity(job, os, affinityArchitecture, affinityOptions)
832 def static isGCStressRelatedTesting(def scenario) {
833 // The 'r2r_gcstress15' scenario is a basic scenario.
834 // Detect it and make it a GCStress related.
835 if (scenario == 'r2r_gcstress15')
840 def gcStressTestEnvVars = [ 'COMPlus_GCStress', 'COMPlus_ZapDisable', 'COMPlus_HeapVerify']
841 def scenarioName = scenario.toLowerCase()
842 def isGCStressTesting = false
843 Constants.jitStressModeScenarios[scenario].each{ k, v ->
844 if (k in gcStressTestEnvVars) {
845 isGCStressTesting = true;
848 return isGCStressTesting
851 def static isCoreFxScenario(def scenario) {
852 def corefx_prefix = 'corefx_'
853 if (scenario.length() < corefx_prefix.length()) {
856 return scenario.substring(0,corefx_prefix.length()) == corefx_prefix
859 def static isR2RBaselineScenario(def scenario) {
860 return (scenario == 'r2r')
863 def static isR2RStressScenario(def scenario) {
864 return Constants.r2rStressScenarios.containsKey(scenario)
867 def static isR2RScenario(def scenario) {
868 return isR2RBaselineScenario(scenario) || isR2RStressScenario(scenario)
871 def static isJitStressScenario(def scenario) {
872 return Constants.jitStressModeScenarios.containsKey(scenario)
875 def static isLongGc(def scenario) {
876 return (scenario == 'longgc' || scenario == 'gcsimulator')
879 def static isJitDiff(def scenario) {
880 return (scenario == 'jitdiff')
883 def static isGcReliabilityFramework(def scenario) {
884 return (scenario == 'gc_reliability_framework')
887 def static isArmWindowsScenario(def scenario) {
888 return Constants.validArmWindowsScenarios.contains(scenario)
891 def static isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly) {
892 if (isBuildOnly == true) {
893 os = 'Windows_NT_BuildOnly'
896 def validOsPrTriggerArchConfigs = Constants.prTriggeredValidInnerLoopCombos[os]
897 if (validOsPrTriggerArchConfigs != null) {
898 def validOsPrTriggerConfigs = validOsPrTriggerArchConfigs[architecture]
899 if (validOsPrTriggerConfigs != null) {
900 if (configuration in validOsPrTriggerConfigs) {
909 // This means the job builds and runs the 'innerloop' test set. This does not mean the job is
910 // scheduled with a default PR trigger despite the correlation being true at the moment.
911 def static isInnerloopTestScenario(def scenario) {
912 return (scenario == 'innerloop' || scenario == 'no_tiered_compilation_innerloop')
915 def static isCrossGenComparisonScenario(def scenario) {
916 return (scenario == 'crossgen_comparison')
919 def static shouldGenerateCrossGenComparisonJob(def os, def architecture, def configuration, def scenario) {
920 assert isCrossGenComparisonScenario(scenario)
921 return ((os == 'Ubuntu' && architecture == 'arm') || (os == 'Ubuntu16.04' && architecture == 'arm64')) && (configuration == 'Checked' || configuration == 'Release')
924 def static getFxBranch(def branch) {
925 def fxBranch = branch
926 // Map 'dev/unix_test_workflow' to 'master' so we can test CoreFX jobs in the CoreCLR dev/unix_test_workflow
927 // branch even though CoreFX doesn't have such a branch.
928 if (branch == 'dev/unix_test_workflow') {
934 def static setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly) {
935 // 2 hours (120 minutes) is the default timeout
938 if (!isInnerloopTestScenario(scenario)) {
939 // Pri-1 test builds take a long time (see calculateBuildCommands()). So up the Pri-1 build jobs timeout.
944 // Note that these can only increase, never decrease, the Pri-1 timeout possibly set above.
945 if (isGCStressRelatedTesting(scenario)) {
948 else if (isCoreFxScenario(scenario)) {
951 else if (isJitStressScenario(scenario)) {
954 else if (isR2RBaselineScenario(scenario)) {
957 else if (isLongGc(scenario)) {
960 else if (isJitDiff(scenario)) {
963 else if (isGcReliabilityFramework(scenario)) {
966 else if (architecture == 'armem' || architecture == 'arm64') {
970 if (architecture == 'arm') {
971 // ARM32 machines are particularly slow.
976 if (configuration == 'Debug') {
977 // Debug runs can be very slow. Add an hour.
981 if (architecture == 'x86_arm_altjit' || architecture == 'x64_arm64_altjit') {
982 // AltJit runs compile all methods twice.
986 // If we've changed the timeout from the default, set it in the job.
988 if (timeout != 120) {
989 Utilities.setJobTimeout(newJob, timeout)
993 def static getJobFolder(def scenario) {
994 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
997 if (scenario == 'illink') {
1003 def static getStressModeDisplayName(def scenario) {
1005 Constants.jitStressModeScenarios[scenario].each{ k, v ->
1006 def prefixLength = 'COMPlus_'.length()
1007 if (k.length() >= prefixLength) {
1008 def modeName = k.substring(prefixLength, k.length())
1009 if (displayStr != '') {
1010 // Separate multiple variables with a space.
1013 displayStr += modeName + '=' + v
1017 if (isCoreFxScenario(scenario)) {
1018 displayStr = ('CoreFx ' + displayStr).trim()
1024 def static getR2RDisplayName(def scenario) {
1025 // Assume the scenario name is one from the r2rStressScenarios dict, and remove its "r2r_" prefix.
1026 def displayStr = scenario
1027 def prefixLength = 'r2r_'.length()
1028 if (displayStr.length() >= prefixLength) {
1029 displayStr = "R2R " + displayStr.substring(prefixLength, displayStr.length())
1030 } else if (scenario == 'r2r') {
1036 def static getScenarioDisplayString(def scenario) {
1039 return "Innerloop Build and Test"
1041 case 'no_tiered_compilation_innerloop':
1042 def displayStr = getStressModeDisplayName(scenario)
1043 return "Innerloop Build and Test (Jit - ${displayStr})"
1045 case 'corefx_innerloop':
1046 return "CoreFX Tests"
1049 return "Build and Test"
1052 return "Jit Diff Build and Test"
1055 return "IL RoundTrip Build and Test"
1058 return "Long-Running GC Build & Test"
1061 return "GC Simulator"
1063 case 'standalone_gc':
1064 return "Standalone GC"
1066 case 'gc_reliability_framework':
1067 return "GC Reliability Framework"
1073 if (isJitStressScenario(scenario)) {
1074 def displayStr = getStressModeDisplayName(scenario)
1075 return "Build and Test (Jit - ${displayStr})"
1077 else if (isR2RScenario(scenario)) {
1078 def displayStr = getR2RDisplayName(scenario)
1079 return "${displayStr} Build and Test"
1082 return "${scenario}"
1087 println("Unknown scenario: ${scenario}");
1092 // Functions to create an environment script.
1093 // envScriptCreate -- initialize the script (call first)
1094 // envScriptFinalize -- finalize the script (call last)
1095 // envScriptSetStressModeVariables -- set stress mode variables in the env script
1096 // envScriptAppendExistingScript -- append an existing script to the generated script
1098 // Each script returns a string of commands. Concatenate all the strings together before
1099 // adding them to the builds commands, to make sure they get executed as one Jenkins script.
1102 // Initialize the environment setting script.
1103 def static envScriptCreate(def os, def stepScriptLocation) {
1105 if (os == 'Windows_NT') {
1106 stepScript += "echo Creating TestEnv script\r\n"
1107 stepScript += "if exist ${stepScriptLocation} del ${stepScriptLocation}\r\n"
1109 // Create at least an empty script.
1110 stepScript += "echo. > ${stepScriptLocation}\r\n"
1113 stepScript += "echo Creating environment setting script\n"
1114 stepScript += "echo \\#\\!/usr/bin/env bash > ${stepScriptLocation}\n"
1120 // Generates the string for setting stress mode variables.
1121 def static envScriptSetStressModeVariables(def os, def stressModeVars, def stepScriptLocation) {
1123 if (os == 'Windows_NT') {
1124 stressModeVars.each{ k, v ->
1125 // Write out what we are writing to the script file
1126 stepScript += "echo Setting ${k}=${v}\r\n"
1127 // Write out the set itself to the script file`
1128 stepScript += "echo set ${k}=${v} >> ${stepScriptLocation}\r\n"
1132 stressModeVars.each{ k, v ->
1133 // Write out what we are writing to the script file
1134 stepScript += "echo Setting ${k}=${v}\n"
1135 // Write out the set itself to the script file`
1136 stepScript += "echo export ${k}=${v} >> ${stepScriptLocation}\n"
1143 // Append an existing script to an environment script.
1144 // Returns string of commands to do this.
1145 def static envScriptAppendExistingScript(def os, def appendScript, def stepScriptLocation) {
1146 assert (os == 'Windows_NT')
1149 stepScript += "echo Appending ${appendScript} to ${stepScriptLocation}\r\n"
1150 stepScript += "type ${appendScript} >> ${stepScriptLocation}\r\n"
1155 // Finalize an environment setting script.
1156 // Returns string of commands to do this.
1157 def static envScriptFinalize(def os, def stepScriptLocation) {
1160 if (os == 'Windows_NT') {
1161 // Display the resulting script. This is useful when looking at the output log file.
1162 stepScript += "echo Display the total script ${stepScriptLocation}\r\n"
1163 stepScript += "type ${stepScriptLocation}\r\n"
1166 stepScript += "chmod +x ${stepScriptLocation}\n"
1172 def static isNeedDocker(def architecture, def os, def isBuild) {
1174 if (architecture == 'x86' && os == 'Ubuntu') {
1177 else if (architecture == 'armem') {
1180 else if (architecture == 'arm') {
1181 if (os == 'Ubuntu') {
1185 else if (architecture == 'arm64') {
1186 if (os == 'Ubuntu16.04') {
1192 if (architecture == 'x86' && os == 'Ubuntu') {
1199 def static getDockerImageName(def architecture, def os, def isBuild) {
1200 // We must change some docker private images to official later
1202 if (architecture == 'x86' && os == 'Ubuntu') {
1203 return "hseok82/dotnet-buildtools-prereqs:ubuntu-16.04-crossx86-ef0ac75-20175511035548"
1205 else if (architecture == 'armem') {
1206 if (os == 'Tizen') {
1207 return "tizendotnet/dotnet-buildtools-prereqs:ubuntu-16.04-cross-e435274-20180426002255-tizen-rootfs-5.0m1"
1210 else if (architecture == 'arm') {
1211 if (os == 'Ubuntu') {
1212 return "microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-e435274-20180426002420"
1215 else if (architecture == 'arm64') {
1216 if (os == 'Ubuntu16.04') {
1217 return "microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-arm64-a3ae44b-20180315221921"
1222 if (architecture == 'x86' && os == 'Ubuntu') {
1223 return "hseok82/dotnet-buildtools-prereqs:ubuntu1604_x86_test"
1226 println("Unknown architecture to use docker: ${architecture} ${os}");
1230 def static getTestArtifactsTgzFileName(def osGroup, def architecture, def configuration) {
1231 return "bin-tests-${osGroup}.${architecture}.${configuration}.tgz"
1234 // We have a limited amount of some hardware. For these, scale back the periodic testing we do,
1235 // and only allowing using this hardware in some specific branches.
1236 def static jobRequiresLimitedHardware(def architecture, def os) {
1237 if (architecture == 'arm') {
1238 // arm Windows and Linux hardware is limited.
1241 else if (architecture == 'arm64') {
1242 // arm64 Windows and Linux hardware is limited.
1250 // Calculates the name of the build job based on some typical parameters.
1252 def static getJobName(def configuration, def architecture, def os, def scenario, def isBuildOnly) {
1253 // If the architecture is x64, do not add that info into the build name.
1254 // Need to change around some systems and other builds to pick up the right builds
1257 def suffix = scenario != 'normal' ? "_${scenario}" : '';
1262 switch (architecture) {
1264 if (scenario == 'normal') {
1265 // For now we leave x64 off of the name for compatibility with other jobs
1266 baseName = configuration.toLowerCase() + '_' + os.toLowerCase()
1268 else if (scenario == 'formatting') {
1269 // we don't care about the configuration for the formatting job. It runs all configs
1270 baseName = architecture.toLowerCase() + '_' + os.toLowerCase()
1273 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1277 // These are cross builds
1278 assert os == 'Tizen'
1279 baseName = 'armel_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1283 // These are cross builds
1284 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1287 case 'x86_arm_altjit':
1288 case 'x64_arm64_altjit':
1289 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1292 println("Unknown architecture: ${architecture}");
1297 return baseName + suffix
1300 def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob, def bidailyCrossList) {
1302 // The dev/unix_test_workflow branch is used for Jenkins CI testing. We generally do not need any non-PR
1303 // triggers in the branch, because that would use machine resources unnecessarily.
1304 if (branch == 'dev/unix_test_workflow') {
1308 // Limited hardware is restricted for non-PR triggers to certain branches.
1309 if (jobRequiresLimitedHardware(architecture, os) && (!(branch in Constants.LimitedHardwareBranches))) {
1313 // Ubuntu x86 CI jobs are failing. Disable non-PR triggered jobs to avoid these constant failures
1314 // until this is fixed. Tracked by https://github.com/dotnet/coreclr/issues/19003.
1315 if (architecture == 'x86' && os == 'Ubuntu') {
1319 def isNormalOrInnerloop = (scenario == "normal" || scenario == "innerloop")
1323 case 'crossgen_comparison':
1324 if (isFlowJob && ((os == 'Ubuntu' && architecture == 'arm') || (os == 'Ubuntu16.04' && architecture == 'arm64')) && (configuration == 'Checked' || configuration == 'Release')) {
1325 addPeriodicTriggerHelper(job, '@daily')
1329 case 'pmi_asm_diffs':
1330 // No non-PR triggers for now.
1334 switch (architecture) {
1337 if (isFlowJob && architecture == 'x86' && os == 'Ubuntu') {
1338 addPeriodicTriggerHelper(job, '@daily')
1340 else if (isFlowJob || os == 'Windows_NT' || (architecture == 'x64' && !(os in Constants.crossList))) {
1341 addGithubPushTriggerHelper(job)
1345 if (os == 'Windows_NT') {
1346 if (isFlowJob || (isNormalOrInnerloop && (configuration == 'Debug'))) {
1347 // We would normally want a per-push trigger, but with limited hardware we can't keep up.
1348 // Do the builds daily.
1349 addPeriodicTriggerHelper(job, '@daily')
1353 // Only the flow jobs get push triggers; the build and test jobs are triggered by the flow job.
1355 addPeriodicTriggerHelper(job, '@daily')
1360 if (os == 'Windows_NT') {
1361 if (isFlowJob || (isNormalOrInnerloop && (configuration == 'Debug'))) {
1362 // We would normally want a push trigger, but with limited hardware we can't keep up.
1363 // Do the builds daily.
1364 addPeriodicTriggerHelper(job, '@daily')
1368 assert os == 'Ubuntu'
1369 // Only the flow jobs get push triggers; the build and test jobs are triggered by the flow job.
1371 // Currently no push triggers, with limited arm Linux hardware.
1372 // TODO: If we have enough machine capacity, add some arm Linux push triggers.
1373 addPeriodicTriggerHelper(job, '@daily')
1378 addGithubPushTriggerHelper(job)
1380 case 'x86_arm_altjit':
1381 case 'x64_arm64_altjit':
1382 // Only do altjit push triggers for Checked; don't waste time on Debug or Release.
1383 if (configuration == 'Checked') {
1384 addGithubPushTriggerHelper(job)
1388 println("Unknown architecture: ${architecture}");
1394 assert !(os in bidailyCrossList)
1395 // r2r gets a push trigger for checked/release
1396 if (configuration == 'Checked' || configuration == 'Release') {
1397 if (architecture == 'x64' && os != 'OSX10.12') {
1398 //Flow jobs should be Windows, Ubuntu, OSX0.12, or CentOS
1399 if (isFlowJob || os == 'Windows_NT') {
1400 addGithubPushTriggerHelper(job)
1402 // OSX10.12 r2r jobs should only run every 12 hours, not daily.
1403 } else if (architecture == 'x64' && os == 'OSX10.12'){
1405 addPeriodicTriggerHelper(job, 'H H/12 * * *')
1408 // For x86, only add per-commit jobs for Windows
1409 else if (architecture == 'x86') {
1410 if (os == 'Windows_NT') {
1411 addGithubPushTriggerHelper(job)
1414 // arm r2r jobs should only run weekly.
1415 else if (architecture == 'arm') {
1417 addPeriodicTriggerHelper(job, '@weekly')
1420 // arm64 r2r jobs should only run weekly.
1421 else if (architecture == 'arm64') {
1423 addPeriodicTriggerHelper(job, '@weekly')
1428 case 'r2r_jitstress1':
1429 case 'r2r_jitstress2':
1430 case 'r2r_jitstress1_tiered':
1431 case 'r2r_jitstress2_tiered':
1432 case 'r2r_jitstressregs1':
1433 case 'r2r_jitstressregs2':
1434 case 'r2r_jitstressregs3':
1435 case 'r2r_jitstressregs4':
1436 case 'r2r_jitstressregs8':
1437 case 'r2r_jitstressregs0x10':
1438 case 'r2r_jitstressregs0x80':
1439 case 'r2r_jitstressregs0x1000':
1440 case 'r2r_jitminopts':
1441 case 'r2r_jitforcerelocs':
1442 case 'r2r_gcstress15':
1443 case 'r2r_no_tiered_compilation':
1444 assert !(os in bidailyCrossList)
1446 // GCStress=C is currently not supported on OS X
1447 if (os == 'OSX10.12' && isGCStressRelatedTesting(scenario)) {
1451 if (configuration == 'Checked' || configuration == 'Release') {
1452 if (architecture == 'x64') {
1453 //Flow jobs should be Windows, Ubuntu, OSX10.12, or CentOS
1454 if (isFlowJob || os == 'Windows_NT') {
1455 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1458 // For x86, only add periodic jobs for Windows
1459 else if (architecture == 'x86') {
1460 if (os == 'Windows_NT') {
1461 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1464 else if (architecture == 'arm') {
1466 addPeriodicTriggerHelper(job, '@weekly')
1469 else if (architecture == 'arm64') {
1471 addPeriodicTriggerHelper(job, '@weekly')
1477 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1478 assert configuration == 'Release'
1479 assert architecture == 'x64'
1480 addPeriodicTriggerHelper(job, '@daily')
1481 // TODO: Add once external email sending is available again
1482 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1485 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1486 assert configuration == 'Release'
1487 assert architecture == 'x64'
1488 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1489 // TODO: Add once external email sending is available again
1490 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1492 case 'standalone_gc':
1493 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1494 assert (configuration == 'Release' || configuration == 'Checked')
1495 // TODO: Add once external email sending is available again
1496 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1497 addPeriodicTriggerHelper(job, '@daily')
1499 case 'gc_reliability_framework':
1500 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1501 assert (configuration == 'Release' || configuration == 'Checked')
1502 // Only triggered by phrase.
1505 assert !(os in bidailyCrossList)
1506 // ILASM/ILDASM roundtrip one gets a daily build, and only for release
1507 if (architecture == 'x64' && configuration == 'Release') {
1508 if (isFlowJob || os == 'Windows_NT') {
1509 addPeriodicTriggerHelper(job, '@daily')
1514 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1515 assert configuration == 'Checked'
1516 assert (architecture == 'x64' || architecture == 'x86')
1517 addGithubPushTriggerHelper(job)
1520 assert (os == 'Windows_NT' || os == "Ubuntu")
1521 assert architecture == 'x64'
1522 addGithubPushTriggerHelper(job)
1524 case 'jitstressregs1':
1525 case 'jitstressregs2':
1526 case 'jitstressregs3':
1527 case 'jitstressregs4':
1528 case 'jitstressregs8':
1529 case 'jitstressregs0x10':
1530 case 'jitstressregs0x80':
1531 case 'jitstressregs0x1000':
1533 case 'tieredcompilation':
1534 case 'no_tiered_compilation':
1538 case 'jitstress1_tiered':
1539 case 'jitstress2_tiered':
1540 case 'jitstress2_jitstressregs1':
1541 case 'jitstress2_jitstressregs2':
1542 case 'jitstress2_jitstressregs3':
1543 case 'jitstress2_jitstressregs4':
1544 case 'jitstress2_jitstressregs8':
1545 case 'jitstress2_jitstressregs0x10':
1546 case 'jitstress2_jitstressregs0x80':
1547 case 'jitstress2_jitstressregs0x1000':
1548 case 'tailcallstress':
1551 case 'jitnox86hwintrinsic':
1552 case 'jitincompletehwintrinsic':
1553 case 'jitx86hwintrinsicnoavx':
1554 case 'jitx86hwintrinsicnoavx2':
1555 case 'jitx86hwintrinsicnosimd':
1556 case 'corefx_baseline':
1557 case 'corefx_minopts':
1558 case 'corefx_tieredcompilation':
1559 case 'corefx_jitstress1':
1560 case 'corefx_jitstress2':
1561 case 'corefx_jitstressregs1':
1562 case 'corefx_jitstressregs2':
1563 case 'corefx_jitstressregs3':
1564 case 'corefx_jitstressregs4':
1565 case 'corefx_jitstressregs8':
1566 case 'corefx_jitstressregs0x10':
1567 case 'corefx_jitstressregs0x80':
1568 case 'corefx_jitstressregs0x1000':
1570 if (os == 'CentOS7.1') {
1573 if (os in bidailyCrossList) {
1576 // ARM corefx testing uses non-flow jobs to provide the configuration-specific
1577 // build for the flow job. We don't need cron jobs for these. Note that the
1578 // Windows ARM jobs depend on a Windows "build only" job that exits the trigger
1579 // function very early, so only non-Windows gets here.
1580 if ((architecture == 'arm') && isCoreFxScenario(scenario) && !isFlowJob) {
1583 if ((architecture == 'arm64') && isCoreFxScenario(scenario) && !isFlowJob) {
1586 if (jobRequiresLimitedHardware(architecture, os)) {
1587 if ((architecture == 'arm64') && (os == 'Ubuntu16.04')) {
1588 // These jobs are very fast on Linux/arm64 hardware, so run them daily.
1589 addPeriodicTriggerHelper(job, '@daily')
1592 addPeriodicTriggerHelper(job, '@weekly')
1596 addPeriodicTriggerHelper(job, '@daily')
1601 if (os == 'CentOS7.1') {
1604 if (os in bidailyCrossList) {
1607 addPeriodicTriggerHelper(job, '@weekly')
1610 case 'gcstress0xc_zapdisable':
1611 case 'gcstress0xc_zapdisable_jitstress2':
1612 case 'gcstress0xc_zapdisable_heapverify1':
1613 case 'gcstress0xc_jitstress1':
1614 case 'gcstress0xc_jitstress2':
1615 case 'gcstress0xc_minopts_heapverify1':
1616 if (os == 'OSX10.12') {
1617 // GCStress=C is currently not supported on OS X
1620 if (os == 'CentOS7.1') {
1623 if (os in bidailyCrossList) {
1626 addPeriodicTriggerHelper(job, '@weekly')
1630 // Testing on other operating systems TBD
1631 assert (os == 'Windows_NT' || os == 'Ubuntu')
1632 if (architecture == 'x64' || architecture == 'x86') {
1633 if (configuration == 'Checked') {
1634 addPeriodicTriggerHelper(job, '@daily')
1640 println("Unknown scenario: ${scenario}");
1647 // **************************
1648 // Define the basic inner loop builds for PR and commit. This is basically just the set
1649 // of coreclr builds over linux/osx 10.12/windows and debug/release/checked. In addition, the windows
1650 // builds will do a couple extra steps.
1651 // **************************
1653 // Adds a trigger for the PR build if one is needed. If isFlowJob is true, then this is the
1654 // flow job that rolls up the build and test for non-windows OS's. // If the job is a windows build only job,
1655 // it's just used for internal builds
1656 // If you add a job with a trigger phrase, please add that phrase to coreclr/Documentation/project-docs/ci-trigger-phrases.md
1657 def static addTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob) {
1658 def isNormalOrInnerloop = (scenario == "normal" || scenario == "innerloop")
1660 if (isWindowsBuildOnlyJob) {
1664 def bidailyCrossList = ['RHEL7.2', 'Debian8.4']
1665 // Non pull request builds.
1667 addNonPRTriggers(job, branch, isPR, architecture, os, configuration, scenario, isFlowJob, isWindowsBuildOnlyJob, bidailyCrossList)
1692 // Pull request builds. Generally these fall into two categories: default triggers and on-demand triggers
1693 // We generally only have a distinct set of default triggers but a bunch of on-demand ones.
1695 def contextString = ""
1696 def triggerString = ""
1697 def needsTrigger = true
1698 def isDefaultTrigger = false
1699 def isArm64PrivateJob = false
1700 def scenarioString = ""
1702 // Set up default context string and trigger phrases. This is overridden in places, sometimes just to keep
1703 // the existing non-standard descriptions and phrases. In some cases, the scenarios are asymmetric, as for
1704 // some jobs where the Debug configuration just does builds, no tests.
1706 // Some configurations, like arm32/arm64, always use the exact scenario name as part of the context string.
1707 // This makes it possible to copy/paste the displayed context string as "@dotnet-bot test <context-string>"
1708 // to invoke the trigger. Any "fancy" context string makes that impossible, requiring the user to either
1709 // remember the mapping from context string to trigger string, or use "@dotnet-bot help" to look it up.
1711 if (architecture == 'armem') {
1712 assert os == 'Tizen'
1713 architecture = 'armel'
1716 switch (architecture) {
1717 case 'x64_arm64_altjit':
1718 case 'x86_arm_altjit':
1719 // TODO: for consistency, add "Build and Test" at end.
1720 contextString = "${os} ${architecture} ${configuration} ${scenario}"
1721 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*"
1727 contextString = "${os} ${architecture} Cross ${configuration}"
1728 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
1730 if (scenario == 'innerloop') {
1731 contextString += " Innerloop"
1732 triggerString += "\\W+Innerloop"
1735 contextString += " ${scenario}"
1736 triggerString += "\\W+${scenario}"
1739 if (scenario == 'pmi_asm_diffs') {
1740 // Don't add the "Build and Test" part
1742 else if (configuration == 'Debug') {
1743 contextString += " Build"
1744 triggerString += "\\W+Build"
1747 contextString += " Build and Test"
1748 triggerString += "\\W+Build and Test"
1751 triggerString += ".*"
1755 scenarioString = getScenarioDisplayString(scenario)
1756 contextString = "${os} ${architecture} ${configuration} ${scenarioString}"
1757 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}"
1761 triggerString += "\\W+Build and Test.*"
1764 case 'corefx_innerloop': // maintain this asymmetry
1765 triggerString += "\\W+CoreFX Tests.*"
1769 triggerString += "\\W+${scenario}.*"
1773 triggerString += ".*"
1777 // Now determine what kind of trigger this job needs, if any. Any job should be triggerable, except for
1778 // non-flow jobs that are only used as part of flow jobs.
1780 switch (architecture) {
1781 case 'x64': // editor brace matching: {
1782 if (scenario == 'formatting') {
1783 assert configuration == 'Checked'
1784 if (os == 'Windows_NT' || os == 'Ubuntu') {
1785 isDefaultTrigger = true
1786 contextString = "${os} ${architecture} Formatting"
1791 if (scenario == 'pmi_asm_diffs') {
1792 // Everything is already set.
1793 // No default triggers.
1798 // OpenSUSE, Debian & RedHat get trigger phrases for pri 0 build, and pri 1 build & test
1801 if (scenario == 'innerloop') {
1803 contextString = "${os} ${architecture} ${configuration} Innerloop Build"
1804 isDefaultTrigger = true
1814 assert scenario != 'innerloop'
1815 contextString = "${os} ${architecture} ${configuration} Build"
1816 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+Build.*"
1820 if (scenario == 'illink') {
1823 else if (scenario == 'corefx_innerloop') {
1824 if (configuration == 'Checked') {
1825 isDefaultTrigger = true
1833 // Triggers on the non-flow jobs aren't necessary here
1834 // Corefx testing uses non-flow jobs.
1835 if (!isFlowJob && !isCoreFxScenario(scenario)) {
1836 needsTrigger = false
1841 isDefaultTrigger = true
1844 case 'no_tiered_compilation_innerloop':
1845 if (os == 'Ubuntu') {
1846 isDefaultTrigger = true
1858 // CentOS uses checked for default PR tests while debug is build only
1859 if (configuration == 'Debug') {
1860 isDefaultTrigger = true
1861 contextString = "${os} ${architecture} ${configuration} Innerloop Build"
1865 // Make sure this is a flow job to get build and test.
1867 needsTrigger = false
1871 if (configuration == 'Checked') {
1872 assert job.name.contains("flow")
1873 isDefaultTrigger = true
1874 contextString = "${os} ${architecture} ${configuration} Innerloop Build and Test"
1879 // Make sure this is a flow job to get build and test.
1881 needsTrigger = false
1894 case 'no_tiered_compilation_innerloop':
1895 isDefaultTrigger = true
1898 case 'corefx_innerloop':
1899 if (configuration == 'Checked' || configuration == 'Release') {
1900 isDefaultTrigger = true
1910 println("Unknown os: ${os}");
1917 // editor brace matching: }
1919 case 'armel': // editor brace matching: {
1922 azureVMAgentPostBuildAction {
1923 agentPostBuildAction('Delete agent if the build was not successful (when idle).')
1930 if (scenario == 'innerloop') {
1931 if (configuration == 'Checked') {
1932 isDefaultTrigger = true
1939 // editor brace matching: }
1942 case 'arm64': // editor brace matching: {
1948 // Triggers on the non-flow jobs aren't necessary
1950 needsTrigger = false
1956 case 'no_tiered_compilation_innerloop':
1957 if (configuration == 'Checked') {
1958 isDefaultTrigger = true
1961 case 'crossgen_comparison':
1962 if (os == 'Ubuntu' && architecture == 'arm' && (configuration == 'Checked' || configuration == 'Release')) {
1963 isDefaultTrigger = true
1970 assert isArmWindowsScenario(scenario)
1972 // For Debug normal/innerloop scenario, we don't do test runs, so we don't use flow jobs. That means we need a trigger for
1973 // the non-flow Build job. All others need a trigger on the flow job.
1974 def needsFlowJobTrigger = !(isNormalOrInnerloop && (configuration == 'Debug'))
1975 if (isFlowJob != needsFlowJobTrigger) {
1976 needsTrigger = false
1982 if (configuration == 'Debug') {
1983 // Add default PR trigger for Windows arm64 Debug builds. This is a build only -- no tests are run --
1984 // so the private test hardware is not used. Thus, it can be run by all users, not just arm64Users.
1985 // People in arm64Users will get both this and the Checked Build and Test job.
1986 isDefaultTrigger = true
1987 } else if (configuration == 'Checked') {
1988 isDefaultTrigger = true
1989 isArm64PrivateJob = true
1993 isArm64PrivateJob = true
1998 println("NYI os: ${os}");
2004 // editor brace matching: }
2005 case 'x86': // editor brace matching: {
2006 assert ((os == 'Windows_NT') || ((os == 'Ubuntu') && isNormalOrInnerloop))
2007 if (os == 'Ubuntu') {
2008 // Triggers on the non-flow jobs aren't necessary here
2010 needsTrigger = false
2014 // on-demand only for ubuntu x86
2015 contextString = "${os} ${architecture} ${configuration} Build"
2016 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}.*"
2021 case 'no_tiered_compilation_innerloop':
2022 isDefaultTrigger = true
2029 // editor brace matching: }
2030 case 'x64_arm64_altjit':
2031 case 'x86_arm_altjit':
2032 // Everything default
2036 println("Unknown architecture: ${architecture}");
2042 if (isArm64PrivateJob) {
2043 if (isDefaultTrigger) {
2044 Utilities.addDefaultPrivateGithubPRTriggerForBranch(job, branch, contextString, null, arm64Users)
2047 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
2051 if (isDefaultTrigger) {
2052 Utilities.addGithubPRTriggerForBranch(job, branch, contextString)
2055 Utilities.addGithubPRTriggerForBranch(job, branch, contextString, triggerString)
2061 def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR, def architecture, def configuration, def os, def isBuildOnly) {
2062 def buildCommands = []
2063 def osGroup = getOSGroup(os)
2064 def lowerConfiguration = configuration.toLowerCase()
2066 // Which set of tests to build? Innerloop tests build Pri-0.
2067 // Currently, we only generate asm diffs on Pri-0 tests, if we generate asm diffs on tests at all.
2068 // CoreFX testing skipts building tests altogether (done below).
2069 // All other scenarios build Pri-1 tests.
2071 if (isInnerloopTestScenario(scenario)) {
2075 def doCoreFxTesting = isCoreFxScenario(scenario)
2077 def buildCoreclrTests = true
2078 if (doCoreFxTesting || (scenario == 'pmi_asm_diffs')) {
2079 // These scenarios don't need the coreclr tests build.
2080 buildCoreclrTests = false
2083 // Calculate the build steps, archival, and xunit results
2085 case 'Windows_NT': // editor brace matching: {
2086 switch (architecture) {
2089 case 'x86_arm_altjit':
2090 case 'x64_arm64_altjit':
2091 def arch = architecture
2093 if (architecture == 'x86_arm_altjit') {
2096 else if (architecture == 'x64_arm64_altjit') {
2100 if (scenario == 'formatting') {
2101 buildCommands += "python -u tests\\scripts\\format.py -c %WORKSPACE% -o Windows_NT -a ${arch}"
2102 Utilities.addArchival(newJob, "format.patch", "", true, false)
2106 if (scenario == 'illink') {
2107 buildCommands += "tests\\scripts\\build_illink.cmd clone ${arch}"
2110 // If it is a release build for Windows, ensure PGO is used, else fail the build.
2111 if ((lowerConfiguration == 'release') &&
2112 (scenario in Constants.basicScenarios) &&
2113 (architecture != 'x86_arm_altjit') &&
2114 (architecture != 'x64_arm64_altjit')) {
2116 buildOpts += ' -enforcepgo'
2119 if (buildCoreclrTests) {
2120 buildOpts += " -priority=${priority}"
2122 buildOpts += ' skiptests';
2125 // Set __TestIntermediateDir to something short. If __TestIntermediateDir is already set, build-test.cmd will
2126 // output test binaries to that directory. If it is not set, the binaries are sent to a default directory whose name is about
2127 // 35 characters long.
2129 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${arch} ${buildOpts}"
2131 if (scenario == 'pmi_asm_diffs') {
2132 // Now, generate the layout. We don't have any tests, but we need to restore the packages before calling runtest.cmd.
2133 // Call build-test.cmd to do this. It will do a little more than we need, but that's ok.
2134 buildCommands += "build-test.cmd ${lowerConfiguration} ${arch} skipmanaged skipnative"
2135 buildCommands += "tests\\runtest.cmd ${lowerConfiguration} ${arch} GenerateLayoutOnly"
2137 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2138 buildCommands += "python -u %WORKSPACE%\\tests\\scripts\\run-pmi-diffs.py -arch ${arch} -ci_arch ${architecture} -build_type ${configuration}"
2141 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('_\\pmi\\asm', '.\\dasm.${os}.${architecture}.${configuration}.zip')\"";
2144 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.zip")
2149 def runtestArguments = ''
2150 def testOpts = 'collectdumps'
2152 if (isR2RScenario(scenario)) {
2154 // If this is a ReadyToRun scenario, pass 'crossgen' or 'crossgenaltjit'
2155 // to cause framework assemblies to be crossgen'ed. Pass 'runcrossgentests'
2156 // to cause the tests to be crossgen'ed.
2158 if ((architecture == 'x86_arm_altjit') || (architecture == 'x64_arm64_altjit')) {
2159 testOpts += ' crossgenaltjit protononjit.dll'
2161 testOpts += ' crossgen'
2164 testOpts += ' runcrossgentests'
2166 else if (scenario == 'jitdiff') {
2167 testOpts += ' jitdisasm crossgen'
2169 else if (scenario == 'ilrt') {
2170 testOpts += ' ilasmroundtrip'
2172 else if (isLongGc(scenario)) {
2173 testOpts += " ${scenario} sequential"
2175 else if (scenario == 'standalone_gc') {
2176 testOpts += ' gcname clrgc.dll'
2178 else if (scenario == 'illink') {
2179 testOpts += " link %WORKSPACE%\\linker\\linker\\bin\\netcore_Release\\netcoreapp2.0\\win10-${arch}\\publish\\illink.exe"
2182 // Default per-test timeout is 10 minutes. For stress modes and Debug scenarios, increase this
2183 // to 30 minutes (30 * 60 * 1000 = 180000). The "timeout" argument to runtest.cmd sets this, by
2184 // taking a timeout value in milliseconds. (Note that it sets the __TestTimeout environment variable,
2185 // which is read by the xunit harness.)
2186 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario) || (lowerConfiguration == 'debug'))
2188 def timeout = 1800000
2189 testOpts += " timeout ${timeout}"
2192 // If we are running a stress mode, we should write out the set of key
2193 // value env pairs to a file at this point and then we'll pass that to runtest.cmd
2195 def envScriptPath = ''
2196 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
2197 def buildCommandsStr = ''
2198 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
2199 buildCommandsStr += envScriptCreate(os, envScriptPath)
2201 if (isJitStressScenario(scenario)) {
2202 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
2204 else if (isR2RStressScenario(scenario)) {
2205 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.r2rStressScenarios[scenario], envScriptPath)
2208 if (architecture == 'x86_arm_altjit') {
2209 buildCommandsStr += envScriptAppendExistingScript(os, "%WORKSPACE%\\tests\\x86_arm_altjit.cmd", envScriptPath)
2210 testOpts += " altjitarch arm"
2212 else if (architecture == 'x64_arm64_altjit') {
2213 buildCommandsStr += envScriptAppendExistingScript(os, "%WORKSPACE%\\tests\\x64_arm64_altjit.cmd", envScriptPath)
2214 testOpts += " altjitarch arm64"
2217 envScriptFinalize(os, envScriptPath)
2219 // Note that buildCommands is an array of individually executed commands; we want all the commands used to
2220 // create the SetStressModes.bat script to be executed together, hence we accumulate them as strings
2221 // into a single script.
2222 buildCommands += buildCommandsStr
2224 else if (architecture == 'x86_arm_altjit') {
2225 envScriptPath = "%WORKSPACE%\\tests\\x86_arm_altjit.cmd"
2226 testOpts += " altjitarch arm"
2228 else if (architecture == 'x64_arm64_altjit') {
2229 envScriptPath = "%WORKSPACE%\\tests\\x64_arm64_altjit.cmd"
2230 testOpts += " altjitarch arm64"
2232 if (envScriptPath != '') {
2233 testOpts += " TestEnv ${envScriptPath}"
2236 runtestArguments = "${lowerConfiguration} ${arch} ${testOpts}"
2238 if (doCoreFxTesting) {
2239 if (scenario == 'corefx_innerloop') {
2240 // Create CORE_ROOT and testhost
2241 buildCommands += "build-test.cmd ${lowerConfiguration} ${arch} buildtesthostonly"
2242 buildCommands += "tests\\runtest.cmd ${runtestArguments} CoreFXTestsAll"
2244 // Archive and process (only) the test results
2245 Utilities.addArchival(newJob, "bin/Logs/**/testResults.xml")
2246 Utilities.addXUnitDotNETResults(newJob, "bin/Logs/**/testResults.xml")
2249 def workspaceRelativeFxRoot = "_/fx"
2250 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
2251 def fxBranch = getFxBranch(branch)
2253 buildCommands += "python -u %WORKSPACE%\\tests\\scripts\\run-corefx-tests.py -arch ${arch} -ci_arch ${architecture} -build_type ${configuration} -fx_root ${absoluteFxRoot} -fx_branch ${fxBranch} -env_script ${envScriptPath}"
2255 // Archive and process (only) the test results
2256 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2257 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2259 //Archive additional build stuff to diagnose why my attempt at fault injection isn't causing CI to fail
2260 Utilities.addArchival(newJob, "SetStressModes.bat", "", true, false)
2261 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/testhost/**", "", true, false)
2264 else if (isGcReliabilityFramework(scenario)) {
2265 buildCommands += "tests\\runtest.cmd ${runtestArguments} GenerateLayoutOnly"
2266 buildCommands += "tests\\scripts\\run-gc-reliability-framework.cmd ${arch} ${configuration}"
2269 buildCommands += "tests\\runtest.cmd ${runtestArguments}"
2271 } // end if (!isBuildOnly)
2273 if (!doCoreFxTesting) {
2274 // Run the rest of the build
2275 // Build the mscorlib for the other OS's
2276 buildCommands += "build.cmd ${lowerConfiguration} ${arch} linuxmscorlib"
2277 buildCommands += "build.cmd ${lowerConfiguration} ${arch} osxmscorlib"
2279 if (arch == 'x64') {
2280 buildCommands += "build.cmd ${lowerConfiguration} arm64 linuxmscorlib"
2283 // Zip up the tests directory so that we don't use so much space/time copying
2284 // 10s of thousands of files around.
2285 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('.\\bin\\tests\\${osGroup}.${arch}.${configuration}', '.\\bin\\tests\\tests.zip')\"";
2287 if (!isJitStressScenario(scenario)) {
2288 // For Windows, pull full test results and test drops for x86/x64.
2289 // No need to pull for stress mode scenarios (downstream builds use the default scenario)
2290 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2293 if (scenario == 'jitdiff') {
2294 // retrieve jit-dasm output for base commit, and run jit-diff
2296 // if this is a build only job, we want to keep the default (build) artifacts for the flow job
2297 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${arch}.${configuration}/dasm/**")
2302 Utilities.addXUnitDotNETResults(newJob, 'bin/**/TestRun*.xml', true)
2308 assert isArmWindowsScenario(scenario)
2312 if (buildCoreclrTests) {
2313 buildOpts += " -priority=${priority}"
2315 buildOpts += ' skiptests'
2318 // This is now a build only job. Do not run tests. Use the flow job.
2319 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} ${buildOpts}"
2321 if (doCoreFxTesting) {
2324 // Set the stress mode variables; this is incorporated into the generated CoreFx RunTests.cmd files.
2325 def envScriptPath = ''
2326 def buildCommandsStr = ''
2327 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
2328 buildCommandsStr += envScriptCreate(os, envScriptPath)
2329 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
2330 envScriptFinalize(os, envScriptPath)
2331 buildCommands += buildCommandsStr
2333 def workspaceRelativeFxRootLinux = "_/fx"
2334 def workspaceRelativeFxRootWin = "_\\fx"
2335 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
2336 def fxBranch = getFxBranch(branch)
2338 buildCommands += "python -u %WORKSPACE%\\tests\\scripts\\run-corefx-tests.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} -fx_root ${absoluteFxRoot} -fx_branch ${fxBranch} -env_script ${envScriptPath} -no_run_tests"
2340 // Zip up the CoreFx runtime and tests. We don't need the CoreCLR binaries; they have been copied to the CoreFX tree.
2341 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('${workspaceRelativeFxRootWin}\\artifacts\\bin\\testhost\\netcoreapp-Windows_NT-Release-${architecture}', '${workspaceRelativeFxRootWin}\\fxruntime.zip')\"";
2342 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('${workspaceRelativeFxRootWin}\\artifacts\\bin\\tests', '${workspaceRelativeFxRootWin}\\fxtests.zip')\"";
2344 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxruntime.zip")
2345 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxtests.zip")
2347 // Zip up the tests directory so that we don't use so much space/time copying
2348 // 10s of thousands of files around.
2349 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('.\\bin\\tests\\${osGroup}.${architecture}.${configuration}', '.\\bin\\tests\\tests.zip')\"";
2352 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2356 println("Unknown architecture: ${architecture}");
2361 // end case 'Windows_NT'; editor brace matching: }
2370 case 'Fedora24': // editor brace matching: {
2371 switch (architecture) {
2373 if (os == 'Ubuntu') {
2374 // build and PAL test
2375 def dockerImage = getDockerImageName(architecture, os, true)
2376 buildCommands += "docker run -i --rm -v \${WORKSPACE}:/opt/code -w /opt/code -e ROOTFS_DIR=/crossrootfs/x86 ${dockerImage} ./build.sh ${architecture} cross ${lowerConfiguration}"
2377 dockerImage = getDockerImageName(architecture, os, false)
2378 buildCommands += "docker run -i --rm -v \${WORKSPACE}:/opt/code -w /opt/code ${dockerImage} ./src/pal/tests/palsuite/runpaltests.sh /opt/code/bin/obj/${osGroup}.${architecture}.${configuration} /opt/code/bin/paltestout"
2379 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2380 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2385 if (scenario == 'formatting') {
2386 buildCommands += "python tests/scripts/format.py -c \${WORKSPACE} -o Linux -a ${architecture}"
2387 Utilities.addArchival(newJob, "format.patch", "", true, false)
2391 if (scenario == 'pmi_asm_diffs') {
2392 buildCommands += "./build.sh ${lowerConfiguration} ${architecture} skiptests skipbuildpackages"
2393 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} generatelayoutonly"
2395 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2396 buildCommands += "python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration}"
2399 buildCommands += "tar -czf dasm.${os}.${architecture}.${configuration}.tgz ./_/pmi/asm"
2400 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.tgz")
2404 if (scenario == 'illink') {
2405 assert(os == 'Ubuntu')
2406 buildCommands += "./tests/scripts/build_illink.sh --clone --arch=${architecture}"
2409 if (!doCoreFxTesting) {
2410 // We run pal tests on all OS but generate mscorlib (and thus, nuget packages)
2411 // only on supported OS platforms.
2412 def bootstrapRid = Utilities.getBoostrapPublishRid(os)
2413 def bootstrapRidEnv = bootstrapRid != null ? "__PUBLISH_RID=${bootstrapRid} " : ''
2415 buildCommands += "${bootstrapRidEnv}./build.sh ${lowerConfiguration} ${architecture}"
2417 def testBuildOpts = ""
2418 if (priority == '1') {
2419 testBuildOpts = "priority1"
2422 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} ${testBuildOpts}"
2423 buildCommands += "src/pal/tests/palsuite/runpaltests.sh \${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration} \${WORKSPACE}/bin/paltestout"
2425 // Archive the bin/tests folder for *_tst jobs
2426 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
2427 buildCommands += "tar -czf ${testArtifactsTgzFileName} bin/tests/${osGroup}.${architecture}.${configuration}"
2428 Utilities.addArchival(newJob, "${testArtifactsTgzFileName}", "")
2430 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2433 if (scenario == 'corefx_innerloop') {
2434 assert os == 'Ubuntu' || 'OSX10.12'
2435 assert architecture == 'x64'
2437 buildCommands += "./build.sh ${lowerConfiguration} ${architecture} skiptests"
2438 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} generatetesthostonly"
2439 buildCommands += "./tests/runtest.sh ${lowerConfiguration} --corefxtestsall --testHostDir=\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/testhost/ --coreclr-src=\${WORKSPACE}"
2442 // Archive and process (only) the test results
2443 Utilities.addArchival(newJob, "bin/Logs/**/testResults.xml")
2444 Utilities.addXUnitDotNETResults(newJob, "bin/Logs/**/testResults.xml")
2447 // Corefx stress testing
2448 assert os == 'Ubuntu'
2449 assert architecture == 'x64'
2450 assert lowerConfiguration == 'checked'
2451 assert isJitStressScenario(scenario)
2454 buildCommands += "./build.sh ${lowerConfiguration} ${architecture}"
2456 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2458 def envScriptCmds = envScriptCreate(os, scriptFileName)
2459 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2460 envScriptCmds += envScriptFinalize(os, scriptFileName)
2461 buildCommands += envScriptCmds
2463 // Build and text corefx
2464 def workspaceRelativeFxRoot = "_/fx"
2465 def absoluteFxRoot = "\$WORKSPACE/${workspaceRelativeFxRoot}"
2466 def fxBranch = getFxBranch(branch)
2468 buildCommands += "python -u \$WORKSPACE/tests/scripts/run-corefx-tests.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} -fx_root ${absoluteFxRoot} -fx_branch ${fxBranch} -env_script ${scriptFileName}"
2470 // Archive and process (only) the test results
2471 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2472 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2477 // Emulator cross builds for ARM runs on Tizen currently
2478 assert os == 'Tizen'
2480 def arm_abi = "armel"
2481 def linuxCodeName = "tizen"
2483 // Unzip the Windows test binaries first. Exit with 0
2484 buildCommands += "unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/Windows_NT.x64.${configuration} || exit 0"
2486 // Unpack the corefx binaries
2487 buildCommands += "mkdir ./bin/CoreFxBinDir"
2488 buildCommands += "tar -xf ./artifacts/bin/build.tar.gz -C ./bin/CoreFxBinDir"
2490 // Call the ARM CI script to cross build and test using docker
2491 buildCommands += """./tests/scripts/arm32_ci_script.sh \\
2494 --linuxCodeName=${linuxCodeName} \\
2495 --buildConfig=${lowerConfiguration} \\
2496 --testRootDir=./bin/tests/Windows_NT.x64.${configuration} \\
2497 --coreFxBinDir=./bin/CoreFxBinDir \\
2498 --testDirFile=./tests/testsRunningInsideARM.txt"""
2500 // Basic archiving of the build, no pal tests
2501 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2505 // Non-Windows ARM cross builds on hardware run on Ubuntu only
2506 assert (os == 'Ubuntu') || (os == 'Ubuntu16.04')
2508 // Add some useful information to the log file. Ignore return codes.
2509 buildCommands += "uname -a || true"
2511 def additionalOpts = ""
2512 if (architecture == 'arm') {
2513 additionalOpts = "-e CAC_ROOTFS_DIR=/crossrootfs/x86"
2516 // Cross build the Ubuntu/arm product using docker with a docker image that contains the correct
2517 // Ubuntu cross-compilation toolset (running on a Ubuntu x64 host).
2518 // For CoreFX testing, we only need the product build; we don't need to generate the layouts. The product
2519 // build is then copied into the corefx layout by the run-corefx-test.py script. For CoreFX testing, we
2520 // ZIP up the generated CoreFX runtime and tests.
2522 def dockerImage = getDockerImageName(architecture, os, true)
2523 def dockerCmd = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} -e ROOTFS_DIR=/crossrootfs/${architecture} ${additionalOpts} ${dockerImage} "
2525 buildCommands += "${dockerCmd}\${WORKSPACE}/build.sh ${lowerConfiguration} ${architecture} cross"
2527 if (doCoreFxTesting) {
2528 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2530 def envScriptCmds = envScriptCreate(os, scriptFileName)
2531 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2532 envScriptCmds += envScriptFinalize(os, scriptFileName)
2533 buildCommands += envScriptCmds
2535 // Build and text corefx
2536 def workspaceRelativeFxRootLinux = "_/fx"
2537 def absoluteFxRoot = "\$WORKSPACE/${workspaceRelativeFxRootLinux}"
2538 def fxBranch = getFxBranch(branch)
2540 buildCommands += "${dockerCmd}python -u \$WORKSPACE/tests/scripts/run-corefx-tests.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} -fx_root ${absoluteFxRoot} -fx_branch ${fxBranch} -env_script ${scriptFileName} -no_run_tests"
2542 // Docker creates files with root permission, so we need to zip in docker also, or else we'll get permission errors.
2543 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeFxRootLinux}/fxruntime.zip ${workspaceRelativeFxRootLinux}/artifacts/bin/testhost/netcoreapp-Linux-Release-${architecture}"
2544 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeFxRootLinux}/fxtests.zip ${workspaceRelativeFxRootLinux}/artifacts/bin/tests"
2546 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxruntime.zip")
2547 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxtests.zip")
2549 else if (isCrossGenComparisonScenario(scenario)) {
2550 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross generatelayoutonly"
2552 def workspaceRelativeProductBinDir = "bin/Product/${osGroup}.${architecture}.${configuration}"
2553 def workspaceRelativeCoreLib = "${workspaceRelativeProductBinDir}/IL/System.Private.CoreLib.dll"
2554 def workspaceRelativeCoreRootDir = "bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root"
2555 def workspaceRelativeCrossGenComparisonScript = "tests/scripts/crossgen_comparison.py"
2556 def workspaceRelativeResultsDir = "_"
2557 def workspaceRelativeArtifactsArchive = "${os}.${architecture}.${configuration}.${scenario}.zip"
2558 def crossGenComparisonCmd = "python -u \${WORKSPACE}/${workspaceRelativeCrossGenComparisonScript} "
2559 def crossArch = "x64"
2560 def crossGenExecutable = "\${WORKSPACE}/${workspaceRelativeProductBinDir}/${crossArch}/crossgen"
2561 def workspaceRelativeCrossArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${crossArch}_${architecture}.${configuration}"
2563 buildCommands += "${dockerCmd}mkdir -p \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2564 buildCommands += "${dockerCmd}${crossGenComparisonCmd}crossgen_corelib --crossgen ${crossGenExecutable} --il_corelib \${WORKSPACE}/${workspaceRelativeCoreLib} --result_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2565 buildCommands += "${dockerCmd}${crossGenComparisonCmd}crossgen_framework --crossgen ${crossGenExecutable} --core_root \${WORKSPACE}/${workspaceRelativeCoreRootDir} --result_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2567 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeArtifactsArchive} ${workspaceRelativeCoreLib} ${workspaceRelativeCoreRootDir} ${workspaceRelativeCrossGenComparisonScript} ${workspaceRelativeResultsDir}"
2568 Utilities.addArchival(newJob, "${workspaceRelativeArtifactsArchive}")
2570 else if (scenario == 'pmi_asm_diffs') {
2571 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross generatelayoutonly"
2573 // Pass `--skip_diffs` -- the actual diffs will be done on an arm machine in the test job. This is the build job.
2574 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2575 buildCommands += "python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} --skip_diffs"
2577 // ZIP what we created.
2578 buildCommands += "zip -r product.${os}.${architecture}.${lowerConfiguration}.zip ./bin/Product/Linux.${architecture}.${configuration}"
2579 buildCommands += "zip -r product.baseline.${os}.${architecture}.${lowerConfiguration}.zip ./_/pmi/base/bin/Product/Linux.${architecture}.${configuration}"
2580 buildCommands += "zip -r coreroot.${os}.${architecture}.${lowerConfiguration}.zip ./bin/tests/Linux.${architecture}.${configuration}/Tests/Core_Root"
2581 buildCommands += "zip -r coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.zip ./_/pmi/base/bin/tests/Linux.${architecture}.${configuration}/Tests/Core_Root"
2583 // Archive the built artifacts
2584 Utilities.addArchival(newJob, "product.${os}.${architecture}.${lowerConfiguration}.zip,product.baseline.${os}.${architecture}.${lowerConfiguration}.zip,coreroot.${os}.${architecture}.${lowerConfiguration}.zip,coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.zip")
2587 // Then, using the same docker image, build the tests and generate the CORE_ROOT layout.
2589 def testBuildOpts = ""
2590 if (priority == '1') {
2591 testBuildOpts = "priority1"
2594 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross ${testBuildOpts}"
2596 // ZIP up the built tests (including CORE_ROOT and native test components copied to the CORE_ROOT) for the test job (created in the flow job code)
2597 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
2598 buildCommands += "tar -czf ${testArtifactsTgzFileName} bin/tests/${osGroup}.${architecture}.${configuration}"
2600 Utilities.addArchival(newJob, "${testArtifactsTgzFileName}", "")
2603 // Archive the build logs from both product and test builds.
2604 Utilities.addArchival(newJob, "bin/Logs/*.log,bin/Logs/*.wrn,bin/Logs/*.err", "")
2606 // We need to clean up the build machines; the docker build leaves newly built files with root permission, which
2607 // the cleanup task in Jenkins can't remove.
2610 azureVMAgentPostBuildAction {
2611 agentPostBuildAction('Delete agent after build execution (when idle).')
2617 println("Unknown architecture: ${architecture}");
2622 // editor brace matching: }
2624 println("Unknown os: ${os}");
2629 return buildCommands
2632 // Determine if we should generate a job for the given parameters. This is for non-flow jobs: either build and test, or build only.
2633 // Returns true if the job should be generated.
2634 def static shouldGenerateJob(def scenario, def isPR, def architecture, def configuration, def os, def isBuildOnly)
2636 // The various "innerloop" jobs are only available as PR triggered.
2639 if (isInnerloopTestScenario(scenario)) {
2643 if (scenario == 'corefx_innerloop') {
2648 // Tizen is only supported for armem architecture
2649 if (os == 'Tizen' && architecture != 'armem') {
2653 // Filter based on architecture.
2655 switch (architecture) {
2657 if ((os != 'Windows_NT') && (os != 'Ubuntu')) {
2662 if ((os != 'Windows_NT') && (os != 'Ubuntu16.04')) {
2667 if (os != 'Tizen') {
2671 case 'x86_arm_altjit':
2672 case 'x64_arm64_altjit':
2673 if (os != 'Windows_NT') {
2678 if ((os != 'Windows_NT') && (os != 'Ubuntu')) {
2683 // Everything implemented
2686 println("Unknown architecture: ${architecture}")
2691 // Which (Windows) build only jobs are required?
2693 def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
2696 switch (architecture) {
2699 // We use build only jobs for Windows arm/arm64 cross-compilation corefx testing, so we need to generate builds for that.
2700 if (!isCoreFxScenario(scenario)) {
2706 if (!isNormalOrInnerloop) {
2715 // Filter based on scenario.
2717 if (isJitStressScenario(scenario)) {
2718 if (configuration != 'Checked') {
2722 def isEnabledOS = (os == 'Windows_NT') ||
2723 (os == 'Ubuntu' && (architecture == 'x64') && isCoreFxScenario(scenario)) ||
2724 (os == 'Ubuntu' && architecture == 'arm') ||
2725 (os == 'Ubuntu16.04' && architecture == 'arm64')
2730 switch (architecture) {
2732 case 'x86_arm_altjit':
2733 case 'x64_arm64_altjit':
2737 // x86 ubuntu: no stress modes
2738 if (os == 'Ubuntu') {
2745 // We use build only jobs for Windows arm/arm64 cross-compilation corefx testing, so we need to generate builds for that.
2746 // No "regular" Windows arm corefx jobs, e.g.
2747 // For Ubuntu arm corefx testing, we use regular jobs (not "build only" since only Windows has "build only", and
2748 // the Ubuntu arm "regular" jobs don't run tests anyway).
2749 if (os == 'Windows_NT') {
2750 if (! (isBuildOnly && isCoreFxScenario(scenario)) ) {
2755 if (!isCoreFxScenario(scenario)) {
2762 // armem: no stress jobs for ARM emulator.
2766 else if (isR2RScenario(scenario)) {
2767 if (os != 'Windows_NT') {
2771 if (isR2RBaselineScenario(scenario)) {
2772 // no need for Debug scenario; Checked is sufficient
2773 if (configuration != 'Checked' && configuration != 'Release') {
2777 else if (isR2RStressScenario(scenario)) {
2778 // Stress scenarios only run with Checked builds, not Release (they would work with Debug, but be slow).
2779 if (configuration != 'Checked') {
2784 switch (architecture) {
2787 // Windows arm/arm64 ready-to-run jobs use flow jobs and test jobs, but depend on "normal" (not R2R specific) build jobs.
2794 else if (isCrossGenComparisonScenario(scenario)) {
2795 return shouldGenerateCrossGenComparisonJob(os, architecture, configuration, scenario)
2801 // The ilrt build isn't necessary except for Windows_NT2003. Non-Windows NT uses
2802 // the default scenario build
2803 if (os != 'Windows_NT') {
2807 if (architecture != 'x64') {
2811 if (configuration != 'Release') {
2816 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2819 if (architecture != 'x64') {
2822 if (configuration != 'Checked') {
2828 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2831 if (architecture != 'x64') {
2834 if (configuration != 'Release') {
2838 case 'gc_reliability_framework':
2839 case 'standalone_gc':
2840 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2844 if (architecture != 'x64') {
2848 if (configuration != 'Release' && configuration != 'Checked') {
2852 // We only run Windows and Ubuntu x64 Checked for formatting right now
2854 if (os != 'Windows_NT' && os != 'Ubuntu') {
2857 if (architecture != 'x64') {
2860 if (configuration != 'Checked') {
2865 if (os != 'Windows_NT' && (os != 'Ubuntu' || architecture != 'x64')) {
2868 if (architecture != 'x64' && architecture != 'x86') {
2876 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly)) {
2880 case 'corefx_innerloop':
2881 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2884 if (architecture != 'x64') {
2888 case 'pmi_asm_diffs':
2889 if (configuration != 'Checked') {
2892 if (architecture == 'armem') {
2895 // Currently, we don't support pmi_asm_diffs for Windows arm/arm64. We don't have a dotnet CLI available to
2896 // build jitutils. The jobs are not in validArmWindowsScenarios.
2897 if ((os == 'Windows_NT') && (architecture == 'arm' || architecture == 'arm64')) {
2900 // Currently, no support for Linux x86.
2901 if ((os != 'Windows_NT') && (architecture == 'x86')) {
2906 println("Unknown scenario: ${scenario}")
2912 // For altjit, don't do any scenarios that don't change compilation. That is, scenarios that only change
2913 // runtime behavior, not compile-time behavior, are not interesting.
2914 switch (architecture) {
2915 case 'x86_arm_altjit':
2916 case 'x64_arm64_altjit':
2917 if (isGCStressRelatedTesting(scenario)) {
2925 // The job was not filtered out, so we should generate it!
2929 Constants.allScenarios.each { scenario ->
2930 [true, false].each { isPR ->
2931 Constants.architectureList.each { architecture ->
2932 Constants.configurationList.each { configuration ->
2933 Constants.osList.each { os ->
2934 // If the OS is Windows_NT_BuildOnly, set the isBuildOnly flag to true
2935 // and reset the os to Windows_NT
2936 def isBuildOnly = false
2937 if (os == 'Windows_NT_BuildOnly') {
2942 if (!shouldGenerateJob(scenario, isPR, architecture, configuration, os, isBuildOnly)) {
2947 def jobName = getJobName(configuration, architecture, os, scenario, isBuildOnly)
2948 def folderName = getJobFolder(scenario)
2950 // Create the new job
2951 def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folderName)) {}
2953 addToViews(newJob, false, isPR, architecture, os, configuration, scenario) // isFlowJob == false
2955 setJobMachineAffinity(architecture, os, true, false, false, newJob) // isBuildJob = true, isTestJob = false, isFlowJob = false
2957 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
2958 addTriggers(newJob, branch, isPR, architecture, os, configuration, scenario, false, isBuildOnly) // isFlowJob==false
2959 setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly)
2961 // Copy Windows build test binaries and corefx build artifacts for Linux cross build for armem.
2962 // We don't use a flow job for this, but we do depend on there being existing builds with these
2963 // artifacts produced.
2964 if ((architecture == 'armem') && (os == 'Tizen')) {
2965 // Define the Windows Tests and Corefx build job names
2966 def lowerConfiguration = configuration.toLowerCase()
2967 def WindowsTestsName = projectFolder + '/' +
2968 Utilities.getFullJobName(project,
2969 getJobName(lowerConfiguration, 'x64' , 'windows_nt', 'normal', true),
2971 def fxBranch = getFxBranch(branch)
2972 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' +
2973 Utilities.getFolderName(fxBranch)
2975 def arm_abi = 'armel'
2976 def corefx_os = 'tizen'
2978 // Let's use release CoreFX to test checked CoreCLR,
2979 // because we do not generate checked CoreFX in CoreFX CI yet.
2980 def corefx_lowerConfiguration = lowerConfiguration
2981 if (lowerConfiguration == 'checked') {
2982 corefx_lowerConfiguration = 'release'
2985 // Copy the Windows test binaries and the Corefx build binaries
2988 copyArtifacts(WindowsTestsName) {
2989 includePatterns('bin/tests/tests.zip')
2991 latestSuccessful(true)
2994 copyArtifacts("${corefxFolder}/${corefx_os}_${arm_abi}_cross_${corefx_lowerConfiguration}") {
2995 includePatterns('artifacts/bin/build.tar.gz')
2997 latestSuccessful(true)
3004 def buildCommands = calculateBuildCommands(newJob, scenario, branch, isPR, architecture, configuration, os, isBuildOnly)
3008 if (os == 'Windows_NT') {
3009 buildCommands.each { buildCommand ->
3010 batchFile(buildCommand)
3014 buildCommands.each { buildCommand ->
3027 // Create a Windows ARM/ARM64 test job that will be used by a flow job.
3028 // Returns the newly created job.
3029 def static CreateWindowsArmTestJob(def dslFactory, def project, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3031 def osGroup = getOSGroup(os)
3032 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
3034 def jobFolder = getJobFolder(scenario)
3035 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
3037 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
3041 // Set up the copies
3043 // Coreclr build we are trying to test
3045 // ** NOTE ** This will, correctly, overwrite the CORE_ROOT from the Windows test archive
3047 copyArtifacts(inputCoreCLRBuildName) {
3048 excludePatterns('**/testResults.xml', '**/*.ni.dll')
3050 buildNumber('${CORECLR_BUILD}')
3054 if (isCoreFxScenario(scenario)) {
3056 // Only arm/arm64 supported for corefx testing now.
3057 assert architecture == 'arm' || architecture == 'arm64'
3059 // Unzip CoreFx runtime
3060 batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('_\\fx\\fxruntime.zip', '_\\fx\\artifacts\\bin\\testhost\\netcoreapp-Windows_NT-Release-${architecture}')\"")
3062 // Unzip CoreFx tests.
3063 batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('_\\fx\\fxtests.zip', '_\\fx\\artifacts\\bin\\tests')\"")
3065 // Add the script to run the corefx tests
3066 def corefx_runtime_path = "%WORKSPACE%\\_\\fx\\artifacts\\bin\\testhost\\netcoreapp-Windows_NT-Release-${architecture}"
3067 def corefx_tests_dir = "%WORKSPACE%\\_\\fx\\artifacts\\bin\\tests"
3068 def corefx_exclusion_file = "%WORKSPACE%\\tests\\${architecture}\\corefx_test_exclusions.txt"
3069 batchFile("call %WORKSPACE%\\tests\\scripts\\run-corefx-tests.bat ${corefx_runtime_path} ${corefx_tests_dir} ${corefx_exclusion_file} ${architecture}")
3071 } else { // !isCoreFxScenario(scenario)
3074 batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('bin\\tests\\tests.zip', 'bin\\tests\\${osGroup}.${architecture}.${configuration}')\"")
3076 def buildCommands = ""
3078 def coreRootLocation = "%WORKSPACE%\\bin\\tests\\Windows_NT.${architecture}.${configuration}\\Tests\\Core_Root"
3079 def addEnvVariable = { variable, value -> buildCommands += "set ${variable}=${value}\r\n"}
3080 def addCommand = { cmd -> buildCommands += "${cmd}\r\n"}
3082 // Make sure Command Extensions are enabled. Used so %ERRORLEVEL% is available.
3083 addCommand("SETLOCAL ENABLEEXTENSIONS")
3086 addEnvVariable("CORE_ROOT", coreRootLocation)
3087 addEnvVariable("COMPlus_NoGuiOnAssert", "1")
3088 addEnvVariable("COMPlus_ContinueOnAssert", "0")
3090 // If we are running a stress mode, we'll set those variables as well
3091 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
3092 def stressValues = null
3093 if (isJitStressScenario(scenario)) {
3094 stressValues = Constants.jitStressModeScenarios[scenario]
3097 stressValues = Constants.r2rStressScenarios[scenario]
3100 stressValues.each { key, value ->
3101 addEnvVariable(key, value)
3105 if (isR2RScenario(scenario)) {
3106 // Crossgen the framework assemblies.
3107 buildCommands += """
3108 @for %%F in (%CORE_ROOT%\\*.dll) do @call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nxF
3109 @goto skip_PrecompileAssembly
3112 @REM Skip mscorlib since it is already precompiled.
3113 @if /I "%3" == "mscorlib.dll" exit /b 0
3114 @if /I "%3" == "mscorlib.ni.dll" exit /b 0
3116 "%CORE_ROOT%\\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" %2 >nul 2>nul
3117 @if "%errorlevel%" == "-2146230517" (
3118 echo %2 is not a managed assembly.
3119 ) else if "%errorlevel%" == "-2146234344" (
3120 echo %2 is not a managed assembly.
3121 ) else if %errorlevel% neq 0 (
3122 echo Unable to precompile %2
3128 :skip_PrecompileAssembly
3131 // Set RunCrossGen variable to cause test wrappers to invoke their logic to run
3132 // crossgen on tests before running them.
3133 addEnvVariable("RunCrossGen", "true")
3134 } // isR2RScenario(scenario)
3137 // Do not run generate layout. It will delete the correct CORE_ROOT, and we do not have a correct product
3138 // dir to copy from.
3139 def runtestCommand = "%WORKSPACE%\\tests\\runtest.cmd ${architecture} ${configuration} skipgeneratelayout"
3141 addCommand("${runtestCommand}")
3143 // Use the smarty errorlevel as the script errorlevel.
3144 addCommand("exit /b %errorlevel%")
3146 batchFile(buildCommands)
3147 } // non-corefx testing
3151 if (!isCoreFxScenario(scenario)) {
3152 Utilities.addXUnitDotNETResults(newJob, 'bin/**/TestRun*.xml', true)
3158 // Create a test job not covered by the "Windows ARM" case that will be used by a flow job.
3159 // E.g., non-Windows tests.
3160 // Returns the newly created job.
3161 def static CreateOtherTestJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3163 def lowerConfiguration = configuration.toLowerCase()
3165 def isUbuntuArm64Job = ((os == "Ubuntu16.04") && (architecture == 'arm64'))
3166 def isUbuntuArm32Job = ((os == "Ubuntu") && (architecture == 'arm'))
3167 def isUbuntuArmJob = isUbuntuArm32Job || isUbuntuArm64Job
3169 def doCoreFxTesting = isCoreFxScenario(scenario)
3170 def isPmiAsmDiffsScenario = (scenario == 'pmi_asm_diffs')
3172 def workspaceRelativeFxRootLinux = "_/fx" // only used for CoreFX testing
3174 def osGroup = getOSGroup(os)
3175 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
3178 def useServerGC = false
3180 // Enable Server GC for Ubuntu PR builds
3181 // REVIEW: why? Does this apply to all architectures? Why only PR?
3182 if (os == 'Ubuntu' && isPR) {
3183 testOpts += ' --useServerGC'
3187 if (isR2RScenario(scenario)) {
3189 testOpts += ' --crossgen --runcrossgentests'
3191 if (scenario == 'r2r_jitstress1') {
3192 testOpts += ' --jitstress=1'
3194 else if (scenario == 'r2r_jitstress2') {
3195 testOpts += ' --jitstress=2'
3197 else if (scenario == 'r2r_jitstress1_tiered') {
3198 testOpts += ' --jitstress=1'
3200 else if (scenario == 'r2r_jitstress2_tiered') {
3201 testOpts += ' --jitstress=2'
3203 else if (scenario == 'r2r_jitstressregs1') {
3204 testOpts += ' --jitstressregs=1'
3206 else if (scenario == 'r2r_jitstressregs2') {
3207 testOpts += ' --jitstressregs=2'
3209 else if (scenario == 'r2r_jitstressregs3') {
3210 testOpts += ' --jitstressregs=3'
3212 else if (scenario == 'r2r_jitstressregs4') {
3213 testOpts += ' --jitstressregs=4'
3215 else if (scenario == 'r2r_jitstressregs8') {
3216 testOpts += ' --jitstressregs=8'
3218 else if (scenario == 'r2r_jitstressregs0x10') {
3219 testOpts += ' --jitstressregs=0x10'
3221 else if (scenario == 'r2r_jitstressregs0x80') {
3222 testOpts += ' --jitstressregs=0x80'
3224 else if (scenario == 'r2r_jitstressregs0x1000') {
3225 testOpts += ' --jitstressregs=0x1000'
3227 else if (scenario == 'r2r_jitminopts') {
3228 testOpts += ' --jitminopts'
3230 else if (scenario == 'r2r_jitforcerelocs') {
3231 testOpts += ' --jitforcerelocs'
3233 else if (scenario == 'r2r_gcstress15') {
3234 testOpts += ' --gcstresslevel=0xF'
3237 else if (scenario == 'jitdiff') {
3238 testOpts += ' --jitdisasm --crossgen'
3240 else if (scenario == 'illink') {
3241 testOpts += ' --link=\$WORKSPACE/linker/linker/bin/netcore_Release/netcoreapp2.0/ubuntu-x64/publish/illink'
3243 else if (isLongGc(scenario)) {
3244 // Long GC tests behave very poorly when they are not
3245 // the only test running (many of them allocate until OOM).
3246 testOpts += ' --sequential'
3248 // A note - runtest.sh does have "--long-gc" and "--gcsimulator" options
3249 // for running long GC and GCSimulator tests, respectively. We don't use them
3250 // here because using a playlist file produces much more readable output on the CI machines
3251 // and reduces running time.
3253 // The Long GC playlist contains all of the tests that are
3254 // going to be run. The GCSimulator playlist contains all of
3255 // the GC simulator tests.
3256 if (scenario == 'longgc') {
3257 testOpts += ' --long-gc --playlist=./tests/longRunningGcTests.txt'
3259 else if (scenario == 'gcsimulator') {
3260 testOpts += ' --gcsimulator --playlist=./tests/gcSimulatorTests.txt'
3263 else if (isGcReliabilityFramework(scenario)) {
3264 testOpts += ' --build-overlay-only'
3266 else if (scenario == 'standalone_gc') {
3267 if (osGroup == 'OSX') {
3268 testOpts += ' --gcname=libclrgc.dylib'
3270 else if (osGroup == 'Linux') {
3271 testOpts += ' --gcname=libclrgc.so'
3274 println("Unexpected OS group: ${osGroup} for os ${os}")
3279 def jobFolder = getJobFolder(scenario)
3280 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
3282 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
3286 // Set up the copies
3288 // Coreclr build we are trying to test
3290 // HACK: the Ubuntu arm64 copyArtifacts Jenkins plug-in is ridiculously slow (45 minutes to
3291 // 1.5 hours for this step). Instead, directly use wget, which is fast (1 minute).
3293 if (!isUbuntuArm64Job) {
3294 copyArtifacts(inputCoreCLRBuildName) {
3295 excludePatterns('**/testResults.xml', '**/*.ni.dll')
3297 buildNumber('${CORECLR_BUILD}')
3302 if (isUbuntuArmJob) {
3303 // Add some useful information to the log file. Ignore return codes.
3304 shell("uname -a || true")
3307 if (isUbuntuArm64Job) {
3308 // Copy the required artifacts directly, using wget, e.g.:
3310 // https://ci.dot.net/job/dotnet_coreclr/job/master/job/arm64_cross_checked_ubuntu16.04_innerloop_prtest/16/artifact/testnativebin.checked.zip
3311 // https://ci.dot.net/job/dotnet_coreclr/job/master/job/arm64_cross_checked_ubuntu16.04_innerloop_prtest/16/artifact/tests.checked.zip
3313 // parameterized as:
3315 // https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/job/${inputJobName}/${CORECLR_BUILD}/artifact/testnativebin.checked.zip
3316 // https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/job/${inputJobName}/${CORECLR_BUILD}/artifact/tests.checked.zip
3318 // CoreFX example artifact URLs:
3320 // https://ci.dot.net/job/dotnet_coreclr/job/dev_unix_test_workflow/job/jitstress/job/arm64_cross_checked_ubuntu16.04_corefx_baseline_prtest/1/artifact/_/fx/fxruntime.zip
3321 // https://ci.dot.net/job/dotnet_coreclr/job/dev_unix_test_workflow/job/jitstress/job/arm64_cross_checked_ubuntu16.04_corefx_baseline_prtest/1/artifact/_/fx/fxtests.zip
3323 // Note that the source might be in a "jitstress" folder.
3325 // Use `--progress=dot:giga` to display some progress output, but limit it in the log file.
3327 // Use `--directory-prefix=_/fx` to specify where to put the corefx files (to match what other platforms do). Use this instead of `-O`.
3329 shell("echo \"Using wget instead of the Jenkins copy artifacts plug-in to copy artifacts from ${inputCoreCLRBuildName}\"")
3331 def mungedProjectName = Utilities.getFolderName(project)
3332 def mungedBranchName = Utilities.getFolderName(branch)
3334 def doCrossGenComparison = isCrossGenComparisonScenario(scenario)
3335 def inputCoreCLRBuildScenario = isInnerloopTestScenario(scenario) ? 'innerloop' : 'normal'
3336 if (isPmiAsmDiffsScenario || doCoreFxTesting || doCrossGenComparison) {
3337 // These depend on unique builds for each scenario
3338 inputCoreCLRBuildScenario = scenario
3340 def sourceJobName = getJobName(configuration, architecture, os, inputCoreCLRBuildScenario, false)
3341 def inputJobName = Utilities.getFullJobName(sourceJobName, isPR)
3343 // Need to add the sub-folder if necessary.
3344 def inputJobPath = "job/${inputJobName}"
3345 def folderName = getJobFolder(inputCoreCLRBuildScenario)
3346 if (folderName != '') {
3347 inputJobPath = "job/${folderName}/job/${inputJobName}"
3350 def inputUrlRoot = "https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/${inputJobPath}/\${CORECLR_BUILD}/artifact"
3352 if (isPmiAsmDiffsScenario) {
3353 def workspaceRelativeRootLinux = "_/pmi"
3354 shell("mkdir -p ${workspaceRelativeRootLinux}")
3355 shell("wget --progress=dot:giga ${inputUrlRoot}/product.${os}.${architecture}.${lowerConfiguration}.zip")
3356 shell("wget --progress=dot:giga ${inputUrlRoot}/product.baseline.${os}.${architecture}.${lowerConfiguration}.zip")
3357 shell("wget --progress=dot:giga ${inputUrlRoot}/coreroot.${os}.${architecture}.${lowerConfiguration}.zip")
3358 shell("wget --progress=dot:giga ${inputUrlRoot}/coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.zip")
3360 else if (doCoreFxTesting) {
3361 shell("mkdir -p ${workspaceRelativeFxRootLinux}")
3362 shell("wget --progress=dot:giga --directory-prefix=${workspaceRelativeFxRootLinux} ${inputUrlRoot}/${workspaceRelativeFxRootLinux}/fxtests.zip")
3363 shell("wget --progress=dot:giga --directory-prefix=${workspaceRelativeFxRootLinux} ${inputUrlRoot}/${workspaceRelativeFxRootLinux}/fxruntime.zip")
3366 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
3367 shell("wget --progress=dot:giga ${inputUrlRoot}/${testArtifactsTgzFileName}")
3371 if (architecture == 'x86') {
3372 shell("mkdir ./bin/CoreFxNative")
3374 def fxBranch = getFxBranch(branch)
3375 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' + Utilities.getFolderName(fxBranch)
3377 copyArtifacts("${corefxFolder}/ubuntu16.04_x86_release") {
3378 includePatterns('artifacts/bin/build.tar.gz')
3379 targetDirectory('bin/CoreFxNative')
3381 latestSuccessful(true)
3385 shell("mkdir ./bin/CoreFxBinDir")
3386 shell("tar -xf ./bin/CoreFxNative/artifacts/bin/build.tar.gz -C ./bin/CoreFxBinDir")
3389 if (isPmiAsmDiffsScenario) {
3390 // TODO: add back "-q" when we know it works
3391 shell("unzip -o ./product.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3392 shell("unzip -o ./product.baseline.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3393 shell("unzip -o ./coreroot.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3394 shell("unzip -o ./coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3396 // CoreFX testing downloads the CoreFX tests, not the coreclr tests. Also, unzip the built CoreFX layout/runtime directories.
3397 else if (doCoreFxTesting) {
3398 shell("unzip -q -o ${workspaceRelativeFxRootLinux}/fxtests.zip || exit 0")
3399 shell("unzip -q -o ${workspaceRelativeFxRootLinux}/fxruntime.zip || exit 0")
3402 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
3403 shell("tar -xzf ./${testArtifactsTgzFileName} || exit 0") // extracts to ./bin/tests/${osGroup}.${architecture}.${configuration}
3406 // Execute the tests
3407 def runDocker = isNeedDocker(architecture, os, false)
3408 def dockerPrefix = ""
3411 def dockerImage = getDockerImageName(architecture, os, false)
3412 dockerPrefix = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} "
3413 dockerCmd = dockerPrefix + "${dockerImage} "
3416 // If we are running a stress mode, we'll set those variables first.
3417 // For CoreFX, the stress variables are already built into the CoreFX test build per-test wrappers.
3418 if (!doCoreFxTesting && isJitStressScenario(scenario)) {
3419 def scriptFileName = "\${WORKSPACE}/set_stress_test_env.sh"
3420 def envScriptCmds = envScriptCreate(os, scriptFileName)
3421 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
3422 envScriptCmds += envScriptFinalize(os, scriptFileName)
3423 shell("${envScriptCmds}")
3424 testOpts += " --test-env=${scriptFileName}"
3427 // setup-stress-dependencies.sh, invoked by runtest.sh to download the coredistools package, depends on the "dotnet"
3428 // tool downloaded by the "init-tools.sh" script. However, it only invokes setup-stress-dependencies.sh for x64. The
3429 // coredistools package is used by GCStress on x86 and x64 to disassemble code to determine instruction boundaries.
3430 // On arm/arm64, it is not required as determining instruction boundaries is trivial.
3431 if (isGCStressRelatedTesting(scenario)) {
3432 if (architecture == 'x64') {
3433 shell('./init-tools.sh')
3437 if (isPmiAsmDiffsScenario) {
3439 python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} --skip_baseline_build""")
3441 shell("zip -r dasm.${os}.${architecture}.${configuration}.zip ./_/pmi/asm")
3443 else if (doCoreFxTesting) {
3445 \${WORKSPACE}/tests/scripts/run-corefx-tests.sh --test-exclude-file \${WORKSPACE}/tests/${architecture}/corefx_linux_test_exclusions.txt --runtime \${WORKSPACE}/${workspaceRelativeFxRootLinux}/artifacts/bin/testhost/netcoreapp-Linux-Release-${architecture} --arch ${architecture} --corefx-tests \${WORKSPACE}/${workspaceRelativeFxRootLinux}/artifacts/bin --configurationGroup Release""")
3448 def runScript = "${dockerCmd}./tests/runtest.sh"
3452 ${lowerConfiguration} \\
3453 --testRootDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}\" \\
3454 --coreOverlayDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root\" \\
3455 --limitedDumpGeneration ${testOpts}""")
3458 if (isGcReliabilityFramework(scenario)) {
3459 // runtest.sh doesn't actually execute the reliability framework - do it here.
3462 dockerCmd = dockerPrefix + "-e COMPlus_gcServer=1 ${dockerImage} "
3465 shell("export COMPlus_gcServer=1")
3469 shell("${dockerCmd}./tests/scripts/run-gc-reliability-framework.sh ${architecture} ${configuration}")
3474 // Experimental: If on Ubuntu 14.04, then attempt to pull in crash dump links
3475 if (os in ['Ubuntu']) {
3476 SummaryBuilder summaries = new SummaryBuilder()
3477 summaries.addLinksSummaryFromFile('Crash dumps from this run:', 'dumplings.txt')
3478 summaries.emit(newJob)
3481 if (isPmiAsmDiffsScenario) {
3483 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.zip")
3485 else if (doCoreFxTesting) {
3486 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/artifacts/bin/**/testResults.xml")
3487 if ((os == "Ubuntu") && (architecture == 'arm')) {
3488 // We have a problem with the xunit plug-in, where it is consistently failing on Ubuntu arm32 test result uploading with this error:
3490 // [xUnit] [ERROR] - The plugin hasn't been performed correctly: remote file operation failed: /ssd/j/workspace/dotnet_coreclr/master/jitstress/arm_cross_checked_ubuntu_corefx_baseline_tst at hudson.remoting.Channel@3697f46d:JNLP4-connect connection from 131.107.159.149/131.107.159.149:58529: java.io.IOException: Remote call on JNLP4-connect connection from 131.107.159.149/131.107.159.149:58529 failed
3492 // We haven't been able to identify the reason. So, do not add xunit parsing of the test data in this scenario.
3493 // This is tracked by: https://github.com/dotnet/coreclr/issues/19447.
3496 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRootLinux}/artifacts/bin/**/testResults.xml")
3500 Utilities.addXUnitDotNETResults(newJob, '**/coreclrtests.xml')
3506 def static CreateNonWindowsCrossGenComparisonTestJob(def dslFactory, def project, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3508 assert isCrossGenComparisonScenario(scenario)
3510 def osGroup = getOSGroup(os)
3511 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
3513 def workspaceRelativeResultsDir = "_"
3514 def workspaceRelativeNativeArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${architecture}_${architecture}.${configuration}"
3516 def crossArch = "x64"
3517 def workspaceRelativeCrossArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${crossArch}_${architecture}.${configuration}"
3519 def jobFolder = getJobFolder(scenario)
3520 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
3522 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
3525 def workspaceRelativeArtifactsArchive = "${os}.${architecture}.${configuration}.${scenario}.zip"
3528 copyArtifacts(inputCoreCLRBuildName) {
3529 includePatterns("${workspaceRelativeArtifactsArchive}")
3531 buildNumber('${CORECLR_BUILD}')
3535 shell("unzip -o ${workspaceRelativeArtifactsArchive} || exit 0")
3537 def workspaceRelativeCoreLib = "bin/Product/${osGroup}.${architecture}.${configuration}/IL/System.Private.CoreLib.dll"
3538 def workspaceRelativeCoreRootDir = "bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root"
3539 def workspaceRelativeCrossGenComparisonScript = "tests/scripts/crossgen_comparison.py"
3540 def workspaceRelativeCrossGenExecutable = "${workspaceRelativeCoreRootDir}/crossgen"
3542 def crossGenComparisonCmd = "python -u \${WORKSPACE}/${workspaceRelativeCrossGenComparisonScript} "
3543 def crossGenExecutable = "\${WORKSPACE}/${workspaceRelativeCrossGenExecutable}"
3545 shell("mkdir -p ${workspaceRelativeNativeArchResultDir}")
3546 shell("${crossGenComparisonCmd}crossgen_corelib --crossgen ${crossGenExecutable} --il_corelib \${WORKSPACE}/${workspaceRelativeCoreLib} --result_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir}")
3547 shell("${crossGenComparisonCmd}crossgen_framework --crossgen ${crossGenExecutable} --core_root \${WORKSPACE}/${workspaceRelativeCoreRootDir} --result_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir}")
3549 shell("${crossGenComparisonCmd}compare --base_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir} --diff_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}")
3553 Utilities.addArchival(newJob, "${workspaceRelativeNativeArchResultDir}/**")
3554 Utilities.addArchival(newJob, "${workspaceRelativeCrossArchResultDir}/**")
3559 // Create a test job that will be used by a flow job.
3560 // Returns the newly created job.
3561 // Note that we don't add tests jobs to the various views, since they are always used by a flow job, which is in the views,
3562 // and we want the views to be the minimal set of "top-level" jobs that represent all work.
3563 def static CreateTestJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3565 def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
3568 if (windowsArmJob) {
3569 newJob = CreateWindowsArmTestJob(dslFactory, project, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3571 else if (isCrossGenComparisonScenario(scenario)) {
3572 newJob = CreateNonWindowsCrossGenComparisonTestJob(dslFactory, project, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3575 newJob = CreateOtherTestJob(dslFactory, project, branch, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3578 setJobMachineAffinity(architecture, os, false, true, false, newJob) // isBuildJob = false, isTestJob = true, isFlowJob = false
3580 if (scenario == 'jitdiff') {
3581 def osGroup = getOSGroup(os)
3582 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/dasm/**")
3585 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
3586 setJobTimeout(newJob, isPR, architecture, configuration, scenario, false)
3591 // Create a flow job to tie together a build job with the given test job.
3592 // Returns the new flow job.
3593 def static CreateFlowJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def fullTestJobName, def inputCoreCLRBuildName)
3595 // Windows CoreCLR build and Linux CoreCLR build (in parallel) ->
3596 // Linux CoreCLR test
3597 def flowJobName = getJobName(configuration, architecture, os, scenario, false) + "_flow"
3598 def jobFolder = getJobFolder(scenario)
3600 def newFlowJob = dslFactory.buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, jobFolder)) {
3602 coreclrBuildJob = build(params, '${inputCoreCLRBuildName}')
3604 // And then build the test build
3605 build(params + [CORECLR_BUILD: coreclrBuildJob.build.number], '${fullTestJobName}')
3608 JobReport.Report.addReference(inputCoreCLRBuildName)
3609 JobReport.Report.addReference(fullTestJobName)
3611 addToViews(newFlowJob, true, isPR, architecture, os, configuration, scenario) // isFlowJob = true
3613 setJobMachineAffinity(architecture, os, false, false, true, newFlowJob) // isBuildJob = false, isTestJob = false, isFlowJob = true
3615 Utilities.standardJobSetup(newFlowJob, project, isPR, "*/${branch}")
3616 addTriggers(newFlowJob, branch, isPR, architecture, os, configuration, scenario, true, false) // isFlowJob==true, isWindowsBuildOnlyJob==false
3621 // Determine if we should generate a flow job for the given parameters.
3622 // Returns true if the job should be generated.
3623 def static shouldGenerateFlowJob(def scenario, def isPR, def architecture, def configuration, def os)
3625 // The various "innerloop" jobs are only available as PR triggered.
3628 if (isInnerloopTestScenario(scenario)) {
3632 if (scenario == 'corefx_innerloop') {
3637 // Filter based on OS and architecture.
3639 switch (architecture) {
3641 if (os != "Ubuntu" && os != "Windows_NT") {
3646 if (os != "Ubuntu16.04" && os != "Windows_NT") {
3651 if (os != "Ubuntu") {
3656 if (!(os in Constants.crossList)) {
3659 if (os == "Windows_NT") {
3664 case 'x86_arm_altjit':
3665 case 'x64_arm64_altjit':
3669 println("Unknown architecture: ${architecture}")
3674 def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
3676 // Filter based on scenario in OS.
3678 if (os == 'Windows_NT') {
3679 assert architecture == 'arm' || architecture == 'arm64'
3680 if (!isArmWindowsScenario(scenario)) {
3683 if (isNormalOrInnerloop && (configuration == 'Debug')) {
3684 // The arm32/arm64 Debug configuration for innerloop/normal scenario is a special case: it does a build only, and no test run.
3685 // To do that, it doesn't require a flow job.
3691 if (architecture == 'arm') {
3692 if (!(scenario in Constants.validLinuxArmScenarios)) {
3696 else if (architecture == 'arm64') {
3697 if (!(scenario in Constants.validLinuxArm64Scenarios)) {
3701 else if (architecture == 'x86') {
3702 // Linux/x86 only want innerloop and default test
3703 if (!isNormalOrInnerloop) {
3707 else if (architecture == 'x64') {
3708 // Linux/x64 corefx testing doesn't need a flow job; the "build" job runs run-corefx-tests.py which
3709 // builds and runs the corefx tests. Other Linux/x64 flow jobs are required to get the test
3710 // build from a Windows machine.
3711 if (isCoreFxScenario(scenario)) {
3717 // For CentOS, we only want Checked/Release builds.
3718 if (os == 'CentOS7.1') {
3719 if (configuration != 'Checked' && configuration != 'Release') {
3722 if (!isNormalOrInnerloop && !isR2RScenario(scenario)) {
3727 // For RedHat and Debian, we only do Release builds.
3728 else if (os == 'RHEL7.2' || os == 'Debian8.4') {
3729 if (configuration != 'Release') {
3732 if (!isNormalOrInnerloop) {
3737 // Next, filter based on scenario.
3739 if (isJitStressScenario(scenario)) {
3740 if (configuration != 'Checked') {
3744 else if (isR2RBaselineScenario(scenario)) {
3745 if (configuration != 'Checked' && configuration != 'Release') {
3749 else if (isR2RStressScenario(scenario)) {
3750 if (configuration != 'Checked') {
3754 else if (isCrossGenComparisonScenario(scenario)) {
3755 return shouldGenerateCrossGenComparisonJob(os, architecture, configuration, scenario)
3763 // Long GC tests take a long time on non-Release builds
3764 // ilrt is also Release only
3765 if (configuration != 'Release') {
3771 if (configuration != 'Checked') {
3776 case 'gc_reliability_framework':
3777 case 'standalone_gc':
3778 if (configuration != 'Release' && configuration != 'Checked') {
3787 if (os != 'Windows_NT' && os != 'Ubuntu') {
3797 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, false)) {
3802 case 'pmi_asm_diffs':
3803 if (configuration != 'Checked') {
3806 // No need for flow job except for Linux arm/arm64
3807 if ((os != 'Windows_NT') && (architecture != 'arm') && (architecture != 'arm64')) {
3812 case 'corefx_innerloop':
3813 // No flow job needed
3817 println("Unknown scenario: ${scenario}")
3823 // The job was not filtered out, so we should generate it!
3827 // Create jobs requiring flow jobs. This includes x64 non-Windows, arm/arm64 Ubuntu, and arm/arm64 Windows.
3828 Constants.allScenarios.each { scenario ->
3829 [true, false].each { isPR ->
3830 Constants.architectureList.each { architecture ->
3831 Constants.configurationList.each { configuration ->
3832 Constants.osList.each { os ->
3834 if (!shouldGenerateFlowJob(scenario, isPR, architecture, configuration, os)) {
3838 def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
3839 def doCoreFxTesting = isCoreFxScenario(scenario)
3840 def doCrossGenComparison = isCrossGenComparisonScenario(scenario)
3841 def isPmiAsmDiffsScenario = (scenario == 'pmi_asm_diffs')
3843 // Figure out the job name of the CoreCLR build the test will depend on.
3845 def inputCoreCLRBuildScenario = isInnerloopTestScenario(scenario) ? 'innerloop' : 'normal'
3846 def inputCoreCLRBuildIsBuildOnly = false
3847 if (doCoreFxTesting || isPmiAsmDiffsScenario) {
3848 // Every CoreFx test depends on its own unique build.
3849 inputCoreCLRBuildScenario = scenario
3850 if (windowsArmJob) {
3851 // Only Windows ARM corefx jobs use "build only" jobs. Others, such as Ubuntu ARM corefx, use "regular" jobs.
3852 inputCoreCLRBuildIsBuildOnly = true
3855 else if (doCrossGenComparison) {
3856 inputCoreCLRBuildScenario = scenario
3859 def inputCoreCLRFolderName = getJobFolder(inputCoreCLRBuildScenario)
3860 def inputCoreCLRBuildName = projectFolder + '/' +
3861 Utilities.getFullJobName(project, getJobName(configuration, architecture, os, inputCoreCLRBuildScenario, inputCoreCLRBuildIsBuildOnly), isPR, inputCoreCLRFolderName)
3863 // =============================================================================================
3864 // Create the test job
3865 // =============================================================================================
3867 def testJob = CreateTestJob(this, project, branch, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3869 // =============================================================================================
3870 // Create a build flow to join together the build and tests required to run this test.
3871 // =============================================================================================
3873 if (os == 'RHEL7.2' || os == 'Debian8.4') {
3874 // Do not create the flow job for RHEL jobs.
3878 def fullTestJobName = projectFolder + '/' + testJob.name
3879 def flowJob = CreateFlowJob(this, project, branch, architecture, os, configuration, scenario, isPR, fullTestJobName, inputCoreCLRBuildName)
3887 JobReport.Report.generateJobReport(out)
3889 // Make the call to generate the help job
3890 Utilities.createHelperJob(this, project, branch,
3891 "Welcome to the ${project} Repository", // This is prepended to the help message
3892 "Have a nice day!") // This is appended to the help message. You might put known issues here.
3894 Utilities.addCROSSCheck(this, project, branch)