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 def static getCrossArchitectures(def os, def architecture, def scenario) {
36 switch (architecture) {
47 // We use this class (vs variables) so that the static functions can access data here.
50 // We have very limited Windows ARM64 hardware (used for ARM/ARM64 testing) and Linux/arm32 and Linux/arm64 hardware.
51 // So only allow certain branches to use it.
52 def static LimitedHardwareBranches = [
55 // Innerloop build OS's
56 // The Windows_NT_BuildOnly OS is a way to speed up the Non-Windows builds by avoiding
57 // test execution in the build flow runs. It generates the exact same build
58 // as Windows_NT but without running the tests.
64 'Windows_NT_BuildOnly',
72 def static crossList = [
80 // This is a set of JIT stress modes combined with the set of variables that
81 // need to be set to actually enable that stress mode. The key of the map is the stress mode and
82 // the values are the environment variables
83 def static jitStressModeScenarios = [
84 'minopts' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JITMinOpts' : '1'],
85 'tieredcompilation' : ['COMPlus_TieredCompilation' : '1'], // this can be removed once tiered compilation is on by default
86 'no_tiered_compilation' : ['COMPlus_TieredCompilation' : '0'],
87 'no_tiered_compilation_innerloop': ['COMPlus_TieredCompilation' : '0'],
88 'forcerelocs' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_ForceRelocs' : '1'],
89 'jitstress1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '1'],
90 'jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2'],
91 'jitstress1_tiered' : ['COMPlus_TieredCompilation' : '1', 'COMPlus_JitStress' : '1'],
92 'jitstress2_tiered' : ['COMPlus_TieredCompilation' : '1', 'COMPlus_JitStress' : '2'],
93 'jitstressregs1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '1'],
94 'jitstressregs2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '2'],
95 'jitstressregs3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '3'],
96 'jitstressregs4' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '4'],
97 'jitstressregs8' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '8'],
98 'jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x10'],
99 'jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x80'],
100 'jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x1000'],
101 'jitstress2_jitstressregs1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '1'],
102 'jitstress2_jitstressregs2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '2'],
103 'jitstress2_jitstressregs3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '3'],
104 'jitstress2_jitstressregs4' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '4'],
105 'jitstress2_jitstressregs8' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '8'],
106 'jitstress2_jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x10'],
107 'jitstress2_jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x80'],
108 'jitstress2_jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x1000'],
109 'tailcallstress' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_TailcallStress' : '1'],
110 'jitsse2only' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableAVX' : '0', 'COMPlus_EnableSSE3_4' : '0'],
111 'jitnosimd' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_FeatureSIMD' : '0'],
112 'jitincompletehwintrinsic' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1'],
113 'jitx86hwintrinsicnoavx' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_EnableAVX' : '0'], // testing the legacy SSE encoding
114 'jitx86hwintrinsicnoavx2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_EnableAVX2' : '0'], // testing SNB/IVB
115 'jitx86hwintrinsicnosimd' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_FeatureSIMD' : '0'], // match "jitnosimd", may need to remove after decoupling HW intrinsic from FeatureSIMD
116 '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'],
117 'corefx_baseline' : ['COMPlus_TieredCompilation' : '0'], // corefx baseline
118 'corefx_minopts' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JITMinOpts' : '1'],
119 'corefx_tieredcompilation' : ['COMPlus_TieredCompilation' : '1'], // this can be removed once tiered compilation is on by default
120 'corefx_jitstress1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '1'],
121 'corefx_jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2'],
122 'corefx_jitstressregs1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '1'],
123 'corefx_jitstressregs2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '2'],
124 'corefx_jitstressregs3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '3'],
125 'corefx_jitstressregs4' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '4'],
126 'corefx_jitstressregs8' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '8'],
127 'corefx_jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x10'],
128 'corefx_jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x80'],
129 'corefx_jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x1000'],
130 'gcstress0x3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0x3'],
131 'gcstress0xc' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC'],
132 'zapdisable' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0'],
133 'heapverify1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_HeapVerify' : '1'],
134 'gcstress0xc_zapdisable' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0'],
135 'gcstress0xc_zapdisable_jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0', 'COMPlus_JitStress' : '2'],
136 'gcstress0xc_zapdisable_heapverify1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0', 'COMPlus_HeapVerify' : '1'],
137 'gcstress0xc_jitstress1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_JitStress' : '1'],
138 'gcstress0xc_jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_JitStress' : '2'],
139 'gcstress0xc_minopts_heapverify1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_JITMinOpts' : '1', 'COMPlus_HeapVerify' : '1']
142 // This is a set of ReadyToRun stress scenarios
143 def static r2rStressScenarios = [
144 'r2r_jitstress1' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStress": "1"],
145 'r2r_jitstress2' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStress": "2"],
146 'r2r_jitstress1_tiered' : ['COMPlus_TieredCompilation' : '1', "COMPlus_JitStress": "1"],
147 'r2r_jitstress2_tiered' : ['COMPlus_TieredCompilation' : '1', "COMPlus_JitStress": "2"],
148 'r2r_jitstressregs1' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "1"],
149 'r2r_jitstressregs2' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "2"],
150 'r2r_jitstressregs3' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "3"],
151 'r2r_jitstressregs4' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "4"],
152 'r2r_jitstressregs8' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "8"],
153 'r2r_jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "0x10"],
154 'r2r_jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "0x80"],
155 'r2r_jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "0x1000"],
156 'r2r_jitminopts' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JITMinOpts": "1"],
157 'r2r_jitforcerelocs' : ['COMPlus_TieredCompilation' : '0', "COMPlus_ForceRelocs": "1"],
158 'r2r_gcstress15' : ['COMPlus_TieredCompilation' : '0', "COMPlus_GCStress": "0xF"],
159 'r2r_no_tiered_compilation' : ['COMPlus_TieredCompilation' : '0'],
162 // This is the basic set of scenarios
163 def static basicScenarios = [
171 // 'jitdiff', // jitdiff is currently disabled, until someone spends the effort to make it fully work
173 'gc_reliability_framework',
176 'crossgen_comparison',
179 def static allScenarios = basicScenarios + r2rStressScenarios.keySet() + jitStressModeScenarios.keySet()
181 // Valid PR trigger combinations.
182 def static prTriggeredValidInnerLoopCombos = [
200 'Windows_NT_BuildOnly': [
244 // A set of scenarios that are valid for arm/arm64 tests run on hardware. This is a map from valid scenario name
245 // to Tests.lst file categories to exclude.
247 // This list should contain a subset of the scenarios from `allScenarios`. Please keep this in the same order as that,
248 // and with the same values, with some commented out, for easier maintenance.
250 // Note that some scenarios that are commented out should be enabled, but haven't yet been.
252 def static validArmWindowsScenarios = [
262 // 'gc_reliability_framework'
264 // 'corefx_innerloop'
265 // 'crossgen_comparison'
269 'r2r_jitstress1_tiered',
270 'r2r_jitstress2_tiered',
271 'r2r_jitstressregs1',
272 'r2r_jitstressregs2',
273 'r2r_jitstressregs3',
274 'r2r_jitstressregs4',
275 'r2r_jitstressregs8',
276 'r2r_jitstressregs0x10',
277 'r2r_jitstressregs0x80',
278 'r2r_jitstressregs0x1000',
280 'r2r_jitforcerelocs',
282 'r2r_no_tiered_compilation',
285 'no_tiered_compilation',
286 'no_tiered_compilation_innerloop',
299 'jitstressregs0x1000',
300 'jitstress2_jitstressregs1',
301 'jitstress2_jitstressregs2',
302 'jitstress2_jitstressregs3',
303 'jitstress2_jitstressregs4',
304 'jitstress2_jitstressregs8',
305 'jitstress2_jitstressregs0x10',
306 'jitstress2_jitstressregs0x80',
307 'jitstress2_jitstressregs0x1000',
309 // 'jitsse2only' // Only relevant to xarch
310 'jitnosimd', // Only interesting on platforms where SIMD support exists.
311 // 'jitincompletehwintrinsic'
312 // 'jitx86hwintrinsicnoavx'
313 // 'jitx86hwintrinsicnoavx2'
314 // 'jitx86hwintrinsicnosimd'
315 // 'jitnox86hwintrinsic'
316 'corefx_baseline', // corefx tests don't use smarty
317 'corefx_minopts', // corefx tests don't use smarty
318 'corefx_tieredcompilation', // corefx tests don't use smarty
319 'corefx_jitstress1', // corefx tests don't use smarty
320 'corefx_jitstress2', // corefx tests don't use smarty
321 'corefx_jitstressregs1', // corefx tests don't use smarty
322 'corefx_jitstressregs2', // corefx tests don't use smarty
323 'corefx_jitstressregs3', // corefx tests don't use smarty
324 'corefx_jitstressregs4', // corefx tests don't use smarty
325 'corefx_jitstressregs8', // corefx tests don't use smarty
326 'corefx_jitstressregs0x10', // corefx tests don't use smarty
327 'corefx_jitstressregs0x80', // corefx tests don't use smarty
328 'corefx_jitstressregs0x1000', // corefx tests don't use smarty
333 'gcstress0xc_zapdisable',
334 'gcstress0xc_zapdisable_jitstress2',
335 'gcstress0xc_zapdisable_heapverify1',
336 'gcstress0xc_jitstress1',
337 'gcstress0xc_jitstress2',
338 'gcstress0xc_minopts_heapverify1',
341 // NOTE: the following scenarios are not defined in the 'allScenarios' list! Is this a bug?
344 'minopts_zapdisable',
345 'gcstress0x3_jitstress1',
346 'gcstress0x3_jitstress2',
347 'gcstress0x3_jitstressregs1',
348 'gcstress0x3_jitstressregs2',
349 'gcstress0x3_jitstressregs3',
350 'gcstress0x3_jitstressregs4',
351 'gcstress0x3_jitstressregs8',
352 'gcstress0x3_jitstressregs0x10',
353 'gcstress0x3_jitstressregs0x80',
354 'gcstress0x3_jitstressregs0x1000',
355 'gcstress0xc_jitstressregs1',
356 'gcstress0xc_jitstressregs2',
357 'gcstress0xc_jitstressregs3',
358 'gcstress0xc_jitstressregs4',
359 'gcstress0xc_jitstressregs8',
360 'gcstress0xc_jitstressregs0x10',
361 'gcstress0xc_jitstressregs0x80',
362 'gcstress0xc_jitstressregs0x1000'
365 def static validLinuxArmScenarios = [
375 // 'gc_reliability_framework'
377 // 'corefx_innerloop'
378 'crossgen_comparison',
382 'r2r_jitstress1_tiered',
383 'r2r_jitstress2_tiered',
384 'r2r_jitstressregs1',
385 'r2r_jitstressregs2',
386 'r2r_jitstressregs3',
387 'r2r_jitstressregs4',
388 'r2r_jitstressregs8',
389 'r2r_jitstressregs0x10',
390 'r2r_jitstressregs0x80',
391 'r2r_jitstressregs0x1000',
393 'r2r_jitforcerelocs',
395 'r2r_no_tiered_compilation',
398 'no_tiered_compilation',
399 'no_tiered_compilation_innerloop',
412 'jitstressregs0x1000',
413 'jitstress2_jitstressregs1',
414 'jitstress2_jitstressregs2',
415 'jitstress2_jitstressregs3',
416 'jitstress2_jitstressregs4',
417 'jitstress2_jitstressregs8',
418 'jitstress2_jitstressregs0x10',
419 'jitstress2_jitstressregs0x80',
420 'jitstress2_jitstressregs0x1000',
422 // 'jitsse2only' // Only relevant to xarch
423 // 'jitnosimd' // Only interesting on platforms where SIMD support exists.
424 // 'jitincompletehwintrinsic'
425 // 'jitx86hwintrinsicnoavx'
426 // 'jitx86hwintrinsicnoavx2'
427 // 'jitx86hwintrinsicnosimd'
428 // 'jitnox86hwintrinsic'
431 'corefx_tieredcompilation',
434 'corefx_jitstressregs1',
435 'corefx_jitstressregs2',
436 'corefx_jitstressregs3',
437 'corefx_jitstressregs4',
438 'corefx_jitstressregs8',
439 'corefx_jitstressregs0x10',
440 'corefx_jitstressregs0x80',
441 'corefx_jitstressregs0x1000',
446 'gcstress0xc_zapdisable',
447 'gcstress0xc_zapdisable_jitstress2',
448 'gcstress0xc_zapdisable_heapverify1',
449 'gcstress0xc_jitstress1',
450 'gcstress0xc_jitstress2',
451 'gcstress0xc_minopts_heapverify1'
454 def static validLinuxArm64Scenarios = [
464 // 'gc_reliability_framework'
466 // 'corefx_innerloop'
467 // 'crossgen_comparison'
471 'r2r_jitstress1_tiered',
472 'r2r_jitstress2_tiered',
473 'r2r_jitstressregs1',
474 'r2r_jitstressregs2',
475 'r2r_jitstressregs3',
476 'r2r_jitstressregs4',
477 'r2r_jitstressregs8',
478 'r2r_jitstressregs0x10',
479 'r2r_jitstressregs0x80',
480 'r2r_jitstressregs0x1000',
482 'r2r_jitforcerelocs',
484 'r2r_no_tiered_compilation',
487 'no_tiered_compilation',
488 'no_tiered_compilation_innerloop',
501 'jitstressregs0x1000',
502 'jitstress2_jitstressregs1',
503 'jitstress2_jitstressregs2',
504 'jitstress2_jitstressregs3',
505 'jitstress2_jitstressregs4',
506 'jitstress2_jitstressregs8',
507 'jitstress2_jitstressregs0x10',
508 'jitstress2_jitstressregs0x80',
509 'jitstress2_jitstressregs0x1000',
511 // 'jitsse2only' // Only relevant to xarch
512 'jitnosimd', // Only interesting on platforms where SIMD support exists.
513 // 'jitincompletehwintrinsic'
514 // 'jitx86hwintrinsicnoavx'
515 // 'jitx86hwintrinsicnoavx2'
516 // 'jitx86hwintrinsicnosimd'
517 // 'jitnox86hwintrinsic'
520 'corefx_tieredcompilation',
523 'corefx_jitstressregs1',
524 'corefx_jitstressregs2',
525 'corefx_jitstressregs3',
526 'corefx_jitstressregs4',
527 'corefx_jitstressregs8',
528 'corefx_jitstressregs0x10',
529 'corefx_jitstressregs0x80',
530 'corefx_jitstressregs0x1000',
535 'gcstress0xc_zapdisable',
536 'gcstress0xc_zapdisable_jitstress2',
537 'gcstress0xc_zapdisable_heapverify1',
538 'gcstress0xc_jitstress1',
539 'gcstress0xc_jitstress2',
540 'gcstress0xc_minopts_heapverify1'
543 def static configurationList = ['Debug', 'Checked', 'Release']
545 // This is the set of architectures
546 // Some of these are pseudo-architectures:
547 // armem -- ARM builds/runs using an emulator. Used for Tizen runs.
548 // x86_arm_altjit -- ARM runs on x86 using the ARM altjit
549 // x64_arm64_altjit -- ARM64 runs on x64 using the ARM64 altjit
550 def static architectureList = ['arm', 'armem', 'x86_arm_altjit', 'x64_arm64_altjit', 'arm64', 'x64', 'x86']
552 // This set of architectures that cross build on Windows and run on Windows ARM64 hardware.
553 def static armWindowsCrossArchitectureList = ['arm', 'arm64']
556 // **************************************************************
557 // Create some specific views
559 // These aren't using the Utilities.addStandardFolderView() function, because that creates
560 // views based on a single regular expression. These views will be generated by adding a
561 // specific set of jobs to them.
563 // Utilities.addStandardFolderView() also creates a lot of additional stuff around the
564 // view, like "Build Statistics", "Job Statistics", "Unstable Jobs". Until it is determined
565 // those are required, don't add them (which simplifies the view pages, as well).
566 // **************************************************************
569 def static MergeJobView = null
570 def static PeriodicJobView = null
571 def static ArchitectureViews = [:]
572 def static OSViews = [:]
575 // MergeJobView: include all jobs that execute when a PR change is merged.
576 Views.MergeJobView = listView('Merge') {
589 // PeriodicJobView: include all jobs that execute on a schedule
590 Views.PeriodicJobView = listView('Periodic') {
603 // Create a view for non-PR jobs for each architecture.
604 Constants.architectureList.each { architecture ->
605 Views.ArchitectureViews[architecture] = listView(architecture) {
619 // Create a view for non-PR jobs for each OS.
620 Constants.osList.each { os ->
621 // Don't create one for the special 'Windows_NT_BuildOnly'
622 if (os == 'Windows_NT_BuildOnly') {
625 Views.OSViews[os] = listView(os) {
639 def static addToMergeView(def job) {
640 Views.MergeJobView.with {
647 def static addToPeriodicView(def job) {
648 Views.PeriodicJobView.with {
655 def static addToViews(def job, def isFlowJob, def isPR, def architecture, def os, def configuration, def scenario) {
657 // No views want PR jobs currently.
661 // 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
662 // "top-level" jobs. Build only jobs are such jobs.
663 if (os == 'Windows_NT_BuildOnly') {
668 // For non-flow jobs, which ones are only used by flow jobs?
669 if ((architecture == 'arm') || (architecture == 'arm64')) {
670 if (isCoreFxScenario(scenario)) {
671 // We have corefx-specific scenario builds for each of the runs, but these are driven by flow jobs.
675 // We're left with the basic normal/innerloop builds. We might want to remove these from the views also, if desired.
676 // However, there are a few, like the Debug Build, that is build only, not "Build and Test", that we should leave.
680 // Add to architecture view.
681 Views.ArchitectureViews[architecture].with {
688 Views.OSViews[os].with {
695 def static addPeriodicTriggerHelper(def job, String cronString, boolean alwaysRuns = false) {
696 addToPeriodicView(job)
697 Utilities.addPeriodicTrigger(job, cronString, alwaysRuns)
700 def static addGithubPushTriggerHelper(def job) {
702 Utilities.addGithubPushTrigger(job)
706 def static setMachineAffinity(def job, def os, def architecture, def options = null) {
707 assert os instanceof String
708 assert architecture instanceof String
710 def armArches = ['arm', 'armem', 'arm64']
712 if (!(architecture in armArches)) {
713 assert options == null
714 Utilities.setMachineAffinity(job, os, 'latest-or-auto')
719 // This is an arm(64) job.
721 // There are several options.
725 // Arm32 (Build) -> latest-arm64
726 // |-> os == "Windows_NT" && (architecture == "arm") && options['use_arm64_build_machine'] == true
727 // Arm32 (Test) -> arm64-windows_nt
728 // |-> os == "Windows_NT" && (architecture == "arm") && options['use_arm64_build_machine'] == false
730 // Arm64 (Build) -> latest-arm64
731 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == true
732 // Arm64 (Test) -> arm64-windows_nt
733 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == false
737 // Arm32 emulator (Build, Test) -> arm-cross-latest
738 // |-> os == "Tizen" && (architecture == "armem")
740 // Arm32 hardware (Flow) -> Ubuntu 16.04 latest-or-auto (don't use limited arm hardware)
741 // |-> os == "Ubuntu" && (architecture == "arm") && options['is_flow_job'] == true
742 // Arm32 hardware (Build) -> Ubuntu 16.04 latest-or-auto
743 // |-> os == "Ubuntu" && (architecture == "arm") && options['is_build_job'] == true
744 // Arm32 hardware (Test) -> Helix ubuntu.1404.arm32.open queue
745 // |-> os == "Ubuntu" && (architecture == "arm")
747 // Arm64 (Build) -> arm64-cross-latest
748 // |-> os != "Windows_NT" && architecture == "arm64" && options['is_build_job'] == true
749 // Arm64 (Test) -> Helix Ubuntu.1604.Arm64.Open queue
750 // |-> os != "Windows_NT" && architecture == "arm64"
752 // Note: we are no longer using Jenkins tags "arm64-huge-page-size", "arm64-small-page-size".
753 // Support for Linux arm64 large page size has been removed for now, as it wasn't being used.
755 // Note: we are no longer using Jenkins tag 'latest-arm64' for arm/arm64 Windows build machines. Instead,
756 // we are using public VS2017 arm/arm64 tools in a VM from Helix.
758 // This has to be a arm arch
759 assert architecture in armArches
760 if (os == "Windows_NT") {
761 // arm32/arm64 Windows jobs share the same machines for now
762 def isBuild = options['use_arm64_build_machine'] == true
764 if (isBuild == true) {
766 label('Windows.10.Amd64.ClientRS4.DevEx.Open')
769 Utilities.setMachineAffinity(job, 'windows.10.arm64.open')
772 assert os != 'Windows_NT'
774 if (architecture == 'armem') {
775 // arm emulator (Tizen). Build and test on same machine,
778 Utilities.setMachineAffinity(job, 'Ubuntu', 'arm-cross-latest')
781 // arm/arm64 Ubuntu on hardware.
782 assert architecture == 'arm' || architecture == 'arm64'
783 def isFlow = (options != null) && (options['is_flow_job'] == true)
784 def isBuild = (options != null) && (options['is_build_job'] == true)
785 if (isFlow || isBuild) {
786 // arm/arm64 Ubuntu build machine. Build uses docker, so the actual host OS is not
787 // very important. Therefore, use latest or auto. Flow jobs don't need to use arm hardware.
788 Utilities.setMachineAffinity(job, 'Ubuntu16.04', 'latest-or-auto')
790 // arm/arm64 Ubuntu test machine. Specify the Helix queue name here.
791 if (architecture == 'arm64') {
792 assert os == 'Ubuntu16.04'
794 label('Ubuntu.1604.Arm64.Open')
798 assert os == 'Ubuntu'
800 label('ubuntu.1404.arm32.open')
808 // setJobMachineAffinity: compute the machine affinity options for a job,
809 // then set the job with those affinity options.
810 def static setJobMachineAffinity(def architecture, def os, def isBuildJob, def isTestJob, def isFlowJob, def job)
812 assert (isBuildJob && !isTestJob && !isFlowJob) ||
813 (!isBuildJob && isTestJob && !isFlowJob) ||
814 (!isBuildJob && !isTestJob && isFlowJob)
816 def affinityOptions = null
817 def affinityArchitecture = architecture
819 if (os == "Windows_NT") {
820 if (architecture in Constants.armWindowsCrossArchitectureList) {
822 affinityOptions = [ "use_arm64_build_machine" : true ]
823 } else if (isTestJob) {
824 affinityOptions = [ "use_arm64_build_machine" : false ]
825 } else if (isFlowJob) {
826 // For the flow jobs set the machine affinity as x64
827 affinityArchitecture = 'x64'
832 if ((architecture == 'arm64') || (architecture == 'arm')) {
834 affinityOptions = ['is_build_job': true]
835 } else if (isFlowJob) {
836 affinityOptions = ['is_flow_job': true]
841 setMachineAffinity(job, os, affinityArchitecture, affinityOptions)
844 def static isGCStressRelatedTesting(def scenario) {
845 // The 'r2r_gcstress15' scenario is a basic scenario.
846 // Detect it and make it a GCStress related.
847 if (scenario == 'r2r_gcstress15')
852 def gcStressTestEnvVars = [ 'COMPlus_GCStress', 'COMPlus_ZapDisable', 'COMPlus_HeapVerify']
853 def scenarioName = scenario.toLowerCase()
854 def isGCStressTesting = false
855 Constants.jitStressModeScenarios[scenario].each{ k, v ->
856 if (k in gcStressTestEnvVars) {
857 isGCStressTesting = true;
860 return isGCStressTesting
863 def static isCoreFxScenario(def scenario) {
864 def corefx_prefix = 'corefx_'
865 if (scenario.length() < corefx_prefix.length()) {
868 return scenario.substring(0,corefx_prefix.length()) == corefx_prefix
871 def static isR2RBaselineScenario(def scenario) {
872 return (scenario == 'r2r')
875 def static isR2RStressScenario(def scenario) {
876 return Constants.r2rStressScenarios.containsKey(scenario)
879 def static isR2RScenario(def scenario) {
880 return isR2RBaselineScenario(scenario) || isR2RStressScenario(scenario)
883 def static isJitStressScenario(def scenario) {
884 return Constants.jitStressModeScenarios.containsKey(scenario)
887 def static isLongGc(def scenario) {
888 return (scenario == 'longgc' || scenario == 'gcsimulator')
891 def static isJitDiff(def scenario) {
892 return (scenario == 'jitdiff')
895 def static isGcReliabilityFramework(def scenario) {
896 return (scenario == 'gc_reliability_framework')
899 def static isArmWindowsScenario(def scenario) {
900 return Constants.validArmWindowsScenarios.contains(scenario)
903 def static isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly) {
904 if (isBuildOnly == true) {
905 os = 'Windows_NT_BuildOnly'
908 def validOsPrTriggerArchConfigs = Constants.prTriggeredValidInnerLoopCombos[os]
909 if (validOsPrTriggerArchConfigs != null) {
910 def validOsPrTriggerConfigs = validOsPrTriggerArchConfigs[architecture]
911 if (validOsPrTriggerConfigs != null) {
912 if (configuration in validOsPrTriggerConfigs) {
921 // This means the job builds and runs the 'innerloop' test set. This does not mean the job is
922 // scheduled with a default PR trigger despite the correlation being true at the moment.
923 def static isInnerloopTestScenario(def scenario) {
924 return (scenario == 'innerloop' || scenario == 'no_tiered_compilation_innerloop')
927 def static isCrossGenComparisonScenario(def scenario) {
928 return (scenario == 'crossgen_comparison')
931 def static shouldGenerateCrossGenComparisonJob(def os, def architecture, def configuration, def scenario) {
932 assert isCrossGenComparisonScenario(scenario)
933 return (os == 'Ubuntu' && architecture == 'arm' && (configuration == 'Checked' || configuration == 'Release'))
936 def static getFxBranch(def branch) {
937 def fxBranch = branch
938 // Map 'dev/unix_test_workflow' to 'master' so we can test CoreFX jobs in the CoreCLR dev/unix_test_workflow
939 // branch even though CoreFX doesn't have such a branch.
940 if (branch == 'dev/unix_test_workflow') {
946 def static setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly) {
947 // 2 hours (120 minutes) is the default timeout
950 if (!isInnerloopTestScenario(scenario)) {
951 // Pri-1 test builds take a long time (see calculateBuildCommands()). So up the Pri-1 build jobs timeout.
956 // Note that these can only increase, never decrease, the Pri-1 timeout possibly set above.
957 if (isGCStressRelatedTesting(scenario)) {
960 else if (isCoreFxScenario(scenario)) {
963 else if (isJitStressScenario(scenario)) {
966 else if (isR2RBaselineScenario(scenario)) {
969 else if (isLongGc(scenario)) {
972 else if (isJitDiff(scenario)) {
975 else if (isGcReliabilityFramework(scenario)) {
978 else if (architecture == 'armem' || architecture == 'arm64') {
982 if (architecture == 'arm') {
983 // ARM32 machines are particularly slow.
988 if (configuration == 'Debug') {
989 // Debug runs can be very slow. Add an hour.
993 if (architecture == 'x86_arm_altjit' || architecture == 'x64_arm64_altjit') {
994 // AltJit runs compile all methods twice.
998 // If we've changed the timeout from the default, set it in the job.
1000 if (timeout != 120) {
1001 Utilities.setJobTimeout(newJob, timeout)
1005 def static getJobFolder(def scenario) {
1006 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
1009 if (scenario == 'illink') {
1015 def static getStressModeDisplayName(def scenario) {
1017 Constants.jitStressModeScenarios[scenario].each{ k, v ->
1018 def prefixLength = 'COMPlus_'.length()
1019 if (k.length() >= prefixLength) {
1020 def modeName = k.substring(prefixLength, k.length())
1021 if (displayStr != '') {
1022 // Separate multiple variables with a space.
1025 displayStr += modeName + '=' + v
1029 if (isCoreFxScenario(scenario)) {
1030 displayStr = ('CoreFx ' + displayStr).trim()
1036 def static getR2RDisplayName(def scenario) {
1037 // Assume the scenario name is one from the r2rStressScenarios dict, and remove its "r2r_" prefix.
1038 def displayStr = scenario
1039 def prefixLength = 'r2r_'.length()
1040 if (displayStr.length() >= prefixLength) {
1041 displayStr = "R2R " + displayStr.substring(prefixLength, displayStr.length())
1042 } else if (scenario == 'r2r') {
1048 def static getScenarioDisplayString(def scenario) {
1051 return "Innerloop Build and Test"
1053 case 'no_tiered_compilation_innerloop':
1054 def displayStr = getStressModeDisplayName(scenario)
1055 return "Innerloop Build and Test (Jit - ${displayStr})"
1057 case 'corefx_innerloop':
1058 return "CoreFX Tests"
1061 return "Build and Test"
1064 return "Jit Diff Build and Test"
1067 return "IL RoundTrip Build and Test"
1070 return "Long-Running GC Build & Test"
1073 return "GC Simulator"
1075 case 'standalone_gc':
1076 return "Standalone GC"
1078 case 'gc_reliability_framework':
1079 return "GC Reliability Framework"
1085 if (isJitStressScenario(scenario)) {
1086 def displayStr = getStressModeDisplayName(scenario)
1087 return "Build and Test (Jit - ${displayStr})"
1089 else if (isR2RScenario(scenario)) {
1090 def displayStr = getR2RDisplayName(scenario)
1091 return "${displayStr} Build and Test"
1094 return "${scenario}"
1099 println("Unknown scenario: ${scenario}");
1104 // Functions to create an environment script.
1105 // envScriptCreate -- initialize the script (call first)
1106 // envScriptFinalize -- finalize the script (call last)
1107 // envScriptSetStressModeVariables -- set stress mode variables in the env script
1108 // envScriptAppendExistingScript -- append an existing script to the generated script
1110 // Each script returns a string of commands. Concatenate all the strings together before
1111 // adding them to the builds commands, to make sure they get executed as one Jenkins script.
1114 // Initialize the environment setting script.
1115 def static envScriptCreate(def os, def stepScriptLocation) {
1117 if (os == 'Windows_NT') {
1118 stepScript += "echo Creating TestEnv script\r\n"
1119 stepScript += "if exist ${stepScriptLocation} del ${stepScriptLocation}\r\n"
1121 // Create at least an empty script.
1122 stepScript += "echo. > ${stepScriptLocation}\r\n"
1125 stepScript += "echo Creating environment setting script\n"
1126 stepScript += "echo \\#\\!/usr/bin/env bash > ${stepScriptLocation}\n"
1132 // Generates the string for setting stress mode variables.
1133 def static envScriptSetStressModeVariables(def os, def stressModeVars, def stepScriptLocation) {
1135 if (os == 'Windows_NT') {
1136 stressModeVars.each{ k, v ->
1137 // Write out what we are writing to the script file
1138 stepScript += "echo Setting ${k}=${v}\r\n"
1139 // Write out the set itself to the script file`
1140 stepScript += "echo set ${k}=${v} >> ${stepScriptLocation}\r\n"
1144 stressModeVars.each{ k, v ->
1145 // Write out what we are writing to the script file
1146 stepScript += "echo Setting ${k}=${v}\n"
1147 // Write out the set itself to the script file`
1148 stepScript += "echo export ${k}=${v} >> ${stepScriptLocation}\n"
1155 // Append an existing script to an environment script.
1156 // Returns string of commands to do this.
1157 def static envScriptAppendExistingScript(def os, def appendScript, def stepScriptLocation) {
1158 assert (os == 'Windows_NT')
1161 stepScript += "echo Appending ${appendScript} to ${stepScriptLocation}\r\n"
1162 stepScript += "type ${appendScript} >> ${stepScriptLocation}\r\n"
1167 // Finalize an environment setting script.
1168 // Returns string of commands to do this.
1169 def static envScriptFinalize(def os, def stepScriptLocation) {
1172 if (os == 'Windows_NT') {
1173 // Display the resulting script. This is useful when looking at the output log file.
1174 stepScript += "echo Display the total script ${stepScriptLocation}\r\n"
1175 stepScript += "type ${stepScriptLocation}\r\n"
1178 stepScript += "chmod +x ${stepScriptLocation}\n"
1184 def static isNeedDocker(def architecture, def os, def isBuild) {
1186 if (architecture == 'x86' && os == 'Ubuntu') {
1189 else if (architecture == 'armem') {
1192 else if (architecture == 'arm') {
1193 if (os == 'Ubuntu') {
1197 else if (architecture == 'arm64') {
1198 if (os == 'Ubuntu16.04') {
1204 if (architecture == 'x86' && os == 'Ubuntu') {
1211 def static getDockerImageName(def architecture, def os, def isBuild) {
1212 // We must change some docker private images to official later
1214 if (architecture == 'x86' && os == 'Ubuntu') {
1215 return "hseok82/dotnet-buildtools-prereqs:ubuntu-16.04-crossx86-ef0ac75-20175511035548"
1217 else if (architecture == 'armem') {
1218 if (os == 'Tizen') {
1219 return "tizendotnet/dotnet-buildtools-prereqs:ubuntu-16.04-cross-e435274-20180426002255-tizen-rootfs-5.0m1"
1222 else if (architecture == 'arm') {
1223 if (os == 'Ubuntu') {
1224 return "microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-e435274-20180426002420"
1227 else if (architecture == 'arm64') {
1228 if (os == 'Ubuntu16.04') {
1229 return "microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-arm64-a3ae44b-20180315221921"
1234 if (architecture == 'x86' && os == 'Ubuntu') {
1235 return "hseok82/dotnet-buildtools-prereqs:ubuntu1604_x86_test"
1238 println("Unknown architecture to use docker: ${architecture} ${os}");
1242 def static getTestArtifactsTgzFileName(def osGroup, def architecture, def configuration) {
1243 return "bin-tests-${osGroup}.${architecture}.${configuration}.tgz"
1246 // We have a limited amount of some hardware. For these, scale back the periodic testing we do,
1247 // and only allowing using this hardware in some specific branches.
1248 def static jobRequiresLimitedHardware(def architecture, def os) {
1249 if (architecture == 'arm') {
1250 // arm Windows and Linux hardware is limited.
1253 else if (architecture == 'arm64') {
1254 // arm64 Windows and Linux hardware is limited.
1262 // Calculates the name of the build job based on some typical parameters.
1264 def static getJobName(def configuration, def architecture, def os, def scenario, def isBuildOnly) {
1265 // If the architecture is x64, do not add that info into the build name.
1266 // Need to change around some systems and other builds to pick up the right builds
1269 def suffix = scenario != 'normal' ? "_${scenario}" : '';
1274 switch (architecture) {
1276 if (scenario == 'normal') {
1277 // For now we leave x64 off of the name for compatibility with other jobs
1278 baseName = configuration.toLowerCase() + '_' + os.toLowerCase()
1280 else if (scenario == 'formatting') {
1281 // we don't care about the configuration for the formatting job. It runs all configs
1282 baseName = architecture.toLowerCase() + '_' + os.toLowerCase()
1285 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1289 // These are cross builds
1290 assert os == 'Tizen'
1291 baseName = 'armel_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1295 // These are cross builds
1296 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1299 case 'x86_arm_altjit':
1300 case 'x64_arm64_altjit':
1301 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1304 println("Unknown architecture: ${architecture}");
1309 return baseName + suffix
1312 def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob, def bidailyCrossList) {
1314 // The dev/unix_test_workflow branch is used for Jenkins CI testing. We generally do not need any non-PR
1315 // triggers in the branch, because that would use machine resources unnecessarily.
1316 if (branch == 'dev/unix_test_workflow') {
1320 // Limited hardware is restricted for non-PR triggers to certain branches.
1321 if (jobRequiresLimitedHardware(architecture, os) && (!(branch in Constants.LimitedHardwareBranches))) {
1325 // Ubuntu x86 CI jobs are failing. Disable non-PR triggered jobs to avoid these constant failures
1326 // until this is fixed. Tracked by https://github.com/dotnet/coreclr/issues/19003.
1327 if (architecture == 'x86' && os == 'Ubuntu') {
1331 def isNormalOrInnerloop = (scenario == "normal" || scenario == "innerloop")
1335 case 'crossgen_comparison':
1336 if (isFlowJob && os == 'Ubuntu' && architecture == 'arm' && (configuration == 'Checked' || configuration == 'Release')) {
1337 addPeriodicTriggerHelper(job, '@daily')
1341 case 'pmi_asm_diffs':
1342 // No non-PR triggers for now.
1346 switch (architecture) {
1349 if (isFlowJob && architecture == 'x86' && os == 'Ubuntu') {
1350 addPeriodicTriggerHelper(job, '@daily')
1352 else if (isFlowJob || os == 'Windows_NT' || (architecture == 'x64' && !(os in Constants.crossList))) {
1353 addGithubPushTriggerHelper(job)
1357 if (os == 'Windows_NT') {
1358 if (isFlowJob || (isNormalOrInnerloop && (configuration == 'Debug'))) {
1359 // We would normally want a per-push trigger, but with limited hardware we can't keep up.
1360 // Do the builds daily.
1361 addPeriodicTriggerHelper(job, '@daily')
1365 // Only the flow jobs get push triggers; the build and test jobs are triggered by the flow job.
1367 addPeriodicTriggerHelper(job, '@daily')
1372 if (os == 'Windows_NT') {
1373 if (isFlowJob || (isNormalOrInnerloop && (configuration == 'Debug'))) {
1374 // We would normally want a push trigger, but with limited hardware we can't keep up.
1375 // Do the builds daily.
1376 addPeriodicTriggerHelper(job, '@daily')
1380 assert os == 'Ubuntu'
1381 // Only the flow jobs get push triggers; the build and test jobs are triggered by the flow job.
1383 // Currently no push triggers, with limited arm Linux hardware.
1384 // TODO: If we have enough machine capacity, add some arm Linux push triggers.
1385 addPeriodicTriggerHelper(job, '@daily')
1390 addGithubPushTriggerHelper(job)
1392 case 'x86_arm_altjit':
1393 case 'x64_arm64_altjit':
1394 // Only do altjit push triggers for Checked; don't waste time on Debug or Release.
1395 if (configuration == 'Checked') {
1396 addGithubPushTriggerHelper(job)
1400 println("Unknown architecture: ${architecture}");
1406 assert !(os in bidailyCrossList)
1407 // r2r gets a push trigger for checked/release
1408 if (configuration == 'Checked' || configuration == 'Release') {
1409 if (architecture == 'x64' && os != 'OSX10.12') {
1410 //Flow jobs should be Windows, Ubuntu, OSX0.12, or CentOS
1411 if (isFlowJob || os == 'Windows_NT') {
1412 addGithubPushTriggerHelper(job)
1414 // OSX10.12 r2r jobs should only run every 12 hours, not daily.
1415 } else if (architecture == 'x64' && os == 'OSX10.12'){
1417 addPeriodicTriggerHelper(job, 'H H/12 * * *')
1420 // For x86, only add per-commit jobs for Windows
1421 else if (architecture == 'x86') {
1422 if (os == 'Windows_NT') {
1423 addGithubPushTriggerHelper(job)
1426 // arm r2r jobs should only run weekly.
1427 else if (architecture == 'arm') {
1429 addPeriodicTriggerHelper(job, '@weekly')
1432 // arm64 r2r jobs should only run weekly.
1433 else if (architecture == 'arm64') {
1435 addPeriodicTriggerHelper(job, '@weekly')
1440 case 'r2r_jitstress1':
1441 case 'r2r_jitstress2':
1442 case 'r2r_jitstress1_tiered':
1443 case 'r2r_jitstress2_tiered':
1444 case 'r2r_jitstressregs1':
1445 case 'r2r_jitstressregs2':
1446 case 'r2r_jitstressregs3':
1447 case 'r2r_jitstressregs4':
1448 case 'r2r_jitstressregs8':
1449 case 'r2r_jitstressregs0x10':
1450 case 'r2r_jitstressregs0x80':
1451 case 'r2r_jitstressregs0x1000':
1452 case 'r2r_jitminopts':
1453 case 'r2r_jitforcerelocs':
1454 case 'r2r_gcstress15':
1455 case 'r2r_no_tiered_compilation':
1456 assert !(os in bidailyCrossList)
1458 // GCStress=C is currently not supported on OS X
1459 if (os == 'OSX10.12' && isGCStressRelatedTesting(scenario)) {
1463 if (configuration == 'Checked' || configuration == 'Release') {
1464 if (architecture == 'x64') {
1465 //Flow jobs should be Windows, Ubuntu, OSX10.12, or CentOS
1466 if (isFlowJob || os == 'Windows_NT') {
1467 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1470 // For x86, only add periodic jobs for Windows
1471 else if (architecture == 'x86') {
1472 if (os == 'Windows_NT') {
1473 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1476 else if (architecture == 'arm') {
1478 addPeriodicTriggerHelper(job, '@weekly')
1481 else if (architecture == 'arm64') {
1483 addPeriodicTriggerHelper(job, '@weekly')
1489 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1490 assert configuration == 'Release'
1491 assert architecture == 'x64'
1492 addPeriodicTriggerHelper(job, '@daily')
1493 // TODO: Add once external email sending is available again
1494 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1497 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1498 assert configuration == 'Release'
1499 assert architecture == 'x64'
1500 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1501 // TODO: Add once external email sending is available again
1502 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1504 case 'standalone_gc':
1505 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1506 assert (configuration == 'Release' || configuration == 'Checked')
1507 // TODO: Add once external email sending is available again
1508 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1509 addPeriodicTriggerHelper(job, '@daily')
1511 case 'gc_reliability_framework':
1512 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1513 assert (configuration == 'Release' || configuration == 'Checked')
1514 // Only triggered by phrase.
1517 assert !(os in bidailyCrossList)
1518 // ILASM/ILDASM roundtrip one gets a daily build, and only for release
1519 if (architecture == 'x64' && configuration == 'Release') {
1520 if (isFlowJob || os == 'Windows_NT') {
1521 addPeriodicTriggerHelper(job, '@daily')
1526 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1527 assert configuration == 'Checked'
1528 assert (architecture == 'x64' || architecture == 'x86')
1529 addGithubPushTriggerHelper(job)
1532 assert (os == 'Windows_NT' || os == "Ubuntu")
1533 assert architecture == 'x64'
1534 addGithubPushTriggerHelper(job)
1536 case 'jitstressregs1':
1537 case 'jitstressregs2':
1538 case 'jitstressregs3':
1539 case 'jitstressregs4':
1540 case 'jitstressregs8':
1541 case 'jitstressregs0x10':
1542 case 'jitstressregs0x80':
1543 case 'jitstressregs0x1000':
1545 case 'tieredcompilation':
1546 case 'no_tiered_compilation':
1550 case 'jitstress1_tiered':
1551 case 'jitstress2_tiered':
1552 case 'jitstress2_jitstressregs1':
1553 case 'jitstress2_jitstressregs2':
1554 case 'jitstress2_jitstressregs3':
1555 case 'jitstress2_jitstressregs4':
1556 case 'jitstress2_jitstressregs8':
1557 case 'jitstress2_jitstressregs0x10':
1558 case 'jitstress2_jitstressregs0x80':
1559 case 'jitstress2_jitstressregs0x1000':
1560 case 'tailcallstress':
1563 case 'jitnox86hwintrinsic':
1564 case 'jitincompletehwintrinsic':
1565 case 'jitx86hwintrinsicnoavx':
1566 case 'jitx86hwintrinsicnoavx2':
1567 case 'jitx86hwintrinsicnosimd':
1568 case 'corefx_baseline':
1569 case 'corefx_minopts':
1570 case 'corefx_tieredcompilation':
1571 case 'corefx_jitstress1':
1572 case 'corefx_jitstress2':
1573 case 'corefx_jitstressregs1':
1574 case 'corefx_jitstressregs2':
1575 case 'corefx_jitstressregs3':
1576 case 'corefx_jitstressregs4':
1577 case 'corefx_jitstressregs8':
1578 case 'corefx_jitstressregs0x10':
1579 case 'corefx_jitstressregs0x80':
1580 case 'corefx_jitstressregs0x1000':
1582 if (os == 'CentOS7.1') {
1585 if (os in bidailyCrossList) {
1588 // ARM corefx testing uses non-flow jobs to provide the configuration-specific
1589 // build for the flow job. We don't need cron jobs for these. Note that the
1590 // Windows ARM jobs depend on a Windows "build only" job that exits the trigger
1591 // function very early, so only non-Windows gets here.
1592 if ((architecture == 'arm') && isCoreFxScenario(scenario) && !isFlowJob) {
1595 if ((architecture == 'arm64') && isCoreFxScenario(scenario) && !isFlowJob) {
1598 if (jobRequiresLimitedHardware(architecture, os)) {
1599 if ((architecture == 'arm64') && (os == 'Ubuntu16.04')) {
1600 // These jobs are very fast on Linux/arm64 hardware, so run them daily.
1601 addPeriodicTriggerHelper(job, '@daily')
1604 addPeriodicTriggerHelper(job, '@weekly')
1608 addPeriodicTriggerHelper(job, '@daily')
1613 if (os == 'CentOS7.1') {
1616 if (os in bidailyCrossList) {
1619 addPeriodicTriggerHelper(job, '@weekly')
1622 case 'gcstress0xc_zapdisable':
1623 case 'gcstress0xc_zapdisable_jitstress2':
1624 case 'gcstress0xc_zapdisable_heapverify1':
1625 case 'gcstress0xc_jitstress1':
1626 case 'gcstress0xc_jitstress2':
1627 case 'gcstress0xc_minopts_heapverify1':
1628 if (os == 'OSX10.12') {
1629 // GCStress=C is currently not supported on OS X
1632 if (os == 'CentOS7.1') {
1635 if (os in bidailyCrossList) {
1638 addPeriodicTriggerHelper(job, '@weekly')
1642 // Testing on other operating systems TBD
1643 assert (os == 'Windows_NT' || os == 'Ubuntu')
1644 if (architecture == 'x64' || architecture == 'x86') {
1645 if (configuration == 'Checked') {
1646 addPeriodicTriggerHelper(job, '@daily')
1652 println("Unknown scenario: ${scenario}");
1659 // **************************
1660 // Define the basic inner loop builds for PR and commit. This is basically just the set
1661 // of coreclr builds over linux/osx 10.12/windows and debug/release/checked. In addition, the windows
1662 // builds will do a couple extra steps.
1663 // **************************
1665 // Adds a trigger for the PR build if one is needed. If isFlowJob is true, then this is the
1666 // flow job that rolls up the build and test for non-windows OS's. // If the job is a windows build only job,
1667 // it's just used for internal builds
1668 // If you add a job with a trigger phrase, please add that phrase to coreclr/Documentation/project-docs/ci-trigger-phrases.md
1669 def static addTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob) {
1670 def isNormalOrInnerloop = (scenario == "normal" || scenario == "innerloop")
1672 if (isWindowsBuildOnlyJob) {
1676 def bidailyCrossList = ['RHEL7.2', 'Debian8.4']
1677 // Non pull request builds.
1679 addNonPRTriggers(job, branch, isPR, architecture, os, configuration, scenario, isFlowJob, isWindowsBuildOnlyJob, bidailyCrossList)
1704 // Pull request builds. Generally these fall into two categories: default triggers and on-demand triggers
1705 // We generally only have a distinct set of default triggers but a bunch of on-demand ones.
1707 def contextString = ""
1708 def triggerString = ""
1709 def needsTrigger = true
1710 def isDefaultTrigger = false
1711 def isArm64PrivateJob = false
1712 def scenarioString = ""
1714 // Set up default context string and trigger phrases. This is overridden in places, sometimes just to keep
1715 // the existing non-standard descriptions and phrases. In some cases, the scenarios are asymmetric, as for
1716 // some jobs where the Debug configuration just does builds, no tests.
1718 // Some configurations, like arm32/arm64, always use the exact scenario name as part of the context string.
1719 // This makes it possible to copy/paste the displayed context string as "@dotnet-bot test <context-string>"
1720 // to invoke the trigger. Any "fancy" context string makes that impossible, requiring the user to either
1721 // remember the mapping from context string to trigger string, or use "@dotnet-bot help" to look it up.
1723 if (architecture == 'armem') {
1724 assert os == 'Tizen'
1725 architecture = 'armel'
1728 switch (architecture) {
1729 case 'x64_arm64_altjit':
1730 case 'x86_arm_altjit':
1731 // TODO: for consistency, add "Build and Test" at end.
1732 contextString = "${os} ${architecture} ${configuration} ${scenario}"
1733 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*"
1739 contextString = "${os} ${architecture} Cross ${configuration}"
1740 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
1742 if (scenario == 'innerloop') {
1743 contextString += " Innerloop"
1744 triggerString += "\\W+Innerloop"
1747 contextString += " ${scenario}"
1748 triggerString += "\\W+${scenario}"
1751 if (scenario == 'pmi_asm_diffs') {
1752 // Don't add the "Build and Test" part
1754 else if (configuration == 'Debug') {
1755 contextString += " Build"
1756 triggerString += "\\W+Build"
1759 contextString += " Build and Test"
1760 triggerString += "\\W+Build and Test"
1763 triggerString += ".*"
1767 scenarioString = getScenarioDisplayString(scenario)
1768 contextString = "${os} ${architecture} ${configuration} ${scenarioString}"
1769 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}"
1773 triggerString += "\\W+Build and Test.*"
1776 case 'corefx_innerloop': // maintain this asymmetry
1777 triggerString += "\\W+CoreFX Tests.*"
1781 triggerString += "\\W+${scenario}.*"
1785 triggerString += ".*"
1789 // Now determine what kind of trigger this job needs, if any. Any job should be triggerable, except for
1790 // non-flow jobs that are only used as part of flow jobs.
1792 switch (architecture) {
1793 case 'x64': // editor brace matching: {
1794 if (scenario == 'formatting') {
1795 assert configuration == 'Checked'
1796 if (os == 'Windows_NT' || os == 'Ubuntu') {
1797 isDefaultTrigger = true
1798 contextString = "${os} ${architecture} Formatting"
1803 if (scenario == 'pmi_asm_diffs') {
1804 // Everything is already set.
1805 // No default triggers.
1810 // OpenSUSE, Debian & RedHat get trigger phrases for pri 0 build, and pri 1 build & test
1813 if (scenario == 'innerloop') {
1815 contextString = "${os} ${architecture} ${configuration} Innerloop Build"
1816 isDefaultTrigger = true
1826 assert scenario != 'innerloop'
1827 contextString = "${os} ${architecture} ${configuration} Build"
1828 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+Build.*"
1832 if (scenario == 'illink') {
1835 else if (scenario == 'corefx_innerloop') {
1836 if (configuration == 'Checked') {
1837 isDefaultTrigger = true
1845 // Triggers on the non-flow jobs aren't necessary here
1846 // Corefx testing uses non-flow jobs.
1847 if (!isFlowJob && !isCoreFxScenario(scenario)) {
1848 needsTrigger = false
1853 isDefaultTrigger = true
1856 case 'no_tiered_compilation_innerloop':
1857 if (os == 'Ubuntu') {
1858 isDefaultTrigger = true
1870 // CentOS uses checked for default PR tests while debug is build only
1871 if (configuration == 'Debug') {
1872 isDefaultTrigger = true
1873 contextString = "${os} ${architecture} ${configuration} Innerloop Build"
1877 // Make sure this is a flow job to get build and test.
1879 needsTrigger = false
1883 if (configuration == 'Checked') {
1884 assert job.name.contains("flow")
1885 isDefaultTrigger = true
1886 contextString = "${os} ${architecture} ${configuration} Innerloop Build and Test"
1891 // Make sure this is a flow job to get build and test.
1893 needsTrigger = false
1906 case 'no_tiered_compilation_innerloop':
1907 isDefaultTrigger = true
1910 case 'corefx_innerloop':
1911 if (configuration == 'Checked' || configuration == 'Release') {
1912 isDefaultTrigger = true
1922 println("Unknown os: ${os}");
1929 // editor brace matching: }
1931 case 'armel': // editor brace matching: {
1934 azureVMAgentPostBuildAction {
1935 agentPostBuildAction('Delete agent if the build was not successful (when idle).')
1942 if (scenario == 'innerloop') {
1943 if (configuration == 'Checked') {
1944 isDefaultTrigger = true
1951 // editor brace matching: }
1954 case 'arm64': // editor brace matching: {
1960 // Triggers on the non-flow jobs aren't necessary
1962 needsTrigger = false
1968 case 'no_tiered_compilation_innerloop':
1969 if (configuration == 'Checked') {
1970 isDefaultTrigger = true
1973 case 'crossgen_comparison':
1974 if (os == 'Ubuntu' && architecture == 'arm' && (configuration == 'Checked' || configuration == 'Release')) {
1975 isDefaultTrigger = true
1982 assert isArmWindowsScenario(scenario)
1984 // 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
1985 // the non-flow Build job. All others need a trigger on the flow job.
1986 def needsFlowJobTrigger = !(isNormalOrInnerloop && (configuration == 'Debug'))
1987 if (isFlowJob != needsFlowJobTrigger) {
1988 needsTrigger = false
1994 if (configuration == 'Debug') {
1995 // Add default PR trigger for Windows arm64 Debug builds. This is a build only -- no tests are run --
1996 // so the private test hardware is not used. Thus, it can be run by all users, not just arm64Users.
1997 // People in arm64Users will get both this and the Checked Build and Test job.
1998 isDefaultTrigger = true
1999 } else if (configuration == 'Checked') {
2000 isDefaultTrigger = true
2001 isArm64PrivateJob = true
2005 isArm64PrivateJob = true
2010 println("NYI os: ${os}");
2016 // editor brace matching: }
2017 case 'x86': // editor brace matching: {
2018 assert ((os == 'Windows_NT') || ((os == 'Ubuntu') && isNormalOrInnerloop))
2019 if (os == 'Ubuntu') {
2020 // Triggers on the non-flow jobs aren't necessary here
2022 needsTrigger = false
2026 // on-demand only for ubuntu x86
2027 contextString = "${os} ${architecture} ${configuration} Build"
2028 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}.*"
2033 case 'no_tiered_compilation_innerloop':
2034 isDefaultTrigger = true
2041 // editor brace matching: }
2042 case 'x64_arm64_altjit':
2043 case 'x86_arm_altjit':
2044 // Everything default
2048 println("Unknown architecture: ${architecture}");
2054 if (isArm64PrivateJob) {
2055 if (isDefaultTrigger) {
2056 Utilities.addDefaultPrivateGithubPRTriggerForBranch(job, branch, contextString, null, arm64Users)
2059 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
2063 if (isDefaultTrigger) {
2064 Utilities.addGithubPRTriggerForBranch(job, branch, contextString)
2067 Utilities.addGithubPRTriggerForBranch(job, branch, contextString, triggerString)
2073 def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR, def architecture, def configuration, def os, def isBuildOnly) {
2074 def buildCommands = []
2075 def osGroup = getOSGroup(os)
2076 def lowerConfiguration = configuration.toLowerCase()
2078 // Which set of tests to build? Innerloop tests build Pri-0.
2079 // Currently, we only generate asm diffs on Pri-0 tests, if we generate asm diffs on tests at all.
2080 // CoreFX testing skipts building tests altogether (done below).
2081 // All other scenarios build Pri-1 tests.
2083 if (isInnerloopTestScenario(scenario)) {
2087 def doCoreFxTesting = isCoreFxScenario(scenario)
2089 def buildCoreclrTests = true
2090 if (doCoreFxTesting || (scenario == 'pmi_asm_diffs')) {
2091 // These scenarios don't need the coreclr tests build.
2092 buildCoreclrTests = false
2095 // Calculate the build steps, archival, and xunit results
2097 case 'Windows_NT': // editor brace matching: {
2098 switch (architecture) {
2101 case 'x86_arm_altjit':
2102 case 'x64_arm64_altjit':
2103 def arch = architecture
2105 if (architecture == 'x86_arm_altjit') {
2108 else if (architecture == 'x64_arm64_altjit') {
2112 if (scenario == 'formatting') {
2113 buildCommands += "python -u tests\\scripts\\format.py -c %WORKSPACE% -o Windows_NT -a ${arch}"
2114 Utilities.addArchival(newJob, "format.patch", "", true, false)
2118 if (scenario == 'illink') {
2119 buildCommands += "tests\\scripts\\build_illink.cmd clone ${arch}"
2122 // If it is a release build for Windows, ensure PGO is used, else fail the build.
2123 if ((lowerConfiguration == 'release') &&
2124 (scenario in Constants.basicScenarios) &&
2125 (architecture != 'x86_arm_altjit') &&
2126 (architecture != 'x64_arm64_altjit')) {
2128 buildOpts += ' -enforcepgo'
2131 if (buildCoreclrTests) {
2132 buildOpts += " -priority=${priority}"
2134 buildOpts += ' skiptests';
2137 // Set __TestIntermediateDir to something short. If __TestIntermediateDir is already set, build-test.cmd will
2138 // output test binaries to that directory. If it is not set, the binaries are sent to a default directory whose name is about
2139 // 35 characters long.
2141 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${arch} ${buildOpts}"
2143 if (scenario == 'pmi_asm_diffs') {
2144 // Now, generate the layout. We don't have any tests, but we need to restore the packages before calling runtest.cmd.
2145 // Call build-test.cmd to do this. It will do a little more than we need, but that's ok.
2146 buildCommands += "build-test.cmd ${lowerConfiguration} ${arch} skipmanaged skipnative"
2147 buildCommands += "tests\\runtest.cmd ${lowerConfiguration} ${arch} GenerateLayoutOnly"
2149 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2150 buildCommands += "python -u %WORKSPACE%\\tests\\scripts\\run-pmi-diffs.py -arch ${arch} -ci_arch ${architecture} -build_type ${configuration}"
2153 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('_\\pmi\\asm', '.\\dasm.${os}.${architecture}.${configuration}.zip')\"";
2156 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.zip")
2161 def runtestArguments = ''
2162 def testOpts = 'collectdumps'
2164 if (isR2RScenario(scenario)) {
2166 // If this is a ReadyToRun scenario, pass 'crossgen' or 'crossgenaltjit'
2167 // to cause framework assemblies to be crossgen'ed. Pass 'runcrossgentests'
2168 // to cause the tests to be crossgen'ed.
2170 if ((architecture == 'x86_arm_altjit') || (architecture == 'x64_arm64_altjit')) {
2171 testOpts += ' crossgenaltjit protononjit.dll'
2173 testOpts += ' crossgen'
2176 testOpts += ' runcrossgentests'
2178 else if (scenario == 'jitdiff') {
2179 testOpts += ' jitdisasm crossgen'
2181 else if (scenario == 'ilrt') {
2182 testOpts += ' ilasmroundtrip'
2184 else if (isLongGc(scenario)) {
2185 testOpts += " ${scenario} sequential"
2187 else if (scenario == 'standalone_gc') {
2188 testOpts += ' gcname clrgc.dll'
2190 else if (scenario == 'illink') {
2191 testOpts += " link %WORKSPACE%\\linker\\linker\\bin\\netcore_Release\\netcoreapp2.0\\win10-${arch}\\publish\\illink.exe"
2194 // Default per-test timeout is 10 minutes. For stress modes and Debug scenarios, increase this
2195 // to 30 minutes (30 * 60 * 1000 = 180000). The "timeout" argument to runtest.cmd sets this, by
2196 // taking a timeout value in milliseconds. (Note that it sets the __TestTimeout environment variable,
2197 // which is read by the xunit harness.)
2198 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario) || (lowerConfiguration == 'debug'))
2200 def timeout = 1800000
2201 testOpts += " timeout ${timeout}"
2204 // If we are running a stress mode, we should write out the set of key
2205 // value env pairs to a file at this point and then we'll pass that to runtest.cmd
2207 def envScriptPath = ''
2208 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
2209 def buildCommandsStr = ''
2210 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
2211 buildCommandsStr += envScriptCreate(os, envScriptPath)
2213 if (isJitStressScenario(scenario)) {
2214 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
2216 else if (isR2RStressScenario(scenario)) {
2217 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.r2rStressScenarios[scenario], envScriptPath)
2220 if (architecture == 'x86_arm_altjit') {
2221 buildCommandsStr += envScriptAppendExistingScript(os, "%WORKSPACE%\\tests\\x86_arm_altjit.cmd", envScriptPath)
2222 testOpts += " altjitarch arm"
2224 else if (architecture == 'x64_arm64_altjit') {
2225 buildCommandsStr += envScriptAppendExistingScript(os, "%WORKSPACE%\\tests\\x64_arm64_altjit.cmd", envScriptPath)
2226 testOpts += " altjitarch arm64"
2229 envScriptFinalize(os, envScriptPath)
2231 // Note that buildCommands is an array of individually executed commands; we want all the commands used to
2232 // create the SetStressModes.bat script to be executed together, hence we accumulate them as strings
2233 // into a single script.
2234 buildCommands += buildCommandsStr
2236 else if (architecture == 'x86_arm_altjit') {
2237 envScriptPath = "%WORKSPACE%\\tests\\x86_arm_altjit.cmd"
2238 testOpts += " altjitarch arm"
2240 else if (architecture == 'x64_arm64_altjit') {
2241 envScriptPath = "%WORKSPACE%\\tests\\x64_arm64_altjit.cmd"
2242 testOpts += " altjitarch arm64"
2244 if (envScriptPath != '') {
2245 testOpts += " TestEnv ${envScriptPath}"
2248 runtestArguments = "${lowerConfiguration} ${arch} ${testOpts}"
2250 if (doCoreFxTesting) {
2251 if (scenario == 'corefx_innerloop') {
2252 // Create CORE_ROOT and testhost
2253 buildCommands += "build-test.cmd ${lowerConfiguration} ${arch} buildtesthostonly"
2254 buildCommands += "tests\\runtest.cmd ${runtestArguments} CoreFXTestsAll"
2256 // Archive and process (only) the test results
2257 Utilities.addArchival(newJob, "bin/Logs/**/testResults.xml")
2258 Utilities.addXUnitDotNETResults(newJob, "bin/Logs/**/testResults.xml")
2261 def workspaceRelativeFxRoot = "_/fx"
2262 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
2263 def fxBranch = getFxBranch(branch)
2265 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}"
2267 // Archive and process (only) the test results
2268 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2269 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2271 //Archive additional build stuff to diagnose why my attempt at fault injection isn't causing CI to fail
2272 Utilities.addArchival(newJob, "SetStressModes.bat", "", true, false)
2273 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/testhost/**", "", true, false)
2276 else if (isGcReliabilityFramework(scenario)) {
2277 buildCommands += "tests\\runtest.cmd ${runtestArguments} GenerateLayoutOnly"
2278 buildCommands += "tests\\scripts\\run-gc-reliability-framework.cmd ${arch} ${configuration}"
2281 buildCommands += "tests\\runtest.cmd ${runtestArguments}"
2283 } // end if (!isBuildOnly)
2285 if (!doCoreFxTesting) {
2286 // Run the rest of the build
2287 // Build the mscorlib for the other OS's
2288 buildCommands += "build.cmd ${lowerConfiguration} ${arch} linuxmscorlib"
2289 buildCommands += "build.cmd ${lowerConfiguration} ${arch} osxmscorlib"
2291 if (arch == 'x64') {
2292 buildCommands += "build.cmd ${lowerConfiguration} arm64 linuxmscorlib"
2295 // Zip up the tests directory so that we don't use so much space/time copying
2296 // 10s of thousands of files around.
2297 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')\"";
2299 if (!isJitStressScenario(scenario)) {
2300 // For Windows, pull full test results and test drops for x86/x64.
2301 // No need to pull for stress mode scenarios (downstream builds use the default scenario)
2302 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2305 if (scenario == 'jitdiff') {
2306 // retrieve jit-dasm output for base commit, and run jit-diff
2308 // if this is a build only job, we want to keep the default (build) artifacts for the flow job
2309 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${arch}.${configuration}/dasm/**")
2314 Utilities.addXUnitDotNETResults(newJob, 'bin/**/TestRun*.xml', true)
2320 assert isArmWindowsScenario(scenario)
2324 if (buildCoreclrTests) {
2325 buildOpts += " -priority=${priority}"
2327 buildOpts += ' skiptests'
2330 // This is now a build only job. Do not run tests. Use the flow job.
2331 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} ${buildOpts}"
2333 if (doCoreFxTesting) {
2336 // Set the stress mode variables; this is incorporated into the generated CoreFx RunTests.cmd files.
2337 def envScriptPath = ''
2338 def buildCommandsStr = ''
2339 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
2340 buildCommandsStr += envScriptCreate(os, envScriptPath)
2341 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
2342 envScriptFinalize(os, envScriptPath)
2343 buildCommands += buildCommandsStr
2345 def workspaceRelativeFxRootLinux = "_/fx"
2346 def workspaceRelativeFxRootWin = "_\\fx"
2347 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
2348 def fxBranch = getFxBranch(branch)
2350 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"
2352 // Zip up the CoreFx runtime and tests. We don't need the CoreCLR binaries; they have been copied to the CoreFX tree.
2353 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')\"";
2354 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('${workspaceRelativeFxRootWin}\\artifacts\\bin\\tests', '${workspaceRelativeFxRootWin}\\fxtests.zip')\"";
2356 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxruntime.zip")
2357 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxtests.zip")
2359 // Zip up the tests directory so that we don't use so much space/time copying
2360 // 10s of thousands of files around.
2361 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')\"";
2364 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2368 println("Unknown architecture: ${architecture}");
2373 // end case 'Windows_NT'; editor brace matching: }
2382 case 'Fedora24': // editor brace matching: {
2383 switch (architecture) {
2385 if (os == 'Ubuntu') {
2386 // build and PAL test
2387 def dockerImage = getDockerImageName(architecture, os, true)
2388 buildCommands += "docker run -i --rm -v \${WORKSPACE}:/opt/code -w /opt/code -e ROOTFS_DIR=/crossrootfs/x86 ${dockerImage} ./build.sh ${architecture} cross ${lowerConfiguration}"
2389 dockerImage = getDockerImageName(architecture, os, false)
2390 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"
2391 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2392 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2397 if (scenario == 'formatting') {
2398 buildCommands += "python tests/scripts/format.py -c \${WORKSPACE} -o Linux -a ${architecture}"
2399 Utilities.addArchival(newJob, "format.patch", "", true, false)
2403 if (scenario == 'pmi_asm_diffs') {
2404 buildCommands += "./build.sh ${lowerConfiguration} ${architecture} skiptests skipbuildpackages"
2405 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} generatelayoutonly"
2407 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2408 buildCommands += "python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration}"
2411 buildCommands += "tar -czf dasm.${os}.${architecture}.${configuration}.tgz ./_/pmi/asm"
2412 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.tgz")
2416 if (scenario == 'illink') {
2417 assert(os == 'Ubuntu')
2418 buildCommands += "./tests/scripts/build_illink.sh --clone --arch=${architecture}"
2421 if (!doCoreFxTesting) {
2422 // We run pal tests on all OS but generate mscorlib (and thus, nuget packages)
2423 // only on supported OS platforms.
2424 def bootstrapRid = Utilities.getBoostrapPublishRid(os)
2425 def bootstrapRidEnv = bootstrapRid != null ? "__PUBLISH_RID=${bootstrapRid} " : ''
2427 buildCommands += "${bootstrapRidEnv}./build.sh ${lowerConfiguration} ${architecture}"
2429 def testBuildOpts = ""
2430 if (priority == '1') {
2431 testBuildOpts = "priority1"
2434 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} ${testBuildOpts}"
2435 buildCommands += "src/pal/tests/palsuite/runpaltests.sh \${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration} \${WORKSPACE}/bin/paltestout"
2437 // Archive the bin/tests folder for *_tst jobs
2438 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
2439 buildCommands += "tar -czf ${testArtifactsTgzFileName} bin/tests/${osGroup}.${architecture}.${configuration}"
2440 Utilities.addArchival(newJob, "${testArtifactsTgzFileName}", "")
2442 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2445 if (scenario == 'corefx_innerloop') {
2446 assert os == 'Ubuntu' || 'OSX10.12'
2447 assert architecture == 'x64'
2449 buildCommands += "./build.sh ${lowerConfiguration} ${architecture} skiptests"
2450 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} generatetesthostonly"
2451 buildCommands += "./tests/runtest.sh ${lowerConfiguration} --corefxtestsall --testHostDir=\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/testhost/ --coreclr-src=\${WORKSPACE}"
2454 // Archive and process (only) the test results
2455 Utilities.addArchival(newJob, "bin/Logs/**/testResults.xml")
2456 Utilities.addXUnitDotNETResults(newJob, "bin/Logs/**/testResults.xml")
2459 // Corefx stress testing
2460 assert os == 'Ubuntu'
2461 assert architecture == 'x64'
2462 assert lowerConfiguration == 'checked'
2463 assert isJitStressScenario(scenario)
2466 buildCommands += "./build.sh ${lowerConfiguration} ${architecture}"
2468 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2470 def envScriptCmds = envScriptCreate(os, scriptFileName)
2471 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2472 envScriptCmds += envScriptFinalize(os, scriptFileName)
2473 buildCommands += envScriptCmds
2475 // Build and text corefx
2476 def workspaceRelativeFxRoot = "_/fx"
2477 def absoluteFxRoot = "\$WORKSPACE/${workspaceRelativeFxRoot}"
2478 def fxBranch = getFxBranch(branch)
2480 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}"
2482 // Archive and process (only) the test results
2483 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2484 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2489 // Emulator cross builds for ARM runs on Tizen currently
2490 assert os == 'Tizen'
2492 def arm_abi = "armel"
2493 def linuxCodeName = "tizen"
2495 // Unzip the Windows test binaries first. Exit with 0
2496 buildCommands += "unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/Windows_NT.x64.${configuration} || exit 0"
2498 // Unpack the corefx binaries
2499 buildCommands += "mkdir ./bin/CoreFxBinDir"
2500 buildCommands += "tar -xf ./artifacts/bin/build.tar.gz -C ./bin/CoreFxBinDir"
2502 // Call the ARM CI script to cross build and test using docker
2503 buildCommands += """./tests/scripts/arm32_ci_script.sh \\
2506 --linuxCodeName=${linuxCodeName} \\
2507 --buildConfig=${lowerConfiguration} \\
2508 --testRootDir=./bin/tests/Windows_NT.x64.${configuration} \\
2509 --coreFxBinDir=./bin/CoreFxBinDir \\
2510 --testDirFile=./tests/testsRunningInsideARM.txt"""
2512 // Basic archiving of the build, no pal tests
2513 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2517 // Non-Windows ARM cross builds on hardware run on Ubuntu only
2518 assert (os == 'Ubuntu') || (os == 'Ubuntu16.04')
2520 // Add some useful information to the log file. Ignore return codes.
2521 buildCommands += "uname -a || true"
2523 def additionalOpts = ""
2524 if (architecture == 'arm') {
2525 additionalOpts = "-e CAC_ROOTFS_DIR=/crossrootfs/x86"
2528 // Cross build the Ubuntu/arm product using docker with a docker image that contains the correct
2529 // Ubuntu cross-compilation toolset (running on a Ubuntu x64 host).
2530 // For CoreFX testing, we only need the product build; we don't need to generate the layouts. The product
2531 // build is then copied into the corefx layout by the run-corefx-test.py script. For CoreFX testing, we
2532 // ZIP up the generated CoreFX runtime and tests.
2534 def dockerImage = getDockerImageName(architecture, os, true)
2535 def dockerCmd = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} -e ROOTFS_DIR=/crossrootfs/${architecture} ${additionalOpts} ${dockerImage} "
2537 buildCommands += "${dockerCmd}\${WORKSPACE}/build.sh ${lowerConfiguration} ${architecture} cross"
2539 if (doCoreFxTesting) {
2540 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2542 def envScriptCmds = envScriptCreate(os, scriptFileName)
2543 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2544 envScriptCmds += envScriptFinalize(os, scriptFileName)
2545 buildCommands += envScriptCmds
2547 // Build and text corefx
2548 def workspaceRelativeFxRootLinux = "_/fx"
2549 def absoluteFxRoot = "\$WORKSPACE/${workspaceRelativeFxRootLinux}"
2550 def fxBranch = getFxBranch(branch)
2552 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"
2554 // Docker creates files with root permission, so we need to zip in docker also, or else we'll get permission errors.
2555 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeFxRootLinux}/fxruntime.zip ${workspaceRelativeFxRootLinux}/artifacts/bin/testhost/netcoreapp-Linux-Release-${architecture}"
2556 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeFxRootLinux}/fxtests.zip ${workspaceRelativeFxRootLinux}/artifacts/bin/tests"
2558 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxruntime.zip")
2559 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxtests.zip")
2561 else if (isCrossGenComparisonScenario(scenario)) {
2562 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross generatelayoutonly"
2564 def workspaceRelativeProductBinDir = "bin/Product/${osGroup}.${architecture}.${configuration}"
2565 def workspaceRelativeCoreLib = "${workspaceRelativeProductBinDir}/IL/System.Private.CoreLib.dll"
2566 def workspaceRelativeCoreRootDir = "bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root"
2567 def workspaceRelativeCrossGenComparisonScript = "tests/scripts/crossgen_comparison.py"
2568 def workspaceRelativeResultsDir = "_"
2569 def workspaceRelativeArtifactsArchive = "${os}.${architecture}.${configuration}.${scenario}.zip"
2570 def crossGenComparisonCmd = "python -u \${WORKSPACE}/${workspaceRelativeCrossGenComparisonScript} "
2571 getCrossArchitectures(os, architecture, scenario).each{ crossArch ->
2572 def crossGenExecutable = "\${WORKSPACE}/${workspaceRelativeProductBinDir}/${crossArch}/crossgen"
2573 def workspaceRelativeCrossArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${crossArch}_${architecture}.${configuration}"
2575 buildCommands += "${dockerCmd}mkdir -p \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2576 buildCommands += "${dockerCmd}${crossGenComparisonCmd}crossgen_corelib --crossgen ${crossGenExecutable} --il_corelib \${WORKSPACE}/${workspaceRelativeCoreLib} --result_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2577 buildCommands += "${dockerCmd}${crossGenComparisonCmd}crossgen_framework --crossgen ${crossGenExecutable} --core_root \${WORKSPACE}/${workspaceRelativeCoreRootDir} --result_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2579 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeArtifactsArchive} ${workspaceRelativeCoreLib} ${workspaceRelativeCoreRootDir} ${workspaceRelativeCrossGenComparisonScript} ${workspaceRelativeResultsDir}"
2580 Utilities.addArchival(newJob, "${workspaceRelativeArtifactsArchive}")
2582 else if (scenario == 'pmi_asm_diffs') {
2583 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross generatelayoutonly"
2585 // Pass `--skip_diffs` -- the actual diffs will be done on an arm machine in the test job. This is the build job.
2586 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2587 buildCommands += "python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} --skip_diffs"
2589 // ZIP what we created.
2590 buildCommands += "zip -r product.${os}.${architecture}.${lowerConfiguration}.zip ./bin/Product/Linux.${architecture}.${configuration}"
2591 buildCommands += "zip -r product.baseline.${os}.${architecture}.${lowerConfiguration}.zip ./_/pmi/base/bin/Product/Linux.${architecture}.${configuration}"
2592 buildCommands += "zip -r coreroot.${os}.${architecture}.${lowerConfiguration}.zip ./bin/tests/Linux.${architecture}.${configuration}/Tests/Core_Root"
2593 buildCommands += "zip -r coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.zip ./_/pmi/base/bin/tests/Linux.${architecture}.${configuration}/Tests/Core_Root"
2595 // Archive the built artifacts
2596 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")
2599 // Then, using the same docker image, build the tests and generate the CORE_ROOT layout.
2601 def testBuildOpts = ""
2602 if (priority == '1') {
2603 testBuildOpts = "priority1"
2606 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross ${testBuildOpts}"
2608 // 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)
2609 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
2610 buildCommands += "tar -czf ${testArtifactsTgzFileName} bin/tests/${osGroup}.${architecture}.${configuration}"
2612 Utilities.addArchival(newJob, "${testArtifactsTgzFileName}", "")
2615 // Archive the build logs from both product and test builds.
2616 Utilities.addArchival(newJob, "bin/Logs/*.log,bin/Logs/*.wrn,bin/Logs/*.err", "")
2618 // We need to clean up the build machines; the docker build leaves newly built files with root permission, which
2619 // the cleanup task in Jenkins can't remove.
2622 azureVMAgentPostBuildAction {
2623 agentPostBuildAction('Delete agent after build execution (when idle).')
2629 println("Unknown architecture: ${architecture}");
2634 // editor brace matching: }
2636 println("Unknown os: ${os}");
2641 return buildCommands
2644 // Determine if we should generate a job for the given parameters. This is for non-flow jobs: either build and test, or build only.
2645 // Returns true if the job should be generated.
2646 def static shouldGenerateJob(def scenario, def isPR, def architecture, def configuration, def os, def isBuildOnly)
2648 // The various "innerloop" jobs are only available as PR triggered.
2651 if (isInnerloopTestScenario(scenario)) {
2655 if (scenario == 'corefx_innerloop') {
2660 // Tizen is only supported for armem architecture
2661 if (os == 'Tizen' && architecture != 'armem') {
2665 // Filter based on architecture.
2667 switch (architecture) {
2669 if ((os != 'Windows_NT') && (os != 'Ubuntu')) {
2674 if ((os != 'Windows_NT') && (os != 'Ubuntu16.04')) {
2679 if (os != 'Tizen') {
2683 case 'x86_arm_altjit':
2684 case 'x64_arm64_altjit':
2685 if (os != 'Windows_NT') {
2690 if ((os != 'Windows_NT') && (os != 'Ubuntu')) {
2695 // Everything implemented
2698 println("Unknown architecture: ${architecture}")
2703 // Which (Windows) build only jobs are required?
2705 def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
2708 switch (architecture) {
2711 // We use build only jobs for Windows arm/arm64 cross-compilation corefx testing, so we need to generate builds for that.
2712 if (!isCoreFxScenario(scenario)) {
2718 if (!isNormalOrInnerloop) {
2727 // Filter based on scenario.
2729 if (isJitStressScenario(scenario)) {
2730 if (configuration != 'Checked') {
2734 def isEnabledOS = (os == 'Windows_NT') ||
2735 (os == 'Ubuntu' && (architecture == 'x64') && isCoreFxScenario(scenario)) ||
2736 (os == 'Ubuntu' && architecture == 'arm') ||
2737 (os == 'Ubuntu16.04' && architecture == 'arm64')
2742 switch (architecture) {
2744 case 'x86_arm_altjit':
2745 case 'x64_arm64_altjit':
2749 // x86 ubuntu: no stress modes
2750 if (os == 'Ubuntu') {
2757 // We use build only jobs for Windows arm/arm64 cross-compilation corefx testing, so we need to generate builds for that.
2758 // No "regular" Windows arm corefx jobs, e.g.
2759 // For Ubuntu arm corefx testing, we use regular jobs (not "build only" since only Windows has "build only", and
2760 // the Ubuntu arm "regular" jobs don't run tests anyway).
2761 if (os == 'Windows_NT') {
2762 if (! (isBuildOnly && isCoreFxScenario(scenario)) ) {
2767 if (!isCoreFxScenario(scenario)) {
2774 // armem: no stress jobs for ARM emulator.
2778 else if (isR2RScenario(scenario)) {
2779 if (os != 'Windows_NT') {
2783 if (isR2RBaselineScenario(scenario)) {
2784 // no need for Debug scenario; Checked is sufficient
2785 if (configuration != 'Checked' && configuration != 'Release') {
2789 else if (isR2RStressScenario(scenario)) {
2790 // Stress scenarios only run with Checked builds, not Release (they would work with Debug, but be slow).
2791 if (configuration != 'Checked') {
2796 switch (architecture) {
2799 // Windows arm/arm64 ready-to-run jobs use flow jobs and test jobs, but depend on "normal" (not R2R specific) build jobs.
2806 else if (isCrossGenComparisonScenario(scenario)) {
2807 return shouldGenerateCrossGenComparisonJob(os, architecture, configuration, scenario)
2813 // The ilrt build isn't necessary except for Windows_NT2003. Non-Windows NT uses
2814 // the default scenario build
2815 if (os != 'Windows_NT') {
2819 if (architecture != 'x64') {
2823 if (configuration != 'Release') {
2828 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2831 if (architecture != 'x64') {
2834 if (configuration != 'Checked') {
2840 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2843 if (architecture != 'x64') {
2846 if (configuration != 'Release') {
2850 case 'gc_reliability_framework':
2851 case 'standalone_gc':
2852 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2856 if (architecture != 'x64') {
2860 if (configuration != 'Release' && configuration != 'Checked') {
2864 // We only run Windows and Ubuntu x64 Checked for formatting right now
2866 if (os != 'Windows_NT' && os != 'Ubuntu') {
2869 if (architecture != 'x64') {
2872 if (configuration != 'Checked') {
2877 if (os != 'Windows_NT' && (os != 'Ubuntu' || architecture != 'x64')) {
2880 if (architecture != 'x64' && architecture != 'x86') {
2888 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly)) {
2892 case 'corefx_innerloop':
2893 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2896 if (architecture != 'x64') {
2900 case 'pmi_asm_diffs':
2901 if (configuration != 'Checked') {
2904 if (architecture == 'armem') {
2907 // Currently, we don't support pmi_asm_diffs for Windows arm/arm64. We don't have a dotnet CLI available to
2908 // build jitutils. The jobs are not in validArmWindowsScenarios.
2909 if ((os == 'Windows_NT') && (architecture == 'arm' || architecture == 'arm64')) {
2912 // Currently, no support for Linux x86.
2913 if ((os != 'Windows_NT') && (architecture == 'x86')) {
2918 println("Unknown scenario: ${scenario}")
2924 // For altjit, don't do any scenarios that don't change compilation. That is, scenarios that only change
2925 // runtime behavior, not compile-time behavior, are not interesting.
2926 switch (architecture) {
2927 case 'x86_arm_altjit':
2928 case 'x64_arm64_altjit':
2929 if (isGCStressRelatedTesting(scenario)) {
2937 // The job was not filtered out, so we should generate it!
2941 Constants.allScenarios.each { scenario ->
2942 [true, false].each { isPR ->
2943 Constants.architectureList.each { architecture ->
2944 Constants.configurationList.each { configuration ->
2945 Constants.osList.each { os ->
2946 // If the OS is Windows_NT_BuildOnly, set the isBuildOnly flag to true
2947 // and reset the os to Windows_NT
2948 def isBuildOnly = false
2949 if (os == 'Windows_NT_BuildOnly') {
2954 if (!shouldGenerateJob(scenario, isPR, architecture, configuration, os, isBuildOnly)) {
2959 def jobName = getJobName(configuration, architecture, os, scenario, isBuildOnly)
2960 def folderName = getJobFolder(scenario)
2962 // Create the new job
2963 def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folderName)) {}
2965 addToViews(newJob, false, isPR, architecture, os, configuration, scenario) // isFlowJob == false
2967 setJobMachineAffinity(architecture, os, true, false, false, newJob) // isBuildJob = true, isTestJob = false, isFlowJob = false
2969 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
2970 addTriggers(newJob, branch, isPR, architecture, os, configuration, scenario, false, isBuildOnly) // isFlowJob==false
2971 setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly)
2973 // Copy Windows build test binaries and corefx build artifacts for Linux cross build for armem.
2974 // We don't use a flow job for this, but we do depend on there being existing builds with these
2975 // artifacts produced.
2976 if ((architecture == 'armem') && (os == 'Tizen')) {
2977 // Define the Windows Tests and Corefx build job names
2978 def lowerConfiguration = configuration.toLowerCase()
2979 def WindowsTestsName = projectFolder + '/' +
2980 Utilities.getFullJobName(project,
2981 getJobName(lowerConfiguration, 'x64' , 'windows_nt', 'normal', true),
2983 def fxBranch = getFxBranch(branch)
2984 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' +
2985 Utilities.getFolderName(fxBranch)
2987 def arm_abi = 'armel'
2988 def corefx_os = 'tizen'
2990 // Let's use release CoreFX to test checked CoreCLR,
2991 // because we do not generate checked CoreFX in CoreFX CI yet.
2992 def corefx_lowerConfiguration = lowerConfiguration
2993 if (lowerConfiguration == 'checked') {
2994 corefx_lowerConfiguration = 'release'
2997 // Copy the Windows test binaries and the Corefx build binaries
3000 copyArtifacts(WindowsTestsName) {
3001 includePatterns('bin/tests/tests.zip')
3003 latestSuccessful(true)
3006 copyArtifacts("${corefxFolder}/${corefx_os}_${arm_abi}_cross_${corefx_lowerConfiguration}") {
3007 includePatterns('artifacts/bin/build.tar.gz')
3009 latestSuccessful(true)
3016 def buildCommands = calculateBuildCommands(newJob, scenario, branch, isPR, architecture, configuration, os, isBuildOnly)
3020 if (os == 'Windows_NT') {
3021 buildCommands.each { buildCommand ->
3022 batchFile(buildCommand)
3026 buildCommands.each { buildCommand ->
3039 // Create a Windows ARM/ARM64 test job that will be used by a flow job.
3040 // Returns the newly created job.
3041 def static CreateWindowsArmTestJob(def dslFactory, def project, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3043 def osGroup = getOSGroup(os)
3044 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
3046 def jobFolder = getJobFolder(scenario)
3047 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
3049 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
3053 // Set up the copies
3055 // Coreclr build we are trying to test
3057 // ** NOTE ** This will, correctly, overwrite the CORE_ROOT from the Windows test archive
3059 copyArtifacts(inputCoreCLRBuildName) {
3060 excludePatterns('**/testResults.xml', '**/*.ni.dll')
3062 buildNumber('${CORECLR_BUILD}')
3066 if (isCoreFxScenario(scenario)) {
3068 // Only arm/arm64 supported for corefx testing now.
3069 assert architecture == 'arm' || architecture == 'arm64'
3071 // Unzip CoreFx runtime
3072 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}')\"")
3074 // Unzip CoreFx tests.
3075 batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('_\\fx\\fxtests.zip', '_\\fx\\artifacts\\bin\\tests')\"")
3077 // Add the script to run the corefx tests
3078 def corefx_runtime_path = "%WORKSPACE%\\_\\fx\\artifacts\\bin\\testhost\\netcoreapp-Windows_NT-Release-${architecture}"
3079 def corefx_tests_dir = "%WORKSPACE%\\_\\fx\\artifacts\\bin\\tests"
3080 def corefx_exclusion_file = "%WORKSPACE%\\tests\\${architecture}\\corefx_test_exclusions.txt"
3081 batchFile("call %WORKSPACE%\\tests\\scripts\\run-corefx-tests.bat ${corefx_runtime_path} ${corefx_tests_dir} ${corefx_exclusion_file} ${architecture}")
3083 } else { // !isCoreFxScenario(scenario)
3086 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}')\"")
3088 def buildCommands = ""
3090 def coreRootLocation = "%WORKSPACE%\\bin\\tests\\Windows_NT.${architecture}.${configuration}\\Tests\\Core_Root"
3091 def addEnvVariable = { variable, value -> buildCommands += "set ${variable}=${value}\r\n"}
3092 def addCommand = { cmd -> buildCommands += "${cmd}\r\n"}
3094 // Make sure Command Extensions are enabled. Used so %ERRORLEVEL% is available.
3095 addCommand("SETLOCAL ENABLEEXTENSIONS")
3098 addEnvVariable("CORE_ROOT", coreRootLocation)
3099 addEnvVariable("COMPlus_NoGuiOnAssert", "1")
3100 addEnvVariable("COMPlus_ContinueOnAssert", "0")
3102 // If we are running a stress mode, we'll set those variables as well
3103 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
3104 def stressValues = null
3105 if (isJitStressScenario(scenario)) {
3106 stressValues = Constants.jitStressModeScenarios[scenario]
3109 stressValues = Constants.r2rStressScenarios[scenario]
3112 stressValues.each { key, value ->
3113 addEnvVariable(key, value)
3117 if (isR2RScenario(scenario)) {
3118 // Crossgen the framework assemblies.
3119 buildCommands += """
3120 @for %%F in (%CORE_ROOT%\\*.dll) do @call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nxF
3121 @goto skip_PrecompileAssembly
3124 @REM Skip mscorlib since it is already precompiled.
3125 @if /I "%3" == "mscorlib.dll" exit /b 0
3126 @if /I "%3" == "mscorlib.ni.dll" exit /b 0
3128 "%CORE_ROOT%\\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" %2 >nul 2>nul
3129 @if "%errorlevel%" == "-2146230517" (
3130 echo %2 is not a managed assembly.
3131 ) else if "%errorlevel%" == "-2146234344" (
3132 echo %2 is not a managed assembly.
3133 ) else if %errorlevel% neq 0 (
3134 echo Unable to precompile %2
3140 :skip_PrecompileAssembly
3143 // Set RunCrossGen variable to cause test wrappers to invoke their logic to run
3144 // crossgen on tests before running them.
3145 addEnvVariable("RunCrossGen", "true")
3146 } // isR2RScenario(scenario)
3149 // Do not run generate layout. It will delete the correct CORE_ROOT, and we do not have a correct product
3150 // dir to copy from.
3151 def runtestCommand = "%WORKSPACE%\\tests\\runtest.cmd ${architecture} ${configuration} skipgeneratelayout"
3153 addCommand("${runtestCommand}")
3155 // Use the smarty errorlevel as the script errorlevel.
3156 addCommand("exit /b %errorlevel%")
3158 batchFile(buildCommands)
3159 } // non-corefx testing
3163 if (!isCoreFxScenario(scenario)) {
3164 Utilities.addXUnitDotNETResults(newJob, 'bin/**/TestRun*.xml', true)
3170 // Create a test job not covered by the "Windows ARM" case that will be used by a flow job.
3171 // E.g., non-Windows tests.
3172 // Returns the newly created job.
3173 def static CreateOtherTestJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3175 def lowerConfiguration = configuration.toLowerCase()
3177 def isUbuntuArm64Job = ((os == "Ubuntu16.04") && (architecture == 'arm64'))
3178 def isUbuntuArm32Job = ((os == "Ubuntu") && (architecture == 'arm'))
3179 def isUbuntuArmJob = isUbuntuArm32Job || isUbuntuArm64Job
3181 def doCoreFxTesting = isCoreFxScenario(scenario)
3182 def isPmiAsmDiffsScenario = (scenario == 'pmi_asm_diffs')
3184 def workspaceRelativeFxRootLinux = "_/fx" // only used for CoreFX testing
3186 def osGroup = getOSGroup(os)
3187 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
3190 def useServerGC = false
3192 // Enable Server GC for Ubuntu PR builds
3193 // REVIEW: why? Does this apply to all architectures? Why only PR?
3194 if (os == 'Ubuntu' && isPR) {
3195 testOpts += ' --useServerGC'
3199 if (isR2RScenario(scenario)) {
3201 testOpts += ' --crossgen --runcrossgentests'
3203 if (scenario == 'r2r_jitstress1') {
3204 testOpts += ' --jitstress=1'
3206 else if (scenario == 'r2r_jitstress2') {
3207 testOpts += ' --jitstress=2'
3209 else if (scenario == 'r2r_jitstress1_tiered') {
3210 testOpts += ' --jitstress=1'
3212 else if (scenario == 'r2r_jitstress2_tiered') {
3213 testOpts += ' --jitstress=2'
3215 else if (scenario == 'r2r_jitstressregs1') {
3216 testOpts += ' --jitstressregs=1'
3218 else if (scenario == 'r2r_jitstressregs2') {
3219 testOpts += ' --jitstressregs=2'
3221 else if (scenario == 'r2r_jitstressregs3') {
3222 testOpts += ' --jitstressregs=3'
3224 else if (scenario == 'r2r_jitstressregs4') {
3225 testOpts += ' --jitstressregs=4'
3227 else if (scenario == 'r2r_jitstressregs8') {
3228 testOpts += ' --jitstressregs=8'
3230 else if (scenario == 'r2r_jitstressregs0x10') {
3231 testOpts += ' --jitstressregs=0x10'
3233 else if (scenario == 'r2r_jitstressregs0x80') {
3234 testOpts += ' --jitstressregs=0x80'
3236 else if (scenario == 'r2r_jitstressregs0x1000') {
3237 testOpts += ' --jitstressregs=0x1000'
3239 else if (scenario == 'r2r_jitminopts') {
3240 testOpts += ' --jitminopts'
3242 else if (scenario == 'r2r_jitforcerelocs') {
3243 testOpts += ' --jitforcerelocs'
3245 else if (scenario == 'r2r_gcstress15') {
3246 testOpts += ' --gcstresslevel=0xF'
3249 else if (scenario == 'jitdiff') {
3250 testOpts += ' --jitdisasm --crossgen'
3252 else if (scenario == 'illink') {
3253 testOpts += ' --link=\$WORKSPACE/linker/linker/bin/netcore_Release/netcoreapp2.0/ubuntu-x64/publish/illink'
3255 else if (isLongGc(scenario)) {
3256 // Long GC tests behave very poorly when they are not
3257 // the only test running (many of them allocate until OOM).
3258 testOpts += ' --sequential'
3260 // A note - runtest.sh does have "--long-gc" and "--gcsimulator" options
3261 // for running long GC and GCSimulator tests, respectively. We don't use them
3262 // here because using a playlist file produces much more readable output on the CI machines
3263 // and reduces running time.
3265 // The Long GC playlist contains all of the tests that are
3266 // going to be run. The GCSimulator playlist contains all of
3267 // the GC simulator tests.
3268 if (scenario == 'longgc') {
3269 testOpts += ' --long-gc --playlist=./tests/longRunningGcTests.txt'
3271 else if (scenario == 'gcsimulator') {
3272 testOpts += ' --gcsimulator --playlist=./tests/gcSimulatorTests.txt'
3275 else if (isGcReliabilityFramework(scenario)) {
3276 testOpts += ' --build-overlay-only'
3278 else if (scenario == 'standalone_gc') {
3279 if (osGroup == 'OSX') {
3280 testOpts += ' --gcname=libclrgc.dylib'
3282 else if (osGroup == 'Linux') {
3283 testOpts += ' --gcname=libclrgc.so'
3286 println("Unexpected OS group: ${osGroup} for os ${os}")
3291 def jobFolder = getJobFolder(scenario)
3292 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
3294 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
3298 // Set up the copies
3300 // Coreclr build we are trying to test
3302 // HACK: the Ubuntu arm64 copyArtifacts Jenkins plug-in is ridiculously slow (45 minutes to
3303 // 1.5 hours for this step). Instead, directly use wget, which is fast (1 minute).
3305 if (!isUbuntuArm64Job) {
3306 copyArtifacts(inputCoreCLRBuildName) {
3307 excludePatterns('**/testResults.xml', '**/*.ni.dll')
3309 buildNumber('${CORECLR_BUILD}')
3314 if (isUbuntuArmJob) {
3315 // Add some useful information to the log file. Ignore return codes.
3316 shell("uname -a || true")
3319 if (isUbuntuArm64Job) {
3320 // Copy the required artifacts directly, using wget, e.g.:
3322 // https://ci.dot.net/job/dotnet_coreclr/job/master/job/arm64_cross_checked_ubuntu16.04_innerloop_prtest/16/artifact/testnativebin.checked.zip
3323 // https://ci.dot.net/job/dotnet_coreclr/job/master/job/arm64_cross_checked_ubuntu16.04_innerloop_prtest/16/artifact/tests.checked.zip
3325 // parameterized as:
3327 // https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/job/${inputJobName}/${CORECLR_BUILD}/artifact/testnativebin.checked.zip
3328 // https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/job/${inputJobName}/${CORECLR_BUILD}/artifact/tests.checked.zip
3330 // CoreFX example artifact URLs:
3332 // 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
3333 // 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
3335 // Note that the source might be in a "jitstress" folder.
3337 // Use `--progress=dot:giga` to display some progress output, but limit it in the log file.
3339 // Use `--directory-prefix=_/fx` to specify where to put the corefx files (to match what other platforms do). Use this instead of `-O`.
3341 shell("echo \"Using wget instead of the Jenkins copy artifacts plug-in to copy artifacts from ${inputCoreCLRBuildName}\"")
3343 def mungedProjectName = Utilities.getFolderName(project)
3344 def mungedBranchName = Utilities.getFolderName(branch)
3346 def doCrossGenComparison = isCrossGenComparisonScenario(scenario)
3347 def inputCoreCLRBuildScenario = isInnerloopTestScenario(scenario) ? 'innerloop' : 'normal'
3348 if (isPmiAsmDiffsScenario || doCoreFxTesting || doCrossGenComparison) {
3349 // These depend on unique builds for each scenario
3350 inputCoreCLRBuildScenario = scenario
3352 def sourceJobName = getJobName(configuration, architecture, os, inputCoreCLRBuildScenario, false)
3353 def inputJobName = Utilities.getFullJobName(sourceJobName, isPR)
3355 // Need to add the sub-folder if necessary.
3356 def inputJobPath = "job/${inputJobName}"
3357 def folderName = getJobFolder(inputCoreCLRBuildScenario)
3358 if (folderName != '') {
3359 inputJobPath = "job/${folderName}/job/${inputJobName}"
3362 def inputUrlRoot = "https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/${inputJobPath}/\${CORECLR_BUILD}/artifact"
3364 if (isPmiAsmDiffsScenario) {
3365 def workspaceRelativeRootLinux = "_/pmi"
3366 shell("mkdir -p ${workspaceRelativeRootLinux}")
3367 shell("wget --progress=dot:giga ${inputUrlRoot}/product.${os}.${architecture}.${lowerConfiguration}.zip")
3368 shell("wget --progress=dot:giga ${inputUrlRoot}/product.baseline.${os}.${architecture}.${lowerConfiguration}.zip")
3369 shell("wget --progress=dot:giga ${inputUrlRoot}/coreroot.${os}.${architecture}.${lowerConfiguration}.zip")
3370 shell("wget --progress=dot:giga ${inputUrlRoot}/coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.zip")
3372 else if (doCoreFxTesting) {
3373 shell("mkdir -p ${workspaceRelativeFxRootLinux}")
3374 shell("wget --progress=dot:giga --directory-prefix=${workspaceRelativeFxRootLinux} ${inputUrlRoot}/${workspaceRelativeFxRootLinux}/fxtests.zip")
3375 shell("wget --progress=dot:giga --directory-prefix=${workspaceRelativeFxRootLinux} ${inputUrlRoot}/${workspaceRelativeFxRootLinux}/fxruntime.zip")
3378 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
3379 shell("wget --progress=dot:giga ${inputUrlRoot}/${testArtifactsTgzFileName}")
3383 if (architecture == 'x86') {
3384 shell("mkdir ./bin/CoreFxNative")
3386 def fxBranch = getFxBranch(branch)
3387 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' + Utilities.getFolderName(fxBranch)
3389 copyArtifacts("${corefxFolder}/ubuntu16.04_x86_release") {
3390 includePatterns('artifacts/bin/build.tar.gz')
3391 targetDirectory('bin/CoreFxNative')
3393 latestSuccessful(true)
3397 shell("mkdir ./bin/CoreFxBinDir")
3398 shell("tar -xf ./bin/CoreFxNative/artifacts/bin/build.tar.gz -C ./bin/CoreFxBinDir")
3401 if (isPmiAsmDiffsScenario) {
3402 // TODO: add back "-q" when we know it works
3403 shell("unzip -o ./product.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3404 shell("unzip -o ./product.baseline.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3405 shell("unzip -o ./coreroot.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3406 shell("unzip -o ./coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3408 // CoreFX testing downloads the CoreFX tests, not the coreclr tests. Also, unzip the built CoreFX layout/runtime directories.
3409 else if (doCoreFxTesting) {
3410 shell("unzip -q -o ${workspaceRelativeFxRootLinux}/fxtests.zip || exit 0")
3411 shell("unzip -q -o ${workspaceRelativeFxRootLinux}/fxruntime.zip || exit 0")
3414 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
3415 shell("tar -xzf ./${testArtifactsTgzFileName} || exit 0") // extracts to ./bin/tests/${osGroup}.${architecture}.${configuration}
3418 // Execute the tests
3419 def runDocker = isNeedDocker(architecture, os, false)
3420 def dockerPrefix = ""
3423 def dockerImage = getDockerImageName(architecture, os, false)
3424 dockerPrefix = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} "
3425 dockerCmd = dockerPrefix + "${dockerImage} "
3428 // If we are running a stress mode, we'll set those variables first.
3429 // For CoreFX, the stress variables are already built into the CoreFX test build per-test wrappers.
3430 if (!doCoreFxTesting && isJitStressScenario(scenario)) {
3431 def scriptFileName = "\${WORKSPACE}/set_stress_test_env.sh"
3432 def envScriptCmds = envScriptCreate(os, scriptFileName)
3433 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
3434 envScriptCmds += envScriptFinalize(os, scriptFileName)
3435 shell("${envScriptCmds}")
3436 testOpts += " --test-env=${scriptFileName}"
3439 // setup-stress-dependencies.sh, invoked by runtest.sh to download the coredistools package, depends on the "dotnet"
3440 // tool downloaded by the "init-tools.sh" script. However, it only invokes setup-stress-dependencies.sh for x64. The
3441 // coredistools package is used by GCStress on x86 and x64 to disassemble code to determine instruction boundaries.
3442 // On arm/arm64, it is not required as determining instruction boundaries is trivial.
3443 if (isGCStressRelatedTesting(scenario)) {
3444 if (architecture == 'x64') {
3445 shell('./init-tools.sh')
3449 if (isPmiAsmDiffsScenario) {
3451 python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} --skip_baseline_build""")
3453 shell("zip -r dasm.${os}.${architecture}.${configuration}.zip ./_/pmi/asm")
3455 else if (doCoreFxTesting) {
3457 \${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""")
3460 def runScript = "${dockerCmd}./tests/runtest.sh"
3464 ${lowerConfiguration} \\
3465 --testRootDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}\" \\
3466 --coreOverlayDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root\" \\
3467 --limitedDumpGeneration ${testOpts}""")
3470 if (isGcReliabilityFramework(scenario)) {
3471 // runtest.sh doesn't actually execute the reliability framework - do it here.
3474 dockerCmd = dockerPrefix + "-e COMPlus_gcServer=1 ${dockerImage} "
3477 shell("export COMPlus_gcServer=1")
3481 shell("${dockerCmd}./tests/scripts/run-gc-reliability-framework.sh ${architecture} ${configuration}")
3486 // Experimental: If on Ubuntu 14.04, then attempt to pull in crash dump links
3487 if (os in ['Ubuntu']) {
3488 SummaryBuilder summaries = new SummaryBuilder()
3489 summaries.addLinksSummaryFromFile('Crash dumps from this run:', 'dumplings.txt')
3490 summaries.emit(newJob)
3493 if (isPmiAsmDiffsScenario) {
3495 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.zip")
3497 else if (doCoreFxTesting) {
3498 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/artifacts/bin/**/testResults.xml")
3499 if ((os == "Ubuntu") && (architecture == 'arm')) {
3500 // We have a problem with the xunit plug-in, where it is consistently failing on Ubuntu arm32 test result uploading with this error:
3502 // [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
3504 // We haven't been able to identify the reason. So, do not add xunit parsing of the test data in this scenario.
3505 // This is tracked by: https://github.com/dotnet/coreclr/issues/19447.
3508 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRootLinux}/artifacts/bin/**/testResults.xml")
3512 Utilities.addXUnitDotNETResults(newJob, '**/coreclrtests.xml')
3518 def static CreateNonWindowsCrossGenComparisonTestJob(def dslFactory, def project, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3520 assert isCrossGenComparisonScenario(scenario)
3522 def osGroup = getOSGroup(os)
3523 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
3525 def workspaceRelativeResultsDir = "_"
3526 def workspaceRelativeNativeArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${architecture}_${architecture}.${configuration}"
3528 def jobFolder = getJobFolder(scenario)
3529 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
3531 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
3534 def workspaceRelativeArtifactsArchive = "${os}.${architecture}.${configuration}.${scenario}.zip"
3537 copyArtifacts(inputCoreCLRBuildName) {
3538 includePatterns("${workspaceRelativeArtifactsArchive}")
3540 buildNumber('${CORECLR_BUILD}')
3544 shell("unzip -o ${workspaceRelativeArtifactsArchive} || exit 0")
3546 def workspaceRelativeCoreLib = "bin/Product/${osGroup}.${architecture}.${configuration}/IL/System.Private.CoreLib.dll"
3547 def workspaceRelativeCoreRootDir = "bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root"
3548 def workspaceRelativeCrossGenComparisonScript = "tests/scripts/crossgen_comparison.py"
3549 def workspaceRelativeCrossGenExecutable = "${workspaceRelativeCoreRootDir}/crossgen"
3551 def crossGenComparisonCmd = "python -u \${WORKSPACE}/${workspaceRelativeCrossGenComparisonScript} "
3552 def crossGenExecutable = "\${WORKSPACE}/${workspaceRelativeCrossGenExecutable}"
3554 shell("mkdir -p ${workspaceRelativeNativeArchResultDir}")
3555 shell("${crossGenComparisonCmd}crossgen_corelib --crossgen ${crossGenExecutable} --il_corelib \${WORKSPACE}/${workspaceRelativeCoreLib} --result_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir}")
3556 shell("${crossGenComparisonCmd}crossgen_framework --crossgen ${crossGenExecutable} --core_root \${WORKSPACE}/${workspaceRelativeCoreRootDir} --result_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir}")
3558 getCrossArchitectures(os, architecture, scenario).each{ crossArch ->
3559 def workspaceRelativeCrossArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${crossArch}_${architecture}.${configuration}"
3560 shell("${crossGenComparisonCmd}compare --base_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir} --diff_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}")
3565 Utilities.addArchival(newJob, "${workspaceRelativeNativeArchResultDir}/**")
3566 getCrossArchitectures(os, architecture, scenario).each{ crossArch ->
3567 def workspaceRelativeCrossArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${crossArch}_${architecture}.${configuration}"
3568 Utilities.addArchival(newJob, "${workspaceRelativeCrossArchResultDir}/**")
3574 // Create a test job that will be used by a flow job.
3575 // Returns the newly created job.
3576 // 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,
3577 // and we want the views to be the minimal set of "top-level" jobs that represent all work.
3578 def static CreateTestJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3580 def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
3583 if (windowsArmJob) {
3584 newJob = CreateWindowsArmTestJob(dslFactory, project, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3586 else if (isCrossGenComparisonScenario(scenario)) {
3587 newJob = CreateNonWindowsCrossGenComparisonTestJob(dslFactory, project, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3590 newJob = CreateOtherTestJob(dslFactory, project, branch, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3593 setJobMachineAffinity(architecture, os, false, true, false, newJob) // isBuildJob = false, isTestJob = true, isFlowJob = false
3595 if (scenario == 'jitdiff') {
3596 def osGroup = getOSGroup(os)
3597 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/dasm/**")
3600 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
3601 setJobTimeout(newJob, isPR, architecture, configuration, scenario, false)
3606 // Create a flow job to tie together a build job with the given test job.
3607 // Returns the new flow job.
3608 def static CreateFlowJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def fullTestJobName, def inputCoreCLRBuildName)
3610 // Windows CoreCLR build and Linux CoreCLR build (in parallel) ->
3611 // Linux CoreCLR test
3612 def flowJobName = getJobName(configuration, architecture, os, scenario, false) + "_flow"
3613 def jobFolder = getJobFolder(scenario)
3615 def newFlowJob = dslFactory.buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, jobFolder)) {
3617 coreclrBuildJob = build(params, '${inputCoreCLRBuildName}')
3619 // And then build the test build
3620 build(params + [CORECLR_BUILD: coreclrBuildJob.build.number], '${fullTestJobName}')
3623 JobReport.Report.addReference(inputCoreCLRBuildName)
3624 JobReport.Report.addReference(fullTestJobName)
3626 addToViews(newFlowJob, true, isPR, architecture, os, configuration, scenario) // isFlowJob = true
3628 setJobMachineAffinity(architecture, os, false, false, true, newFlowJob) // isBuildJob = false, isTestJob = false, isFlowJob = true
3630 Utilities.standardJobSetup(newFlowJob, project, isPR, "*/${branch}")
3631 addTriggers(newFlowJob, branch, isPR, architecture, os, configuration, scenario, true, false) // isFlowJob==true, isWindowsBuildOnlyJob==false
3636 // Determine if we should generate a flow job for the given parameters.
3637 // Returns true if the job should be generated.
3638 def static shouldGenerateFlowJob(def scenario, def isPR, def architecture, def configuration, def os)
3640 // The various "innerloop" jobs are only available as PR triggered.
3643 if (isInnerloopTestScenario(scenario)) {
3647 if (scenario == 'corefx_innerloop') {
3652 // Filter based on OS and architecture.
3654 switch (architecture) {
3656 if (os != "Ubuntu" && os != "Windows_NT") {
3661 if (os != "Ubuntu16.04" && os != "Windows_NT") {
3666 if (os != "Ubuntu") {
3671 if (!(os in Constants.crossList)) {
3674 if (os == "Windows_NT") {
3679 case 'x86_arm_altjit':
3680 case 'x64_arm64_altjit':
3684 println("Unknown architecture: ${architecture}")
3689 def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
3691 // Filter based on scenario in OS.
3693 if (os == 'Windows_NT') {
3694 assert architecture == 'arm' || architecture == 'arm64'
3695 if (!isArmWindowsScenario(scenario)) {
3698 if (isNormalOrInnerloop && (configuration == 'Debug')) {
3699 // The arm32/arm64 Debug configuration for innerloop/normal scenario is a special case: it does a build only, and no test run.
3700 // To do that, it doesn't require a flow job.
3706 if (architecture == 'arm') {
3707 if (!(scenario in Constants.validLinuxArmScenarios)) {
3711 else if (architecture == 'arm64') {
3712 if (!(scenario in Constants.validLinuxArm64Scenarios)) {
3716 else if (architecture == 'x86') {
3717 // Linux/x86 only want innerloop and default test
3718 if (!isNormalOrInnerloop) {
3722 else if (architecture == 'x64') {
3723 // Linux/x64 corefx testing doesn't need a flow job; the "build" job runs run-corefx-tests.py which
3724 // builds and runs the corefx tests. Other Linux/x64 flow jobs are required to get the test
3725 // build from a Windows machine.
3726 if (isCoreFxScenario(scenario)) {
3732 // For CentOS, we only want Checked/Release builds.
3733 if (os == 'CentOS7.1') {
3734 if (configuration != 'Checked' && configuration != 'Release') {
3737 if (!isNormalOrInnerloop && !isR2RScenario(scenario)) {
3742 // For RedHat and Debian, we only do Release builds.
3743 else if (os == 'RHEL7.2' || os == 'Debian8.4') {
3744 if (configuration != 'Release') {
3747 if (!isNormalOrInnerloop) {
3752 // Next, filter based on scenario.
3754 if (isJitStressScenario(scenario)) {
3755 if (configuration != 'Checked') {
3759 else if (isR2RBaselineScenario(scenario)) {
3760 if (configuration != 'Checked' && configuration != 'Release') {
3764 else if (isR2RStressScenario(scenario)) {
3765 if (configuration != 'Checked') {
3769 else if (isCrossGenComparisonScenario(scenario)) {
3770 return shouldGenerateCrossGenComparisonJob(os, architecture, configuration, scenario)
3778 // Long GC tests take a long time on non-Release builds
3779 // ilrt is also Release only
3780 if (configuration != 'Release') {
3786 if (configuration != 'Checked') {
3791 case 'gc_reliability_framework':
3792 case 'standalone_gc':
3793 if (configuration != 'Release' && configuration != 'Checked') {
3802 if (os != 'Windows_NT' && os != 'Ubuntu') {
3812 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, false)) {
3817 case 'pmi_asm_diffs':
3818 if (configuration != 'Checked') {
3821 // No need for flow job except for Linux arm/arm64
3822 if ((os != 'Windows_NT') && (architecture != 'arm') && (architecture != 'arm64')) {
3827 case 'corefx_innerloop':
3828 // No flow job needed
3832 println("Unknown scenario: ${scenario}")
3838 // The job was not filtered out, so we should generate it!
3842 // Create jobs requiring flow jobs. This includes x64 non-Windows, arm/arm64 Ubuntu, and arm/arm64 Windows.
3843 Constants.allScenarios.each { scenario ->
3844 [true, false].each { isPR ->
3845 Constants.architectureList.each { architecture ->
3846 Constants.configurationList.each { configuration ->
3847 Constants.osList.each { os ->
3849 if (!shouldGenerateFlowJob(scenario, isPR, architecture, configuration, os)) {
3853 def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
3854 def doCoreFxTesting = isCoreFxScenario(scenario)
3855 def doCrossGenComparison = isCrossGenComparisonScenario(scenario)
3856 def isPmiAsmDiffsScenario = (scenario == 'pmi_asm_diffs')
3858 // Figure out the job name of the CoreCLR build the test will depend on.
3860 def inputCoreCLRBuildScenario = isInnerloopTestScenario(scenario) ? 'innerloop' : 'normal'
3861 def inputCoreCLRBuildIsBuildOnly = false
3862 if (doCoreFxTesting || isPmiAsmDiffsScenario) {
3863 // Every CoreFx test depends on its own unique build.
3864 inputCoreCLRBuildScenario = scenario
3865 if (windowsArmJob) {
3866 // Only Windows ARM corefx jobs use "build only" jobs. Others, such as Ubuntu ARM corefx, use "regular" jobs.
3867 inputCoreCLRBuildIsBuildOnly = true
3870 else if (doCrossGenComparison) {
3871 inputCoreCLRBuildScenario = scenario
3874 def inputCoreCLRFolderName = getJobFolder(inputCoreCLRBuildScenario)
3875 def inputCoreCLRBuildName = projectFolder + '/' +
3876 Utilities.getFullJobName(project, getJobName(configuration, architecture, os, inputCoreCLRBuildScenario, inputCoreCLRBuildIsBuildOnly), isPR, inputCoreCLRFolderName)
3878 // =============================================================================================
3879 // Create the test job
3880 // =============================================================================================
3882 def testJob = CreateTestJob(this, project, branch, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3884 // =============================================================================================
3885 // Create a build flow to join together the build and tests required to run this test.
3886 // =============================================================================================
3888 if (os == 'RHEL7.2' || os == 'Debian8.4') {
3889 // Do not create the flow job for RHEL jobs.
3893 def fullTestJobName = projectFolder + '/' + testJob.name
3894 def flowJob = CreateFlowJob(this, project, branch, architecture, os, configuration, scenario, isPR, fullTestJobName, inputCoreCLRBuildName)
3902 JobReport.Report.generateJobReport(out)
3904 // Make the call to generate the help job
3905 Utilities.createHelperJob(this, project, branch,
3906 "Welcome to the ${project} Repository", // This is prepended to the help message
3907 "Have a nice day!") // This is appended to the help message. You might put known issues here.
3909 Utilities.addCROSSCheck(this, project, branch)