1 // Import the utility functionality.
3 import jobs.generation.*
5 // The input project name (e.g. dotnet/coreclr)
6 def project = GithubProject
7 // The input branch name (e.g. master)
8 def branch = GithubBranchName
9 def projectFolder = Utilities.getFolderName(project) + '/' + Utilities.getFolderName(branch)
11 // Create a folder for JIT stress jobs and associated folder views
13 Utilities.addStandardFolderView(this, 'jitstress', project)
15 // Create a folder for testing via illink
17 Utilities.addStandardFolderView(this, 'illink', project)
19 def static getOSGroup(def os) {
20 def osGroupMap = ['Ubuntu' : 'Linux',
21 'Ubuntu16.04' : 'Linux',
22 'Ubuntu16.10' : 'Linux',
24 'Debian8.4' : 'Linux',
26 'CentOS7.1' : 'Linux',
29 'Windows_NT' : 'Windows_NT']
30 def osGroup = osGroupMap.get(os, null)
31 assert osGroup != null : "Could not find os group for ${os}"
35 // We use this class (vs variables) so that the static functions can access data here.
38 // We have very limited Windows ARM64 hardware (used for ARM/ARM64 testing) and Linux/arm32 and Linux/arm64 hardware.
39 // So only allow certain branches to use it.
40 def static LimitedHardwareBranches = [
43 // Innerloop build OS's
44 // The Windows_NT_BuildOnly OS is a way to speed up the Non-Windows builds by avoiding
45 // test execution in the build flow runs. It generates the exact same build
46 // as Windows_NT but without running the tests.
52 'Windows_NT_BuildOnly',
60 def static crossList = [
68 // This is a set of JIT stress modes combined with the set of variables that
69 // need to be set to actually enable that stress mode. The key of the map is the stress mode and
70 // the values are the environment variables
71 def static jitStressModeScenarios = [
72 'minopts' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JITMinOpts' : '1'],
73 'tieredcompilation' : ['COMPlus_TieredCompilation' : '1'], // this can be removed once tiered compilation is on by default
74 'no_tiered_compilation' : ['COMPlus_TieredCompilation' : '0'],
75 'no_tiered_compilation_innerloop': ['COMPlus_TieredCompilation' : '0'],
76 'forcerelocs' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_ForceRelocs' : '1'],
77 'jitstress1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '1'],
78 'jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2'],
79 'jitstress1_tiered' : ['COMPlus_TieredCompilation' : '1', 'COMPlus_JitStress' : '1'],
80 'jitstress2_tiered' : ['COMPlus_TieredCompilation' : '1', 'COMPlus_JitStress' : '2'],
81 'jitstressregs1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '1'],
82 'jitstressregs2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '2'],
83 'jitstressregs3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '3'],
84 'jitstressregs4' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '4'],
85 'jitstressregs8' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '8'],
86 'jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x10'],
87 'jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x80'],
88 'jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x1000'],
89 'jitstress2_jitstressregs1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '1'],
90 'jitstress2_jitstressregs2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '2'],
91 'jitstress2_jitstressregs3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '3'],
92 'jitstress2_jitstressregs4' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '4'],
93 'jitstress2_jitstressregs8' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '8'],
94 'jitstress2_jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x10'],
95 'jitstress2_jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x80'],
96 'jitstress2_jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x1000'],
97 'tailcallstress' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_TailcallStress' : '1'],
98 'jitsse2only' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableAVX' : '0', 'COMPlus_EnableSSE3_4' : '0'],
99 'jitnosimd' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_FeatureSIMD' : '0'],
100 'jitincompletehwintrinsic' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1'],
101 'jitx86hwintrinsicnoavx' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_EnableAVX' : '0'], // testing the legacy SSE encoding
102 'jitx86hwintrinsicnoavx2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_EnableAVX2' : '0'], // testing SNB/IVB
103 'jitx86hwintrinsicnosimd' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_FeatureSIMD' : '0'], // match "jitnosimd", may need to remove after decoupling HW intrinsic from FeatureSIMD
104 'jitnox86hwintrinsic' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_EnableSSE' : '0' , 'COMPlus_EnableSSE2' : '0' , 'COMPlus_EnableSSE3' : '0' , 'COMPlus_EnableSSSE3' : '0' , 'COMPlus_EnableSSE41' : '0' , 'COMPlus_EnableSSE42' : '0' , 'COMPlus_EnableAVX' : '0' , 'COMPlus_EnableAVX2' : '0' , 'COMPlus_EnableAES' : '0' , 'COMPlus_EnableBMI1' : '0' , 'COMPlus_EnableBMI2' : '0' , 'COMPlus_EnableFMA' : '0' , 'COMPlus_EnableLZCNT' : '0' , 'COMPlus_EnablePCLMULQDQ' : '0' , 'COMPlus_EnablePOPCNT' : '0'],
105 'corefx_baseline' : ['COMPlus_TieredCompilation' : '0'], // corefx baseline
106 'corefx_minopts' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JITMinOpts' : '1'],
107 'corefx_tieredcompilation' : ['COMPlus_TieredCompilation' : '1'], // this can be removed once tiered compilation is on by default
108 'corefx_jitstress1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '1'],
109 'corefx_jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStress' : '2'],
110 'corefx_jitstressregs1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '1'],
111 'corefx_jitstressregs2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '2'],
112 'corefx_jitstressregs3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '3'],
113 'corefx_jitstressregs4' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '4'],
114 'corefx_jitstressregs8' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '8'],
115 'corefx_jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x10'],
116 'corefx_jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x80'],
117 'corefx_jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_JitStressRegs' : '0x1000'],
118 'gcstress0x3' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0x3'],
119 'gcstress0xc' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC'],
120 'zapdisable' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0'],
121 'heapverify1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_HeapVerify' : '1'],
122 'gcstress0xc_zapdisable' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0'],
123 'gcstress0xc_zapdisable_jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0', 'COMPlus_JitStress' : '2'],
124 'gcstress0xc_zapdisable_heapverify1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0', 'COMPlus_HeapVerify' : '1'],
125 'gcstress0xc_jitstress1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_JitStress' : '1'],
126 'gcstress0xc_jitstress2' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_JitStress' : '2'],
127 'gcstress0xc_minopts_heapverify1' : ['COMPlus_TieredCompilation' : '0', 'COMPlus_GCStress' : '0xC', 'COMPlus_JITMinOpts' : '1', 'COMPlus_HeapVerify' : '1']
130 // This is a set of ReadyToRun stress scenarios
131 def static r2rStressScenarios = [
132 'r2r_jitstress1' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStress": "1"],
133 'r2r_jitstress2' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStress": "2"],
134 'r2r_jitstress1_tiered' : ['COMPlus_TieredCompilation' : '1', "COMPlus_JitStress": "1"],
135 'r2r_jitstress2_tiered' : ['COMPlus_TieredCompilation' : '1', "COMPlus_JitStress": "2"],
136 'r2r_jitstressregs1' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "1"],
137 'r2r_jitstressregs2' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "2"],
138 'r2r_jitstressregs3' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "3"],
139 'r2r_jitstressregs4' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "4"],
140 'r2r_jitstressregs8' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "8"],
141 'r2r_jitstressregs0x10' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "0x10"],
142 'r2r_jitstressregs0x80' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "0x80"],
143 'r2r_jitstressregs0x1000' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JitStressRegs": "0x1000"],
144 'r2r_jitminopts' : ['COMPlus_TieredCompilation' : '0', "COMPlus_JITMinOpts": "1"],
145 'r2r_jitforcerelocs' : ['COMPlus_TieredCompilation' : '0', "COMPlus_ForceRelocs": "1"],
146 'r2r_gcstress15' : ['COMPlus_TieredCompilation' : '0', "COMPlus_GCStress": "0xF"],
147 'r2r_no_tiered_compilation' : ['COMPlus_TieredCompilation' : '0'],
150 // This is the basic set of scenarios
151 def static basicScenarios = [
159 // 'jitdiff', // jitdiff is currently disabled, until someone spends the effort to make it fully work
161 'gc_reliability_framework',
164 'crossgen_comparison',
167 def static allScenarios = basicScenarios + r2rStressScenarios.keySet() + jitStressModeScenarios.keySet()
169 // Valid PR trigger combinations.
170 def static prTriggeredValidInnerLoopCombos = [
188 'Windows_NT_BuildOnly': [
227 // A set of scenarios that are valid for arm/arm64 tests run on hardware. This is a map from valid scenario name
228 // to Tests.lst file categories to exclude.
230 // This list should contain a subset of the scenarios from `allScenarios`. Please keep this in the same order as that,
231 // and with the same values, with some commented out, for easier maintenance.
233 // Note that some scenarios that are commented out should be enabled, but haven't yet been.
235 def static validArmWindowsScenarios = [
245 // 'gc_reliability_framework'
247 // 'corefx_innerloop'
248 // 'crossgen_comparison'
252 'r2r_jitstress1_tiered',
253 'r2r_jitstress2_tiered',
254 'r2r_jitstressregs1',
255 'r2r_jitstressregs2',
256 'r2r_jitstressregs3',
257 'r2r_jitstressregs4',
258 'r2r_jitstressregs8',
259 'r2r_jitstressregs0x10',
260 'r2r_jitstressregs0x80',
261 'r2r_jitstressregs0x1000',
263 'r2r_jitforcerelocs',
265 'r2r_no_tiered_compilation',
268 'no_tiered_compilation',
269 'no_tiered_compilation_innerloop',
282 'jitstressregs0x1000',
283 'jitstress2_jitstressregs1',
284 'jitstress2_jitstressregs2',
285 'jitstress2_jitstressregs3',
286 'jitstress2_jitstressregs4',
287 'jitstress2_jitstressregs8',
288 'jitstress2_jitstressregs0x10',
289 'jitstress2_jitstressregs0x80',
290 'jitstress2_jitstressregs0x1000',
292 // 'jitsse2only' // Only relevant to xarch
293 'jitnosimd', // Only interesting on platforms where SIMD support exists.
294 // 'jitincompletehwintrinsic'
295 // 'jitx86hwintrinsicnoavx'
296 // 'jitx86hwintrinsicnoavx2'
297 // 'jitx86hwintrinsicnosimd'
298 // 'jitnox86hwintrinsic'
299 'corefx_baseline', // corefx tests don't use smarty
300 'corefx_minopts', // corefx tests don't use smarty
301 'corefx_tieredcompilation', // corefx tests don't use smarty
302 'corefx_jitstress1', // corefx tests don't use smarty
303 'corefx_jitstress2', // corefx tests don't use smarty
304 'corefx_jitstressregs1', // corefx tests don't use smarty
305 'corefx_jitstressregs2', // corefx tests don't use smarty
306 'corefx_jitstressregs3', // corefx tests don't use smarty
307 'corefx_jitstressregs4', // corefx tests don't use smarty
308 'corefx_jitstressregs8', // corefx tests don't use smarty
309 'corefx_jitstressregs0x10', // corefx tests don't use smarty
310 'corefx_jitstressregs0x80', // corefx tests don't use smarty
311 'corefx_jitstressregs0x1000', // corefx tests don't use smarty
316 'gcstress0xc_zapdisable',
317 'gcstress0xc_zapdisable_jitstress2',
318 'gcstress0xc_zapdisable_heapverify1',
319 'gcstress0xc_jitstress1',
320 'gcstress0xc_jitstress2',
321 'gcstress0xc_minopts_heapverify1',
324 // NOTE: the following scenarios are not defined in the 'allScenarios' list! Is this a bug?
327 'minopts_zapdisable',
328 'gcstress0x3_jitstress1',
329 'gcstress0x3_jitstress2',
330 'gcstress0x3_jitstressregs1',
331 'gcstress0x3_jitstressregs2',
332 'gcstress0x3_jitstressregs3',
333 'gcstress0x3_jitstressregs4',
334 'gcstress0x3_jitstressregs8',
335 'gcstress0x3_jitstressregs0x10',
336 'gcstress0x3_jitstressregs0x80',
337 'gcstress0x3_jitstressregs0x1000',
338 'gcstress0xc_jitstressregs1',
339 'gcstress0xc_jitstressregs2',
340 'gcstress0xc_jitstressregs3',
341 'gcstress0xc_jitstressregs4',
342 'gcstress0xc_jitstressregs8',
343 'gcstress0xc_jitstressregs0x10',
344 'gcstress0xc_jitstressregs0x80',
345 'gcstress0xc_jitstressregs0x1000'
348 def static validLinuxArmScenarios = [
358 // 'gc_reliability_framework'
360 // 'corefx_innerloop'
361 'crossgen_comparison',
365 'r2r_jitstress1_tiered',
366 'r2r_jitstress2_tiered',
367 'r2r_jitstressregs1',
368 'r2r_jitstressregs2',
369 'r2r_jitstressregs3',
370 'r2r_jitstressregs4',
371 'r2r_jitstressregs8',
372 'r2r_jitstressregs0x10',
373 'r2r_jitstressregs0x80',
374 'r2r_jitstressregs0x1000',
376 'r2r_jitforcerelocs',
378 'r2r_no_tiered_compilation',
381 'no_tiered_compilation',
382 'no_tiered_compilation_innerloop',
395 'jitstressregs0x1000',
396 'jitstress2_jitstressregs1',
397 'jitstress2_jitstressregs2',
398 'jitstress2_jitstressregs3',
399 'jitstress2_jitstressregs4',
400 'jitstress2_jitstressregs8',
401 'jitstress2_jitstressregs0x10',
402 'jitstress2_jitstressregs0x80',
403 'jitstress2_jitstressregs0x1000',
405 // 'jitsse2only' // Only relevant to xarch
406 // 'jitnosimd' // Only interesting on platforms where SIMD support exists.
407 // 'jitincompletehwintrinsic'
408 // 'jitx86hwintrinsicnoavx'
409 // 'jitx86hwintrinsicnoavx2'
410 // 'jitx86hwintrinsicnosimd'
411 // 'jitnox86hwintrinsic'
414 'corefx_tieredcompilation',
417 'corefx_jitstressregs1',
418 'corefx_jitstressregs2',
419 'corefx_jitstressregs3',
420 'corefx_jitstressregs4',
421 'corefx_jitstressregs8',
422 'corefx_jitstressregs0x10',
423 'corefx_jitstressregs0x80',
424 'corefx_jitstressregs0x1000',
429 'gcstress0xc_zapdisable',
430 'gcstress0xc_zapdisable_jitstress2',
431 'gcstress0xc_zapdisable_heapverify1',
432 'gcstress0xc_jitstress1',
433 'gcstress0xc_jitstress2',
434 'gcstress0xc_minopts_heapverify1'
437 def static validLinuxArm64Scenarios = [
447 // 'gc_reliability_framework'
449 // 'corefx_innerloop'
450 'crossgen_comparison',
454 'r2r_jitstress1_tiered',
455 'r2r_jitstress2_tiered',
456 'r2r_jitstressregs1',
457 'r2r_jitstressregs2',
458 'r2r_jitstressregs3',
459 'r2r_jitstressregs4',
460 'r2r_jitstressregs8',
461 'r2r_jitstressregs0x10',
462 'r2r_jitstressregs0x80',
463 'r2r_jitstressregs0x1000',
465 'r2r_jitforcerelocs',
467 'r2r_no_tiered_compilation',
470 'no_tiered_compilation',
471 'no_tiered_compilation_innerloop',
484 'jitstressregs0x1000',
485 'jitstress2_jitstressregs1',
486 'jitstress2_jitstressregs2',
487 'jitstress2_jitstressregs3',
488 'jitstress2_jitstressregs4',
489 'jitstress2_jitstressregs8',
490 'jitstress2_jitstressregs0x10',
491 'jitstress2_jitstressregs0x80',
492 'jitstress2_jitstressregs0x1000',
494 // 'jitsse2only' // Only relevant to xarch
495 'jitnosimd', // Only interesting on platforms where SIMD support exists.
496 // 'jitincompletehwintrinsic'
497 // 'jitx86hwintrinsicnoavx'
498 // 'jitx86hwintrinsicnoavx2'
499 // 'jitx86hwintrinsicnosimd'
500 // 'jitnox86hwintrinsic'
503 'corefx_tieredcompilation',
506 'corefx_jitstressregs1',
507 'corefx_jitstressregs2',
508 'corefx_jitstressregs3',
509 'corefx_jitstressregs4',
510 'corefx_jitstressregs8',
511 'corefx_jitstressregs0x10',
512 'corefx_jitstressregs0x80',
513 'corefx_jitstressregs0x1000',
518 'gcstress0xc_zapdisable',
519 'gcstress0xc_zapdisable_jitstress2',
520 'gcstress0xc_zapdisable_heapverify1',
521 'gcstress0xc_jitstress1',
522 'gcstress0xc_jitstress2',
523 'gcstress0xc_minopts_heapverify1'
526 def static configurationList = ['Debug', 'Checked', 'Release']
528 // This is the set of architectures
529 // Some of these are pseudo-architectures:
530 // armem -- ARM builds/runs using an emulator. Used for Tizen runs.
531 def static architectureList = ['arm', 'armem', 'arm64', 'x64', 'x86']
533 // This set of architectures that cross build on Windows and run on Windows ARM64 hardware.
534 def static armWindowsCrossArchitectureList = ['arm', 'arm64']
537 // **************************************************************
538 // Create some specific views
540 // These aren't using the Utilities.addStandardFolderView() function, because that creates
541 // views based on a single regular expression. These views will be generated by adding a
542 // specific set of jobs to them.
544 // Utilities.addStandardFolderView() also creates a lot of additional stuff around the
545 // view, like "Build Statistics", "Job Statistics", "Unstable Jobs". Until it is determined
546 // those are required, don't add them (which simplifies the view pages, as well).
547 // **************************************************************
550 def static MergeJobView = null
551 def static PeriodicJobView = null
552 def static ArchitectureViews = [:]
553 def static OSViews = [:]
556 // MergeJobView: include all jobs that execute when a PR change is merged.
557 Views.MergeJobView = listView('Merge') {
570 // PeriodicJobView: include all jobs that execute on a schedule
571 Views.PeriodicJobView = listView('Periodic') {
584 // Create a view for non-PR jobs for each architecture.
585 Constants.architectureList.each { architecture ->
586 Views.ArchitectureViews[architecture] = listView(architecture) {
600 // Create a view for non-PR jobs for each OS.
601 Constants.osList.each { os ->
602 // Don't create one for the special 'Windows_NT_BuildOnly'
603 if (os == 'Windows_NT_BuildOnly') {
606 Views.OSViews[os] = listView(os) {
620 def static addToMergeView(def job) {
621 Views.MergeJobView.with {
628 def static addToPeriodicView(def job) {
629 Views.PeriodicJobView.with {
636 def static addToViews(def job, def isFlowJob, def isPR, def architecture, def os, def configuration, def scenario) {
638 // No views want PR jobs currently.
642 // 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
643 // "top-level" jobs. Build only jobs are such jobs.
644 if (os == 'Windows_NT_BuildOnly') {
649 // For non-flow jobs, which ones are only used by flow jobs?
650 if ((architecture == 'arm') || (architecture == 'arm64')) {
651 if (isCoreFxScenario(scenario)) {
652 // We have corefx-specific scenario builds for each of the runs, but these are driven by flow jobs.
656 // We're left with the basic normal/innerloop builds. We might want to remove these from the views also, if desired.
657 // However, there are a few, like the Debug Build, that is build only, not "Build and Test", that we should leave.
661 // Add to architecture view.
662 Views.ArchitectureViews[architecture].with {
669 Views.OSViews[os].with {
676 def static addPeriodicTriggerHelper(def job, String cronString, boolean alwaysRuns = false) {
677 addToPeriodicView(job)
678 Utilities.addPeriodicTrigger(job, cronString, alwaysRuns)
681 def static addGithubPushTriggerHelper(def job) {
683 Utilities.addGithubPushTrigger(job)
687 def static setMachineAffinity(def job, def os, def architecture, def options = null) {
688 assert os instanceof String
689 assert architecture instanceof String
691 def armArches = ['arm', 'armem', 'arm64']
693 if (!(architecture in armArches)) {
694 assert options == null
695 Utilities.setMachineAffinity(job, os, 'latest-or-auto')
700 // This is an arm(64) job.
702 // There are several options.
706 // Arm32 (Build) -> latest-arm64
707 // |-> os == "Windows_NT" && (architecture == "arm") && options['use_arm64_build_machine'] == true
708 // Arm32 (Test) -> arm64-windows_nt
709 // |-> os == "Windows_NT" && (architecture == "arm") && options['use_arm64_build_machine'] == false
711 // Arm64 (Build) -> latest-arm64
712 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == true
713 // Arm64 (Test) -> arm64-windows_nt
714 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == false
718 // Arm32 emulator (Build, Test) -> arm-cross-latest
719 // |-> os == "Tizen" && (architecture == "armem")
721 // Arm32 hardware (Flow) -> Ubuntu 16.04 latest-or-auto (don't use limited arm hardware)
722 // |-> os == "Ubuntu" && (architecture == "arm") && options['is_flow_job'] == true
723 // Arm32 hardware (Build) -> Ubuntu 16.04 latest-or-auto
724 // |-> os == "Ubuntu" && (architecture == "arm") && options['is_build_job'] == true
725 // Arm32 hardware (Test) -> Helix ubuntu.1404.arm32.open queue
726 // |-> os == "Ubuntu" && (architecture == "arm")
728 // Arm64 (Build) -> arm64-cross-latest
729 // |-> os != "Windows_NT" && architecture == "arm64" && options['is_build_job'] == true
730 // Arm64 (Test) -> Helix Ubuntu.1604.Arm64.Open queue
731 // |-> os != "Windows_NT" && architecture == "arm64"
733 // Note: we are no longer using Jenkins tags "arm64-huge-page-size", "arm64-small-page-size".
734 // Support for Linux arm64 large page size has been removed for now, as it wasn't being used.
736 // Note: we are no longer using Jenkins tag 'latest-arm64' for arm/arm64 Windows build machines. Instead,
737 // we are using public VS2017 arm/arm64 tools in a VM from Helix.
739 // This has to be a arm arch
740 assert architecture in armArches
741 if (os == "Windows_NT") {
742 // arm32/arm64 Windows jobs share the same machines for now
743 def isBuild = options['use_arm64_build_machine'] == true
745 if (isBuild == true) {
747 label('Windows.10.Amd64.ClientRS4.DevEx.Open')
750 Utilities.setMachineAffinity(job, 'windows.10.arm64.open')
753 assert os != 'Windows_NT'
755 if (architecture == 'armem') {
756 // arm emulator (Tizen). Build and test on same machine,
759 Utilities.setMachineAffinity(job, 'Ubuntu', 'arm-cross-latest')
762 // arm/arm64 Ubuntu on hardware.
763 assert architecture == 'arm' || architecture == 'arm64'
764 def isFlow = (options != null) && (options['is_flow_job'] == true)
765 def isBuild = (options != null) && (options['is_build_job'] == true)
766 if (isFlow || isBuild) {
767 // arm/arm64 Ubuntu build machine. Build uses docker, so the actual host OS is not
768 // very important. Therefore, use latest or auto. Flow jobs don't need to use arm hardware.
769 Utilities.setMachineAffinity(job, 'Ubuntu16.04', 'latest-or-auto')
771 // arm/arm64 Ubuntu test machine. Specify the Helix queue name here.
772 if (architecture == 'arm64') {
773 assert os == 'Ubuntu16.04'
775 label('Ubuntu.1604.Arm64.Open')
779 assert os == 'Ubuntu'
781 label('ubuntu.1404.arm32.open')
789 // setJobMachineAffinity: compute the machine affinity options for a job,
790 // then set the job with those affinity options.
791 def static setJobMachineAffinity(def architecture, def os, def isBuildJob, def isTestJob, def isFlowJob, def job)
793 assert (isBuildJob && !isTestJob && !isFlowJob) ||
794 (!isBuildJob && isTestJob && !isFlowJob) ||
795 (!isBuildJob && !isTestJob && isFlowJob)
797 def affinityOptions = null
798 def affinityArchitecture = architecture
800 if (os == "Windows_NT") {
801 if (architecture in Constants.armWindowsCrossArchitectureList) {
803 affinityOptions = [ "use_arm64_build_machine" : true ]
804 } else if (isTestJob) {
805 affinityOptions = [ "use_arm64_build_machine" : false ]
806 } else if (isFlowJob) {
807 // For the flow jobs set the machine affinity as x64
808 affinityArchitecture = 'x64'
813 if ((architecture == 'arm64') || (architecture == 'arm')) {
815 affinityOptions = ['is_build_job': true]
816 } else if (isFlowJob) {
817 affinityOptions = ['is_flow_job': true]
822 setMachineAffinity(job, os, affinityArchitecture, affinityOptions)
825 def static isGCStressRelatedTesting(def scenario) {
826 // The 'r2r_gcstress15' scenario is a basic scenario.
827 // Detect it and make it a GCStress related.
828 if (scenario == 'r2r_gcstress15')
833 def gcStressTestEnvVars = [ 'COMPlus_GCStress', 'COMPlus_ZapDisable', 'COMPlus_HeapVerify']
834 def scenarioName = scenario.toLowerCase()
835 def isGCStressTesting = false
836 Constants.jitStressModeScenarios[scenario].each{ k, v ->
837 if (k in gcStressTestEnvVars) {
838 isGCStressTesting = true;
841 return isGCStressTesting
844 def static isCoreFxScenario(def scenario) {
845 def corefx_prefix = 'corefx_'
846 if (scenario.length() < corefx_prefix.length()) {
849 return scenario.substring(0,corefx_prefix.length()) == corefx_prefix
852 def static isR2RBaselineScenario(def scenario) {
853 return (scenario == 'r2r')
856 def static isR2RStressScenario(def scenario) {
857 return Constants.r2rStressScenarios.containsKey(scenario)
860 def static isR2RScenario(def scenario) {
861 return isR2RBaselineScenario(scenario) || isR2RStressScenario(scenario)
864 def static isJitStressScenario(def scenario) {
865 return Constants.jitStressModeScenarios.containsKey(scenario)
868 def static isLongGc(def scenario) {
869 return (scenario == 'longgc' || scenario == 'gcsimulator')
872 def static isJitDiff(def scenario) {
873 return (scenario == 'jitdiff')
876 def static isGcReliabilityFramework(def scenario) {
877 return (scenario == 'gc_reliability_framework')
880 def static isArmWindowsScenario(def scenario) {
881 return Constants.validArmWindowsScenarios.contains(scenario)
884 def static isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly) {
885 if (isBuildOnly == true) {
886 os = 'Windows_NT_BuildOnly'
889 def validOsPrTriggerArchConfigs = Constants.prTriggeredValidInnerLoopCombos[os]
890 if (validOsPrTriggerArchConfigs != null) {
891 def validOsPrTriggerConfigs = validOsPrTriggerArchConfigs[architecture]
892 if (validOsPrTriggerConfigs != null) {
893 if (configuration in validOsPrTriggerConfigs) {
902 // This means the job builds and runs the 'innerloop' test set. This does not mean the job is
903 // scheduled with a default PR trigger despite the correlation being true at the moment.
904 def static isInnerloopTestScenario(def scenario) {
905 return (scenario == 'innerloop' || scenario == 'no_tiered_compilation_innerloop')
908 def static isCrossGenComparisonScenario(def scenario) {
909 return (scenario == 'crossgen_comparison')
912 def static shouldGenerateCrossGenComparisonJob(def os, def architecture, def configuration, def scenario) {
913 assert isCrossGenComparisonScenario(scenario)
914 return ((os == 'Ubuntu' && architecture == 'arm') || (os == 'Ubuntu16.04' && architecture == 'arm64')) && (configuration == 'Checked' || configuration == 'Release')
917 def static getFxBranch(def branch) {
918 def fxBranch = branch
919 // Map 'dev/unix_test_workflow' to 'master' so we can test CoreFX jobs in the CoreCLR dev/unix_test_workflow
920 // branch even though CoreFX doesn't have such a branch.
921 if (branch == 'dev/unix_test_workflow') {
927 def static setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly) {
928 // 2 hours (120 minutes) is the default timeout
931 if (!isInnerloopTestScenario(scenario)) {
932 // Pri-1 test builds take a long time (see calculateBuildCommands()). So up the Pri-1 build jobs timeout.
937 // Note that these can only increase, never decrease, the Pri-1 timeout possibly set above.
938 if (isGCStressRelatedTesting(scenario)) {
941 else if (isCoreFxScenario(scenario)) {
943 if (architecture == 'arm64') {
944 if (configuration == 'Checked' || configuration == 'Debug') {
945 // ARM64 checked/debug is slow, see #17414.
950 else if (isJitStressScenario(scenario)) {
953 else if (isR2RBaselineScenario(scenario)) {
956 else if (isLongGc(scenario)) {
959 else if (isJitDiff(scenario)) {
962 else if (isGcReliabilityFramework(scenario)) {
965 else if (architecture == 'armem' || architecture == 'arm64') {
969 if (architecture == 'arm') {
970 // ARM32 machines are particularly slow.
975 if (configuration == 'Debug') {
976 // Debug runs can be very slow. Add an hour.
980 // If we've changed the timeout from the default, set it in the job.
982 if (timeout != 120) {
983 Utilities.setJobTimeout(newJob, timeout)
987 def static getJobFolder(def scenario) {
988 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
991 if (scenario == 'illink') {
997 def static getStressModeDisplayName(def scenario) {
999 Constants.jitStressModeScenarios[scenario].each{ k, v ->
1000 def prefixLength = 'COMPlus_'.length()
1001 if (k.length() >= prefixLength) {
1002 def modeName = k.substring(prefixLength, k.length())
1003 if (displayStr != '') {
1004 // Separate multiple variables with a space.
1007 displayStr += modeName + '=' + v
1011 if (isCoreFxScenario(scenario)) {
1012 displayStr = ('CoreFx ' + displayStr).trim()
1018 def static getR2RDisplayName(def scenario) {
1019 // Assume the scenario name is one from the r2rStressScenarios dict, and remove its "r2r_" prefix.
1020 def displayStr = scenario
1021 def prefixLength = 'r2r_'.length()
1022 if (displayStr.length() >= prefixLength) {
1023 displayStr = "R2R " + displayStr.substring(prefixLength, displayStr.length())
1024 } else if (scenario == 'r2r') {
1030 def static getScenarioDisplayString(def scenario) {
1033 return "Innerloop Build and Test"
1035 case 'no_tiered_compilation_innerloop':
1036 def displayStr = getStressModeDisplayName(scenario)
1037 return "Innerloop Build and Test (Jit - ${displayStr})"
1039 case 'corefx_innerloop':
1040 return "CoreFX Tests"
1043 return "Build and Test"
1046 return "Jit Diff Build and Test"
1049 return "IL RoundTrip Build and Test"
1052 return "Long-Running GC Build & Test"
1055 return "GC Simulator"
1057 case 'standalone_gc':
1058 return "Standalone GC"
1060 case 'gc_reliability_framework':
1061 return "GC Reliability Framework"
1067 if (isJitStressScenario(scenario)) {
1068 def displayStr = getStressModeDisplayName(scenario)
1069 return "Build and Test (Jit - ${displayStr})"
1071 else if (isR2RScenario(scenario)) {
1072 def displayStr = getR2RDisplayName(scenario)
1073 return "${displayStr} Build and Test"
1076 return "${scenario}"
1081 println("Unknown scenario: ${scenario}");
1086 // Functions to create an environment script.
1087 // envScriptCreate -- initialize the script (call first)
1088 // envScriptFinalize -- finalize the script (call last)
1089 // envScriptSetStressModeVariables -- set stress mode variables in the env script
1090 // envScriptAppendExistingScript -- append an existing script to the generated script
1092 // Each script returns a string of commands. Concatenate all the strings together before
1093 // adding them to the builds commands, to make sure they get executed as one Jenkins script.
1096 // Initialize the environment setting script.
1097 def static envScriptCreate(def os, def stepScriptLocation) {
1099 if (os == 'Windows_NT') {
1100 stepScript += "echo Creating TestEnv script\r\n"
1101 stepScript += "if exist ${stepScriptLocation} del ${stepScriptLocation}\r\n"
1103 // Create at least an empty script.
1104 stepScript += "echo. > ${stepScriptLocation}\r\n"
1107 stepScript += "echo Creating environment setting script\n"
1108 stepScript += "echo \\#\\!/usr/bin/env bash > ${stepScriptLocation}\n"
1114 // Generates the string for setting stress mode variables.
1115 def static envScriptSetStressModeVariables(def os, def stressModeVars, def stepScriptLocation) {
1117 if (os == 'Windows_NT') {
1118 stressModeVars.each{ k, v ->
1119 // Write out what we are writing to the script file
1120 stepScript += "echo Setting ${k}=${v}\r\n"
1121 // Write out the set itself to the script file`
1122 stepScript += "echo set ${k}=${v} >> ${stepScriptLocation}\r\n"
1126 stressModeVars.each{ k, v ->
1127 // Write out what we are writing to the script file
1128 stepScript += "echo Setting ${k}=${v}\n"
1129 // Write out the set itself to the script file`
1130 stepScript += "echo export ${k}=${v} >> ${stepScriptLocation}\n"
1137 // Append an existing script to an environment script.
1138 // Returns string of commands to do this.
1139 def static envScriptAppendExistingScript(def os, def appendScript, def stepScriptLocation) {
1140 assert (os == 'Windows_NT')
1143 stepScript += "echo Appending ${appendScript} to ${stepScriptLocation}\r\n"
1144 stepScript += "type ${appendScript} >> ${stepScriptLocation}\r\n"
1149 // Finalize an environment setting script.
1150 // Returns string of commands to do this.
1151 def static envScriptFinalize(def os, def stepScriptLocation) {
1154 if (os == 'Windows_NT') {
1155 // Display the resulting script. This is useful when looking at the output log file.
1156 stepScript += "echo Display the total script ${stepScriptLocation}\r\n"
1157 stepScript += "type ${stepScriptLocation}\r\n"
1160 stepScript += "chmod +x ${stepScriptLocation}\n"
1166 def static isNeedDocker(def architecture, def os, def isBuild) {
1168 if (architecture == 'x86' && os == 'Ubuntu') {
1171 else if (architecture == 'armem') {
1174 else if (architecture == 'arm') {
1175 if (os == 'Ubuntu') {
1179 else if (architecture == 'arm64') {
1180 if (os == 'Ubuntu16.04') {
1186 if (architecture == 'x86' && os == 'Ubuntu') {
1193 def static getDockerImageName(def architecture, def os, def isBuild) {
1194 // We must change some docker private images to official later
1196 if (architecture == 'x86' && os == 'Ubuntu') {
1197 return "hseok82/dotnet-buildtools-prereqs:ubuntu-16.04-crossx86-ef0ac75-20175511035548"
1199 else if (architecture == 'armem') {
1200 if (os == 'Tizen') {
1201 return "tizendotnet/dotnet-buildtools-prereqs:ubuntu-16.04-cross-e435274-20180426002255-tizen-rootfs-5.0m1"
1204 else if (architecture == 'arm') {
1205 if (os == 'Ubuntu') {
1206 return "microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-e435274-20180426002420"
1209 else if (architecture == 'arm64') {
1210 if (os == 'Ubuntu16.04') {
1211 return "microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-arm64-a3ae44b-20180315221921"
1216 if (architecture == 'x86' && os == 'Ubuntu') {
1217 return "hseok82/dotnet-buildtools-prereqs:ubuntu1604_x86_test"
1220 println("Unknown architecture to use docker: ${architecture} ${os}");
1224 def static getTestArtifactsTgzFileName(def osGroup, def architecture, def configuration) {
1225 return "bin-tests-${osGroup}.${architecture}.${configuration}.tgz"
1228 // We have a limited amount of some hardware. For these, scale back the periodic testing we do,
1229 // and only allowing using this hardware in some specific branches.
1230 def static jobRequiresLimitedHardware(def architecture, def os) {
1231 if (architecture == 'arm') {
1232 // arm Windows and Linux hardware is limited.
1235 else if (architecture == 'arm64') {
1236 // arm64 Windows and Linux hardware is limited.
1244 // Calculates the name of the build job based on some typical parameters.
1246 def static getJobName(def configuration, def architecture, def os, def scenario, def isBuildOnly) {
1247 // If the architecture is x64, do not add that info into the build name.
1248 // Need to change around some systems and other builds to pick up the right builds
1251 def suffix = scenario != 'normal' ? "_${scenario}" : '';
1256 switch (architecture) {
1258 if (scenario == 'normal') {
1259 // For now we leave x64 off of the name for compatibility with other jobs
1260 baseName = configuration.toLowerCase() + '_' + os.toLowerCase()
1262 else if (scenario == 'formatting') {
1263 // we don't care about the configuration for the formatting job. It runs all configs
1264 baseName = architecture.toLowerCase() + '_' + os.toLowerCase()
1267 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1271 // These are cross builds
1272 assert os == 'Tizen'
1273 baseName = 'armel_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1277 // These are cross builds
1278 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1281 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1284 println("Unknown architecture: ${architecture}");
1289 return baseName + suffix
1292 def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob, def bidailyCrossList) {
1294 // The dev/unix_test_workflow branch is used for Jenkins CI testing. We generally do not need any non-PR
1295 // triggers in the branch, because that would use machine resources unnecessarily.
1296 if (branch == 'dev/unix_test_workflow') {
1300 // Limited hardware is restricted for non-PR triggers to certain branches.
1301 if (jobRequiresLimitedHardware(architecture, os) && (!(branch in Constants.LimitedHardwareBranches))) {
1305 // Ubuntu x86 CI jobs are failing. Disable non-PR triggered jobs to avoid these constant failures
1306 // until this is fixed. Tracked by https://github.com/dotnet/coreclr/issues/19003.
1307 if (architecture == 'x86' && os == 'Ubuntu') {
1311 def isNormalOrInnerloop = (scenario == "normal" || scenario == "innerloop")
1315 case 'crossgen_comparison':
1316 if (isFlowJob && ((os == 'Ubuntu' && architecture == 'arm') || (os == 'Ubuntu16.04' && architecture == 'arm64')) && (configuration == 'Checked' || configuration == 'Release')) {
1317 addPeriodicTriggerHelper(job, '@daily')
1321 case 'pmi_asm_diffs':
1322 // No non-PR triggers for now.
1326 switch (architecture) {
1329 if (isFlowJob && architecture == 'x86' && os == 'Ubuntu') {
1330 addPeriodicTriggerHelper(job, '@daily')
1332 else if (isFlowJob || os == 'Windows_NT' || (architecture == 'x64' && !(os in Constants.crossList))) {
1333 addGithubPushTriggerHelper(job)
1337 if (os == 'Windows_NT') {
1338 if (isFlowJob || (isNormalOrInnerloop && (configuration == 'Debug'))) {
1339 // We would normally want a per-push trigger, but with limited hardware we can't keep up.
1340 // Do the builds daily.
1341 addPeriodicTriggerHelper(job, '@daily')
1345 // Only the flow jobs get push triggers; the build and test jobs are triggered by the flow job.
1347 addPeriodicTriggerHelper(job, '@daily')
1352 if (os == 'Windows_NT') {
1353 if (isFlowJob || (isNormalOrInnerloop && (configuration == 'Debug'))) {
1354 // We would normally want a push trigger, but with limited hardware we can't keep up.
1355 // Do the builds daily.
1356 addPeriodicTriggerHelper(job, '@daily')
1360 assert os == 'Ubuntu'
1361 // Only the flow jobs get push triggers; the build and test jobs are triggered by the flow job.
1363 // Currently no push triggers, with limited arm Linux hardware.
1364 // TODO: If we have enough machine capacity, add some arm Linux push triggers.
1365 addPeriodicTriggerHelper(job, '@daily')
1370 addGithubPushTriggerHelper(job)
1373 println("Unknown architecture: ${architecture}");
1379 assert !(os in bidailyCrossList)
1380 // r2r gets a push trigger for checked/release
1381 if (configuration == 'Checked' || configuration == 'Release') {
1382 if (architecture == 'x64' && os != 'OSX10.12') {
1383 //Flow jobs should be Windows, Ubuntu, OSX0.12, or CentOS
1384 if (isFlowJob || os == 'Windows_NT') {
1385 addGithubPushTriggerHelper(job)
1387 // OSX10.12 r2r jobs should only run every 12 hours, not daily.
1388 } else if (architecture == 'x64' && os == 'OSX10.12'){
1390 addPeriodicTriggerHelper(job, 'H H/12 * * *')
1393 // For x86, only add per-commit jobs for Windows
1394 else if (architecture == 'x86') {
1395 if (os == 'Windows_NT') {
1396 addGithubPushTriggerHelper(job)
1399 // arm r2r jobs should only run weekly.
1400 else if (architecture == 'arm') {
1402 addPeriodicTriggerHelper(job, '@weekly')
1405 // arm64 r2r jobs should only run weekly.
1406 else if (architecture == 'arm64') {
1408 addPeriodicTriggerHelper(job, '@weekly')
1413 case 'r2r_jitstress1':
1414 case 'r2r_jitstress2':
1415 case 'r2r_jitstress1_tiered':
1416 case 'r2r_jitstress2_tiered':
1417 case 'r2r_jitstressregs1':
1418 case 'r2r_jitstressregs2':
1419 case 'r2r_jitstressregs3':
1420 case 'r2r_jitstressregs4':
1421 case 'r2r_jitstressregs8':
1422 case 'r2r_jitstressregs0x10':
1423 case 'r2r_jitstressregs0x80':
1424 case 'r2r_jitstressregs0x1000':
1425 case 'r2r_jitminopts':
1426 case 'r2r_jitforcerelocs':
1427 case 'r2r_gcstress15':
1428 case 'r2r_no_tiered_compilation':
1429 assert !(os in bidailyCrossList)
1431 // GCStress=C is currently not supported on OS X
1432 if (os == 'OSX10.12' && isGCStressRelatedTesting(scenario)) {
1436 if (configuration == 'Checked' || configuration == 'Release') {
1437 if (architecture == 'x64') {
1438 //Flow jobs should be Windows, Ubuntu, OSX10.12, or CentOS
1439 if (isFlowJob || os == 'Windows_NT') {
1440 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1443 // For x86, only add periodic jobs for Windows
1444 else if (architecture == 'x86') {
1445 if (os == 'Windows_NT') {
1446 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1449 else if (architecture == 'arm') {
1451 addPeriodicTriggerHelper(job, '@weekly')
1454 else if (architecture == 'arm64') {
1456 addPeriodicTriggerHelper(job, '@weekly')
1462 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1463 assert configuration == 'Release'
1464 assert architecture == 'x64'
1465 addPeriodicTriggerHelper(job, '@daily')
1466 // TODO: Add once external email sending is available again
1467 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1470 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1471 assert configuration == 'Release'
1472 assert architecture == 'x64'
1473 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1474 // TODO: Add once external email sending is available again
1475 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1477 case 'standalone_gc':
1478 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1479 assert (configuration == 'Release' || configuration == 'Checked')
1480 // TODO: Add once external email sending is available again
1481 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1482 addPeriodicTriggerHelper(job, '@daily')
1484 case 'gc_reliability_framework':
1485 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1486 assert (configuration == 'Release' || configuration == 'Checked')
1487 // Only triggered by phrase.
1490 assert !(os in bidailyCrossList)
1491 // ILASM/ILDASM roundtrip one gets a daily build, and only for release
1492 if (architecture == 'x64' && configuration == 'Release') {
1493 if (isFlowJob || os == 'Windows_NT') {
1494 addPeriodicTriggerHelper(job, '@daily')
1499 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1500 assert configuration == 'Checked'
1501 assert (architecture == 'x64' || architecture == 'x86')
1502 addGithubPushTriggerHelper(job)
1505 assert (os == 'Windows_NT' || os == "Ubuntu")
1506 assert architecture == 'x64'
1507 addGithubPushTriggerHelper(job)
1509 case 'jitstressregs1':
1510 case 'jitstressregs2':
1511 case 'jitstressregs3':
1512 case 'jitstressregs4':
1513 case 'jitstressregs8':
1514 case 'jitstressregs0x10':
1515 case 'jitstressregs0x80':
1516 case 'jitstressregs0x1000':
1518 case 'tieredcompilation':
1519 case 'no_tiered_compilation':
1523 case 'jitstress1_tiered':
1524 case 'jitstress2_tiered':
1525 case 'jitstress2_jitstressregs1':
1526 case 'jitstress2_jitstressregs2':
1527 case 'jitstress2_jitstressregs3':
1528 case 'jitstress2_jitstressregs4':
1529 case 'jitstress2_jitstressregs8':
1530 case 'jitstress2_jitstressregs0x10':
1531 case 'jitstress2_jitstressregs0x80':
1532 case 'jitstress2_jitstressregs0x1000':
1533 case 'tailcallstress':
1536 case 'jitnox86hwintrinsic':
1537 case 'jitincompletehwintrinsic':
1538 case 'jitx86hwintrinsicnoavx':
1539 case 'jitx86hwintrinsicnoavx2':
1540 case 'jitx86hwintrinsicnosimd':
1541 case 'corefx_baseline':
1542 case 'corefx_minopts':
1543 case 'corefx_tieredcompilation':
1544 case 'corefx_jitstress1':
1545 case 'corefx_jitstress2':
1546 case 'corefx_jitstressregs1':
1547 case 'corefx_jitstressregs2':
1548 case 'corefx_jitstressregs3':
1549 case 'corefx_jitstressregs4':
1550 case 'corefx_jitstressregs8':
1551 case 'corefx_jitstressregs0x10':
1552 case 'corefx_jitstressregs0x80':
1553 case 'corefx_jitstressregs0x1000':
1555 if (os == 'CentOS7.1') {
1558 if (os in bidailyCrossList) {
1561 // ARM corefx testing uses non-flow jobs to provide the configuration-specific
1562 // build for the flow job. We don't need cron jobs for these. Note that the
1563 // Windows ARM jobs depend on a Windows "build only" job that exits the trigger
1564 // function very early, so only non-Windows gets here.
1565 if ((architecture == 'arm') && isCoreFxScenario(scenario) && !isFlowJob) {
1568 if ((architecture == 'arm64') && isCoreFxScenario(scenario) && !isFlowJob) {
1571 if (jobRequiresLimitedHardware(architecture, os)) {
1572 if ((architecture == 'arm64') && (os == 'Ubuntu16.04')) {
1573 // These jobs are very fast on Linux/arm64 hardware, so run them daily.
1574 addPeriodicTriggerHelper(job, '@daily')
1577 addPeriodicTriggerHelper(job, '@weekly')
1581 addPeriodicTriggerHelper(job, '@daily')
1586 if (os == 'CentOS7.1') {
1589 if (os in bidailyCrossList) {
1592 addPeriodicTriggerHelper(job, '@weekly')
1595 case 'gcstress0xc_zapdisable':
1596 case 'gcstress0xc_zapdisable_jitstress2':
1597 case 'gcstress0xc_zapdisable_heapverify1':
1598 case 'gcstress0xc_jitstress1':
1599 case 'gcstress0xc_jitstress2':
1600 case 'gcstress0xc_minopts_heapverify1':
1601 if (os == 'OSX10.12') {
1602 // GCStress=C is currently not supported on OS X
1605 if (os == 'CentOS7.1') {
1608 if (os in bidailyCrossList) {
1611 addPeriodicTriggerHelper(job, '@weekly')
1615 // Testing on other operating systems TBD
1616 assert (os == 'Windows_NT' || os == 'Ubuntu')
1617 if (architecture == 'x64' || architecture == 'x86') {
1618 if (configuration == 'Checked') {
1619 addPeriodicTriggerHelper(job, '@daily')
1625 println("Unknown scenario: ${scenario}");
1632 // **************************
1633 // Define the basic inner loop builds for PR and commit. This is basically just the set
1634 // of coreclr builds over linux/osx 10.12/windows and debug/release/checked. In addition, the windows
1635 // builds will do a couple extra steps.
1636 // **************************
1638 // Adds a trigger for the PR build if one is needed. If isFlowJob is true, then this is the
1639 // flow job that rolls up the build and test for non-windows OS's. // If the job is a windows build only job,
1640 // it's just used for internal builds
1641 // If you add a job with a trigger phrase, please add that phrase to coreclr/Documentation/project-docs/ci-trigger-phrases.md
1642 def static addTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob) {
1643 def isNormalOrInnerloop = (scenario == "normal" || scenario == "innerloop")
1645 if (isWindowsBuildOnlyJob) {
1649 def bidailyCrossList = ['RHEL7.2', 'Debian8.4']
1650 // Non pull request builds.
1652 addNonPRTriggers(job, branch, isPR, architecture, os, configuration, scenario, isFlowJob, isWindowsBuildOnlyJob, bidailyCrossList)
1677 // Pull request builds. Generally these fall into two categories: default triggers and on-demand triggers
1678 // We generally only have a distinct set of default triggers but a bunch of on-demand ones.
1680 def contextString = ""
1681 def triggerString = ""
1682 def needsTrigger = true
1683 def isDefaultTrigger = false
1684 def isArm64PrivateJob = false
1685 def scenarioString = ""
1687 // Set up default context string and trigger phrases. This is overridden in places, sometimes just to keep
1688 // the existing non-standard descriptions and phrases. In some cases, the scenarios are asymmetric, as for
1689 // some jobs where the Debug configuration just does builds, no tests.
1691 // Some configurations, like arm32/arm64, always use the exact scenario name as part of the context string.
1692 // This makes it possible to copy/paste the displayed context string as "@dotnet-bot test <context-string>"
1693 // to invoke the trigger. Any "fancy" context string makes that impossible, requiring the user to either
1694 // remember the mapping from context string to trigger string, or use "@dotnet-bot help" to look it up.
1696 if (architecture == 'armem') {
1697 assert os == 'Tizen'
1698 architecture = 'armel'
1701 switch (architecture) {
1705 contextString = "${os} ${architecture} Cross ${configuration}"
1706 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
1708 if (scenario == 'innerloop') {
1709 contextString += " Innerloop"
1710 triggerString += "\\W+Innerloop"
1713 contextString += " ${scenario}"
1714 triggerString += "\\W+${scenario}"
1717 if (scenario == 'pmi_asm_diffs') {
1718 // Don't add the "Build and Test" part
1720 else if (configuration == 'Debug') {
1721 contextString += " Build"
1722 triggerString += "\\W+Build"
1725 contextString += " Build and Test"
1726 triggerString += "\\W+Build and Test"
1729 triggerString += ".*"
1733 scenarioString = getScenarioDisplayString(scenario)
1734 contextString = "${os} ${architecture} ${configuration} ${scenarioString}"
1735 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}"
1739 triggerString += "\\W+Build and Test.*"
1742 case 'corefx_innerloop': // maintain this asymmetry
1743 triggerString += "\\W+CoreFX Tests.*"
1747 triggerString += "\\W+${scenario}.*"
1751 triggerString += ".*"
1755 // Now determine what kind of trigger this job needs, if any. Any job should be triggerable, except for
1756 // non-flow jobs that are only used as part of flow jobs.
1758 switch (architecture) {
1759 case 'x64': // editor brace matching: {
1760 if (scenario == 'formatting') {
1761 assert configuration == 'Checked'
1762 if (os == 'Windows_NT' || os == 'Ubuntu') {
1763 isDefaultTrigger = true
1764 contextString = "${os} ${architecture} Formatting"
1769 if (scenario == 'pmi_asm_diffs') {
1770 // Everything is already set.
1771 // No default triggers.
1776 // OpenSUSE, Debian & RedHat get trigger phrases for pri 0 build, and pri 1 build & test
1779 if (scenario == 'innerloop') {
1781 contextString = "${os} ${architecture} ${configuration} Innerloop Build"
1782 isDefaultTrigger = true
1792 assert scenario != 'innerloop'
1793 contextString = "${os} ${architecture} ${configuration} Build"
1794 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+Build.*"
1798 if (scenario == 'illink') {
1801 else if (scenario == 'corefx_innerloop') {
1802 if (configuration == 'Checked') {
1803 isDefaultTrigger = true
1811 // Triggers on the non-flow jobs aren't necessary here
1812 // Corefx testing uses non-flow jobs.
1813 if (!isFlowJob && !isCoreFxScenario(scenario)) {
1814 needsTrigger = false
1819 isDefaultTrigger = true
1822 case 'no_tiered_compilation_innerloop':
1823 if (os == 'Ubuntu') {
1824 isDefaultTrigger = true
1836 // CentOS uses checked for default PR tests while debug is build only
1837 if (configuration == 'Debug') {
1838 isDefaultTrigger = true
1839 contextString = "${os} ${architecture} ${configuration} Innerloop Build"
1843 // Make sure this is a flow job to get build and test.
1845 needsTrigger = false
1849 if (configuration == 'Checked') {
1850 assert job.name.contains("flow")
1851 isDefaultTrigger = true
1852 contextString = "${os} ${architecture} ${configuration} Innerloop Build and Test"
1857 // Make sure this is a flow job to get build and test.
1859 needsTrigger = false
1872 case 'no_tiered_compilation_innerloop':
1873 isDefaultTrigger = true
1876 case 'corefx_innerloop':
1877 if (configuration == 'Checked' || configuration == 'Release') {
1878 isDefaultTrigger = true
1888 println("Unknown os: ${os}");
1895 // editor brace matching: }
1897 case 'armel': // editor brace matching: {
1900 azureVMAgentPostBuildAction {
1901 agentPostBuildAction('Delete agent if the build was not successful (when idle).')
1908 if (scenario == 'innerloop') {
1909 if (configuration == 'Checked') {
1910 isDefaultTrigger = true
1917 // editor brace matching: }
1920 case 'arm64': // editor brace matching: {
1926 // Triggers on the non-flow jobs aren't necessary
1928 needsTrigger = false
1931 if (os == 'Ubuntu' && architecture == 'arm') {
1934 case 'no_tiered_compilation_innerloop':
1935 if (configuration == 'Checked') {
1936 isDefaultTrigger = true
1939 case 'crossgen_comparison':
1940 if (configuration == 'Checked' || configuration == 'Release') {
1941 isDefaultTrigger = true
1949 assert isArmWindowsScenario(scenario)
1951 // 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
1952 // the non-flow Build job. All others need a trigger on the flow job.
1953 def needsFlowJobTrigger = !(isNormalOrInnerloop && (configuration == 'Debug'))
1954 if (isFlowJob != needsFlowJobTrigger) {
1955 needsTrigger = false
1961 if (configuration == 'Checked') {
1962 isDefaultTrigger = true
1963 isArm64PrivateJob = true
1967 isArm64PrivateJob = true
1972 println("NYI os: ${os}");
1978 // editor brace matching: }
1979 case 'x86': // editor brace matching: {
1980 assert ((os == 'Windows_NT') || ((os == 'Ubuntu') && isNormalOrInnerloop))
1981 if (os == 'Ubuntu') {
1982 // Triggers on the non-flow jobs aren't necessary here
1984 needsTrigger = false
1988 // on-demand only for ubuntu x86
1989 contextString = "${os} ${architecture} ${configuration} Build"
1990 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}.*"
1995 case 'no_tiered_compilation_innerloop':
1996 isDefaultTrigger = true
2003 // editor brace matching: }
2006 println("Unknown architecture: ${architecture}");
2012 if (isArm64PrivateJob) {
2013 if (isDefaultTrigger) {
2014 Utilities.addDefaultPrivateGithubPRTriggerForBranch(job, branch, contextString, null, arm64Users)
2017 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
2021 if (isDefaultTrigger) {
2022 Utilities.addGithubPRTriggerForBranch(job, branch, contextString)
2025 Utilities.addGithubPRTriggerForBranch(job, branch, contextString, triggerString)
2031 def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR, def architecture, def configuration, def os, def isBuildOnly) {
2032 def buildCommands = []
2033 def osGroup = getOSGroup(os)
2034 def lowerConfiguration = configuration.toLowerCase()
2036 // Which set of tests to build? Innerloop tests build Pri-0.
2037 // Currently, we only generate asm diffs on Pri-0 tests, if we generate asm diffs on tests at all.
2038 // CoreFX testing skipts building tests altogether (done below).
2039 // All other scenarios build Pri-1 tests.
2041 if (isInnerloopTestScenario(scenario)) {
2045 def doCoreFxTesting = isCoreFxScenario(scenario)
2047 def buildCoreclrTests = true
2048 if (doCoreFxTesting || (scenario == 'pmi_asm_diffs')) {
2049 // These scenarios don't need the coreclr tests build.
2050 buildCoreclrTests = false
2053 // Calculate the build steps, archival, and xunit results
2055 case 'Windows_NT': // editor brace matching: {
2056 switch (architecture) {
2059 def arch = architecture
2062 if (scenario == 'formatting') {
2063 buildCommands += "python -u tests\\scripts\\format.py -c %WORKSPACE% -o Windows_NT -a ${arch}"
2064 Utilities.addArchival(newJob, "format.patch", "", true, false)
2068 if (scenario == 'illink') {
2069 buildCommands += "tests\\scripts\\build_illink.cmd clone ${arch}"
2072 // If it is a release build for Windows, ensure PGO is used, else fail the build.
2073 if ((lowerConfiguration == 'release') &&
2074 (scenario in Constants.basicScenarios)) {
2076 buildOpts += ' -enforcepgo'
2079 if (buildCoreclrTests) {
2080 buildOpts += " -priority=${priority}"
2082 buildOpts += ' skiptests';
2085 // Set __TestIntermediateDir to something short. If __TestIntermediateDir is already set, build-test.cmd will
2086 // output test binaries to that directory. If it is not set, the binaries are sent to a default directory whose name is about
2087 // 35 characters long.
2089 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${arch} ${buildOpts}"
2091 if (scenario == 'pmi_asm_diffs') {
2092 // Now, generate the layout. We don't have any tests, but we need to restore the packages before calling runtest.cmd.
2093 // Call build-test.cmd to do this. It will do a little more than we need, but that's ok.
2094 buildCommands += "build-test.cmd ${lowerConfiguration} ${arch} skipmanaged skipnative"
2095 buildCommands += "tests\\runtest.cmd ${lowerConfiguration} ${arch} GenerateLayoutOnly"
2097 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2098 buildCommands += "python -u %WORKSPACE%\\tests\\scripts\\run-pmi-diffs.py -arch ${arch} -ci_arch ${architecture} -build_type ${configuration}"
2101 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('_\\pmi\\asm', '.\\dasm.${os}.${architecture}.${configuration}.zip')\"";
2104 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.zip")
2109 def runtestArguments = ''
2110 def testOpts = 'collectdumps'
2112 if (isR2RScenario(scenario)) {
2114 // If this is a ReadyToRun scenario, pass 'crossgen'
2115 // to cause framework assemblies to be crossgen'ed. Pass 'runcrossgentests'
2116 // to cause the tests to be crossgen'ed.
2118 testOpts += ' crossgen runcrossgentests'
2120 else if (scenario == 'jitdiff') {
2121 testOpts += ' jitdisasm crossgen'
2123 else if (scenario == 'ilrt') {
2124 testOpts += ' ilasmroundtrip'
2126 else if (isLongGc(scenario)) {
2127 testOpts += " ${scenario} sequential"
2129 else if (scenario == 'standalone_gc') {
2130 testOpts += ' gcname clrgc.dll'
2132 else if (scenario == 'illink') {
2133 testOpts += " link %WORKSPACE%\\linker\\linker\\bin\\netcore_Release\\netcoreapp2.0\\win10-${arch}\\publish\\illink.exe"
2136 // Default per-test timeout is 10 minutes. For stress modes and Debug scenarios, increase this
2137 // to 30 minutes (30 * 60 * 1000 = 180000). The "timeout" argument to runtest.cmd sets this, by
2138 // taking a timeout value in milliseconds. (Note that it sets the __TestTimeout environment variable,
2139 // which is read by the xunit harness.)
2140 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario) || (lowerConfiguration == 'debug'))
2142 def timeout = 1800000
2143 testOpts += " timeout ${timeout}"
2146 // If we are running a stress mode, we should write out the set of key
2147 // value env pairs to a file at this point and then we'll pass that to runtest.cmd
2149 def envScriptPath = ''
2150 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
2151 def buildCommandsStr = ''
2152 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
2153 buildCommandsStr += envScriptCreate(os, envScriptPath)
2155 if (isJitStressScenario(scenario)) {
2156 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
2158 else if (isR2RStressScenario(scenario)) {
2159 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.r2rStressScenarios[scenario], envScriptPath)
2162 envScriptFinalize(os, envScriptPath)
2164 // Note that buildCommands is an array of individually executed commands; we want all the commands used to
2165 // create the SetStressModes.bat script to be executed together, hence we accumulate them as strings
2166 // into a single script.
2167 buildCommands += buildCommandsStr
2169 if (envScriptPath != '') {
2170 testOpts += " TestEnv ${envScriptPath}"
2173 runtestArguments = "${lowerConfiguration} ${arch} ${testOpts}"
2175 if (doCoreFxTesting) {
2176 if (scenario == 'corefx_innerloop') {
2177 // Create CORE_ROOT and testhost
2178 buildCommands += "build-test.cmd ${lowerConfiguration} ${arch} buildtesthostonly"
2179 buildCommands += "tests\\runtest.cmd ${runtestArguments} CoreFXTestsAll"
2181 // Archive and process (only) the test results
2182 Utilities.addArchival(newJob, "bin/Logs/**/testResults.xml")
2183 Utilities.addXUnitDotNETResults(newJob, "bin/Logs/**/testResults.xml")
2186 def workspaceRelativeFxRoot = "_/fx"
2187 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
2188 def fxBranch = getFxBranch(branch)
2190 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}"
2192 // Archive and process (only) the test results
2193 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2194 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2196 //Archive additional build stuff to diagnose why my attempt at fault injection isn't causing CI to fail
2197 Utilities.addArchival(newJob, "SetStressModes.bat", "", true, false)
2198 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/testhost/**", "", true, false)
2201 else if (isGcReliabilityFramework(scenario)) {
2202 buildCommands += "tests\\runtest.cmd ${runtestArguments} GenerateLayoutOnly"
2203 buildCommands += "tests\\scripts\\run-gc-reliability-framework.cmd ${arch} ${configuration}"
2206 def buildCommandsStr = "call tests\\runtest.cmd ${runtestArguments}\r\n"
2208 // If we ran the tests, collect the test logs collected by xunit. We want to do this even if the tests fail, so we
2209 // must do it in the same batch file as the test run.
2211 buildCommandsStr += "echo on\r\n" // Show the following commands in the log. "echo" doesn't alter the errorlevel.
2212 buildCommandsStr += "set saved_errorlevel=%errorlevel%\r\n"
2213 buildCommandsStr += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('.\\bin\\tests\\${osGroup}.${arch}.${configuration}\\Reports', '.\\bin\\tests\\testReports.zip')\"\r\n";
2214 buildCommandsStr += "exit /b %saved_errorlevel%\r\n"
2216 def doNotFailIfNothingArchived = true
2217 def archiveOnlyIfSuccessful = false
2218 Utilities.addArchival(newJob, "bin/tests/testReports.zip", "", doNotFailIfNothingArchived, archiveOnlyIfSuccessful)
2220 buildCommands += buildCommandsStr
2222 } // end if (!isBuildOnly)
2224 if (!doCoreFxTesting) {
2225 // Run the rest of the build
2226 // Build the mscorlib for the other OS's
2227 buildCommands += "build.cmd ${lowerConfiguration} ${arch} linuxmscorlib"
2228 buildCommands += "build.cmd ${lowerConfiguration} ${arch} osxmscorlib"
2230 if (arch == 'x64') {
2231 buildCommands += "build.cmd ${lowerConfiguration} arm64 linuxmscorlib"
2234 if (!isJitStressScenario(scenario)) {
2235 // Zip up the tests directory so that we don't use so much space/time copying
2236 // 10s of thousands of files around.
2237 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')\"";
2239 // For Windows, pull full test results and test drops for x86/x64.
2240 // No need to pull for stress mode scenarios (downstream builds use the default scenario)
2241 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2244 if (scenario == 'jitdiff') {
2245 // retrieve jit-dasm output for base commit, and run jit-diff
2247 // if this is a build only job, we want to keep the default (build) artifacts for the flow job
2248 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${arch}.${configuration}/dasm/**")
2253 Utilities.addXUnitDotNETResults(newJob, 'bin/**/TestRun*.xml', true)
2257 // Archive the logs, even if the build failed (which is when they are most interesting).
2258 Utilities.addArchival(newJob, "bin/Logs/*.log,bin/Logs/*.wrn,bin/Logs/*.err,bin/Logs/MsbuildDebugLogs/*", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2262 assert isArmWindowsScenario(scenario)
2266 if (buildCoreclrTests) {
2267 buildOpts += " -priority=${priority}"
2269 buildOpts += ' skiptests'
2272 // This is now a build only job. Do not run tests. Use the flow job.
2273 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} ${buildOpts}"
2275 if (doCoreFxTesting) {
2278 // Set the stress mode variables; this is incorporated into the generated CoreFx RunTests.cmd files.
2279 def envScriptPath = ''
2280 def buildCommandsStr = ''
2281 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
2282 buildCommandsStr += envScriptCreate(os, envScriptPath)
2283 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
2284 envScriptFinalize(os, envScriptPath)
2285 buildCommands += buildCommandsStr
2287 def workspaceRelativeFxRootLinux = "_/fx"
2288 def workspaceRelativeFxRootWin = "_\\fx"
2289 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
2290 def fxBranch = getFxBranch(branch)
2292 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"
2294 // Zip up the CoreFx runtime and tests. We don't need the CoreCLR binaries; they have been copied to the CoreFX tree.
2295 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')\"";
2296 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('${workspaceRelativeFxRootWin}\\artifacts\\bin\\tests', '${workspaceRelativeFxRootWin}\\fxtests.zip')\"";
2298 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxruntime.zip")
2299 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxtests.zip")
2301 // Zip up the tests directory so that we don't use so much space/time copying
2302 // 10s of thousands of files around.
2303 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')\"";
2306 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2309 // Archive the logs, even if the build failed (which is when they are most interesting).
2310 Utilities.addArchival(newJob, "bin/Logs/*.log,bin/Logs/*.wrn,bin/Logs/*.err,bin/Logs/MsbuildDebugLogs/*", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2313 println("Unknown architecture: ${architecture}");
2318 // end case 'Windows_NT'; editor brace matching: }
2327 case 'Fedora24': // editor brace matching: {
2328 switch (architecture) {
2330 if (os == 'Ubuntu') {
2331 // build and PAL test
2332 def dockerImage = getDockerImageName(architecture, os, true)
2333 buildCommands += "docker run -i --rm -v \${WORKSPACE}:/opt/code -w /opt/code -e ROOTFS_DIR=/crossrootfs/x86 ${dockerImage} ./build.sh ${architecture} cross ${lowerConfiguration}"
2334 dockerImage = getDockerImageName(architecture, os, false)
2335 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"
2336 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2337 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2342 if (scenario == 'formatting') {
2343 buildCommands += "python tests/scripts/format.py -c \${WORKSPACE} -o Linux -a ${architecture}"
2344 Utilities.addArchival(newJob, "format.patch", "", true, false)
2348 if (scenario == 'pmi_asm_diffs') {
2349 buildCommands += "./build.sh ${lowerConfiguration} ${architecture} skiptests skipbuildpackages"
2350 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} generatelayoutonly"
2352 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2353 buildCommands += "python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration}"
2356 buildCommands += "tar -czf dasm.${os}.${architecture}.${configuration}.tgz ./_/pmi/asm"
2357 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.tgz")
2361 if (scenario == 'illink') {
2362 assert(os == 'Ubuntu')
2363 buildCommands += "./tests/scripts/build_illink.sh --clone --arch=${architecture}"
2366 if (!doCoreFxTesting) {
2367 // We run pal tests on all OS but generate mscorlib (and thus, nuget packages)
2368 // only on supported OS platforms.
2369 def bootstrapRid = Utilities.getBoostrapPublishRid(os)
2370 def bootstrapRidEnv = bootstrapRid != null ? "__PUBLISH_RID=${bootstrapRid} " : ''
2372 buildCommands += "${bootstrapRidEnv}./build.sh ${lowerConfiguration} ${architecture}"
2374 def testBuildOpts = ""
2375 if (priority == '1') {
2376 testBuildOpts = "priority1"
2379 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} ${testBuildOpts}"
2380 buildCommands += "src/pal/tests/palsuite/runpaltests.sh \${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration} \${WORKSPACE}/bin/paltestout"
2382 // Archive the bin/tests folder for *_tst jobs
2383 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
2384 buildCommands += "tar -czf ${testArtifactsTgzFileName} bin/tests/${osGroup}.${architecture}.${configuration}"
2385 Utilities.addArchival(newJob, "${testArtifactsTgzFileName}", "")
2387 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2390 if (scenario == 'corefx_innerloop') {
2391 assert os == 'Ubuntu' || 'OSX10.12'
2392 assert architecture == 'x64'
2394 buildCommands += "./build.sh ${lowerConfiguration} ${architecture} skiptests"
2395 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} generatetesthostonly"
2396 buildCommands += "./tests/runtest.sh ${lowerConfiguration} --corefxtestsall --testHostDir=\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/testhost/ --coreclr-src=\${WORKSPACE}"
2399 // Archive and process (only) the test results
2400 Utilities.addArchival(newJob, "bin/Logs/**/testResults.xml")
2401 Utilities.addXUnitDotNETResults(newJob, "bin/Logs/**/testResults.xml")
2404 // Corefx stress testing
2405 assert os == 'Ubuntu'
2406 assert architecture == 'x64'
2407 assert lowerConfiguration == 'checked'
2408 assert isJitStressScenario(scenario)
2411 buildCommands += "./build.sh ${lowerConfiguration} ${architecture}"
2413 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2415 def envScriptCmds = envScriptCreate(os, scriptFileName)
2416 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2417 envScriptCmds += envScriptFinalize(os, scriptFileName)
2418 buildCommands += envScriptCmds
2420 // Build and text corefx
2421 def workspaceRelativeFxRoot = "_/fx"
2422 def absoluteFxRoot = "\$WORKSPACE/${workspaceRelativeFxRoot}"
2423 def fxBranch = getFxBranch(branch)
2425 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}"
2427 // Archive and process (only) the test results
2428 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2429 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2433 // Archive the logs, even if the build failed (which is when they are most interesting).
2434 Utilities.addArchival(newJob, "bin/Logs/*.log,bin/Logs/*.wrn,bin/Logs/*.err,bin/Logs/MsbuildDebugLogs/*", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2437 // Emulator cross builds for ARM runs on Tizen currently
2438 assert os == 'Tizen'
2440 def arm_abi = "armel"
2441 def linuxCodeName = "tizen"
2443 // Unzip the Windows test binaries first. Exit with 0
2444 buildCommands += "unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/Windows_NT.x64.${configuration} || exit 0"
2446 // Unpack the corefx binaries
2447 buildCommands += "mkdir ./bin/CoreFxBinDir"
2448 buildCommands += "tar -xf ./artifacts/bin/build.tar.gz -C ./bin/CoreFxBinDir"
2450 // Call the ARM CI script to cross build and test using docker
2451 buildCommands += """./tests/scripts/arm32_ci_script.sh \\
2454 --linuxCodeName=${linuxCodeName} \\
2455 --buildConfig=${lowerConfiguration} \\
2456 --testRootDir=./bin/tests/Windows_NT.x64.${configuration} \\
2457 --coreFxBinDir=./bin/CoreFxBinDir \\
2458 --testDirFile=./tests/testsRunningInsideARM.txt"""
2460 // Basic archiving of the build, no pal tests
2461 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2465 // Non-Windows ARM cross builds on hardware run on Ubuntu only
2466 assert (os == 'Ubuntu') || (os == 'Ubuntu16.04')
2468 // Add some useful information to the log file. Ignore return codes.
2469 buildCommands += "uname -a || true"
2471 // Cross build the Ubuntu/arm product using docker with a docker image that contains the correct
2472 // Ubuntu cross-compilation toolset (running on a Ubuntu x64 host).
2473 // For CoreFX testing, we only need the product build; we don't need to generate the layouts. The product
2474 // build is then copied into the corefx layout by the run-corefx-test.py script. For CoreFX testing, we
2475 // ZIP up the generated CoreFX runtime and tests.
2477 def dockerImage = getDockerImageName(architecture, os, true)
2478 def dockerCmd = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} -e ROOTFS_DIR=/crossrootfs/${architecture} ${dockerImage} "
2480 buildCommands += "${dockerCmd}\${WORKSPACE}/build.sh ${lowerConfiguration} ${architecture} cross"
2482 if (doCoreFxTesting) {
2483 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2485 def envScriptCmds = envScriptCreate(os, scriptFileName)
2486 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2487 envScriptCmds += envScriptFinalize(os, scriptFileName)
2488 buildCommands += envScriptCmds
2490 // Build and text corefx
2491 def workspaceRelativeFxRootLinux = "_/fx"
2492 def absoluteFxRoot = "\$WORKSPACE/${workspaceRelativeFxRootLinux}"
2493 def fxBranch = getFxBranch(branch)
2495 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"
2497 // Docker creates files with root permission, so we need to zip in docker also, or else we'll get permission errors.
2498 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeFxRootLinux}/fxruntime.zip ${workspaceRelativeFxRootLinux}/artifacts/bin/testhost/netcoreapp-Linux-Release-${architecture}"
2499 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeFxRootLinux}/fxtests.zip ${workspaceRelativeFxRootLinux}/artifacts/bin/tests"
2501 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxruntime.zip")
2502 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxtests.zip")
2504 else if (isCrossGenComparisonScenario(scenario)) {
2505 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross generatelayoutonly"
2507 def workspaceRelativeProductBinDir = "bin/Product/${osGroup}.${architecture}.${configuration}"
2508 def workspaceRelativeCoreLib = "${workspaceRelativeProductBinDir}/IL/System.Private.CoreLib.dll"
2509 def workspaceRelativeCoreRootDir = "bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root"
2510 def workspaceRelativeCrossGenComparisonScript = "tests/scripts/crossgen_comparison.py"
2511 def workspaceRelativeResultsDir = "_"
2512 def workspaceRelativeArtifactsArchive = "${os}.${architecture}.${configuration}.${scenario}.zip"
2513 def crossGenComparisonCmd = "python -u \${WORKSPACE}/${workspaceRelativeCrossGenComparisonScript} "
2514 def crossArch = "x64"
2515 def crossGenExecutable = "\${WORKSPACE}/${workspaceRelativeProductBinDir}/${crossArch}/crossgen"
2516 def workspaceRelativeCrossArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${crossArch}_${architecture}.${configuration}"
2518 buildCommands += "${dockerCmd}mkdir -p \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2519 buildCommands += "${dockerCmd}${crossGenComparisonCmd}crossgen_corelib --crossgen ${crossGenExecutable} --il_corelib \${WORKSPACE}/${workspaceRelativeCoreLib} --result_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2520 buildCommands += "${dockerCmd}${crossGenComparisonCmd}crossgen_framework --crossgen ${crossGenExecutable} --core_root \${WORKSPACE}/${workspaceRelativeCoreRootDir} --result_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2522 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeArtifactsArchive} ${workspaceRelativeCoreLib} ${workspaceRelativeCoreRootDir} ${workspaceRelativeCrossGenComparisonScript} ${workspaceRelativeResultsDir}"
2523 Utilities.addArchival(newJob, "${workspaceRelativeArtifactsArchive}")
2525 else if (scenario == 'pmi_asm_diffs') {
2526 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross generatelayoutonly"
2528 // Pass `--skip_diffs` -- the actual diffs will be done on an arm machine in the test job. This is the build job.
2529 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2530 buildCommands += "python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} --skip_diffs"
2532 // ZIP what we created.
2533 buildCommands += "zip -r product.${os}.${architecture}.${lowerConfiguration}.zip ./bin/Product/Linux.${architecture}.${configuration}"
2534 buildCommands += "zip -r product.baseline.${os}.${architecture}.${lowerConfiguration}.zip ./_/pmi/base/bin/Product/Linux.${architecture}.${configuration}"
2535 buildCommands += "zip -r coreroot.${os}.${architecture}.${lowerConfiguration}.zip ./bin/tests/Linux.${architecture}.${configuration}/Tests/Core_Root"
2536 buildCommands += "zip -r coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.zip ./_/pmi/base/bin/tests/Linux.${architecture}.${configuration}/Tests/Core_Root"
2538 // Archive the built artifacts
2539 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")
2542 // Then, using the same docker image, build the tests and generate the CORE_ROOT layout.
2544 def testBuildOpts = ""
2545 if (priority == '1') {
2546 testBuildOpts = "priority1"
2549 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross ${testBuildOpts}"
2551 // 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)
2552 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
2553 buildCommands += "tar -czf ${testArtifactsTgzFileName} bin/tests/${osGroup}.${architecture}.${configuration}"
2555 Utilities.addArchival(newJob, "${testArtifactsTgzFileName}", "")
2558 // Archive the logs, even if the build failed (which is when they are most interesting).
2559 Utilities.addArchival(newJob, "bin/Logs/*.log,bin/Logs/*.wrn,bin/Logs/*.err,bin/Logs/MsbuildDebugLogs/*", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2561 // We need to clean up the build machines; the docker build leaves newly built files with root permission, which
2562 // the cleanup task in Jenkins can't remove.
2565 azureVMAgentPostBuildAction {
2566 agentPostBuildAction('Delete agent after build execution (when idle).')
2572 println("Unknown architecture: ${architecture}");
2577 // editor brace matching: }
2579 println("Unknown os: ${os}");
2584 return buildCommands
2587 // Determine if we should generate a job for the given parameters. This is for non-flow jobs: either build and test, or build only.
2588 // Returns true if the job should be generated.
2589 def static shouldGenerateJob(def scenario, def isPR, def architecture, def configuration, def os, def isBuildOnly)
2591 // The various "innerloop" jobs are only available as PR triggered.
2594 if (isInnerloopTestScenario(scenario)) {
2598 if (scenario == 'corefx_innerloop') {
2603 // Tizen is only supported for armem architecture
2604 if (os == 'Tizen' && architecture != 'armem') {
2608 // Filter based on architecture.
2610 switch (architecture) {
2612 if ((os != 'Windows_NT') && (os != 'Ubuntu')) {
2617 if ((os != 'Windows_NT') && (os != 'Ubuntu16.04')) {
2622 if (os != 'Tizen') {
2627 if ((os != 'Windows_NT') && (os != 'Ubuntu')) {
2632 // Everything implemented
2635 println("Unknown architecture: ${architecture}")
2640 // Which (Windows) build only jobs are required?
2642 def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
2645 switch (architecture) {
2648 // We use build only jobs for Windows arm/arm64 cross-compilation corefx testing, so we need to generate builds for that.
2649 if (!isCoreFxScenario(scenario)) {
2655 if (!isNormalOrInnerloop) {
2664 // Filter based on scenario.
2666 if (isJitStressScenario(scenario)) {
2667 if (configuration != 'Checked') {
2671 def isEnabledOS = (os == 'Windows_NT') ||
2672 (os == 'Ubuntu' && (architecture == 'x64') && isCoreFxScenario(scenario)) ||
2673 (os == 'Ubuntu' && architecture == 'arm') ||
2674 (os == 'Ubuntu16.04' && architecture == 'arm64')
2679 switch (architecture) {
2684 // x86 ubuntu: no stress modes
2685 if (os == 'Ubuntu') {
2692 // We use build only jobs for Windows arm/arm64 cross-compilation corefx testing, so we need to generate builds for that.
2693 // No "regular" Windows arm corefx jobs, e.g.
2694 // For Ubuntu arm corefx testing, we use regular jobs (not "build only" since only Windows has "build only", and
2695 // the Ubuntu arm "regular" jobs don't run tests anyway).
2696 if (os == 'Windows_NT') {
2697 if (! (isBuildOnly && isCoreFxScenario(scenario)) ) {
2702 if (!isCoreFxScenario(scenario)) {
2709 // armem: no stress jobs for ARM emulator.
2713 else if (isR2RScenario(scenario)) {
2714 if (os != 'Windows_NT') {
2718 if (isR2RBaselineScenario(scenario)) {
2719 // no need for Debug scenario; Checked is sufficient
2720 if (configuration != 'Checked' && configuration != 'Release') {
2724 else if (isR2RStressScenario(scenario)) {
2725 // Stress scenarios only run with Checked builds, not Release (they would work with Debug, but be slow).
2726 if (configuration != 'Checked') {
2731 switch (architecture) {
2734 // Windows arm/arm64 ready-to-run jobs use flow jobs and test jobs, but depend on "normal" (not R2R specific) build jobs.
2741 else if (isCrossGenComparisonScenario(scenario)) {
2742 return shouldGenerateCrossGenComparisonJob(os, architecture, configuration, scenario)
2748 // The ilrt build isn't necessary except for Windows_NT2003. Non-Windows NT uses
2749 // the default scenario build
2750 if (os != 'Windows_NT') {
2754 if (architecture != 'x64') {
2758 if (configuration != 'Release') {
2763 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2766 if (architecture != 'x64') {
2769 if (configuration != 'Checked') {
2775 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2778 if (architecture != 'x64') {
2781 if (configuration != 'Release') {
2785 case 'gc_reliability_framework':
2786 case 'standalone_gc':
2787 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2791 if (architecture != 'x64') {
2795 if (configuration != 'Release' && configuration != 'Checked') {
2799 // We only run Windows and Ubuntu x64 Checked for formatting right now
2801 if (os != 'Windows_NT' && os != 'Ubuntu') {
2804 if (architecture != 'x64') {
2807 if (configuration != 'Checked') {
2812 if (os != 'Windows_NT' && (os != 'Ubuntu' || architecture != 'x64')) {
2815 if (architecture != 'x64' && architecture != 'x86') {
2823 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly)) {
2827 case 'corefx_innerloop':
2828 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2831 if (architecture != 'x64') {
2835 case 'pmi_asm_diffs':
2836 if (configuration != 'Checked') {
2839 if (architecture == 'armem') {
2842 // Currently, we don't support pmi_asm_diffs for Windows arm/arm64. We don't have a dotnet CLI available to
2843 // build jitutils. The jobs are not in validArmWindowsScenarios.
2844 if ((os == 'Windows_NT') && (architecture == 'arm' || architecture == 'arm64')) {
2847 // Currently, no support for Linux x86.
2848 if ((os != 'Windows_NT') && (architecture == 'x86')) {
2853 println("Unknown scenario: ${scenario}")
2859 // The job was not filtered out, so we should generate it!
2863 Constants.allScenarios.each { scenario ->
2864 [true, false].each { isPR ->
2865 Constants.architectureList.each { architecture ->
2866 Constants.configurationList.each { configuration ->
2867 Constants.osList.each { os ->
2868 // If the OS is Windows_NT_BuildOnly, set the isBuildOnly flag to true
2869 // and reset the os to Windows_NT
2870 def isBuildOnly = false
2871 if (os == 'Windows_NT_BuildOnly') {
2876 if (!shouldGenerateJob(scenario, isPR, architecture, configuration, os, isBuildOnly)) {
2881 def jobName = getJobName(configuration, architecture, os, scenario, isBuildOnly)
2882 def folderName = getJobFolder(scenario)
2884 // Create the new job
2885 def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folderName)) {}
2887 addToViews(newJob, false, isPR, architecture, os, configuration, scenario) // isFlowJob == false
2889 setJobMachineAffinity(architecture, os, true, false, false, newJob) // isBuildJob = true, isTestJob = false, isFlowJob = false
2891 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
2892 addTriggers(newJob, branch, isPR, architecture, os, configuration, scenario, false, isBuildOnly) // isFlowJob==false
2893 setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly)
2895 // Copy Windows build test binaries and corefx build artifacts for Linux cross build for armem.
2896 // We don't use a flow job for this, but we do depend on there being existing builds with these
2897 // artifacts produced.
2898 if ((architecture == 'armem') && (os == 'Tizen')) {
2899 // Define the Windows Tests and Corefx build job names
2900 def lowerConfiguration = configuration.toLowerCase()
2901 def WindowsTestsName = projectFolder + '/' +
2902 Utilities.getFullJobName(project,
2903 getJobName(lowerConfiguration, 'x64' , 'windows_nt', 'normal', true),
2905 def fxBranch = getFxBranch(branch)
2906 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' +
2907 Utilities.getFolderName(fxBranch)
2909 def arm_abi = 'armel'
2910 def corefx_os = 'tizen'
2912 // Let's use release CoreFX to test checked CoreCLR,
2913 // because we do not generate checked CoreFX in CoreFX CI yet.
2914 def corefx_lowerConfiguration = lowerConfiguration
2915 if (lowerConfiguration == 'checked') {
2916 corefx_lowerConfiguration = 'release'
2919 // Copy the Windows test binaries and the Corefx build binaries
2922 copyArtifacts(WindowsTestsName) {
2923 includePatterns('bin/tests/tests.zip')
2925 latestSuccessful(true)
2928 copyArtifacts("${corefxFolder}/${corefx_os}_${arm_abi}_cross_${corefx_lowerConfiguration}") {
2929 includePatterns('artifacts/bin/build.tar.gz')
2931 latestSuccessful(true)
2938 def buildCommands = calculateBuildCommands(newJob, scenario, branch, isPR, architecture, configuration, os, isBuildOnly)
2942 if (os == 'Windows_NT') {
2943 buildCommands.each { buildCommand ->
2944 batchFile(buildCommand)
2948 buildCommands.each { buildCommand ->
2961 // Create a Windows ARM/ARM64 test job that will be used by a flow job.
2962 // Returns the newly created job.
2963 def static CreateWindowsArmTestJob(def dslFactory, def project, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
2965 def osGroup = getOSGroup(os)
2966 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
2968 def jobFolder = getJobFolder(scenario)
2969 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
2971 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
2975 // Set up the copies
2977 // Coreclr build we are trying to test
2979 // ** NOTE ** This will, correctly, overwrite the CORE_ROOT from the Windows test archive
2981 copyArtifacts(inputCoreCLRBuildName) {
2982 excludePatterns('**/testResults.xml', '**/*.ni.dll')
2984 buildNumber('${CORECLR_BUILD}')
2988 if (isCoreFxScenario(scenario)) {
2990 // Only arm/arm64 supported for corefx testing now.
2991 assert architecture == 'arm' || architecture == 'arm64'
2993 // Unzip CoreFx runtime
2994 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}')\"")
2996 // Unzip CoreFx tests.
2997 batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('_\\fx\\fxtests.zip', '_\\fx\\artifacts\\bin\\tests')\"")
2999 // Add the script to run the corefx tests
3000 def corefx_runtime_path = "%WORKSPACE%\\_\\fx\\artifacts\\bin\\testhost\\netcoreapp-Windows_NT-Release-${architecture}"
3001 def corefx_tests_dir = "%WORKSPACE%\\_\\fx\\artifacts\\bin\\tests"
3002 def corefx_exclusion_file = "%WORKSPACE%\\tests\\${architecture}\\corefx_test_exclusions.txt"
3003 batchFile("call %WORKSPACE%\\tests\\scripts\\run-corefx-tests.bat ${corefx_runtime_path} ${corefx_tests_dir} ${corefx_exclusion_file} ${architecture}")
3005 } else { // !isCoreFxScenario(scenario)
3008 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}')\"")
3010 def buildCommands = ""
3012 def coreRootLocation = "%WORKSPACE%\\bin\\tests\\Windows_NT.${architecture}.${configuration}\\Tests\\Core_Root"
3013 def addEnvVariable = { variable, value -> buildCommands += "set ${variable}=${value}\r\n"}
3014 def addCommand = { cmd -> buildCommands += "${cmd}\r\n"}
3016 // Make sure Command Extensions are enabled. Used so %ERRORLEVEL% is available.
3017 addCommand("SETLOCAL ENABLEEXTENSIONS")
3020 addEnvVariable("CORE_ROOT", coreRootLocation)
3021 addEnvVariable("COMPlus_NoGuiOnAssert", "1")
3022 addEnvVariable("COMPlus_ContinueOnAssert", "0")
3024 // If we are running a stress mode, we'll set those variables as well
3025 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
3026 def stressValues = null
3027 if (isJitStressScenario(scenario)) {
3028 stressValues = Constants.jitStressModeScenarios[scenario]
3031 stressValues = Constants.r2rStressScenarios[scenario]
3034 stressValues.each { key, value ->
3035 addEnvVariable(key, value)
3039 if (isR2RScenario(scenario)) {
3040 // Crossgen the framework assemblies.
3041 buildCommands += """
3042 @for %%F in (%CORE_ROOT%\\*.dll) do @call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nxF
3043 @goto skip_PrecompileAssembly
3046 @REM Skip mscorlib since it is already precompiled.
3047 @if /I "%3" == "mscorlib.dll" exit /b 0
3048 @if /I "%3" == "mscorlib.ni.dll" exit /b 0
3050 "%CORE_ROOT%\\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" %2 >nul 2>nul
3051 @if "%errorlevel%" == "-2146230517" (
3052 echo %2 is not a managed assembly.
3053 ) else if "%errorlevel%" == "-2146234344" (
3054 echo %2 is not a managed assembly.
3055 ) else if %errorlevel% neq 0 (
3056 echo Unable to precompile %2
3062 :skip_PrecompileAssembly
3065 // Set RunCrossGen variable to cause test wrappers to invoke their logic to run
3066 // crossgen on tests before running them.
3067 addEnvVariable("RunCrossGen", "true")
3068 } // isR2RScenario(scenario)
3071 // Do not run generate layout. It will delete the correct CORE_ROOT, and we do not have a correct product
3072 // dir to copy from.
3073 def runtestCommand = "call %WORKSPACE%\\tests\\runtest.cmd ${architecture} ${configuration} skipgeneratelayout"
3075 addCommand("${runtestCommand}")
3076 addCommand("echo on") // Show the following commands in the log. "echo" doesn't alter the errorlevel.
3077 addCommand("set saved_errorlevel=%errorlevel%")
3079 // Collect the test logs collected by xunit. Ignore errors here. We want to collect these even if the run
3080 // failed for some reason, so it needs to be in this batch file.
3082 addCommand("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('.\\bin\\tests\\${osGroup}.${architecture}.${configuration}\\Reports', '.\\bin\\tests\\testReports.zip')\"");
3084 // Use the runtest.cmd errorlevel as the script errorlevel.
3085 addCommand("exit /b %saved_errorlevel%")
3087 batchFile(buildCommands)
3088 } // non-corefx testing
3092 if (!isCoreFxScenario(scenario)) {
3093 def doNotFailIfNothingArchived = true
3094 def archiveOnlyIfSuccessful = false
3095 Utilities.addArchival(newJob, "bin/tests/testReports.zip", "", doNotFailIfNothingArchived, archiveOnlyIfSuccessful)
3097 Utilities.addXUnitDotNETResults(newJob, 'bin/**/TestRun*.xml', true)
3103 // Create a test job not covered by the "Windows ARM" case that will be used by a flow job.
3104 // E.g., non-Windows tests.
3105 // Returns the newly created job.
3106 def static CreateOtherTestJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3108 def lowerConfiguration = configuration.toLowerCase()
3110 def isUbuntuArm64Job = ((os == "Ubuntu16.04") && (architecture == 'arm64'))
3111 def isUbuntuArm32Job = ((os == "Ubuntu") && (architecture == 'arm'))
3112 def isUbuntuArmJob = isUbuntuArm32Job || isUbuntuArm64Job
3114 def doCoreFxTesting = isCoreFxScenario(scenario)
3115 def isPmiAsmDiffsScenario = (scenario == 'pmi_asm_diffs')
3117 def workspaceRelativeFxRootLinux = "_/fx" // only used for CoreFX testing
3119 def osGroup = getOSGroup(os)
3120 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
3123 def useServerGC = false
3125 // Enable Server GC for Ubuntu PR builds
3126 // REVIEW: why? Does this apply to all architectures? Why only PR?
3127 if (os == 'Ubuntu' && isPR) {
3128 testOpts += ' --useServerGC'
3132 if (isR2RScenario(scenario)) {
3134 testOpts += ' --crossgen --runcrossgentests'
3136 if (scenario == 'r2r_jitstress1') {
3137 testOpts += ' --jitstress=1'
3139 else if (scenario == 'r2r_jitstress2') {
3140 testOpts += ' --jitstress=2'
3142 else if (scenario == 'r2r_jitstress1_tiered') {
3143 testOpts += ' --jitstress=1'
3145 else if (scenario == 'r2r_jitstress2_tiered') {
3146 testOpts += ' --jitstress=2'
3148 else if (scenario == 'r2r_jitstressregs1') {
3149 testOpts += ' --jitstressregs=1'
3151 else if (scenario == 'r2r_jitstressregs2') {
3152 testOpts += ' --jitstressregs=2'
3154 else if (scenario == 'r2r_jitstressregs3') {
3155 testOpts += ' --jitstressregs=3'
3157 else if (scenario == 'r2r_jitstressregs4') {
3158 testOpts += ' --jitstressregs=4'
3160 else if (scenario == 'r2r_jitstressregs8') {
3161 testOpts += ' --jitstressregs=8'
3163 else if (scenario == 'r2r_jitstressregs0x10') {
3164 testOpts += ' --jitstressregs=0x10'
3166 else if (scenario == 'r2r_jitstressregs0x80') {
3167 testOpts += ' --jitstressregs=0x80'
3169 else if (scenario == 'r2r_jitstressregs0x1000') {
3170 testOpts += ' --jitstressregs=0x1000'
3172 else if (scenario == 'r2r_jitminopts') {
3173 testOpts += ' --jitminopts'
3175 else if (scenario == 'r2r_jitforcerelocs') {
3176 testOpts += ' --jitforcerelocs'
3178 else if (scenario == 'r2r_gcstress15') {
3179 testOpts += ' --gcstresslevel=0xF'
3182 else if (scenario == 'jitdiff') {
3183 testOpts += ' --jitdisasm --crossgen'
3185 else if (scenario == 'illink') {
3186 testOpts += ' --link=\$WORKSPACE/linker/linker/bin/netcore_Release/netcoreapp2.0/ubuntu-x64/publish/illink'
3188 else if (isLongGc(scenario)) {
3189 // Long GC tests behave very poorly when they are not
3190 // the only test running (many of them allocate until OOM).
3191 testOpts += ' --sequential'
3193 // A note - runtest.sh does have "--long-gc" and "--gcsimulator" options
3194 // for running long GC and GCSimulator tests, respectively. We don't use them
3195 // here because using a playlist file produces much more readable output on the CI machines
3196 // and reduces running time.
3198 // The Long GC playlist contains all of the tests that are
3199 // going to be run. The GCSimulator playlist contains all of
3200 // the GC simulator tests.
3201 if (scenario == 'longgc') {
3202 testOpts += ' --long-gc --playlist=./tests/longRunningGcTests.txt'
3204 else if (scenario == 'gcsimulator') {
3205 testOpts += ' --gcsimulator --playlist=./tests/gcSimulatorTests.txt'
3208 else if (isGcReliabilityFramework(scenario)) {
3209 testOpts += ' --build-overlay-only'
3211 else if (scenario == 'standalone_gc') {
3212 if (osGroup == 'OSX') {
3213 testOpts += ' --gcname=libclrgc.dylib'
3215 else if (osGroup == 'Linux') {
3216 testOpts += ' --gcname=libclrgc.so'
3219 println("Unexpected OS group: ${osGroup} for os ${os}")
3224 def jobFolder = getJobFolder(scenario)
3225 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
3227 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
3231 // Set up the copies
3233 // Coreclr build we are trying to test
3235 // HACK: the Ubuntu arm64 copyArtifacts Jenkins plug-in is ridiculously slow (45 minutes to
3236 // 1.5 hours for this step). Instead, directly use wget, which is fast (1 minute).
3238 if (!isUbuntuArm64Job) {
3239 copyArtifacts(inputCoreCLRBuildName) {
3240 excludePatterns('**/testResults.xml', '**/*.ni.dll')
3242 buildNumber('${CORECLR_BUILD}')
3247 if (isUbuntuArmJob) {
3248 // Add some useful information to the log file. Ignore return codes.
3249 shell("uname -a || true")
3252 if (isUbuntuArm64Job) {
3253 // Copy the required artifacts directly, using wget, e.g.:
3255 // https://ci.dot.net/job/dotnet_coreclr/job/master/job/arm64_cross_checked_ubuntu16.04_innerloop_prtest/16/artifact/testnativebin.checked.zip
3256 // https://ci.dot.net/job/dotnet_coreclr/job/master/job/arm64_cross_checked_ubuntu16.04_innerloop_prtest/16/artifact/tests.checked.zip
3258 // parameterized as:
3260 // https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/job/${inputJobName}/${CORECLR_BUILD}/artifact/testnativebin.checked.zip
3261 // https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/job/${inputJobName}/${CORECLR_BUILD}/artifact/tests.checked.zip
3263 // CoreFX example artifact URLs:
3265 // 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
3266 // 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
3268 // Note that the source might be in a "jitstress" folder.
3270 // Use `--progress=dot:giga` to display some progress output, but limit it in the log file.
3272 // Use `--directory-prefix=_/fx` to specify where to put the corefx files (to match what other platforms do). Use this instead of `-O`.
3274 shell("echo \"Using wget instead of the Jenkins copy artifacts plug-in to copy artifacts from ${inputCoreCLRBuildName}\"")
3276 def mungedProjectName = Utilities.getFolderName(project)
3277 def mungedBranchName = Utilities.getFolderName(branch)
3279 def doCrossGenComparison = isCrossGenComparisonScenario(scenario)
3280 def inputCoreCLRBuildScenario = isInnerloopTestScenario(scenario) ? 'innerloop' : 'normal'
3281 if (isPmiAsmDiffsScenario || doCoreFxTesting || doCrossGenComparison) {
3282 // These depend on unique builds for each scenario
3283 inputCoreCLRBuildScenario = scenario
3285 def sourceJobName = getJobName(configuration, architecture, os, inputCoreCLRBuildScenario, false)
3286 def inputJobName = Utilities.getFullJobName(sourceJobName, isPR)
3288 // Need to add the sub-folder if necessary.
3289 def inputJobPath = "job/${inputJobName}"
3290 def folderName = getJobFolder(inputCoreCLRBuildScenario)
3291 if (folderName != '') {
3292 inputJobPath = "job/${folderName}/job/${inputJobName}"
3295 def inputUrlRoot = "https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/${inputJobPath}/\${CORECLR_BUILD}/artifact"
3297 if (isPmiAsmDiffsScenario) {
3298 def workspaceRelativeRootLinux = "_/pmi"
3299 shell("mkdir -p ${workspaceRelativeRootLinux}")
3300 shell("wget --progress=dot:giga ${inputUrlRoot}/product.${os}.${architecture}.${lowerConfiguration}.zip")
3301 shell("wget --progress=dot:giga ${inputUrlRoot}/product.baseline.${os}.${architecture}.${lowerConfiguration}.zip")
3302 shell("wget --progress=dot:giga ${inputUrlRoot}/coreroot.${os}.${architecture}.${lowerConfiguration}.zip")
3303 shell("wget --progress=dot:giga ${inputUrlRoot}/coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.zip")
3305 else if (doCoreFxTesting) {
3306 shell("mkdir -p ${workspaceRelativeFxRootLinux}")
3307 shell("wget --progress=dot:giga --directory-prefix=${workspaceRelativeFxRootLinux} ${inputUrlRoot}/${workspaceRelativeFxRootLinux}/fxtests.zip")
3308 shell("wget --progress=dot:giga --directory-prefix=${workspaceRelativeFxRootLinux} ${inputUrlRoot}/${workspaceRelativeFxRootLinux}/fxruntime.zip")
3311 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
3312 shell("wget --progress=dot:giga ${inputUrlRoot}/${testArtifactsTgzFileName}")
3316 if (architecture == 'x86') {
3317 shell("mkdir ./bin/CoreFxNative")
3319 def fxBranch = getFxBranch(branch)
3320 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' + Utilities.getFolderName(fxBranch)
3322 copyArtifacts("${corefxFolder}/ubuntu16.04_x86_release") {
3323 includePatterns('artifacts/bin/build.tar.gz')
3324 targetDirectory('bin/CoreFxNative')
3326 latestSuccessful(true)
3330 shell("mkdir ./bin/CoreFxBinDir")
3331 shell("tar -xf ./bin/CoreFxNative/artifacts/bin/build.tar.gz -C ./bin/CoreFxBinDir")
3334 if (isPmiAsmDiffsScenario) {
3335 // TODO: add back "-q" when we know it works
3336 shell("unzip -o ./product.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3337 shell("unzip -o ./product.baseline.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3338 shell("unzip -o ./coreroot.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3339 shell("unzip -o ./coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.zip || exit 0")
3341 // CoreFX testing downloads the CoreFX tests, not the coreclr tests. Also, unzip the built CoreFX layout/runtime directories.
3342 else if (doCoreFxTesting) {
3343 shell("unzip -q -o ${workspaceRelativeFxRootLinux}/fxtests.zip || exit 0")
3344 shell("unzip -q -o ${workspaceRelativeFxRootLinux}/fxruntime.zip || exit 0")
3347 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
3348 shell("tar -xzf ./${testArtifactsTgzFileName} || exit 0") // extracts to ./bin/tests/${osGroup}.${architecture}.${configuration}
3351 // Execute the tests
3352 def runDocker = isNeedDocker(architecture, os, false)
3353 def dockerPrefix = ""
3356 def dockerImage = getDockerImageName(architecture, os, false)
3357 dockerPrefix = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} "
3358 dockerCmd = dockerPrefix + "${dockerImage} "
3361 // If we are running a stress mode, we'll set those variables first.
3362 // For CoreFX, the stress variables are already built into the CoreFX test build per-test wrappers.
3363 if (!doCoreFxTesting && isJitStressScenario(scenario)) {
3364 def scriptFileName = "\${WORKSPACE}/set_stress_test_env.sh"
3365 def envScriptCmds = envScriptCreate(os, scriptFileName)
3366 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
3367 envScriptCmds += envScriptFinalize(os, scriptFileName)
3368 shell("${envScriptCmds}")
3369 testOpts += " --test-env=${scriptFileName}"
3372 // setup-stress-dependencies.sh, invoked by runtest.sh to download the coredistools package, depends on the "dotnet"
3373 // tool downloaded by the "init-tools.sh" script. However, it only invokes setup-stress-dependencies.sh for x64. The
3374 // coredistools package is used by GCStress on x86 and x64 to disassemble code to determine instruction boundaries.
3375 // On arm/arm64, it is not required as determining instruction boundaries is trivial.
3376 if (isGCStressRelatedTesting(scenario)) {
3377 if (architecture == 'x64') {
3378 shell('./init-tools.sh')
3382 if (isPmiAsmDiffsScenario) {
3384 python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} --skip_baseline_build""")
3386 shell("zip -r dasm.${os}.${architecture}.${configuration}.zip ./_/pmi/asm")
3388 else if (doCoreFxTesting) {
3390 \${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""")
3393 def runScript = "${dockerCmd}./tests/runtest.sh"
3397 ${lowerConfiguration} \\
3398 --testRootDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}\" \\
3399 --coreOverlayDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root\" \\
3400 --limitedDumpGeneration ${testOpts}""")
3403 if (isGcReliabilityFramework(scenario)) {
3404 // runtest.sh doesn't actually execute the reliability framework - do it here.
3407 dockerCmd = dockerPrefix + "-e COMPlus_gcServer=1 ${dockerImage} "
3410 shell("export COMPlus_gcServer=1")
3414 shell("${dockerCmd}./tests/scripts/run-gc-reliability-framework.sh ${architecture} ${configuration}")
3419 // Experimental: If on Ubuntu 14.04, then attempt to pull in crash dump links
3420 if (os in ['Ubuntu']) {
3421 SummaryBuilder summaries = new SummaryBuilder()
3422 summaries.addLinksSummaryFromFile('Crash dumps from this run:', 'dumplings.txt')
3423 summaries.emit(newJob)
3426 if (isPmiAsmDiffsScenario) {
3428 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.zip")
3430 else if (doCoreFxTesting) {
3431 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/artifacts/bin/**/testResults.xml")
3432 if ((os == "Ubuntu") && (architecture == 'arm')) {
3433 // We have a problem with the xunit plug-in, where it is consistently failing on Ubuntu arm32 test result uploading with this error:
3435 // [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
3437 // We haven't been able to identify the reason. So, do not add xunit parsing of the test data in this scenario.
3438 // This is tracked by: https://github.com/dotnet/coreclr/issues/19447.
3441 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRootLinux}/artifacts/bin/**/testResults.xml")
3445 Utilities.addXUnitDotNETResults(newJob, '**/coreclrtests.xml')
3451 def static CreateNonWindowsCrossGenComparisonTestJob(def dslFactory, def project, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3453 assert isCrossGenComparisonScenario(scenario)
3455 def osGroup = getOSGroup(os)
3456 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
3458 def workspaceRelativeResultsDir = "_"
3459 def workspaceRelativeNativeArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${architecture}_${architecture}.${configuration}"
3461 def crossArch = "x64"
3462 def workspaceRelativeCrossArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${crossArch}_${architecture}.${configuration}"
3464 def jobFolder = getJobFolder(scenario)
3465 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
3467 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
3470 def workspaceRelativeArtifactsArchive = "${os}.${architecture}.${configuration}.${scenario}.zip"
3473 copyArtifacts(inputCoreCLRBuildName) {
3474 includePatterns("${workspaceRelativeArtifactsArchive}")
3476 buildNumber('${CORECLR_BUILD}')
3480 shell("unzip -o ${workspaceRelativeArtifactsArchive} || exit 0")
3482 def workspaceRelativeCoreLib = "bin/Product/${osGroup}.${architecture}.${configuration}/IL/System.Private.CoreLib.dll"
3483 def workspaceRelativeCoreRootDir = "bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root"
3484 def workspaceRelativeCrossGenComparisonScript = "tests/scripts/crossgen_comparison.py"
3485 def workspaceRelativeCrossGenExecutable = "${workspaceRelativeCoreRootDir}/crossgen"
3487 def crossGenComparisonCmd = "python -u \${WORKSPACE}/${workspaceRelativeCrossGenComparisonScript} "
3488 def crossGenExecutable = "\${WORKSPACE}/${workspaceRelativeCrossGenExecutable}"
3490 shell("mkdir -p ${workspaceRelativeNativeArchResultDir}")
3491 shell("${crossGenComparisonCmd}crossgen_corelib --crossgen ${crossGenExecutable} --il_corelib \${WORKSPACE}/${workspaceRelativeCoreLib} --result_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir}")
3492 shell("${crossGenComparisonCmd}crossgen_framework --crossgen ${crossGenExecutable} --core_root \${WORKSPACE}/${workspaceRelativeCoreRootDir} --result_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir}")
3494 shell("${crossGenComparisonCmd}compare --base_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir} --diff_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}")
3498 Utilities.addArchival(newJob, "${workspaceRelativeNativeArchResultDir}/**")
3499 Utilities.addArchival(newJob, "${workspaceRelativeCrossArchResultDir}/**")
3504 // Create a test job that will be used by a flow job.
3505 // Returns the newly created job.
3506 // 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,
3507 // and we want the views to be the minimal set of "top-level" jobs that represent all work.
3508 def static CreateTestJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3510 def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
3513 if (windowsArmJob) {
3514 newJob = CreateWindowsArmTestJob(dslFactory, project, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3516 else if (isCrossGenComparisonScenario(scenario)) {
3517 newJob = CreateNonWindowsCrossGenComparisonTestJob(dslFactory, project, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3520 newJob = CreateOtherTestJob(dslFactory, project, branch, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3523 setJobMachineAffinity(architecture, os, false, true, false, newJob) // isBuildJob = false, isTestJob = true, isFlowJob = false
3525 if (scenario == 'jitdiff') {
3526 def osGroup = getOSGroup(os)
3527 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/dasm/**")
3530 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
3531 setJobTimeout(newJob, isPR, architecture, configuration, scenario, false)
3536 // Create a flow job to tie together a build job with the given test job.
3537 // Returns the new flow job.
3538 def static CreateFlowJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def fullTestJobName, def inputCoreCLRBuildName)
3540 // Windows CoreCLR build and Linux CoreCLR build (in parallel) ->
3541 // Linux CoreCLR test
3542 def flowJobName = getJobName(configuration, architecture, os, scenario, false) + "_flow"
3543 def jobFolder = getJobFolder(scenario)
3545 def newFlowJob = dslFactory.buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, jobFolder)) {
3547 coreclrBuildJob = build(params, '${inputCoreCLRBuildName}')
3549 // And then build the test build
3550 build(params + [CORECLR_BUILD: coreclrBuildJob.build.number], '${fullTestJobName}')
3553 JobReport.Report.addReference(inputCoreCLRBuildName)
3554 JobReport.Report.addReference(fullTestJobName)
3556 addToViews(newFlowJob, true, isPR, architecture, os, configuration, scenario) // isFlowJob = true
3558 setJobMachineAffinity(architecture, os, false, false, true, newFlowJob) // isBuildJob = false, isTestJob = false, isFlowJob = true
3560 Utilities.standardJobSetup(newFlowJob, project, isPR, "*/${branch}")
3561 addTriggers(newFlowJob, branch, isPR, architecture, os, configuration, scenario, true, false) // isFlowJob==true, isWindowsBuildOnlyJob==false
3566 // Determine if we should generate a flow job for the given parameters.
3567 // Returns true if the job should be generated.
3568 def static shouldGenerateFlowJob(def scenario, def isPR, def architecture, def configuration, def os)
3570 // The various "innerloop" jobs are only available as PR triggered.
3573 if (isInnerloopTestScenario(scenario)) {
3577 if (scenario == 'corefx_innerloop') {
3582 // Filter based on OS and architecture.
3584 switch (architecture) {
3586 if (os != "Ubuntu" && os != "Windows_NT") {
3591 if (os != "Ubuntu16.04" && os != "Windows_NT") {
3596 if (os != "Ubuntu") {
3601 if (!(os in Constants.crossList)) {
3604 if (os == "Windows_NT") {
3612 println("Unknown architecture: ${architecture}")
3617 def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
3619 // Filter based on scenario in OS.
3621 if (os == 'Windows_NT') {
3622 assert architecture == 'arm' || architecture == 'arm64'
3623 if (!isArmWindowsScenario(scenario)) {
3626 if (isNormalOrInnerloop && (configuration == 'Debug')) {
3627 // The arm32/arm64 Debug configuration for innerloop/normal scenario is a special case: it does a build only, and no test run.
3628 // To do that, it doesn't require a flow job.
3634 if (architecture == 'arm') {
3635 if (!(scenario in Constants.validLinuxArmScenarios)) {
3639 else if (architecture == 'arm64') {
3640 if (!(scenario in Constants.validLinuxArm64Scenarios)) {
3644 else if (architecture == 'x86') {
3645 // Linux/x86 only want innerloop and default test
3646 if (!isNormalOrInnerloop) {
3650 else if (architecture == 'x64') {
3651 // Linux/x64 corefx testing doesn't need a flow job; the "build" job runs run-corefx-tests.py which
3652 // builds and runs the corefx tests. Other Linux/x64 flow jobs are required to get the test
3653 // build from a Windows machine.
3654 if (isCoreFxScenario(scenario)) {
3660 // For CentOS, we only want Checked/Release builds.
3661 if (os == 'CentOS7.1') {
3662 if (configuration != 'Checked' && configuration != 'Release') {
3665 if (!isNormalOrInnerloop && !isR2RScenario(scenario)) {
3670 // For RedHat and Debian, we only do Release builds.
3671 else if (os == 'RHEL7.2' || os == 'Debian8.4') {
3672 if (configuration != 'Release') {
3675 if (!isNormalOrInnerloop) {
3680 // Next, filter based on scenario.
3682 if (isJitStressScenario(scenario)) {
3683 if (configuration != 'Checked') {
3687 else if (isR2RBaselineScenario(scenario)) {
3688 if (configuration != 'Checked' && configuration != 'Release') {
3692 else if (isR2RStressScenario(scenario)) {
3693 if (configuration != 'Checked') {
3697 else if (isCrossGenComparisonScenario(scenario)) {
3698 return shouldGenerateCrossGenComparisonJob(os, architecture, configuration, scenario)
3706 // Long GC tests take a long time on non-Release builds
3707 // ilrt is also Release only
3708 if (configuration != 'Release') {
3714 if (configuration != 'Checked') {
3719 case 'gc_reliability_framework':
3720 case 'standalone_gc':
3721 if (configuration != 'Release' && configuration != 'Checked') {
3730 if (os != 'Windows_NT' && os != 'Ubuntu') {
3740 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, false)) {
3745 case 'pmi_asm_diffs':
3746 if (configuration != 'Checked') {
3749 // No need for flow job except for Linux arm/arm64
3750 if ((os != 'Windows_NT') && (architecture != 'arm') && (architecture != 'arm64')) {
3755 case 'corefx_innerloop':
3756 // No flow job needed
3760 println("Unknown scenario: ${scenario}")
3766 // The job was not filtered out, so we should generate it!
3770 // Create jobs requiring flow jobs. This includes x64 non-Windows, arm/arm64 Ubuntu, and arm/arm64 Windows.
3771 Constants.allScenarios.each { scenario ->
3772 [true, false].each { isPR ->
3773 Constants.architectureList.each { architecture ->
3774 Constants.configurationList.each { configuration ->
3775 Constants.osList.each { os ->
3777 if (!shouldGenerateFlowJob(scenario, isPR, architecture, configuration, os)) {
3781 def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
3782 def doCoreFxTesting = isCoreFxScenario(scenario)
3783 def doCrossGenComparison = isCrossGenComparisonScenario(scenario)
3784 def isPmiAsmDiffsScenario = (scenario == 'pmi_asm_diffs')
3786 // Figure out the job name of the CoreCLR build the test will depend on.
3788 def inputCoreCLRBuildScenario = isInnerloopTestScenario(scenario) ? 'innerloop' : 'normal'
3789 def inputCoreCLRBuildIsBuildOnly = false
3790 if (doCoreFxTesting || isPmiAsmDiffsScenario) {
3791 // Every CoreFx test depends on its own unique build.
3792 inputCoreCLRBuildScenario = scenario
3793 if (windowsArmJob) {
3794 // Only Windows ARM corefx jobs use "build only" jobs. Others, such as Ubuntu ARM corefx, use "regular" jobs.
3795 inputCoreCLRBuildIsBuildOnly = true
3798 else if (doCrossGenComparison) {
3799 inputCoreCLRBuildScenario = scenario
3802 def inputCoreCLRFolderName = getJobFolder(inputCoreCLRBuildScenario)
3803 def inputCoreCLRBuildName = projectFolder + '/' +
3804 Utilities.getFullJobName(project, getJobName(configuration, architecture, os, inputCoreCLRBuildScenario, inputCoreCLRBuildIsBuildOnly), isPR, inputCoreCLRFolderName)
3806 // =============================================================================================
3807 // Create the test job
3808 // =============================================================================================
3810 def testJob = CreateTestJob(this, project, branch, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3812 // =============================================================================================
3813 // Create a build flow to join together the build and tests required to run this test.
3814 // =============================================================================================
3816 if (os == 'RHEL7.2' || os == 'Debian8.4') {
3817 // Do not create the flow job for RHEL jobs.
3821 def fullTestJobName = projectFolder + '/' + testJob.name
3822 def flowJob = CreateFlowJob(this, project, branch, architecture, os, configuration, scenario, isPR, fullTestJobName, inputCoreCLRBuildName)
3830 JobReport.Report.generateJobReport(out)
3832 // Make the call to generate the help job
3833 Utilities.createHelperJob(this, project, branch,
3834 "Welcome to the ${project} Repository", // This is prepended to the help message
3835 "Have a nice day!") // This is appended to the help message. You might put known issues here.
3837 Utilities.addCROSSCheck(this, project, branch)