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 = [
179 'Windows_NT_BuildOnly': [
186 // A set of scenarios that are valid for arm/arm64 tests run on hardware. This is a map from valid scenario name
187 // to Tests.lst file categories to exclude.
189 // This list should contain a subset of the scenarios from `allScenarios`. Please keep this in the same order as that,
190 // and with the same values, with some commented out, for easier maintenance.
192 // Note that some scenarios that are commented out should be enabled, but haven't yet been.
194 def static validArmWindowsScenarios = [
204 // 'gc_reliability_framework'
206 // 'corefx_innerloop'
207 // 'crossgen_comparison'
211 'r2r_jitstress1_tiered',
212 'r2r_jitstress2_tiered',
213 'r2r_jitstressregs1',
214 'r2r_jitstressregs2',
215 'r2r_jitstressregs3',
216 'r2r_jitstressregs4',
217 'r2r_jitstressregs8',
218 'r2r_jitstressregs0x10',
219 'r2r_jitstressregs0x80',
220 'r2r_jitstressregs0x1000',
222 'r2r_jitforcerelocs',
224 'r2r_no_tiered_compilation',
227 'no_tiered_compilation',
228 'no_tiered_compilation_innerloop',
241 'jitstressregs0x1000',
242 'jitstress2_jitstressregs1',
243 'jitstress2_jitstressregs2',
244 'jitstress2_jitstressregs3',
245 'jitstress2_jitstressregs4',
246 'jitstress2_jitstressregs8',
247 'jitstress2_jitstressregs0x10',
248 'jitstress2_jitstressregs0x80',
249 'jitstress2_jitstressregs0x1000',
251 // 'jitsse2only' // Only relevant to xarch
252 'jitnosimd', // Only interesting on platforms where SIMD support exists.
253 // 'jitincompletehwintrinsic'
254 // 'jitx86hwintrinsicnoavx'
255 // 'jitx86hwintrinsicnoavx2'
256 // 'jitx86hwintrinsicnosimd'
257 // 'jitnox86hwintrinsic'
258 'corefx_baseline', // corefx tests don't use smarty
259 'corefx_minopts', // corefx tests don't use smarty
260 'corefx_tieredcompilation', // corefx tests don't use smarty
261 'corefx_jitstress1', // corefx tests don't use smarty
262 'corefx_jitstress2', // corefx tests don't use smarty
263 'corefx_jitstressregs1', // corefx tests don't use smarty
264 'corefx_jitstressregs2', // corefx tests don't use smarty
265 'corefx_jitstressregs3', // corefx tests don't use smarty
266 'corefx_jitstressregs4', // corefx tests don't use smarty
267 'corefx_jitstressregs8', // corefx tests don't use smarty
268 'corefx_jitstressregs0x10', // corefx tests don't use smarty
269 'corefx_jitstressregs0x80', // corefx tests don't use smarty
270 'corefx_jitstressregs0x1000', // corefx tests don't use smarty
275 'gcstress0xc_zapdisable',
276 'gcstress0xc_zapdisable_jitstress2',
277 'gcstress0xc_zapdisable_heapverify1',
278 'gcstress0xc_jitstress1',
279 'gcstress0xc_jitstress2',
280 'gcstress0xc_minopts_heapverify1',
283 // NOTE: the following scenarios are not defined in the 'allScenarios' list! Is this a bug?
286 'minopts_zapdisable',
287 'gcstress0x3_jitstress1',
288 'gcstress0x3_jitstress2',
289 'gcstress0x3_jitstressregs1',
290 'gcstress0x3_jitstressregs2',
291 'gcstress0x3_jitstressregs3',
292 'gcstress0x3_jitstressregs4',
293 'gcstress0x3_jitstressregs8',
294 'gcstress0x3_jitstressregs0x10',
295 'gcstress0x3_jitstressregs0x80',
296 'gcstress0x3_jitstressregs0x1000',
297 'gcstress0xc_jitstressregs1',
298 'gcstress0xc_jitstressregs2',
299 'gcstress0xc_jitstressregs3',
300 'gcstress0xc_jitstressregs4',
301 'gcstress0xc_jitstressregs8',
302 'gcstress0xc_jitstressregs0x10',
303 'gcstress0xc_jitstressregs0x80',
304 'gcstress0xc_jitstressregs0x1000'
307 def static validLinuxArmScenarios = [
317 // 'gc_reliability_framework'
319 // 'corefx_innerloop'
320 'crossgen_comparison',
324 'r2r_jitstress1_tiered',
325 'r2r_jitstress2_tiered',
326 'r2r_jitstressregs1',
327 'r2r_jitstressregs2',
328 'r2r_jitstressregs3',
329 'r2r_jitstressregs4',
330 'r2r_jitstressregs8',
331 'r2r_jitstressregs0x10',
332 'r2r_jitstressregs0x80',
333 'r2r_jitstressregs0x1000',
335 'r2r_jitforcerelocs',
337 'r2r_no_tiered_compilation',
340 'no_tiered_compilation',
341 'no_tiered_compilation_innerloop',
354 'jitstressregs0x1000',
355 'jitstress2_jitstressregs1',
356 'jitstress2_jitstressregs2',
357 'jitstress2_jitstressregs3',
358 'jitstress2_jitstressregs4',
359 'jitstress2_jitstressregs8',
360 'jitstress2_jitstressregs0x10',
361 'jitstress2_jitstressregs0x80',
362 'jitstress2_jitstressregs0x1000',
364 // 'jitsse2only' // Only relevant to xarch
365 // 'jitnosimd' // Only interesting on platforms where SIMD support exists.
366 // 'jitincompletehwintrinsic'
367 // 'jitx86hwintrinsicnoavx'
368 // 'jitx86hwintrinsicnoavx2'
369 // 'jitx86hwintrinsicnosimd'
370 // 'jitnox86hwintrinsic'
373 'corefx_tieredcompilation',
376 'corefx_jitstressregs1',
377 'corefx_jitstressregs2',
378 'corefx_jitstressregs3',
379 'corefx_jitstressregs4',
380 'corefx_jitstressregs8',
381 'corefx_jitstressregs0x10',
382 'corefx_jitstressregs0x80',
383 'corefx_jitstressregs0x1000',
388 'gcstress0xc_zapdisable',
389 'gcstress0xc_zapdisable_jitstress2',
390 'gcstress0xc_zapdisable_heapverify1',
391 'gcstress0xc_jitstress1',
392 'gcstress0xc_jitstress2',
393 'gcstress0xc_minopts_heapverify1'
396 def static validLinuxArm64Scenarios = [
406 // 'gc_reliability_framework'
408 // 'corefx_innerloop'
409 'crossgen_comparison',
413 'r2r_jitstress1_tiered',
414 'r2r_jitstress2_tiered',
415 'r2r_jitstressregs1',
416 'r2r_jitstressregs2',
417 'r2r_jitstressregs3',
418 'r2r_jitstressregs4',
419 'r2r_jitstressregs8',
420 'r2r_jitstressregs0x10',
421 'r2r_jitstressregs0x80',
422 'r2r_jitstressregs0x1000',
424 'r2r_jitforcerelocs',
426 'r2r_no_tiered_compilation',
429 'no_tiered_compilation',
430 'no_tiered_compilation_innerloop',
443 'jitstressregs0x1000',
444 'jitstress2_jitstressregs1',
445 'jitstress2_jitstressregs2',
446 'jitstress2_jitstressregs3',
447 'jitstress2_jitstressregs4',
448 'jitstress2_jitstressregs8',
449 'jitstress2_jitstressregs0x10',
450 'jitstress2_jitstressregs0x80',
451 'jitstress2_jitstressregs0x1000',
453 // 'jitsse2only' // Only relevant to xarch
454 'jitnosimd', // Only interesting on platforms where SIMD support exists.
455 // 'jitincompletehwintrinsic'
456 // 'jitx86hwintrinsicnoavx'
457 // 'jitx86hwintrinsicnoavx2'
458 // 'jitx86hwintrinsicnosimd'
459 // 'jitnox86hwintrinsic'
462 'corefx_tieredcompilation',
465 'corefx_jitstressregs1',
466 'corefx_jitstressregs2',
467 'corefx_jitstressregs3',
468 'corefx_jitstressregs4',
469 'corefx_jitstressregs8',
470 'corefx_jitstressregs0x10',
471 'corefx_jitstressregs0x80',
472 'corefx_jitstressregs0x1000',
477 'gcstress0xc_zapdisable',
478 'gcstress0xc_zapdisable_jitstress2',
479 'gcstress0xc_zapdisable_heapverify1',
480 'gcstress0xc_jitstress1',
481 'gcstress0xc_jitstress2',
482 'gcstress0xc_minopts_heapverify1'
485 def static configurationList = ['Debug', 'Checked', 'Release']
487 // This is the set of architectures
488 // Some of these are pseudo-architectures:
489 // armem -- ARM builds/runs using an emulator. Used for Tizen runs.
490 def static architectureList = ['arm', 'armem', 'arm64', 'x64', 'x86']
492 // This set of architectures that cross build on Windows and run on Windows ARM64 hardware.
493 def static armWindowsCrossArchitectureList = ['arm', 'arm64']
496 // **************************************************************
497 // Create some specific views
499 // These aren't using the Utilities.addStandardFolderView() function, because that creates
500 // views based on a single regular expression. These views will be generated by adding a
501 // specific set of jobs to them.
503 // Utilities.addStandardFolderView() also creates a lot of additional stuff around the
504 // view, like "Build Statistics", "Job Statistics", "Unstable Jobs". Until it is determined
505 // those are required, don't add them (which simplifies the view pages, as well).
506 // **************************************************************
509 def static MergeJobView = null
510 def static PeriodicJobView = null
511 def static ArchitectureViews = [:]
512 def static OSViews = [:]
515 // MergeJobView: include all jobs that execute when a PR change is merged.
516 Views.MergeJobView = listView('Merge') {
529 // PeriodicJobView: include all jobs that execute on a schedule
530 Views.PeriodicJobView = listView('Periodic') {
543 // Create a view for non-PR jobs for each architecture.
544 Constants.architectureList.each { architecture ->
545 Views.ArchitectureViews[architecture] = listView(architecture) {
559 // Create a view for non-PR jobs for each OS.
560 Constants.osList.each { os ->
561 // Don't create one for the special 'Windows_NT_BuildOnly'
562 if (os == 'Windows_NT_BuildOnly') {
565 Views.OSViews[os] = listView(os) {
579 def static addToMergeView(def job) {
580 Views.MergeJobView.with {
587 def static addToPeriodicView(def job) {
588 Views.PeriodicJobView.with {
595 def static addToViews(def job, def isFlowJob, def isPR, def architecture, def os, def configuration, def scenario) {
597 // No views want PR jobs currently.
601 // 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
602 // "top-level" jobs. Build only jobs are such jobs.
603 if (os == 'Windows_NT_BuildOnly') {
608 // For non-flow jobs, which ones are only used by flow jobs?
609 if ((architecture == 'arm') || (architecture == 'arm64')) {
610 if (isCoreFxScenario(scenario)) {
611 // We have corefx-specific scenario builds for each of the runs, but these are driven by flow jobs.
615 // We're left with the basic normal/innerloop builds. We might want to remove these from the views also, if desired.
616 // However, there are a few, like the Debug Build, that is build only, not "Build and Test", that we should leave.
620 // Add to architecture view.
621 Views.ArchitectureViews[architecture].with {
628 Views.OSViews[os].with {
635 def static addPeriodicTriggerHelper(def job, String cronString, boolean alwaysRuns = false) {
636 addToPeriodicView(job)
637 Utilities.addPeriodicTrigger(job, cronString, alwaysRuns)
640 def static addGithubPushTriggerHelper(def job) {
641 // Disable all Push trigger jobs. All jobs will need to be requested.
642 // addToMergeView(job)
643 // Utilities.addGithubPushTrigger(job)
647 def static setMachineAffinity(def job, def os, def architecture, def options = null) {
648 assert os instanceof String
649 assert architecture instanceof String
651 def armArches = ['arm', 'armem', 'arm64']
653 if (!(architecture in armArches)) {
654 assert options == null
655 Utilities.setMachineAffinity(job, os, 'latest-or-auto')
660 // This is an arm(64) job.
662 // There are several options.
666 // Arm32 (Build) -> latest-arm64
667 // |-> os == "Windows_NT" && (architecture == "arm") && options['use_arm64_build_machine'] == true
668 // Arm32 (Test) -> arm64-windows_nt
669 // |-> os == "Windows_NT" && (architecture == "arm") && options['use_arm64_build_machine'] == false
671 // Arm64 (Build) -> latest-arm64
672 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == true
673 // Arm64 (Test) -> arm64-windows_nt
674 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == false
678 // Arm32 emulator (Build, Test) -> arm-cross-latest
679 // |-> os == "Tizen" && (architecture == "armem")
681 // Arm32 hardware (Flow) -> Ubuntu 16.04 latest-or-auto (don't use limited arm hardware)
682 // |-> os == "Ubuntu" && (architecture == "arm") && options['is_flow_job'] == true
683 // Arm32 hardware (Build) -> Ubuntu 16.04 latest-or-auto
684 // |-> os == "Ubuntu" && (architecture == "arm") && options['is_build_job'] == true
685 // Arm32 hardware (Test) -> Helix ubuntu.1404.arm32.open queue
686 // |-> os == "Ubuntu" && (architecture == "arm")
688 // Arm64 (Build) -> arm64-cross-latest
689 // |-> os != "Windows_NT" && architecture == "arm64" && options['is_build_job'] == true
690 // Arm64 (Test) -> Helix Ubuntu.1604.Arm64.Iron.Open queue
691 // |-> os != "Windows_NT" && architecture == "arm64"
693 // Note: we are no longer using Jenkins tags "arm64-huge-page-size", "arm64-small-page-size".
694 // Support for Linux arm64 large page size has been removed for now, as it wasn't being used.
696 // Note: we are no longer using Jenkins tag 'latest-arm64' for arm/arm64 Windows build machines. Instead,
697 // we are using public VS2017 arm/arm64 tools in a VM from Helix.
699 // This has to be a arm arch
700 assert architecture in armArches
701 if (os == "Windows_NT") {
702 // arm32/arm64 Windows jobs share the same machines for now
703 def isBuild = options['use_arm64_build_machine'] == true
705 if (isBuild == true) {
707 label('Windows.10.Amd64.ClientRS4.DevEx.Open')
710 Utilities.setMachineAffinity(job, 'windows.10.arm64.open')
713 assert os != 'Windows_NT'
715 if (architecture == 'armem') {
716 // arm emulator (Tizen). Build and test on same machine,
719 Utilities.setMachineAffinity(job, 'Ubuntu', 'arm-cross-latest')
722 // arm/arm64 Ubuntu on hardware.
723 assert architecture == 'arm' || architecture == 'arm64'
724 def isFlow = (options != null) && (options['is_flow_job'] == true)
725 def isBuild = (options != null) && (options['is_build_job'] == true)
726 if (isFlow || isBuild) {
727 // arm/arm64 Ubuntu build machine. Build uses docker, so the actual host OS is not
728 // very important. Therefore, use latest or auto. Flow jobs don't need to use arm hardware.
729 Utilities.setMachineAffinity(job, 'Ubuntu16.04', 'latest-or-auto')
731 // arm/arm64 Ubuntu test machine. Specify the Helix queue name here.
732 if (architecture == 'arm64') {
733 assert os == 'Ubuntu16.04'
735 label('Ubuntu.1604.Arm64.Iron.Open')
739 assert os == 'Ubuntu'
741 label('ubuntu.1404.arm32.open')
749 // setJobMachineAffinity: compute the machine affinity options for a job,
750 // then set the job with those affinity options.
751 def static setJobMachineAffinity(def architecture, def os, def isBuildJob, def isTestJob, def isFlowJob, def job)
753 assert (isBuildJob && !isTestJob && !isFlowJob) ||
754 (!isBuildJob && isTestJob && !isFlowJob) ||
755 (!isBuildJob && !isTestJob && isFlowJob)
757 def affinityOptions = null
758 def affinityArchitecture = architecture
760 if (os == "Windows_NT") {
761 if (architecture in Constants.armWindowsCrossArchitectureList) {
763 affinityOptions = [ "use_arm64_build_machine" : true ]
764 } else if (isTestJob) {
765 affinityOptions = [ "use_arm64_build_machine" : false ]
766 } else if (isFlowJob) {
767 // For the flow jobs set the machine affinity as x64
768 affinityArchitecture = 'x64'
773 if ((architecture == 'arm64') || (architecture == 'arm')) {
775 affinityOptions = ['is_build_job': true]
776 } else if (isFlowJob) {
777 affinityOptions = ['is_flow_job': true]
782 setMachineAffinity(job, os, affinityArchitecture, affinityOptions)
785 def static isGCStressRelatedTesting(def scenario) {
786 // The 'r2r_gcstress15' scenario is a basic scenario.
787 // Detect it and make it a GCStress related.
788 if (scenario == 'r2r_gcstress15')
793 def gcStressTestEnvVars = [ 'COMPlus_GCStress', 'COMPlus_ZapDisable', 'COMPlus_HeapVerify']
794 def scenarioName = scenario.toLowerCase()
795 def isGCStressTesting = false
796 Constants.jitStressModeScenarios[scenario].each{ k, v ->
797 if (k in gcStressTestEnvVars) {
798 isGCStressTesting = true;
801 return isGCStressTesting
804 def static isCoreFxScenario(def scenario) {
805 def corefx_prefix = 'corefx_'
806 if (scenario.length() < corefx_prefix.length()) {
809 return scenario.substring(0,corefx_prefix.length()) == corefx_prefix
812 def static isR2RBaselineScenario(def scenario) {
813 return (scenario == 'r2r')
816 def static isR2RStressScenario(def scenario) {
817 return Constants.r2rStressScenarios.containsKey(scenario)
820 def static isR2RScenario(def scenario) {
821 return isR2RBaselineScenario(scenario) || isR2RStressScenario(scenario)
824 def static isJitStressScenario(def scenario) {
825 return Constants.jitStressModeScenarios.containsKey(scenario)
828 def static isLongGc(def scenario) {
829 return (scenario == 'longgc' || scenario == 'gcsimulator')
832 def static isJitDiff(def scenario) {
833 return (scenario == 'jitdiff')
836 def static isGcReliabilityFramework(def scenario) {
837 return (scenario == 'gc_reliability_framework')
840 def static isArmWindowsScenario(def scenario) {
841 return Constants.validArmWindowsScenarios.contains(scenario)
844 def static isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly) {
845 if (isBuildOnly == true) {
846 os = 'Windows_NT_BuildOnly'
849 def validOsPrTriggerArchConfigs = Constants.prTriggeredValidInnerLoopCombos[os]
850 if (validOsPrTriggerArchConfigs != null) {
851 def validOsPrTriggerConfigs = validOsPrTriggerArchConfigs[architecture]
852 if (validOsPrTriggerConfigs != null) {
853 if (configuration in validOsPrTriggerConfigs) {
862 // This means the job builds and runs the 'innerloop' test set. This does not mean the job is
863 // scheduled with a default PR trigger despite the correlation being true at the moment.
864 def static isInnerloopTestScenario(def scenario) {
865 return (scenario == 'innerloop' || scenario == 'no_tiered_compilation_innerloop')
868 def static isCrossGenComparisonScenario(def scenario) {
869 return (scenario == 'crossgen_comparison')
872 def static shouldGenerateCrossGenComparisonJob(def os, def architecture, def configuration, def scenario) {
873 assert isCrossGenComparisonScenario(scenario)
874 return ((os == 'Ubuntu' && architecture == 'arm') || (os == 'Ubuntu16.04' && architecture == 'arm64')) && (configuration == 'Checked' || configuration == 'Release')
877 def static getFxBranch(def branch) {
878 def fxBranch = branch
879 // Map 'dev/unix_test_workflow' to 'master' so we can test CoreFX jobs in the CoreCLR dev/unix_test_workflow
880 // branch even though CoreFX doesn't have such a branch.
881 if (branch == 'dev/unix_test_workflow') {
887 def static setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly) {
888 // 2 hours (120 minutes) is the default timeout
891 if (!isInnerloopTestScenario(scenario)) {
892 // Pri-1 test builds take a long time (see calculateBuildCommands()). So up the Pri-1 build jobs timeout.
897 // Note that these can only increase, never decrease, the Pri-1 timeout possibly set above.
898 if (isGCStressRelatedTesting(scenario)) {
901 else if (isCoreFxScenario(scenario)) {
904 else if (isJitStressScenario(scenario)) {
907 else if (isR2RBaselineScenario(scenario)) {
910 else if (isLongGc(scenario)) {
913 else if (isJitDiff(scenario)) {
916 else if (isGcReliabilityFramework(scenario)) {
919 else if (architecture == 'armem' || architecture == 'arm64') {
923 if (architecture == 'arm') {
924 // ARM32 machines are particularly slow.
929 if (configuration == 'Debug') {
930 // Debug runs can be very slow. Add an hour.
934 // If we've changed the timeout from the default, set it in the job.
936 if (timeout != 120) {
937 Utilities.setJobTimeout(newJob, timeout)
941 def static getJobFolder(def scenario) {
942 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
945 if (scenario == 'illink') {
951 def static getStressModeDisplayName(def scenario) {
953 Constants.jitStressModeScenarios[scenario].each{ k, v ->
954 def prefixLength = 'COMPlus_'.length()
955 if (k.length() >= prefixLength) {
956 def modeName = k.substring(prefixLength, k.length())
957 if (displayStr != '') {
958 // Separate multiple variables with a space.
961 displayStr += modeName + '=' + v
965 if (isCoreFxScenario(scenario)) {
966 displayStr = ('CoreFx ' + displayStr).trim()
972 def static getR2RDisplayName(def scenario) {
973 // Assume the scenario name is one from the r2rStressScenarios dict, and remove its "r2r_" prefix.
974 def displayStr = scenario
975 def prefixLength = 'r2r_'.length()
976 if (displayStr.length() >= prefixLength) {
977 displayStr = "R2R " + displayStr.substring(prefixLength, displayStr.length())
978 } else if (scenario == 'r2r') {
984 def static getScenarioDisplayString(def scenario) {
987 return "Innerloop Build and Test"
989 case 'no_tiered_compilation_innerloop':
990 def displayStr = getStressModeDisplayName(scenario)
991 return "Innerloop Build and Test (Jit - ${displayStr})"
993 case 'corefx_innerloop':
994 return "CoreFX Tests"
997 return "Build and Test"
1000 return "Jit Diff Build and Test"
1003 return "IL RoundTrip Build and Test"
1006 return "Long-Running GC Build & Test"
1009 return "GC Simulator"
1011 case 'standalone_gc':
1012 return "Standalone GC"
1014 case 'gc_reliability_framework':
1015 return "GC Reliability Framework"
1021 if (isJitStressScenario(scenario)) {
1022 def displayStr = getStressModeDisplayName(scenario)
1023 return "Build and Test (Jit - ${displayStr})"
1025 else if (isR2RScenario(scenario)) {
1026 def displayStr = getR2RDisplayName(scenario)
1027 return "${displayStr} Build and Test"
1030 return "${scenario}"
1035 println("Unknown scenario: ${scenario}");
1040 // Functions to create an environment script.
1041 // envScriptCreate -- initialize the script (call first)
1042 // envScriptFinalize -- finalize the script (call last)
1043 // envScriptSetStressModeVariables -- set stress mode variables in the env script
1044 // envScriptAppendExistingScript -- append an existing script to the generated script
1046 // Each script returns a string of commands. Concatenate all the strings together before
1047 // adding them to the builds commands, to make sure they get executed as one Jenkins script.
1050 // Initialize the environment setting script.
1051 def static envScriptCreate(def os, def stepScriptLocation) {
1053 if (os == 'Windows_NT') {
1054 stepScript += "echo Creating TestEnv script\r\n"
1055 stepScript += "if exist ${stepScriptLocation} del ${stepScriptLocation}\r\n"
1057 // Create at least an empty script.
1058 stepScript += "echo. > ${stepScriptLocation}\r\n"
1061 stepScript += "echo Creating environment setting script\n"
1062 stepScript += "echo \\#\\!/usr/bin/env bash > ${stepScriptLocation}\n"
1068 // Generates the string for setting stress mode variables.
1069 def static envScriptSetStressModeVariables(def os, def stressModeVars, def stepScriptLocation) {
1071 if (os == 'Windows_NT') {
1072 stressModeVars.each{ k, v ->
1073 // Write out what we are writing to the script file
1074 stepScript += "echo Setting ${k}=${v}\r\n"
1075 // Write out the set itself to the script file`
1076 stepScript += "echo set ${k}=${v} >> ${stepScriptLocation}\r\n"
1080 stressModeVars.each{ k, v ->
1081 // Write out what we are writing to the script file
1082 stepScript += "echo Setting ${k}=${v}\n"
1083 // Write out the set itself to the script file`
1084 stepScript += "echo export ${k}=${v} >> ${stepScriptLocation}\n"
1091 // Append an existing script to an environment script.
1092 // Returns string of commands to do this.
1093 def static envScriptAppendExistingScript(def os, def appendScript, def stepScriptLocation) {
1094 assert (os == 'Windows_NT')
1097 stepScript += "echo Appending ${appendScript} to ${stepScriptLocation}\r\n"
1098 stepScript += "type ${appendScript} >> ${stepScriptLocation}\r\n"
1103 // Finalize an environment setting script.
1104 // Returns string of commands to do this.
1105 def static envScriptFinalize(def os, def stepScriptLocation) {
1108 if (os == 'Windows_NT') {
1109 // Display the resulting script. This is useful when looking at the output log file.
1110 stepScript += "echo Display the total script ${stepScriptLocation}\r\n"
1111 stepScript += "type ${stepScriptLocation}\r\n"
1114 stepScript += "chmod +x ${stepScriptLocation}\n"
1120 def static isNeedDocker(def architecture, def os, def isBuild) {
1122 if (architecture == 'x86' && os == 'Ubuntu') {
1125 else if (architecture == 'armem') {
1128 else if (architecture == 'arm') {
1129 if (os == 'Ubuntu') {
1133 else if (architecture == 'arm64') {
1134 if (os == 'Ubuntu16.04') {
1140 if (architecture == 'x86' && os == 'Ubuntu') {
1147 def static getDockerImageName(def architecture, def os, def isBuild) {
1148 // We must change some docker private images to official later
1150 if (architecture == 'x86' && os == 'Ubuntu') {
1151 return "hseok82/dotnet-buildtools-prereqs:ubuntu-16.04-crossx86-ef0ac75-20175511035548"
1153 else if (architecture == 'armem') {
1154 if (os == 'Tizen') {
1155 return "tizendotnet/dotnet-buildtools-prereqs:ubuntu-16.04-cross-e435274-20180426002255-tizen-rootfs-5.0m1"
1158 else if (architecture == 'arm') {
1159 if (os == 'Ubuntu') {
1160 return "mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-14.04-cross-e435274-20180426002420"
1163 else if (architecture == 'arm64') {
1164 if (os == 'Ubuntu16.04') {
1165 return "mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-arm64-a3ae44b-20180315221921"
1170 if (architecture == 'x86' && os == 'Ubuntu') {
1171 return "hseok82/dotnet-buildtools-prereqs:ubuntu1604_x86_test"
1174 println("Unknown architecture to use docker: ${architecture} ${os}");
1178 def static getTestArtifactsTgzFileName(def osGroup, def architecture, def configuration) {
1179 return "bin-tests-${osGroup}.${architecture}.${configuration}.tgz"
1182 // We have a limited amount of some hardware. For these, scale back the periodic testing we do,
1183 // and only allowing using this hardware in some specific branches.
1184 def static jobRequiresLimitedHardware(def architecture, def os) {
1185 if (architecture == 'arm') {
1186 // arm Windows and Linux hardware is limited.
1189 else if (architecture == 'arm64') {
1190 // arm64 Windows and Linux hardware is limited.
1198 // Calculates the name of the build job based on some typical parameters.
1200 def static getJobName(def configuration, def architecture, def os, def scenario, def isBuildOnly) {
1201 // If the architecture is x64, do not add that info into the build name.
1202 // Need to change around some systems and other builds to pick up the right builds
1205 def suffix = scenario != 'normal' ? "_${scenario}" : '';
1210 switch (architecture) {
1212 if (scenario == 'normal') {
1213 // For now we leave x64 off of the name for compatibility with other jobs
1214 baseName = configuration.toLowerCase() + '_' + os.toLowerCase()
1216 else if (scenario == 'formatting') {
1217 // we don't care about the configuration for the formatting job. It runs all configs
1218 baseName = architecture.toLowerCase() + '_' + os.toLowerCase()
1221 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1225 // These are cross builds
1226 assert os == 'Tizen'
1227 baseName = 'armel_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1231 // These are cross builds
1232 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1235 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
1238 println("Unknown architecture: ${architecture}");
1243 return baseName + suffix
1246 def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob, def bidailyCrossList) {
1248 // The dev/unix_test_workflow branch is used for Jenkins CI testing. We generally do not need any non-PR
1249 // triggers in the branch, because that would use machine resources unnecessarily.
1250 if (branch == 'dev/unix_test_workflow') {
1254 // Limited hardware is restricted for non-PR triggers to certain branches.
1255 if (jobRequiresLimitedHardware(architecture, os) && (!(branch in Constants.LimitedHardwareBranches))) {
1259 // Ubuntu x86 CI jobs are failing. Disable non-PR triggered jobs to avoid these constant failures
1260 // until this is fixed. Tracked by https://github.com/dotnet/coreclr/issues/19003.
1261 if (architecture == 'x86' && os == 'Ubuntu') {
1265 def isNormalOrInnerloop = (scenario == "normal" || scenario == "innerloop")
1269 case 'crossgen_comparison':
1270 if (isFlowJob && ((os == 'Ubuntu' && architecture == 'arm') || (os == 'Ubuntu16.04' && architecture == 'arm64')) && (configuration == 'Checked' || configuration == 'Release')) {
1271 addPeriodicTriggerHelper(job, '@daily')
1275 case 'pmi_asm_diffs':
1276 // No non-PR triggers for now.
1280 switch (architecture) {
1283 if (isFlowJob && architecture == 'x86' && os == 'Ubuntu') {
1284 addPeriodicTriggerHelper(job, '@daily')
1286 else if (isFlowJob || os == 'Windows_NT' || (architecture == 'x64' && !(os in Constants.crossList))) {
1287 addGithubPushTriggerHelper(job)
1291 if (os == 'Windows_NT') {
1292 if (isFlowJob || (isNormalOrInnerloop && (configuration == 'Debug'))) {
1293 // We would normally want a per-push trigger, but with limited hardware we can't keep up.
1294 // Do the builds daily.
1295 addPeriodicTriggerHelper(job, '@daily')
1299 // Only the flow jobs get push triggers; the build and test jobs are triggered by the flow job.
1301 addPeriodicTriggerHelper(job, '@daily')
1306 if (os == 'Windows_NT') {
1307 if (isFlowJob || (isNormalOrInnerloop && (configuration == 'Debug'))) {
1308 // We would normally want a push trigger, but with limited hardware we can't keep up.
1309 // Do the builds daily.
1310 addPeriodicTriggerHelper(job, '@daily')
1314 assert os == 'Ubuntu'
1315 // Only the flow jobs get push triggers; the build and test jobs are triggered by the flow job.
1317 // Currently no push triggers, with limited arm Linux hardware.
1318 // TODO: If we have enough machine capacity, add some arm Linux push triggers.
1319 addPeriodicTriggerHelper(job, '@daily')
1324 addGithubPushTriggerHelper(job)
1327 println("Unknown architecture: ${architecture}");
1333 assert !(os in bidailyCrossList)
1334 // r2r gets a push trigger for checked/release
1335 if (configuration == 'Checked' || configuration == 'Release') {
1336 if (architecture == 'x64' && os != 'OSX10.12') {
1337 //Flow jobs should be Windows, Ubuntu, OSX0.12, or CentOS
1338 if (isFlowJob || os == 'Windows_NT') {
1339 addGithubPushTriggerHelper(job)
1341 // OSX10.12 r2r jobs should only run every 12 hours, not daily.
1342 } else if (architecture == 'x64' && os == 'OSX10.12'){
1344 addPeriodicTriggerHelper(job, 'H H/12 * * *')
1347 // For x86, only add per-commit jobs for Windows
1348 else if (architecture == 'x86') {
1349 if (os == 'Windows_NT') {
1350 addGithubPushTriggerHelper(job)
1353 // arm r2r jobs should only run weekly.
1354 else if (architecture == 'arm') {
1356 addPeriodicTriggerHelper(job, '@weekly')
1359 // arm64 r2r jobs should only run weekly.
1360 else if (architecture == 'arm64') {
1362 addPeriodicTriggerHelper(job, '@weekly')
1367 case 'r2r_jitstress1':
1368 case 'r2r_jitstress2':
1369 case 'r2r_jitstress1_tiered':
1370 case 'r2r_jitstress2_tiered':
1371 case 'r2r_jitstressregs1':
1372 case 'r2r_jitstressregs2':
1373 case 'r2r_jitstressregs3':
1374 case 'r2r_jitstressregs4':
1375 case 'r2r_jitstressregs8':
1376 case 'r2r_jitstressregs0x10':
1377 case 'r2r_jitstressregs0x80':
1378 case 'r2r_jitstressregs0x1000':
1379 case 'r2r_jitminopts':
1380 case 'r2r_jitforcerelocs':
1381 case 'r2r_gcstress15':
1382 case 'r2r_no_tiered_compilation':
1383 assert !(os in bidailyCrossList)
1385 // GCStress=C is currently not supported on OS X
1386 if (os == 'OSX10.12' && isGCStressRelatedTesting(scenario)) {
1390 if (configuration == 'Checked' || configuration == 'Release') {
1391 if (architecture == 'x64') {
1392 //Flow jobs should be Windows, Ubuntu, OSX10.12, or CentOS
1393 if (isFlowJob || os == 'Windows_NT') {
1394 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1397 // For x86, only add periodic jobs for Windows
1398 else if (architecture == 'x86') {
1399 if (os == 'Windows_NT') {
1400 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1403 else if (architecture == 'arm') {
1405 addPeriodicTriggerHelper(job, '@weekly')
1408 else if (architecture == 'arm64') {
1410 addPeriodicTriggerHelper(job, '@weekly')
1416 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1417 assert configuration == 'Release'
1418 assert architecture == 'x64'
1419 addPeriodicTriggerHelper(job, '@daily')
1420 // TODO: Add once external email sending is available again
1421 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1424 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1425 assert configuration == 'Release'
1426 assert architecture == 'x64'
1427 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1428 // TODO: Add once external email sending is available again
1429 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1431 case 'standalone_gc':
1432 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1433 assert (configuration == 'Release' || configuration == 'Checked')
1434 // TODO: Add once external email sending is available again
1435 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1436 addPeriodicTriggerHelper(job, '@daily')
1438 case 'gc_reliability_framework':
1439 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1440 assert (configuration == 'Release' || configuration == 'Checked')
1441 // Only triggered by phrase.
1444 assert !(os in bidailyCrossList)
1445 // ILASM/ILDASM roundtrip one gets a daily build, and only for release
1446 if (architecture == 'x64' && configuration == 'Release') {
1447 if (isFlowJob || os == 'Windows_NT') {
1448 addPeriodicTriggerHelper(job, '@daily')
1453 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1454 assert configuration == 'Checked'
1455 assert (architecture == 'x64' || architecture == 'x86')
1456 addGithubPushTriggerHelper(job)
1459 assert (os == 'Windows_NT' || os == "Ubuntu")
1460 assert architecture == 'x64'
1461 addGithubPushTriggerHelper(job)
1463 case 'jitstressregs1':
1464 case 'jitstressregs2':
1465 case 'jitstressregs3':
1466 case 'jitstressregs4':
1467 case 'jitstressregs8':
1468 case 'jitstressregs0x10':
1469 case 'jitstressregs0x80':
1470 case 'jitstressregs0x1000':
1472 case 'tieredcompilation':
1473 case 'no_tiered_compilation':
1477 case 'jitstress1_tiered':
1478 case 'jitstress2_tiered':
1479 case 'jitstress2_jitstressregs1':
1480 case 'jitstress2_jitstressregs2':
1481 case 'jitstress2_jitstressregs3':
1482 case 'jitstress2_jitstressregs4':
1483 case 'jitstress2_jitstressregs8':
1484 case 'jitstress2_jitstressregs0x10':
1485 case 'jitstress2_jitstressregs0x80':
1486 case 'jitstress2_jitstressregs0x1000':
1487 case 'tailcallstress':
1490 case 'jitnox86hwintrinsic':
1491 case 'jitincompletehwintrinsic':
1492 case 'jitx86hwintrinsicnoavx':
1493 case 'jitx86hwintrinsicnoavx2':
1494 case 'jitx86hwintrinsicnosimd':
1495 case 'corefx_baseline':
1496 case 'corefx_minopts':
1497 case 'corefx_tieredcompilation':
1498 case 'corefx_jitstress1':
1499 case 'corefx_jitstress2':
1500 case 'corefx_jitstressregs1':
1501 case 'corefx_jitstressregs2':
1502 case 'corefx_jitstressregs3':
1503 case 'corefx_jitstressregs4':
1504 case 'corefx_jitstressregs8':
1505 case 'corefx_jitstressregs0x10':
1506 case 'corefx_jitstressregs0x80':
1507 case 'corefx_jitstressregs0x1000':
1509 if (os == 'CentOS7.1') {
1512 if (os in bidailyCrossList) {
1515 // ARM corefx testing uses non-flow jobs to provide the configuration-specific
1516 // build for the flow job. We don't need cron jobs for these. Note that the
1517 // Windows ARM jobs depend on a Windows "build only" job that exits the trigger
1518 // function very early, so only non-Windows gets here.
1519 if ((architecture == 'arm') && isCoreFxScenario(scenario) && !isFlowJob) {
1522 if ((architecture == 'arm64') && isCoreFxScenario(scenario) && !isFlowJob) {
1525 if (jobRequiresLimitedHardware(architecture, os)) {
1526 if ((architecture == 'arm64') && (os == 'Ubuntu16.04')) {
1527 // These jobs are very fast on Linux/arm64 hardware, so run them daily.
1528 addPeriodicTriggerHelper(job, '@daily')
1530 else if (scenario == 'corefx_baseline') {
1531 addPeriodicTriggerHelper(job, '@daily')
1534 addPeriodicTriggerHelper(job, '@weekly')
1538 addPeriodicTriggerHelper(job, '@daily')
1543 if (os == 'CentOS7.1') {
1546 if (os in bidailyCrossList) {
1549 addPeriodicTriggerHelper(job, '@weekly')
1552 case 'gcstress0xc_zapdisable':
1553 case 'gcstress0xc_zapdisable_jitstress2':
1554 case 'gcstress0xc_zapdisable_heapverify1':
1555 case 'gcstress0xc_jitstress1':
1556 case 'gcstress0xc_jitstress2':
1557 case 'gcstress0xc_minopts_heapverify1':
1558 if (os == 'OSX10.12') {
1559 // GCStress=C is currently not supported on OS X
1562 if (os == 'CentOS7.1') {
1565 if (os in bidailyCrossList) {
1568 addPeriodicTriggerHelper(job, '@weekly')
1572 // Testing on other operating systems TBD
1573 assert (os == 'Windows_NT' || os == 'Ubuntu')
1574 if (architecture == 'x64' || architecture == 'x86') {
1575 if (configuration == 'Checked') {
1576 addPeriodicTriggerHelper(job, '@daily')
1582 println("Unknown scenario: ${scenario}");
1589 // **************************
1590 // Define the basic inner loop builds for PR and commit. This is basically just the set
1591 // of coreclr builds over linux/osx 10.12/windows and debug/release/checked. In addition, the windows
1592 // builds will do a couple extra steps.
1593 // **************************
1595 // Adds a trigger for the PR build if one is needed. If isFlowJob is true, then this is the
1596 // flow job that rolls up the build and test for non-windows OS's. // If the job is a windows build only job,
1597 // it's just used for internal builds
1598 // If you add a job with a trigger phrase, please add that phrase to coreclr/Documentation/project-docs/ci-trigger-phrases.md
1599 def static addTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob) {
1600 def isNormalOrInnerloop = (scenario == "normal" || scenario == "innerloop")
1602 if (isWindowsBuildOnlyJob) {
1606 def bidailyCrossList = ['RHEL7.2', 'Debian8.4']
1607 // Non pull request builds.
1609 addNonPRTriggers(job, branch, isPR, architecture, os, configuration, scenario, isFlowJob, isWindowsBuildOnlyJob, bidailyCrossList)
1634 // Pull request builds. Generally these fall into two categories: default triggers and on-demand triggers
1635 // We generally only have a distinct set of default triggers but a bunch of on-demand ones.
1637 def contextString = ""
1638 def triggerString = ""
1639 def needsTrigger = true
1640 def isDefaultTrigger = false
1641 def isArm64PrivateJob = false
1642 def scenarioString = ""
1644 // Set up default context string and trigger phrases. This is overridden in places, sometimes just to keep
1645 // the existing non-standard descriptions and phrases. In some cases, the scenarios are asymmetric, as for
1646 // some jobs where the Debug configuration just does builds, no tests.
1648 // Some configurations, like arm32/arm64, always use the exact scenario name as part of the context string.
1649 // This makes it possible to copy/paste the displayed context string as "@dotnet-bot test <context-string>"
1650 // to invoke the trigger. Any "fancy" context string makes that impossible, requiring the user to either
1651 // remember the mapping from context string to trigger string, or use "@dotnet-bot help" to look it up.
1653 if (architecture == 'armem') {
1654 assert os == 'Tizen'
1655 architecture = 'armel'
1658 switch (architecture) {
1662 contextString = "${os} ${architecture} Cross ${configuration}"
1663 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
1665 if (scenario == 'innerloop') {
1666 contextString += " Innerloop"
1667 triggerString += "\\W+Innerloop"
1670 contextString += " ${scenario}"
1671 triggerString += "\\W+${scenario}"
1674 if (scenario == 'pmi_asm_diffs') {
1675 // Don't add the "Build and Test" part
1677 else if (configuration == 'Debug') {
1678 contextString += " Build"
1679 triggerString += "\\W+Build"
1682 contextString += " Build and Test"
1683 triggerString += "\\W+Build and Test"
1686 triggerString += ".*"
1690 scenarioString = getScenarioDisplayString(scenario)
1691 contextString = "${os} ${architecture} ${configuration} ${scenarioString}"
1692 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}"
1696 triggerString += "\\W+Build and Test.*"
1699 case 'corefx_innerloop': // maintain this asymmetry
1700 triggerString += "\\W+CoreFX Tests.*"
1704 triggerString += "\\W+${scenario}.*"
1708 triggerString += ".*"
1712 // Now determine what kind of trigger this job needs, if any. Any job should be triggerable, except for
1713 // non-flow jobs that are only used as part of flow jobs.
1715 switch (architecture) {
1716 case 'x64': // editor brace matching: {
1717 if (scenario == 'formatting') {
1718 assert configuration == 'Checked'
1719 if (os == 'Windows_NT' || os == 'Ubuntu') {
1720 isDefaultTrigger = true
1721 contextString = "${os} ${architecture} Formatting"
1726 if (scenario == 'pmi_asm_diffs') {
1727 // Everything is already set.
1728 // No default triggers.
1733 // OpenSUSE, Debian & RedHat get trigger phrases for pri 0 build, and pri 1 build & test
1736 if (scenario == 'innerloop') {
1738 contextString = "${os} ${architecture} ${configuration} Innerloop Build"
1739 isDefaultTrigger = true
1749 assert scenario != 'innerloop'
1750 contextString = "${os} ${architecture} ${configuration} Build"
1751 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+Build.*"
1755 if (scenario == 'illink') {
1758 else if (scenario == 'corefx_innerloop') {
1759 if (configuration == 'Checked') {
1760 isDefaultTrigger = true
1768 // Triggers on the non-flow jobs aren't necessary here
1769 // Corefx testing uses non-flow jobs.
1770 if (!isFlowJob && !isCoreFxScenario(scenario)) {
1771 needsTrigger = false
1776 isDefaultTrigger = true
1779 case 'no_tiered_compilation_innerloop':
1780 if (os == 'Ubuntu') {
1781 isDefaultTrigger = true
1793 // CentOS uses checked for default PR tests while debug is build only
1794 if (configuration == 'Debug') {
1795 isDefaultTrigger = true
1796 contextString = "${os} ${architecture} ${configuration} Innerloop Build"
1800 // Make sure this is a flow job to get build and test.
1802 needsTrigger = false
1806 if (configuration == 'Checked') {
1807 assert job.name.contains("flow")
1808 isDefaultTrigger = true
1809 contextString = "${os} ${architecture} ${configuration} Innerloop Build and Test"
1814 // Make sure this is a flow job to get build and test.
1816 needsTrigger = false
1829 case 'no_tiered_compilation_innerloop':
1830 isDefaultTrigger = true
1833 case 'corefx_innerloop':
1834 if (configuration == 'Checked' || configuration == 'Release') {
1835 isDefaultTrigger = true
1845 println("Unknown os: ${os}");
1852 // editor brace matching: }
1854 case 'armel': // editor brace matching: {
1857 azureVMAgentPostBuildAction {
1858 agentPostBuildAction('Delete agent if the build was not successful (when idle).')
1865 if (scenario == 'innerloop') {
1866 if (configuration == 'Checked') {
1867 isDefaultTrigger = true
1874 // editor brace matching: }
1877 case 'arm64': // editor brace matching: {
1883 // Triggers on the non-flow jobs aren't necessary
1885 needsTrigger = false
1888 if (os == 'Ubuntu' && architecture == 'arm') {
1891 case 'no_tiered_compilation_innerloop':
1892 if (configuration == 'Checked') {
1893 isDefaultTrigger = true
1896 case 'crossgen_comparison':
1897 if (configuration == 'Checked' || configuration == 'Release') {
1898 isDefaultTrigger = true
1906 assert isArmWindowsScenario(scenario)
1908 // 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
1909 // the non-flow Build job. All others need a trigger on the flow job.
1910 def needsFlowJobTrigger = !(isNormalOrInnerloop && (configuration == 'Debug'))
1911 if (isFlowJob != needsFlowJobTrigger) {
1912 needsTrigger = false
1918 if (configuration == 'Checked') {
1919 isDefaultTrigger = true
1920 isArm64PrivateJob = true
1924 isArm64PrivateJob = true
1929 println("NYI os: ${os}");
1935 // editor brace matching: }
1936 case 'x86': // editor brace matching: {
1937 assert ((os == 'Windows_NT') || ((os == 'Ubuntu') && isNormalOrInnerloop))
1938 if (os == 'Ubuntu') {
1939 // Triggers on the non-flow jobs aren't necessary here
1941 needsTrigger = false
1945 // on-demand only for ubuntu x86
1946 contextString = "${os} ${architecture} ${configuration} Build"
1947 triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}.*"
1952 case 'no_tiered_compilation_innerloop':
1953 isDefaultTrigger = true
1960 // editor brace matching: }
1963 println("Unknown architecture: ${architecture}");
1969 if (isArm64PrivateJob) {
1970 if (isDefaultTrigger) {
1971 Utilities.addDefaultPrivateGithubPRTriggerForBranch(job, branch, contextString, null, arm64Users)
1974 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1978 if (isDefaultTrigger) {
1979 Utilities.addGithubPRTriggerForBranch(job, branch, contextString)
1982 Utilities.addGithubPRTriggerForBranch(job, branch, contextString, triggerString)
1988 def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR, def architecture, def configuration, def os, def isBuildOnly) {
1989 def buildCommands = []
1990 def osGroup = getOSGroup(os)
1991 def lowerConfiguration = configuration.toLowerCase()
1993 // Which set of tests to build? Innerloop tests build Pri-0.
1994 // Currently, we only generate asm diffs on Pri-0 tests, if we generate asm diffs on tests at all.
1995 // CoreFX testing skipts building tests altogether (done below).
1996 // All other scenarios build Pri-1 tests.
1998 if (isInnerloopTestScenario(scenario)) {
2002 def doCoreFxTesting = isCoreFxScenario(scenario)
2004 def buildCoreclrTests = true
2005 if (doCoreFxTesting || (scenario == 'pmi_asm_diffs')) {
2006 // These scenarios don't need the coreclr tests build.
2007 buildCoreclrTests = false
2010 // Calculate the build steps, archival, and xunit results
2012 case 'Windows_NT': // editor brace matching: {
2013 switch (architecture) {
2016 def arch = architecture
2019 if (scenario == 'formatting') {
2020 buildCommands += "python -u tests\\scripts\\format.py -c %WORKSPACE% -o Windows_NT -a ${arch}"
2021 Utilities.addArchival(newJob, "format.patch", "", true, false)
2025 if (scenario == 'illink') {
2026 buildCommands += "tests\\scripts\\build_illink.cmd clone ${arch}"
2029 // If it is a release build for Windows, ensure PGO is used, else fail the build.
2030 if ((lowerConfiguration == 'release') &&
2031 (scenario in Constants.basicScenarios)) {
2033 buildOpts += ' -enforcepgo'
2036 if (buildCoreclrTests) {
2037 buildOpts += " -priority=${priority}"
2039 buildOpts += ' skiptests';
2042 // Set __TestIntermediateDir to something short. If __TestIntermediateDir is already set, build-test.cmd will
2043 // output test binaries to that directory. If it is not set, the binaries are sent to a default directory whose name is about
2044 // 35 characters long.
2046 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${arch} ${buildOpts}"
2048 if (scenario == 'pmi_asm_diffs') {
2049 // Now, generate the layout. We don't have any tests, but we need to restore the packages before calling runtest.cmd.
2050 // Call build-test.cmd to do this. It will do a little more than we need, but that's ok.
2051 buildCommands += "build-test.cmd ${lowerConfiguration} ${arch} skipmanaged skipnative"
2052 buildCommands += "tests\\runtest.cmd ${lowerConfiguration} ${arch} GenerateLayoutOnly"
2054 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2055 buildCommands += "python -u %WORKSPACE%\\tests\\scripts\\run-pmi-diffs.py -arch ${arch} -ci_arch ${architecture} -build_type ${configuration}"
2058 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('_\\pmi\\asm', '.\\dasm.${os}.${architecture}.${configuration}.zip')\"";
2061 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.zip")
2066 def runtestArguments = ''
2067 def testOpts = 'collectdumps'
2069 if (isR2RScenario(scenario)) {
2071 // If this is a ReadyToRun scenario, pass 'crossgen'
2072 // to cause framework assemblies to be crossgen'ed. Pass 'runcrossgentests'
2073 // to cause the tests to be crossgen'ed.
2075 testOpts += ' crossgen runcrossgentests'
2077 else if (scenario == 'jitdiff') {
2078 testOpts += ' jitdisasm crossgen'
2080 else if (scenario == 'ilrt') {
2081 testOpts += ' ilasmroundtrip'
2083 else if (isLongGc(scenario)) {
2084 testOpts += " ${scenario} sequential"
2086 else if (scenario == 'standalone_gc') {
2087 testOpts += ' gcname clrgc.dll'
2089 else if (scenario == 'illink') {
2090 testOpts += " link %WORKSPACE%\\linker\\linker\\bin\\netcore_Release\\netcoreapp2.0\\win10-${arch}\\publish\\illink.exe"
2093 // Default per-test timeout is 10 minutes. For stress modes and Debug scenarios, increase this
2094 // to 30 minutes (30 * 60 * 1000 = 180000). The "timeout" argument to runtest.cmd sets this, by
2095 // taking a timeout value in milliseconds. (Note that it sets the __TestTimeout environment variable,
2096 // which is read by the xunit harness.)
2097 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario) || (lowerConfiguration == 'debug'))
2099 def timeout = 1800000
2100 testOpts += " timeout ${timeout}"
2103 // If we are running a stress mode, we should write out the set of key
2104 // value env pairs to a file at this point and then we'll pass that to runtest.cmd
2106 def envScriptPath = ''
2107 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
2108 def buildCommandsStr = ''
2109 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
2110 buildCommandsStr += envScriptCreate(os, envScriptPath)
2112 if (isJitStressScenario(scenario)) {
2113 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
2115 else if (isR2RStressScenario(scenario)) {
2116 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.r2rStressScenarios[scenario], envScriptPath)
2119 envScriptFinalize(os, envScriptPath)
2121 // Note that buildCommands is an array of individually executed commands; we want all the commands used to
2122 // create the SetStressModes.bat script to be executed together, hence we accumulate them as strings
2123 // into a single script.
2124 buildCommands += buildCommandsStr
2126 if (envScriptPath != '') {
2127 testOpts += " TestEnv ${envScriptPath}"
2130 runtestArguments = "${lowerConfiguration} ${arch} ${testOpts}"
2132 if (doCoreFxTesting) {
2133 if (scenario == 'corefx_innerloop') {
2134 // Create CORE_ROOT and testhost
2135 buildCommands += "build-test.cmd ${lowerConfiguration} ${arch} buildtesthostonly"
2136 buildCommands += "tests\\runtest.cmd ${runtestArguments} CoreFXTestsAll"
2138 // Archive and process (only) the test results
2139 Utilities.addArchival(newJob, "bin/Logs/**/testResults.xml", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2140 Utilities.addXUnitDotNETResults(newJob, "bin/Logs/**/testResults.xml")
2143 def workspaceRelativeFxRoot = "_/fx"
2144 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
2145 def fxBranch = getFxBranch(branch)
2147 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}"
2149 // Archive and process (only) the test results
2150 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2151 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2153 //Archive additional build stuff to diagnose why my attempt at fault injection isn't causing CI to fail
2154 Utilities.addArchival(newJob, "SetStressModes.bat", "", true, false)
2155 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/testhost/**", "", true, false)
2158 else if (isGcReliabilityFramework(scenario)) {
2159 buildCommands += "tests\\runtest.cmd ${runtestArguments} GenerateLayoutOnly"
2160 buildCommands += "tests\\scripts\\run-gc-reliability-framework.cmd ${arch} ${configuration}"
2163 def buildCommandsStr = "call tests\\runtest.cmd ${runtestArguments}\r\n"
2165 // If we ran the tests, collect the test logs collected by xunit. We want to do this even if the tests fail, so we
2166 // must do it in the same batch file as the test run.
2168 buildCommandsStr += "echo on\r\n" // Show the following commands in the log. "echo" doesn't alter the errorlevel.
2169 buildCommandsStr += "set saved_errorlevel=%errorlevel%\r\n"
2170 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";
2171 buildCommandsStr += "exit /b %saved_errorlevel%\r\n"
2173 def doNotFailIfNothingArchived = true
2174 def archiveOnlyIfSuccessful = false
2175 Utilities.addArchival(newJob, "bin/tests/testReports.zip", "", doNotFailIfNothingArchived, archiveOnlyIfSuccessful)
2177 buildCommands += buildCommandsStr
2179 } // end if (!isBuildOnly)
2181 if (!doCoreFxTesting) {
2182 // Run the rest of the build
2183 // Build the mscorlib for the other OS's
2184 buildCommands += "build.cmd ${lowerConfiguration} ${arch} linuxmscorlib"
2185 buildCommands += "build.cmd ${lowerConfiguration} ${arch} osxmscorlib"
2187 if (arch == 'x64') {
2188 buildCommands += "build.cmd ${lowerConfiguration} arm64 linuxmscorlib"
2191 if (!isJitStressScenario(scenario)) {
2192 // Zip up the tests directory so that we don't use so much space/time copying
2193 // 10s of thousands of files around.
2194 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')\"";
2196 // For Windows, pull full test results and test drops for x86/x64.
2197 // No need to pull for stress mode scenarios (downstream builds use the default scenario)
2198 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2201 if (scenario == 'jitdiff') {
2202 // retrieve jit-dasm output for base commit, and run jit-diff
2204 // if this is a build only job, we want to keep the default (build) artifacts for the flow job
2205 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${arch}.${configuration}/dasm/**")
2210 Utilities.addXUnitDotNETResults(newJob, 'bin/**/TestRun*.xml', true)
2214 // Archive the logs, even if the build failed (which is when they are most interesting).
2215 Utilities.addArchival(newJob, "bin/Logs/*.log,bin/Logs/*.wrn,bin/Logs/*.err,bin/Logs/MsbuildDebugLogs/*", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2219 assert isArmWindowsScenario(scenario)
2223 if (buildCoreclrTests) {
2224 buildOpts += " -priority=${priority}"
2226 buildOpts += ' skiptests'
2229 // This is now a build only job. Do not run tests. Use the flow job.
2230 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} ${buildOpts}"
2232 if (doCoreFxTesting) {
2235 // Set the stress mode variables; this is incorporated into the generated CoreFx RunTests.cmd files.
2236 def envScriptPath = ''
2237 def buildCommandsStr = ''
2238 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
2239 buildCommandsStr += envScriptCreate(os, envScriptPath)
2240 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
2241 envScriptFinalize(os, envScriptPath)
2242 buildCommands += buildCommandsStr
2244 def workspaceRelativeFxRootLinux = "_/fx"
2245 def workspaceRelativeFxRootWin = "_\\fx"
2246 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
2247 def fxBranch = getFxBranch(branch)
2249 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"
2251 // Zip up the CoreFx runtime and tests. We don't need the CoreCLR binaries; they have been copied to the CoreFX tree.
2252 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')\"";
2253 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('${workspaceRelativeFxRootWin}\\artifacts\\bin\\tests', '${workspaceRelativeFxRootWin}\\fxtests.zip')\"";
2255 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxruntime.zip")
2256 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxtests.zip")
2258 // Zip up the tests directory so that we don't use so much space/time copying
2259 // 10s of thousands of files around.
2260 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')\"";
2263 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2266 // Archive the logs, even if the build failed (which is when they are most interesting).
2267 Utilities.addArchival(newJob, "bin/Logs/*.log,bin/Logs/*.wrn,bin/Logs/*.err,bin/Logs/MsbuildDebugLogs/*", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2270 println("Unknown architecture: ${architecture}");
2275 // end case 'Windows_NT'; editor brace matching: }
2284 case 'Fedora24': // editor brace matching: {
2285 switch (architecture) {
2287 if (os == 'Ubuntu') {
2288 // build and PAL test
2289 def dockerImage = getDockerImageName(architecture, os, true)
2290 buildCommands += "docker run -i --rm -v \${WORKSPACE}:/opt/code -w /opt/code -e ROOTFS_DIR=/crossrootfs/x86 ${dockerImage} ./build.sh ${architecture} cross ${lowerConfiguration}"
2291 dockerImage = getDockerImageName(architecture, os, false)
2292 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"
2293 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2294 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2299 if (scenario == 'formatting') {
2300 buildCommands += "python tests/scripts/format.py -c \${WORKSPACE} -o Linux -a ${architecture}"
2301 Utilities.addArchival(newJob, "format.patch", "", true, false)
2305 if (scenario == 'pmi_asm_diffs') {
2306 buildCommands += "./build.sh ${lowerConfiguration} ${architecture} skiptests skipbuildpackages"
2307 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} generatelayoutonly"
2309 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2310 buildCommands += "python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration}"
2313 buildCommands += "tar -czf dasm.${os}.${architecture}.${configuration}.tgz ./_/pmi/asm"
2314 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.tgz")
2318 if (scenario == 'illink') {
2319 assert(os == 'Ubuntu')
2320 buildCommands += "./tests/scripts/build_illink.sh --clone --arch=${architecture}"
2323 if (!doCoreFxTesting) {
2324 // We run pal tests on all OS but generate mscorlib (and thus, nuget packages)
2325 // only on supported OS platforms.
2326 def bootstrapRid = Utilities.getBoostrapPublishRid(os)
2327 def bootstrapRidEnv = bootstrapRid != null ? "__PUBLISH_RID=${bootstrapRid} " : ''
2329 buildCommands += "${bootstrapRidEnv}./build.sh ${lowerConfiguration} ${architecture}"
2331 def testBuildOpts = ""
2332 if (priority == '1') {
2333 testBuildOpts = "priority1"
2336 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} ${testBuildOpts}"
2337 buildCommands += "src/pal/tests/palsuite/runpaltests.sh \${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration} \${WORKSPACE}/bin/paltestout"
2339 // Archive the bin/tests folder for *_tst jobs
2340 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
2341 buildCommands += "tar -czf ${testArtifactsTgzFileName} bin/tests/${osGroup}.${architecture}.${configuration}"
2342 Utilities.addArchival(newJob, "${testArtifactsTgzFileName}", "")
2344 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2347 if (scenario == 'corefx_innerloop') {
2348 assert os == 'Ubuntu' || 'OSX10.12'
2349 assert architecture == 'x64'
2351 buildCommands += "./build.sh ${lowerConfiguration} ${architecture} skiptests"
2352 buildCommands += "./build-test.sh ${lowerConfiguration} ${architecture} generatetesthostonly"
2353 buildCommands += "./tests/runtest.sh ${lowerConfiguration} --corefxtestsall --testHostDir=\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/testhost/ --coreclr-src=\${WORKSPACE}"
2355 // Archive and process (only) the test results
2356 Utilities.addArchival(newJob, "bin/Logs/**/testResults.xml", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2357 Utilities.addXUnitDotNETResults(newJob, "bin/Logs/**/testResults.xml")
2360 // Corefx stress testing
2361 assert os == 'Ubuntu'
2362 assert architecture == 'x64'
2363 assert lowerConfiguration == 'checked'
2364 assert isJitStressScenario(scenario)
2367 buildCommands += "./build.sh ${lowerConfiguration} ${architecture}"
2369 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2371 def envScriptCmds = envScriptCreate(os, scriptFileName)
2372 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2373 envScriptCmds += envScriptFinalize(os, scriptFileName)
2374 buildCommands += envScriptCmds
2376 // Build and text corefx
2377 def workspaceRelativeFxRoot = "_/fx"
2378 def absoluteFxRoot = "\$WORKSPACE/${workspaceRelativeFxRoot}"
2379 def fxBranch = getFxBranch(branch)
2381 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}"
2383 // Archive and process (only) the test results
2384 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2385 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/artifacts/bin/**/testResults.xml")
2389 // Archive the logs, even if the build failed (which is when they are most interesting).
2390 Utilities.addArchival(newJob, "bin/Logs/*.log,bin/Logs/*.wrn,bin/Logs/*.err,bin/Logs/MsbuildDebugLogs/*", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2393 // Emulator cross builds for ARM runs on Tizen currently
2394 assert os == 'Tizen'
2396 def arm_abi = "armel"
2397 def linuxCodeName = "tizen"
2399 // Unzip the Windows test binaries first. Exit with 0
2400 buildCommands += "unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/Windows_NT.x64.${configuration} || exit 0"
2402 // Unpack the corefx binaries
2403 buildCommands += "mkdir ./bin/CoreFxBinDir"
2404 buildCommands += "tar -xf ./artifacts/bin/build.tar.gz -C ./bin/CoreFxBinDir"
2406 // Call the ARM CI script to cross build and test using docker
2407 buildCommands += """./tests/scripts/arm32_ci_script.sh \\
2410 --linuxCodeName=${linuxCodeName} \\
2411 --buildConfig=${lowerConfiguration} \\
2412 --testRootDir=./bin/tests/Windows_NT.x64.${configuration} \\
2413 --coreFxBinDir=./bin/CoreFxBinDir \\
2414 --testDirFile=./tests/testsRunningInsideARM.txt"""
2416 // Basic archiving of the build, no pal tests
2417 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2421 // Non-Windows ARM cross builds on hardware run on Ubuntu only
2422 assert (os == 'Ubuntu') || (os == 'Ubuntu16.04')
2424 // Add some useful information to the log file. Ignore return codes.
2425 buildCommands += "uname -a || true"
2427 // Cross build the Ubuntu/arm product using docker with a docker image that contains the correct
2428 // Ubuntu cross-compilation toolset (running on a Ubuntu x64 host).
2429 // For CoreFX testing, we only need the product build; we don't need to generate the layouts. The product
2430 // build is then copied into the corefx layout by the run-corefx-test.py script. For CoreFX testing, we
2431 // ZIP up the generated CoreFX runtime and tests.
2433 def dockerImage = getDockerImageName(architecture, os, true)
2434 def dockerCmd = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} -e ROOTFS_DIR=/crossrootfs/${architecture} ${dockerImage} "
2436 buildCommands += "${dockerCmd}\${WORKSPACE}/build.sh ${lowerConfiguration} ${architecture} cross"
2438 if (doCoreFxTesting) {
2439 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2441 def envScriptCmds = envScriptCreate(os, scriptFileName)
2442 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2443 envScriptCmds += envScriptFinalize(os, scriptFileName)
2444 buildCommands += envScriptCmds
2446 // Build and text corefx
2447 def workspaceRelativeFxRootLinux = "_/fx"
2448 def absoluteFxRoot = "\$WORKSPACE/${workspaceRelativeFxRootLinux}"
2449 def fxBranch = getFxBranch(branch)
2451 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"
2453 // Docker creates files with root permission, so we need to zip in docker also, or else we'll get permission errors.
2454 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeFxRootLinux}/fxruntime.zip ${workspaceRelativeFxRootLinux}/artifacts/bin/testhost/netcoreapp-Linux-Release-${architecture}"
2455 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeFxRootLinux}/fxtests.zip ${workspaceRelativeFxRootLinux}/artifacts/bin/tests"
2457 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxruntime.zip")
2458 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxtests.zip")
2460 else if (isCrossGenComparisonScenario(scenario)) {
2461 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross generatelayoutonly"
2463 def workspaceRelativeProductBinDir = "bin/Product/${osGroup}.${architecture}.${configuration}"
2464 def workspaceRelativeCoreLib = "${workspaceRelativeProductBinDir}/IL/System.Private.CoreLib.dll"
2465 def workspaceRelativeCoreRootDir = "bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root"
2466 def workspaceRelativeCrossGenComparisonScript = "tests/scripts/crossgen_comparison.py"
2467 def workspaceRelativeResultsDir = "_"
2468 def workspaceRelativeArtifactsArchive = "${os}.${architecture}.${configuration}.${scenario}.zip"
2469 def crossGenComparisonCmd = "python -u \${WORKSPACE}/${workspaceRelativeCrossGenComparisonScript} "
2470 def crossArch = "x64"
2471 def crossGenExecutable = "\${WORKSPACE}/${workspaceRelativeProductBinDir}/${crossArch}/crossgen"
2472 def workspaceRelativeCrossArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${crossArch}_${architecture}.${configuration}"
2474 buildCommands += "${dockerCmd}mkdir -p \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2475 buildCommands += "${dockerCmd}${crossGenComparisonCmd}crossgen_corelib --crossgen ${crossGenExecutable} --il_corelib \${WORKSPACE}/${workspaceRelativeCoreLib} --result_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2476 buildCommands += "${dockerCmd}${crossGenComparisonCmd}crossgen_framework --crossgen ${crossGenExecutable} --core_root \${WORKSPACE}/${workspaceRelativeCoreRootDir} --result_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}"
2478 buildCommands += "${dockerCmd}zip -r ${workspaceRelativeArtifactsArchive} ${workspaceRelativeCoreLib} ${workspaceRelativeCoreRootDir} ${workspaceRelativeCrossGenComparisonScript} ${workspaceRelativeResultsDir}"
2479 Utilities.addArchival(newJob, "${workspaceRelativeArtifactsArchive}")
2481 else if (scenario == 'pmi_asm_diffs') {
2482 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross generatelayoutonly"
2484 // Pass `--skip_diffs` -- the actual diffs will be done on an arm machine in the test job. This is the build job.
2485 // TODO: Add -target_branch and -commit_hash arguments based on GitHub variables.
2486 buildCommands += "python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} --skip_diffs"
2488 // Archive what we created.
2489 buildCommands += "tar -czf product.${os}.${architecture}.${lowerConfiguration}.tgz ./bin/Product/Linux.${architecture}.${configuration}"
2490 buildCommands += "tar -czf product.baseline.${os}.${architecture}.${lowerConfiguration}.tgz ./_/pmi/base/bin/Product/Linux.${architecture}.${configuration}"
2491 buildCommands += "tar -czf coreroot.${os}.${architecture}.${lowerConfiguration}.tgz ./bin/tests/Linux.${architecture}.${configuration}/Tests/Core_Root"
2492 buildCommands += "tar -czf coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.tgz ./_/pmi/base/bin/tests/Linux.${architecture}.${configuration}/Tests/Core_Root"
2494 // Archive the built artifacts
2495 Utilities.addArchival(newJob, "product.${os}.${architecture}.${lowerConfiguration}.tgz,product.baseline.${os}.${architecture}.${lowerConfiguration}.tgz,coreroot.${os}.${architecture}.${lowerConfiguration}.tgz,coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.tgz")
2498 // Then, using the same docker image, build the tests and generate the CORE_ROOT layout.
2500 def testBuildOpts = ""
2501 if (priority == '1') {
2502 testBuildOpts = "priority1"
2505 buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross ${testBuildOpts}"
2507 // 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)
2508 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
2509 buildCommands += "tar -czf ${testArtifactsTgzFileName} bin/tests/${osGroup}.${architecture}.${configuration}"
2511 Utilities.addArchival(newJob, "${testArtifactsTgzFileName}", "")
2514 // Archive the logs, even if the build failed (which is when they are most interesting).
2515 Utilities.addArchival(newJob, "bin/Logs/*.log,bin/Logs/*.wrn,bin/Logs/*.err,bin/Logs/MsbuildDebugLogs/*", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
2517 // We need to clean up the build machines; the docker build leaves newly built files with root permission, which
2518 // the cleanup task in Jenkins can't remove.
2521 azureVMAgentPostBuildAction {
2522 agentPostBuildAction('Delete agent after build execution (when idle).')
2528 println("Unknown architecture: ${architecture}");
2533 // editor brace matching: }
2535 println("Unknown os: ${os}");
2540 return buildCommands
2543 // Determine if we should generate a job for the given parameters. This is for non-flow jobs: either build and test, or build only.
2544 // Returns true if the job should be generated.
2545 def static shouldGenerateJob(def scenario, def isPR, def architecture, def configuration, def os, def isBuildOnly)
2547 def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
2549 // Innerloop jobs (except corefx_innerloop) are no longer created in Jenkins
2550 // The only exception is windows arm(64)
2551 if (isInnerloopTestScenario(scenario) && isPR && !windowsArmJob) {
2552 assert scenario != 'corefx_innerloop'
2557 if (isInnerloopTestScenario(scenario)) {
2561 if (scenario == 'corefx_innerloop') {
2566 // Tizen is only supported for armem architecture
2567 if (os == 'Tizen' && architecture != 'armem') {
2571 // Filter based on architecture.
2573 switch (architecture) {
2575 if ((os != 'Windows_NT') && (os != 'Ubuntu')) {
2580 if ((os != 'Windows_NT') && (os != 'Ubuntu16.04')) {
2585 if (os != 'Tizen') {
2590 if ((os != 'Windows_NT') && (os != 'Ubuntu')) {
2595 // Everything implemented
2598 println("Unknown architecture: ${architecture}")
2603 // Which (Windows) build only jobs are required?
2605 def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
2608 switch (architecture) {
2611 // We use build only jobs for Windows arm/arm64 cross-compilation corefx testing, so we need to generate builds for that.
2612 if (!isCoreFxScenario(scenario)) {
2618 if (!isNormalOrInnerloop) {
2627 // Filter based on scenario.
2629 if (isJitStressScenario(scenario)) {
2630 if (configuration != 'Checked') {
2634 def isEnabledOS = (os == 'Windows_NT') ||
2635 (os == 'Ubuntu' && (architecture == 'x64') && isCoreFxScenario(scenario)) ||
2636 (os == 'Ubuntu' && architecture == 'arm') ||
2637 (os == 'Ubuntu16.04' && architecture == 'arm64')
2642 switch (architecture) {
2647 // x86 ubuntu: no stress modes
2648 if (os == 'Ubuntu') {
2655 // We use build only jobs for Windows arm/arm64 cross-compilation corefx testing, so we need to generate builds for that.
2656 // No "regular" Windows arm corefx jobs, e.g.
2657 // For Ubuntu arm corefx testing, we use regular jobs (not "build only" since only Windows has "build only", and
2658 // the Ubuntu arm "regular" jobs don't run tests anyway).
2659 if (os == 'Windows_NT') {
2660 if (! (isBuildOnly && isCoreFxScenario(scenario)) ) {
2665 if (!isCoreFxScenario(scenario)) {
2672 // armem: no stress jobs for ARM emulator.
2676 else if (isR2RScenario(scenario)) {
2677 if (os != 'Windows_NT') {
2681 if (isR2RBaselineScenario(scenario)) {
2682 // no need for Debug scenario; Checked is sufficient
2683 if (configuration != 'Checked' && configuration != 'Release') {
2687 else if (isR2RStressScenario(scenario)) {
2688 // Stress scenarios only run with Checked builds, not Release (they would work with Debug, but be slow).
2689 if (configuration != 'Checked') {
2694 switch (architecture) {
2697 // Windows arm/arm64 ready-to-run jobs use flow jobs and test jobs, but depend on "normal" (not R2R specific) build jobs.
2704 else if (isCrossGenComparisonScenario(scenario)) {
2705 return shouldGenerateCrossGenComparisonJob(os, architecture, configuration, scenario)
2711 // The ilrt build isn't necessary except for Windows_NT2003. Non-Windows NT uses
2712 // the default scenario build
2713 if (os != 'Windows_NT') {
2717 if (architecture != 'x64') {
2721 if (configuration != 'Release') {
2726 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2729 if (architecture != 'x64') {
2732 if (configuration != 'Checked') {
2738 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2741 if (architecture != 'x64') {
2744 if (configuration != 'Release') {
2748 case 'gc_reliability_framework':
2749 case 'standalone_gc':
2750 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2754 if (architecture != 'x64') {
2758 if (configuration != 'Release' && configuration != 'Checked') {
2762 // We only run Windows and Ubuntu x64 Checked for formatting right now
2764 if (os != 'Windows_NT' && os != 'Ubuntu') {
2767 if (architecture != 'x64') {
2770 if (configuration != 'Checked') {
2775 if (os != 'Windows_NT' && (os != 'Ubuntu' || architecture != 'x64')) {
2778 if (architecture != 'x64' && architecture != 'x86') {
2786 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly)) {
2790 case 'corefx_innerloop':
2791 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2794 if (architecture != 'x64') {
2798 case 'pmi_asm_diffs':
2799 if (configuration != 'Checked') {
2802 if (architecture == 'armem') {
2805 // Currently, we don't support pmi_asm_diffs for Windows arm/arm64. We don't have a dotnet CLI available to
2806 // build jitutils. The jobs are not in validArmWindowsScenarios.
2807 if ((os == 'Windows_NT') && (architecture == 'arm' || architecture == 'arm64')) {
2810 // Currently, no support for Linux x86.
2811 if ((os != 'Windows_NT') && (architecture == 'x86')) {
2816 println("Unknown scenario: ${scenario}")
2822 // The job was not filtered out, so we should generate it!
2826 Constants.allScenarios.each { scenario ->
2827 [true, false].each { isPR ->
2828 Constants.architectureList.each { architecture ->
2829 Constants.configurationList.each { configuration ->
2830 Constants.osList.each { os ->
2831 // If the OS is Windows_NT_BuildOnly, set the isBuildOnly flag to true
2832 // and reset the os to Windows_NT
2833 def isBuildOnly = false
2834 if (os == 'Windows_NT_BuildOnly') {
2839 if (!shouldGenerateJob(scenario, isPR, architecture, configuration, os, isBuildOnly)) {
2844 def jobName = getJobName(configuration, architecture, os, scenario, isBuildOnly)
2845 def folderName = getJobFolder(scenario)
2847 // Create the new job
2848 def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folderName)) {}
2850 addToViews(newJob, false, isPR, architecture, os, configuration, scenario) // isFlowJob == false
2852 setJobMachineAffinity(architecture, os, true, false, false, newJob) // isBuildJob = true, isTestJob = false, isFlowJob = false
2854 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
2855 addTriggers(newJob, branch, isPR, architecture, os, configuration, scenario, false, isBuildOnly) // isFlowJob==false
2856 setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly)
2858 // Copy Windows build test binaries and corefx build artifacts for Linux cross build for armem.
2859 // We don't use a flow job for this, but we do depend on there being existing builds with these
2860 // artifacts produced.
2861 if ((architecture == 'armem') && (os == 'Tizen')) {
2862 // Define the Windows Tests and Corefx build job names
2863 def lowerConfiguration = configuration.toLowerCase()
2864 def WindowsTestsName = projectFolder + '/' +
2865 Utilities.getFullJobName(project,
2866 getJobName(lowerConfiguration, 'x64' , 'windows_nt', 'normal', true),
2868 def fxBranch = getFxBranch(branch)
2869 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' +
2870 Utilities.getFolderName(fxBranch)
2872 def arm_abi = 'armel'
2873 def corefx_os = 'tizen'
2875 // Let's use release CoreFX to test checked CoreCLR,
2876 // because we do not generate checked CoreFX in CoreFX CI yet.
2877 def corefx_lowerConfiguration = lowerConfiguration
2878 if (lowerConfiguration == 'checked') {
2879 corefx_lowerConfiguration = 'release'
2882 // Copy the Windows test binaries and the Corefx build binaries
2885 copyArtifacts(WindowsTestsName) {
2886 includePatterns('bin/tests/tests.zip')
2888 latestSuccessful(true)
2891 copyArtifacts("${corefxFolder}/${corefx_os}_${arm_abi}_cross_${corefx_lowerConfiguration}") {
2892 includePatterns('artifacts/bin/build.tar.gz')
2894 latestSuccessful(true)
2901 def buildCommands = calculateBuildCommands(newJob, scenario, branch, isPR, architecture, configuration, os, isBuildOnly)
2905 if (os == 'Windows_NT') {
2906 buildCommands.each { buildCommand ->
2907 batchFile(buildCommand)
2911 buildCommands.each { buildCommand ->
2924 // Create a Windows ARM/ARM64 test job that will be used by a flow job.
2925 // Returns the newly created job.
2926 def static CreateWindowsArmTestJob(def dslFactory, def project, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
2928 def osGroup = getOSGroup(os)
2929 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
2931 def jobFolder = getJobFolder(scenario)
2932 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
2934 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
2938 // Set up the copies
2940 // Coreclr build we are trying to test
2942 // ** NOTE ** This will, correctly, overwrite the CORE_ROOT from the Windows test archive
2944 copyArtifacts(inputCoreCLRBuildName) {
2945 excludePatterns('**/testResults.xml', '**/*.ni.dll')
2947 buildNumber('${CORECLR_BUILD}')
2951 if (isCoreFxScenario(scenario)) {
2953 // Only arm/arm64 supported for corefx testing now.
2954 assert architecture == 'arm' || architecture == 'arm64'
2956 // Unzip CoreFx runtime
2957 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}')\"")
2959 // Unzip CoreFx tests.
2960 batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('_\\fx\\fxtests.zip', '_\\fx\\artifacts\\bin\\tests')\"")
2962 // Add the script to run the corefx tests
2963 def corefx_runtime_path = "%WORKSPACE%\\_\\fx\\artifacts\\bin\\testhost\\netcoreapp-Windows_NT-Release-${architecture}"
2964 def corefx_tests_dir = "%WORKSPACE%\\_\\fx\\artifacts\\bin\\tests"
2965 def corefx_exclusion_file = "%WORKSPACE%\\tests\\${architecture}\\corefx_test_exclusions.txt"
2966 batchFile("call %WORKSPACE%\\tests\\scripts\\run-corefx-tests.bat ${corefx_runtime_path} ${corefx_tests_dir} ${corefx_exclusion_file} ${architecture}")
2968 } else { // !isCoreFxScenario(scenario)
2971 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}')\"")
2973 def buildCommands = ""
2975 def coreRootLocation = "%WORKSPACE%\\bin\\tests\\Windows_NT.${architecture}.${configuration}\\Tests\\Core_Root"
2976 def addEnvVariable = { variable, value -> buildCommands += "set ${variable}=${value}\r\n"}
2977 def addCommand = { cmd -> buildCommands += "${cmd}\r\n"}
2979 // Make sure Command Extensions are enabled. Used so %ERRORLEVEL% is available.
2980 addCommand("SETLOCAL ENABLEEXTENSIONS")
2983 addEnvVariable("CORE_ROOT", coreRootLocation)
2984 addEnvVariable("COMPlus_NoGuiOnAssert", "1")
2985 addEnvVariable("COMPlus_ContinueOnAssert", "0")
2987 // If we are running a stress mode, we'll set those variables as well
2988 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
2989 def stressValues = null
2990 if (isJitStressScenario(scenario)) {
2991 stressValues = Constants.jitStressModeScenarios[scenario]
2994 stressValues = Constants.r2rStressScenarios[scenario]
2997 stressValues.each { key, value ->
2998 addEnvVariable(key, value)
3002 if (isR2RScenario(scenario)) {
3003 // Crossgen the framework assemblies.
3004 buildCommands += """
3005 @for %%F in (%CORE_ROOT%\\*.dll) do @call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nxF
3006 @goto skip_PrecompileAssembly
3009 @REM Skip mscorlib since it is already precompiled.
3010 @if /I "%3" == "mscorlib.dll" exit /b 0
3011 @if /I "%3" == "mscorlib.ni.dll" exit /b 0
3013 "%CORE_ROOT%\\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" %2 >nul 2>nul
3014 @if "%errorlevel%" == "-2146230517" (
3015 echo %2 is not a managed assembly.
3016 ) else if "%errorlevel%" == "-2146234344" (
3017 echo %2 is not a managed assembly.
3018 ) else if %errorlevel% neq 0 (
3019 echo Unable to precompile %2
3025 :skip_PrecompileAssembly
3028 // Set RunCrossGen variable to cause test wrappers to invoke their logic to run
3029 // crossgen on tests before running them.
3030 addEnvVariable("RunCrossGen", "true")
3031 } // isR2RScenario(scenario)
3034 // Do not run generate layout. It will delete the correct CORE_ROOT, and we do not have a correct product
3035 // dir to copy from.
3036 def runtestCommand = "call %WORKSPACE%\\tests\\runtest.cmd ${architecture} ${configuration} skipgeneratelayout"
3038 addCommand("${runtestCommand}")
3039 addCommand("echo on") // Show the following commands in the log. "echo" doesn't alter the errorlevel.
3040 addCommand("set saved_errorlevel=%errorlevel%")
3042 // Collect the test logs collected by xunit. Ignore errors here. We want to collect these even if the run
3043 // failed for some reason, so it needs to be in this batch file.
3045 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')\"");
3047 // Use the runtest.cmd errorlevel as the script errorlevel.
3048 addCommand("exit /b %saved_errorlevel%")
3050 batchFile(buildCommands)
3051 } // non-corefx testing
3055 if (!isCoreFxScenario(scenario)) {
3056 def doNotFailIfNothingArchived = true
3057 def archiveOnlyIfSuccessful = false
3058 Utilities.addArchival(newJob, "bin/tests/testReports.zip", "", doNotFailIfNothingArchived, archiveOnlyIfSuccessful)
3060 Utilities.addXUnitDotNETResults(newJob, 'bin/**/TestRun*.xml', true)
3066 // Create a test job not covered by the "Windows ARM" case that will be used by a flow job.
3067 // E.g., non-Windows tests.
3068 // Returns the newly created job.
3069 def static CreateOtherTestJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3071 def lowerConfiguration = configuration.toLowerCase()
3073 def isUbuntuArm64Job = ((os == "Ubuntu16.04") && (architecture == 'arm64'))
3074 def isUbuntuArm32Job = ((os == "Ubuntu") && (architecture == 'arm'))
3075 def isUbuntuArmJob = isUbuntuArm32Job || isUbuntuArm64Job
3077 def doCoreFxTesting = isCoreFxScenario(scenario)
3078 def isPmiAsmDiffsScenario = (scenario == 'pmi_asm_diffs')
3080 def workspaceRelativeFxRootLinux = "_/fx" // only used for CoreFX testing
3082 def osGroup = getOSGroup(os)
3083 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
3086 def useServerGC = false
3088 // Enable Server GC for Ubuntu PR builds
3089 // REVIEW: why? Does this apply to all architectures? Why only PR?
3090 if (os == 'Ubuntu' && isPR) {
3091 testOpts += ' --useServerGC'
3095 if (isR2RScenario(scenario)) {
3097 testOpts += ' --crossgen --runcrossgentests'
3099 if (scenario == 'r2r_jitstress1') {
3100 testOpts += ' --jitstress=1'
3102 else if (scenario == 'r2r_jitstress2') {
3103 testOpts += ' --jitstress=2'
3105 else if (scenario == 'r2r_jitstress1_tiered') {
3106 testOpts += ' --jitstress=1'
3108 else if (scenario == 'r2r_jitstress2_tiered') {
3109 testOpts += ' --jitstress=2'
3111 else if (scenario == 'r2r_jitstressregs1') {
3112 testOpts += ' --jitstressregs=1'
3114 else if (scenario == 'r2r_jitstressregs2') {
3115 testOpts += ' --jitstressregs=2'
3117 else if (scenario == 'r2r_jitstressregs3') {
3118 testOpts += ' --jitstressregs=3'
3120 else if (scenario == 'r2r_jitstressregs4') {
3121 testOpts += ' --jitstressregs=4'
3123 else if (scenario == 'r2r_jitstressregs8') {
3124 testOpts += ' --jitstressregs=8'
3126 else if (scenario == 'r2r_jitstressregs0x10') {
3127 testOpts += ' --jitstressregs=0x10'
3129 else if (scenario == 'r2r_jitstressregs0x80') {
3130 testOpts += ' --jitstressregs=0x80'
3132 else if (scenario == 'r2r_jitstressregs0x1000') {
3133 testOpts += ' --jitstressregs=0x1000'
3135 else if (scenario == 'r2r_jitminopts') {
3136 testOpts += ' --jitminopts'
3138 else if (scenario == 'r2r_jitforcerelocs') {
3139 testOpts += ' --jitforcerelocs'
3141 else if (scenario == 'r2r_gcstress15') {
3142 testOpts += ' --gcstresslevel=0xF'
3145 else if (scenario == 'jitdiff') {
3146 testOpts += ' --jitdisasm --crossgen'
3148 else if (scenario == 'illink') {
3149 testOpts += ' --link=\$WORKSPACE/linker/linker/bin/netcore_Release/netcoreapp2.0/ubuntu-x64/publish/illink'
3151 else if (isLongGc(scenario)) {
3152 // Long GC tests behave very poorly when they are not
3153 // the only test running (many of them allocate until OOM).
3154 testOpts += ' --sequential'
3156 // A note - runtest.sh does have "--long-gc" and "--gcsimulator" options
3157 // for running long GC and GCSimulator tests, respectively. We don't use them
3158 // here because using a playlist file produces much more readable output on the CI machines
3159 // and reduces running time.
3161 // The Long GC playlist contains all of the tests that are
3162 // going to be run. The GCSimulator playlist contains all of
3163 // the GC simulator tests.
3164 if (scenario == 'longgc') {
3165 testOpts += ' --long-gc --playlist=./tests/longRunningGcTests.txt'
3167 else if (scenario == 'gcsimulator') {
3168 testOpts += ' --gcsimulator --playlist=./tests/gcSimulatorTests.txt'
3171 else if (isGcReliabilityFramework(scenario)) {
3172 testOpts += ' --build-overlay-only'
3174 else if (scenario == 'standalone_gc') {
3175 if (osGroup == 'OSX') {
3176 testOpts += ' --gcname=libclrgc.dylib'
3178 else if (osGroup == 'Linux') {
3179 testOpts += ' --gcname=libclrgc.so'
3182 println("Unexpected OS group: ${osGroup} for os ${os}")
3187 def jobFolder = getJobFolder(scenario)
3188 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
3190 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
3194 // Set up the copies
3196 // Coreclr build we are trying to test
3198 // HACK: the Ubuntu arm64 copyArtifacts Jenkins plug-in is ridiculously slow (45 minutes to
3199 // 1.5 hours for this step). Instead, directly use wget, which is fast (1 minute).
3201 if (!isUbuntuArm64Job) {
3202 copyArtifacts(inputCoreCLRBuildName) {
3203 excludePatterns('**/testResults.xml', '**/*.ni.dll')
3205 buildNumber('${CORECLR_BUILD}')
3210 if (isUbuntuArmJob) {
3211 // Add some useful information to the log file. Ignore return codes.
3212 shell("uname -a || true")
3215 if (isUbuntuArm64Job) {
3216 // Copy the required artifacts directly, using wget, e.g.:
3218 // https://ci.dot.net/job/dotnet_coreclr/job/master/job/arm64_cross_checked_ubuntu16.04_innerloop_prtest/16/artifact/testnativebin.checked.zip
3219 // https://ci.dot.net/job/dotnet_coreclr/job/master/job/arm64_cross_checked_ubuntu16.04_innerloop_prtest/16/artifact/tests.checked.zip
3221 // parameterized as:
3223 // https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/job/${inputJobName}/${CORECLR_BUILD}/artifact/testnativebin.checked.zip
3224 // https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/job/${inputJobName}/${CORECLR_BUILD}/artifact/tests.checked.zip
3226 // CoreFX example artifact URLs:
3228 // 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
3229 // 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
3231 // Note that the source might be in a "jitstress" folder.
3233 // Use `--progress=dot:giga` to display some progress output, but limit it in the log file.
3235 // Use `--directory-prefix=_/fx` to specify where to put the corefx files (to match what other platforms do). Use this instead of `-O`.
3237 shell("echo \"Using wget instead of the Jenkins copy artifacts plug-in to copy artifacts from ${inputCoreCLRBuildName}\"")
3239 def mungedProjectName = Utilities.getFolderName(project)
3240 def mungedBranchName = Utilities.getFolderName(branch)
3242 def doCrossGenComparison = isCrossGenComparisonScenario(scenario)
3243 def inputCoreCLRBuildScenario = isInnerloopTestScenario(scenario) ? 'innerloop' : 'normal'
3244 if (isPmiAsmDiffsScenario || doCoreFxTesting || doCrossGenComparison) {
3245 // These depend on unique builds for each scenario
3246 inputCoreCLRBuildScenario = scenario
3248 def sourceJobName = getJobName(configuration, architecture, os, inputCoreCLRBuildScenario, false)
3249 def inputJobName = Utilities.getFullJobName(sourceJobName, isPR)
3251 // Need to add the sub-folder if necessary.
3252 def inputJobPath = "job/${inputJobName}"
3253 def folderName = getJobFolder(inputCoreCLRBuildScenario)
3254 if (folderName != '') {
3255 inputJobPath = "job/${folderName}/job/${inputJobName}"
3258 def inputUrlRoot = "https://ci.dot.net/job/${mungedProjectName}/job/${mungedBranchName}/${inputJobPath}/\${CORECLR_BUILD}/artifact"
3260 if (isPmiAsmDiffsScenario) {
3261 def workspaceRelativeRootLinux = "_/pmi"
3262 shell("mkdir -p ${workspaceRelativeRootLinux}")
3263 shell("wget --progress=dot:giga ${inputUrlRoot}/product.${os}.${architecture}.${lowerConfiguration}.tgz")
3264 shell("wget --progress=dot:giga ${inputUrlRoot}/product.baseline.${os}.${architecture}.${lowerConfiguration}.tgz")
3265 shell("wget --progress=dot:giga ${inputUrlRoot}/coreroot.${os}.${architecture}.${lowerConfiguration}.tgz")
3266 shell("wget --progress=dot:giga ${inputUrlRoot}/coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.tgz")
3268 else if (doCoreFxTesting) {
3269 shell("mkdir -p ${workspaceRelativeFxRootLinux}")
3270 shell("wget --progress=dot:giga --directory-prefix=${workspaceRelativeFxRootLinux} ${inputUrlRoot}/${workspaceRelativeFxRootLinux}/fxtests.zip")
3271 shell("wget --progress=dot:giga --directory-prefix=${workspaceRelativeFxRootLinux} ${inputUrlRoot}/${workspaceRelativeFxRootLinux}/fxruntime.zip")
3274 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
3275 shell("wget --progress=dot:giga ${inputUrlRoot}/${testArtifactsTgzFileName}")
3279 if (architecture == 'x86') {
3280 shell("mkdir ./bin/CoreFxNative")
3282 def fxBranch = getFxBranch(branch)
3283 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' + Utilities.getFolderName(fxBranch)
3285 copyArtifacts("${corefxFolder}/ubuntu16.04_x86_release") {
3286 includePatterns('artifacts/bin/build.tar.gz')
3287 targetDirectory('bin/CoreFxNative')
3289 latestSuccessful(true)
3293 shell("mkdir ./bin/CoreFxBinDir")
3294 shell("tar -xf ./bin/CoreFxNative/artifacts/bin/build.tar.gz -C ./bin/CoreFxBinDir")
3297 if (isPmiAsmDiffsScenario) {
3298 shell("tar -xzf ./product.${os}.${architecture}.${lowerConfiguration}.tgz || exit 0")
3299 shell("tar -xzf ./product.baseline.${os}.${architecture}.${lowerConfiguration}.tgz || exit 0")
3300 shell("tar -xzf ./coreroot.${os}.${architecture}.${lowerConfiguration}.tgz || exit 0")
3301 shell("tar -xzf ./coreroot.baseline.${os}.${architecture}.${lowerConfiguration}.tgz || exit 0")
3303 // CoreFX testing downloads the CoreFX tests, not the coreclr tests. Also, unzip the built CoreFX layout/runtime directories.
3304 else if (doCoreFxTesting) {
3305 shell("unzip -q -o ${workspaceRelativeFxRootLinux}/fxtests.zip || exit 0")
3306 shell("unzip -q -o ${workspaceRelativeFxRootLinux}/fxruntime.zip || exit 0")
3309 def testArtifactsTgzFileName = getTestArtifactsTgzFileName(osGroup, architecture, configuration)
3310 shell("tar -xzf ./${testArtifactsTgzFileName} || exit 0") // extracts to ./bin/tests/${osGroup}.${architecture}.${configuration}
3313 // Execute the tests
3314 def runDocker = isNeedDocker(architecture, os, false)
3315 def dockerPrefix = ""
3318 def dockerImage = getDockerImageName(architecture, os, false)
3319 dockerPrefix = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} "
3320 dockerCmd = dockerPrefix + "${dockerImage} "
3323 // If we are running a stress mode, we'll set those variables first.
3324 // For CoreFX, the stress variables are already built into the CoreFX test build per-test wrappers.
3325 if (!doCoreFxTesting && isJitStressScenario(scenario)) {
3326 def scriptFileName = "\${WORKSPACE}/set_stress_test_env.sh"
3327 def envScriptCmds = envScriptCreate(os, scriptFileName)
3328 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
3329 envScriptCmds += envScriptFinalize(os, scriptFileName)
3330 shell("${envScriptCmds}")
3331 testOpts += " --test-env=${scriptFileName}"
3334 // setup-stress-dependencies.sh, invoked by runtest.sh to download the coredistools package, depends on the "dotnet"
3335 // tool downloaded by the "init-tools.sh" script. However, it only invokes setup-stress-dependencies.sh for x64. The
3336 // coredistools package is used by GCStress on x86 and x64 to disassemble code to determine instruction boundaries.
3337 // On arm/arm64, it is not required as determining instruction boundaries is trivial.
3338 if (isGCStressRelatedTesting(scenario)) {
3339 if (architecture == 'x64') {
3340 shell('./init-tools.sh')
3344 if (isPmiAsmDiffsScenario) {
3346 python -u \${WORKSPACE}/tests/scripts/run-pmi-diffs.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} --skip_baseline_build""")
3348 shell("tar -czf dasm.${os}.${architecture}.${configuration}.tgz ./_/pmi/asm")
3350 else if (doCoreFxTesting) {
3352 \${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""")
3355 def runScript = "${dockerCmd}./tests/runtest.sh"
3359 ${lowerConfiguration} \\
3360 --testRootDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}\" \\
3361 --coreOverlayDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root\" \\
3362 --limitedDumpGeneration ${testOpts}""")
3365 if (isGcReliabilityFramework(scenario)) {
3366 // runtest.sh doesn't actually execute the reliability framework - do it here.
3369 dockerCmd = dockerPrefix + "-e COMPlus_gcServer=1 ${dockerImage} "
3372 shell("export COMPlus_gcServer=1")
3376 shell("${dockerCmd}./tests/scripts/run-gc-reliability-framework.sh ${architecture} ${configuration}")
3381 // Experimental: If on Ubuntu 14.04, then attempt to pull in crash dump links
3382 if (os in ['Ubuntu']) {
3383 SummaryBuilder summaries = new SummaryBuilder()
3384 summaries.addLinksSummaryFromFile('Crash dumps from this run:', 'dumplings.txt')
3385 summaries.emit(newJob)
3388 if (isPmiAsmDiffsScenario) {
3390 Utilities.addArchival(newJob, "dasm.${os}.${architecture}.${configuration}.tgz")
3392 else if (doCoreFxTesting) {
3393 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/artifacts/bin/**/testResults.xml", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
3394 if ((os == "Ubuntu") && (architecture == 'arm')) {
3395 // We have a problem with the xunit plug-in, where it is consistently failing on Ubuntu arm32 test result uploading with this error:
3397 // [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
3399 // We haven't been able to identify the reason. So, do not add xunit parsing of the test data in this scenario.
3400 // This is tracked by: https://github.com/dotnet/coreclr/issues/19447.
3403 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRootLinux}/artifacts/bin/**/testResults.xml")
3407 Utilities.addXUnitDotNETResults(newJob, '**/coreclrtests.xml')
3413 def static CreateNonWindowsCrossGenComparisonTestJob(def dslFactory, def project, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3415 assert isCrossGenComparisonScenario(scenario)
3417 def osGroup = getOSGroup(os)
3418 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
3420 def workspaceRelativeResultsDir = "_"
3421 def workspaceRelativeNativeArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${architecture}_${architecture}.${configuration}"
3423 def crossArch = "x64"
3424 def workspaceRelativeCrossArchResultDir = "${workspaceRelativeResultsDir}/${osGroup}.${crossArch}_${architecture}.${configuration}"
3426 def jobFolder = getJobFolder(scenario)
3427 def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
3429 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
3432 def workspaceRelativeArtifactsArchive = "${os}.${architecture}.${configuration}.${scenario}.zip"
3435 copyArtifacts(inputCoreCLRBuildName) {
3436 includePatterns("${workspaceRelativeArtifactsArchive}")
3438 buildNumber('${CORECLR_BUILD}')
3442 shell("unzip -o ${workspaceRelativeArtifactsArchive} || exit 0")
3444 def workspaceRelativeCoreLib = "bin/Product/${osGroup}.${architecture}.${configuration}/IL/System.Private.CoreLib.dll"
3445 def workspaceRelativeCoreRootDir = "bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root"
3446 def workspaceRelativeCrossGenComparisonScript = "tests/scripts/crossgen_comparison.py"
3447 def workspaceRelativeCrossGenExecutable = "${workspaceRelativeCoreRootDir}/crossgen"
3449 def crossGenComparisonCmd = "python -u \${WORKSPACE}/${workspaceRelativeCrossGenComparisonScript} "
3450 def crossGenExecutable = "\${WORKSPACE}/${workspaceRelativeCrossGenExecutable}"
3452 shell("mkdir -p ${workspaceRelativeNativeArchResultDir}")
3453 shell("${crossGenComparisonCmd}crossgen_corelib --crossgen ${crossGenExecutable} --il_corelib \${WORKSPACE}/${workspaceRelativeCoreLib} --result_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir}")
3454 shell("${crossGenComparisonCmd}crossgen_framework --crossgen ${crossGenExecutable} --core_root \${WORKSPACE}/${workspaceRelativeCoreRootDir} --result_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir}")
3456 shell("${crossGenComparisonCmd}compare --base_dir \${WORKSPACE}/${workspaceRelativeNativeArchResultDir} --diff_dir \${WORKSPACE}/${workspaceRelativeCrossArchResultDir}")
3460 Utilities.addArchival(newJob, "${workspaceRelativeNativeArchResultDir}/**", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
3461 Utilities.addArchival(newJob, "${workspaceRelativeCrossArchResultDir}/**", "", /* doNotFailIfNothingArchived */ true, /* archiveOnlyIfSuccessful */ false)
3466 // Create a test job that will be used by a flow job.
3467 // Returns the newly created job.
3468 // 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,
3469 // and we want the views to be the minimal set of "top-level" jobs that represent all work.
3470 def static CreateTestJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
3472 def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
3475 if (windowsArmJob) {
3476 newJob = CreateWindowsArmTestJob(dslFactory, project, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3478 else if (isCrossGenComparisonScenario(scenario)) {
3479 newJob = CreateNonWindowsCrossGenComparisonTestJob(dslFactory, project, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3482 newJob = CreateOtherTestJob(dslFactory, project, branch, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3485 setJobMachineAffinity(architecture, os, false, true, false, newJob) // isBuildJob = false, isTestJob = true, isFlowJob = false
3487 if (scenario == 'jitdiff') {
3488 def osGroup = getOSGroup(os)
3489 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/dasm/**")
3492 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
3493 setJobTimeout(newJob, isPR, architecture, configuration, scenario, false)
3498 // Create a flow job to tie together a build job with the given test job.
3499 // Returns the new flow job.
3500 def static CreateFlowJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def fullTestJobName, def inputCoreCLRBuildName)
3502 // Windows CoreCLR build and Linux CoreCLR build (in parallel) ->
3503 // Linux CoreCLR test
3504 def flowJobName = getJobName(configuration, architecture, os, scenario, false) + "_flow"
3505 def jobFolder = getJobFolder(scenario)
3507 def newFlowJob = dslFactory.buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, jobFolder)) {
3509 coreclrBuildJob = build(params, '${inputCoreCLRBuildName}')
3511 // And then build the test build
3512 build(params + [CORECLR_BUILD: coreclrBuildJob.build.number], '${fullTestJobName}')
3515 JobReport.Report.addReference(inputCoreCLRBuildName)
3516 JobReport.Report.addReference(fullTestJobName)
3518 addToViews(newFlowJob, true, isPR, architecture, os, configuration, scenario) // isFlowJob = true
3520 setJobMachineAffinity(architecture, os, false, false, true, newFlowJob) // isBuildJob = false, isTestJob = false, isFlowJob = true
3522 Utilities.standardJobSetup(newFlowJob, project, isPR, "*/${branch}")
3523 addTriggers(newFlowJob, branch, isPR, architecture, os, configuration, scenario, true, false) // isFlowJob==true, isWindowsBuildOnlyJob==false
3528 // Determine if we should generate a flow job for the given parameters.
3529 // Returns true if the job should be generated.
3530 def static shouldGenerateFlowJob(def scenario, def isPR, def architecture, def configuration, def os)
3532 // The various "innerloop" jobs are only available as PR triggered.
3535 if (isInnerloopTestScenario(scenario)) {
3539 if (scenario == 'corefx_innerloop') {
3544 // Disable flow jobs for innerloop pr.
3546 // The only exception is windows arm(64)
3547 if (isInnerloopTestScenario(scenario) && isPR && os != 'Windows_NT') {
3548 assert scenario != 'corefx_innerloop'
3553 // Filter based on OS and architecture.
3555 switch (architecture) {
3557 if (os != "Ubuntu" && os != "Windows_NT") {
3562 if (os != "Ubuntu16.04" && os != "Windows_NT") {
3567 if (os != "Ubuntu") {
3572 if (!(os in Constants.crossList)) {
3575 if (os == "Windows_NT") {
3583 println("Unknown architecture: ${architecture}")
3588 def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
3590 // Filter based on scenario in OS.
3592 if (os == 'Windows_NT') {
3593 assert architecture == 'arm' || architecture == 'arm64'
3594 if (!isArmWindowsScenario(scenario)) {
3597 if (isNormalOrInnerloop && (configuration == 'Debug')) {
3598 // The arm32/arm64 Debug configuration for innerloop/normal scenario is a special case: it does a build only, and no test run.
3599 // To do that, it doesn't require a flow job.
3605 if (architecture == 'arm') {
3606 if (!(scenario in Constants.validLinuxArmScenarios)) {
3610 else if (architecture == 'arm64') {
3611 if (!(scenario in Constants.validLinuxArm64Scenarios)) {
3615 else if (architecture == 'x86') {
3616 // Linux/x86 only want innerloop and default test
3617 if (!isNormalOrInnerloop) {
3621 else if (architecture == 'x64') {
3622 // Linux/x64 corefx testing doesn't need a flow job; the "build" job runs run-corefx-tests.py which
3623 // builds and runs the corefx tests. Other Linux/x64 flow jobs are required to get the test
3624 // build from a Windows machine.
3625 if (isCoreFxScenario(scenario)) {
3631 // For CentOS, we only want Checked/Release builds.
3632 if (os == 'CentOS7.1') {
3633 if (configuration != 'Checked' && configuration != 'Release') {
3636 if (!isNormalOrInnerloop && !isR2RScenario(scenario)) {
3641 // For RedHat and Debian, we only do Release builds.
3642 else if (os == 'RHEL7.2' || os == 'Debian8.4') {
3643 if (configuration != 'Release') {
3646 if (!isNormalOrInnerloop) {
3651 // Next, filter based on scenario.
3653 if (isJitStressScenario(scenario)) {
3654 if (configuration != 'Checked') {
3658 else if (isR2RBaselineScenario(scenario)) {
3659 if (configuration != 'Checked' && configuration != 'Release') {
3663 else if (isR2RStressScenario(scenario)) {
3664 if (configuration != 'Checked') {
3668 else if (isCrossGenComparisonScenario(scenario)) {
3669 return shouldGenerateCrossGenComparisonJob(os, architecture, configuration, scenario)
3677 // Long GC tests take a long time on non-Release builds
3678 // ilrt is also Release only
3679 if (configuration != 'Release') {
3685 if (configuration != 'Checked') {
3690 case 'gc_reliability_framework':
3691 case 'standalone_gc':
3692 if (configuration != 'Release' && configuration != 'Checked') {
3701 if (os != 'Windows_NT' && os != 'Ubuntu') {
3711 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, false)) {
3716 case 'pmi_asm_diffs':
3717 if (configuration != 'Checked') {
3720 // No need for flow job except for Linux arm/arm64
3721 if ((os != 'Windows_NT') && (architecture != 'arm') && (architecture != 'arm64')) {
3726 case 'corefx_innerloop':
3727 // No flow job needed
3731 println("Unknown scenario: ${scenario}")
3737 // The job was not filtered out, so we should generate it!
3741 // Create jobs requiring flow jobs. This includes x64 non-Windows, arm/arm64 Ubuntu, and arm/arm64 Windows.
3742 Constants.allScenarios.each { scenario ->
3743 [true, false].each { isPR ->
3744 Constants.architectureList.each { architecture ->
3745 Constants.configurationList.each { configuration ->
3746 Constants.osList.each { os ->
3748 if (!shouldGenerateFlowJob(scenario, isPR, architecture, configuration, os)) {
3752 def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
3753 def doCoreFxTesting = isCoreFxScenario(scenario)
3754 def doCrossGenComparison = isCrossGenComparisonScenario(scenario)
3755 def isPmiAsmDiffsScenario = (scenario == 'pmi_asm_diffs')
3757 // Figure out the job name of the CoreCLR build the test will depend on.
3759 def inputCoreCLRBuildScenario = isInnerloopTestScenario(scenario) ? 'innerloop' : 'normal'
3760 def inputCoreCLRBuildIsBuildOnly = false
3761 if (doCoreFxTesting || isPmiAsmDiffsScenario) {
3762 // Every CoreFx test depends on its own unique build.
3763 inputCoreCLRBuildScenario = scenario
3764 if (windowsArmJob) {
3765 // Only Windows ARM corefx jobs use "build only" jobs. Others, such as Ubuntu ARM corefx, use "regular" jobs.
3766 inputCoreCLRBuildIsBuildOnly = true
3769 else if (doCrossGenComparison) {
3770 inputCoreCLRBuildScenario = scenario
3773 def inputCoreCLRFolderName = getJobFolder(inputCoreCLRBuildScenario)
3774 def inputCoreCLRBuildName = projectFolder + '/' +
3775 Utilities.getFullJobName(project, getJobName(configuration, architecture, os, inputCoreCLRBuildScenario, inputCoreCLRBuildIsBuildOnly), isPR, inputCoreCLRFolderName)
3777 // =============================================================================================
3778 // Create the test job
3779 // =============================================================================================
3781 def testJob = CreateTestJob(this, project, branch, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
3783 // =============================================================================================
3784 // Create a build flow to join together the build and tests required to run this test.
3785 // =============================================================================================
3787 if (os == 'RHEL7.2' || os == 'Debian8.4') {
3788 // Do not create the flow job for RHEL jobs.
3792 def fullTestJobName = projectFolder + '/' + testJob.name
3793 def flowJob = CreateFlowJob(this, project, branch, architecture, os, configuration, scenario, isPR, fullTestJobName, inputCoreCLRBuildName)
3801 JobReport.Report.generateJobReport(out)
3803 // Make the call to generate the help job
3804 Utilities.createHelperJob(this, project, branch,
3805 "Welcome to the ${project} Repository", // This is prepended to the help message
3806 "Have a nice day!") // This is appended to the help message. You might put known issues here.
3808 Utilities.addCROSSCheck(this, project, branch)