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',
22 'Ubuntu16.04': 'Linux',
23 'Ubuntu16.10': 'Linux',
27 '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 ARM64 hardware (used for ARM/ARMLB/ARM64 testing). So only allow certain branches to use it.
39 def static WindowsArm64Branches = [
42 // Innerloop build OS's
43 // The Windows_NT_BuildOnly OS is a way to speed up the Non-Windows builds by avoiding
44 // test execution in the build flow runs. It generates the exact same build
45 // as Windows_NT but without running the tests.
51 'Windows_NT_BuildOnly',
59 def static crossList = ['Ubuntu', 'OSX10.12', 'CentOS7.1', 'RHEL7.2', 'Debian8.4', 'Windows_NT']
61 // This is a set of JIT stress modes combined with the set of variables that
62 // need to be set to actually enable that stress mode. The key of the map is the stress mode and
63 // the values are the environment variables
64 def static jitStressModeScenarios = [
65 'minopts' : ['COMPlus_JITMinOpts' : '1'],
66 'tieredcompilation' : ['COMPlus_EXPERIMENTAL_TieredCompilation' : '1'],
67 'forcerelocs' : ['COMPlus_ForceRelocs' : '1'],
68 'jitstress1' : ['COMPlus_JitStress' : '1'],
69 'jitstress2' : ['COMPlus_JitStress' : '2'],
70 'jitstressregs1' : ['COMPlus_JitStressRegs' : '1'],
71 'jitstressregs2' : ['COMPlus_JitStressRegs' : '2'],
72 'jitstressregs3' : ['COMPlus_JitStressRegs' : '3'],
73 'jitstressregs4' : ['COMPlus_JitStressRegs' : '4'],
74 'jitstressregs8' : ['COMPlus_JitStressRegs' : '8'],
75 'jitstressregs0x10' : ['COMPlus_JitStressRegs' : '0x10'],
76 'jitstressregs0x80' : ['COMPlus_JitStressRegs' : '0x80'],
77 'jitstressregs0x1000' : ['COMPlus_JitStressRegs' : '0x1000'],
78 'jitstress2_jitstressregs1' : ['COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '1'],
79 'jitstress2_jitstressregs2' : ['COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '2'],
80 'jitstress2_jitstressregs3' : ['COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '3'],
81 'jitstress2_jitstressregs4' : ['COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '4'],
82 'jitstress2_jitstressregs8' : ['COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '8'],
83 'jitstress2_jitstressregs0x10' : ['COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x10'],
84 'jitstress2_jitstressregs0x80' : ['COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x80'],
85 'jitstress2_jitstressregs0x1000' : ['COMPlus_JitStress' : '2', 'COMPlus_JitStressRegs' : '0x1000'],
86 'tailcallstress' : ['COMPlus_TailcallStress' : '1'],
87 'jitsse2only' : ['COMPlus_EnableAVX' : '0', 'COMPlus_EnableSSE3_4' : '0'],
88 'jitnosimd' : ['COMPlus_FeatureSIMD' : '0'],
89 'jitincompletehwintrinsic' : ['COMPlus_EnableIncompleteISAClass' : '1'],
90 'jitx86hwintrinsicnoavx' : ['COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_EnableAVX' : '0'], // testing the legacy SSE encoding
91 'jitx86hwintrinsicnoavx2' : ['COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_EnableAVX2' : '0'], // testing SNB/IVB
92 'jitx86hwintrinsicnosimd' : ['COMPlus_EnableIncompleteISAClass' : '1', 'COMPlus_FeatureSIMD' : '0'], // match "jitnosimd", may need to remove after decoupling HW intrinsic from FeatureSIMD
93 'jitnox86hwintrinsic' : ['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'],
94 'corefx_baseline' : [ : ], // corefx baseline
95 'corefx_minopts' : ['COMPlus_JITMinOpts' : '1'],
96 'corefx_tieredcompilation' : ['COMPlus_EXPERIMENTAL_TieredCompilation' : '1'],
97 'corefx_jitstress1' : ['COMPlus_JitStress' : '1'],
98 'corefx_jitstress2' : ['COMPlus_JitStress' : '2'],
99 'corefx_jitstressregs1' : ['COMPlus_JitStressRegs' : '1'],
100 'corefx_jitstressregs2' : ['COMPlus_JitStressRegs' : '2'],
101 'corefx_jitstressregs3' : ['COMPlus_JitStressRegs' : '3'],
102 'corefx_jitstressregs4' : ['COMPlus_JitStressRegs' : '4'],
103 'corefx_jitstressregs8' : ['COMPlus_JitStressRegs' : '8'],
104 'corefx_jitstressregs0x10' : ['COMPlus_JitStressRegs' : '0x10'],
105 'corefx_jitstressregs0x80' : ['COMPlus_JitStressRegs' : '0x80'],
106 'corefx_jitstressregs0x1000' : ['COMPlus_JitStressRegs' : '0x1000'],
107 'gcstress0x3' : ['COMPlus_GCStress' : '0x3'],
108 'gcstress0xc' : ['COMPlus_GCStress' : '0xC'],
109 'zapdisable' : ['COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0'],
110 'heapverify1' : ['COMPlus_HeapVerify' : '1'],
111 'gcstress0xc_zapdisable' : ['COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0'],
112 'gcstress0xc_zapdisable_jitstress2' : ['COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0', 'COMPlus_JitStress' : '2'],
113 'gcstress0xc_zapdisable_heapverify1' : ['COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0', 'COMPlus_HeapVerify' : '1'],
114 'gcstress0xc_jitstress1' : ['COMPlus_GCStress' : '0xC', 'COMPlus_JitStress' : '1'],
115 'gcstress0xc_jitstress2' : ['COMPlus_GCStress' : '0xC', 'COMPlus_JitStress' : '2'],
116 'gcstress0xc_minopts_heapverify1' : ['COMPlus_GCStress' : '0xC', 'COMPlus_JITMinOpts' : '1', 'COMPlus_HeapVerify' : '1']
119 // This is a set of ReadyToRun stress scenarios
120 def static r2rStressScenarios = [
121 'r2r_jitstress1' : ["COMPlus_JitStress": "1"],
122 'r2r_jitstress2' : ["COMPlus_JitStress": "2"],
123 'r2r_jitstressregs1' : ["COMPlus_JitStressRegs": "1"],
124 'r2r_jitstressregs2' : ["COMPlus_JitStressRegs": "2"],
125 'r2r_jitstressregs3' : ["COMPlus_JitStressRegs": "3"],
126 'r2r_jitstressregs4' : ["COMPlus_JitStressRegs": "4"],
127 'r2r_jitstressregs8' : ["COMPlus_JitStressRegs": "8"],
128 'r2r_jitstressregs0x10' : ["COMPlus_JitStressRegs": "0x10"],
129 'r2r_jitstressregs0x80' : ["COMPlus_JitStressRegs": "0x80"],
130 'r2r_jitstressregs0x1000' : ["COMPlus_JitStressRegs": "0x1000"],
131 'r2r_jitminopts' : ["COMPlus_JITMinOpts": "1"],
132 'r2r_jitforcerelocs' : ["COMPlus_ForceRelocs": "1"],
133 'r2r_gcstress15' : ["COMPlus_GCStress": "0xF"]
136 // This is the basic set of scenarios
137 def static basicScenarios = [
145 // 'jitdiff', // jitdiff is currently disabled, until someone spends the effort to make it fully work
147 'gc_reliability_framework',
150 def static allScenarios = basicScenarios + r2rStressScenarios.keySet() + jitStressModeScenarios.keySet()
152 // Valid PR trigger combinations.
153 def static prTriggeredValidInnerLoopCombos = [
172 'Windows_NT_buildOnly': [
208 // A set of scenarios that are valid for arm/arm64/armlb tests run on hardware. This is a map from valid scenario name
209 // to Tests.lst file categories to exclude.
211 // This list should contain a subset of the scenarios from `allScenarios`. Please keep this in the same order as that,
212 // and with the same values, with some commented out, for easier maintenance.
214 // Note that some scenarios that are commented out should be enabled, but haven't yet been.
216 def static validArmWindowsScenarios = [
226 // 'gc_reliability_framework'
228 'r2r_jitstress1': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
229 'r2r_jitstress2': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
230 'r2r_jitstressregs1': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
231 'r2r_jitstressregs2': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
232 'r2r_jitstressregs3': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
233 'r2r_jitstressregs4': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
234 'r2r_jitstressregs8': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
235 'r2r_jitstressregs0x10': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
236 'r2r_jitstressregs0x80': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
237 'r2r_jitstressregs0x1000': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
238 'r2r_jitminopts': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
239 'r2r_jitforcerelocs': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
240 'r2r_gcstress15': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
241 'minopts': ["MINOPTS_FAIL", "MINOPTS_EXCLUDE"],
242 'tieredcompilation': [],
244 'jitstress1': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
245 'jitstress2': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
246 'jitstressregs1': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
247 'jitstressregs2': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
248 'jitstressregs3': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
249 'jitstressregs4': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
250 'jitstressregs8': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
251 'jitstressregs0x10': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
252 'jitstressregs0x80': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
253 'jitstressregs0x1000': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
254 'jitstress2_jitstressregs1': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
255 'jitstress2_jitstressregs2': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
256 'jitstress2_jitstressregs3': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
257 'jitstress2_jitstressregs4': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
258 'jitstress2_jitstressregs8': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
259 'jitstress2_jitstressregs0x10': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
260 'jitstress2_jitstressregs0x80': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
261 'jitstress2_jitstressregs0x1000': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
262 'tailcallstress': ["TAILCALLSTRESS_FAIL", "TAILCALLSTRESS_EXCLUDE"],
263 // 'jitsse2only' // Only relevant to xarch
264 'jitnosimd': [], // Only interesting on platforms where SIMD support exists.
267 // 'corefx_tieredcompilation'
268 // 'corefx_jitstress1'
269 // 'corefx_jitstress2'
270 // 'corefx_jitstressregs1'
271 // 'corefx_jitstressregs2'
272 // 'corefx_jitstressregs3'
273 // 'corefx_jitstressregs4'
274 // 'corefx_jitstressregs8'
275 // 'corefx_jitstressregs0x10'
276 // 'corefx_jitstressregs0x80'
277 // 'corefx_jitstressregs0x1000'
278 'gcstress0x3': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE"],
279 'gcstress0xc': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE"],
280 'zapdisable': ["ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE"],
282 'gcstress0xc_zapdisable': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE"],
283 'gcstress0xc_zapdisable_jitstress2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
284 'gcstress0xc_zapdisable_heapverify1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE"],
285 'gcstress0xc_jitstress1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
286 'gcstress0xc_jitstress2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
287 'gcstress0xc_minopts_heapverify1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "MINOPTS_FAIL", "MINOPTS_EXCLUDE"],
290 // NOTE: the following scenarios are not defined in the 'allScenarios' list! Is this a bug?
293 'minopts_zapdisable': ["ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE", "MINOPTS_FAIL", "MINOPTS_EXCLUDE"],
294 'gcstress0x3_jitstress1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
295 'gcstress0x3_jitstress2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
296 'gcstress0x3_jitstressregs1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
297 'gcstress0x3_jitstressregs2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
298 'gcstress0x3_jitstressregs3': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
299 'gcstress0x3_jitstressregs4': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
300 'gcstress0x3_jitstressregs8': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
301 'gcstress0x3_jitstressregs0x10': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
302 'gcstress0x3_jitstressregs0x80': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
303 'gcstress0x3_jitstressregs0x1000': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
304 'gcstress0xc_jitstressregs1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
305 'gcstress0xc_jitstressregs2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
306 'gcstress0xc_jitstressregs3': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
307 'gcstress0xc_jitstressregs4': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
308 'gcstress0xc_jitstressregs8': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
309 'gcstress0xc_jitstressregs0x10': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
310 'gcstress0xc_jitstressregs0x80': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
311 'gcstress0xc_jitstressregs0x1000': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"]
314 def static validLinuxArm64Scenarios = [
322 def static configurationList = ['Debug', 'Checked', 'Release']
324 // This is the set of architectures
325 def static architectureList = ['arm', 'armlb', 'x86_arm_altjit', 'x64_arm64_altjit', 'arm64', 'x64', 'x86']
328 // **************************************************************
329 // Create some specific views
331 // These aren't using the Utilities.addStandardFolderView() function, because that creates
332 // views based on a single regular expression. These views will be generated by adding a
333 // specific set of jobs to them.
335 // Utilities.addStandardFolderView() also creates a lot of additional stuff around the
336 // view, like "Build Statistics", "Job Statistics", "Unstable Jobs". Until it is determined
337 // those are required, don't add them (which simplifies the view pages, as well).
338 // **************************************************************
341 def static MergeJobView = null
342 def static PeriodicJobView = null
343 def static ArchitectureViews = [:]
344 def static OSViews = [:]
347 // MergeJobView: include all jobs that execute when a PR change is merged.
348 Views.MergeJobView = listView('Merge') {
361 // PeriodicJobView: include all jobs that execute on a schedule
362 Views.PeriodicJobView = listView('Periodic') {
375 // Create a view for non-PR jobs for each architecture.
376 Constants.architectureList.each { architecture ->
377 Views.ArchitectureViews[architecture] = listView(architecture) {
391 // Create a view for non-PR jobs for each OS.
392 Constants.osList.each { os ->
393 // Don't create one for the special 'Windows_NT_BuildOnly'
394 if (os == 'Windows_NT_BuildOnly') {
397 Views.OSViews[os] = listView(os) {
411 def static addToMergeView(def job) {
412 Views.MergeJobView.with {
419 def static addToPeriodicView(def job) {
420 Views.PeriodicJobView.with {
427 def static addToViews(def job, def isPR, def architecture, def os) {
429 // No views want PR jobs currently.
433 // Add to architecture view.
434 Views.ArchitectureViews[architecture].with {
441 Views.OSViews[os].with {
448 def static addPeriodicTriggerHelper(def job, String cronString, boolean alwaysRuns = false) {
449 addToPeriodicView(job)
450 Utilities.addPeriodicTrigger(job, cronString, alwaysRuns)
453 def static addGithubPushTriggerHelper(def job) {
455 Utilities.addGithubPushTrigger(job)
459 def static setMachineAffinity(def job, def os, def architecture, def options = null) {
460 assert os instanceof String
461 assert architecture instanceof String
463 def armArches = ['arm', 'armlb', 'arm64']
464 def supportedArmLinuxOs = ['Ubuntu', 'Ubuntu16.04', 'Tizen']
466 if (!(architecture in armArches)) {
467 assert options == null
468 Utilities.setMachineAffinity(job, os, 'latest-or-auto')
473 // This is an arm(64) job.
475 // There are several options.
479 // Arm32 (Build) -> latest-arm64
480 // |-> os == "Windows_NT" && architecture == "arm" || architecture == "armlb" && options['use_arm64_build_machine'] == true
481 // Arm32 (Test) -> arm64-windows_nt
482 // |-> os == "Windows_NT" && architecture == "arm" || architecture == "armlb" && options['use_arm64_build_machine'] == false
484 // Arm64 (Build) -> latest-arm64
485 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == true
486 // Arm64 (Test) -> arm64-windows_nt
487 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == false
491 // Arm32 (Build) -> arm-cross-latest
492 // |-> os in supportedArmLinuxOs && architecture == "arm" || architecture == "armlb"
493 // Arm32 (Test) -> NYI Arch not supported
496 // Arm64 (Build) -> arm64-cross-latest
497 // |-> os != "Windows_NT" && architecture == "arm64" && options['is_build_only'] == true
498 // Arm64 Small Page Size (Test) -> arm64-small-page-size
499 // |-> os != "Windows_NT" && architecture == "arm64" && options['large_pages'] == false
500 // Arm64 Large Page Size (Test) -> arm64-huge-page-size
501 // |-> os != "Windows_NT" && architecture == "arm64" && options['large_pages'] == true
503 // This has to be a arm arch
504 assert architecture in armArches
505 if (os == "Windows_NT") {
506 // Arm(64) Windows jobs share the same machines for now
507 def isBuild = options['use_arm64_build_machine'] == true
509 if (isBuild == true) {
510 Utilities.setMachineAffinity(job, os, 'latest-arm64')
512 Utilities.setMachineAffinity(job, os, 'arm64-windows_nt')
515 assert os != 'Windows_NT'
516 assert os in supportedArmLinuxOs
518 if (architecture == 'arm' || architecture == 'armlb') {
519 Utilities.setMachineAffinity(job, 'Ubuntu', 'arm-cross-latest')
522 if (options['is_build_only'] == true) {
523 Utilities.setMachineAffinity(job, os, 'arm64-cross-latest')
525 // Arm64 Test Machines
526 if (options['large_pages'] == false) {
527 Utilities.setMachineAffinity(job, os, 'arm64-small-page-size')
529 Utilities.setMachineAffinity(job, os, 'arm64-huge-page-size')
536 def static isGCStressRelatedTesting(def scenario) {
537 // The 'r2r_gcstress15' scenario is a basic scenario.
538 // Detect it and make it a GCStress related.
539 if (scenario == 'r2r_gcstress15')
544 def gcStressTestEnvVars = [ 'COMPlus_GCStress', 'COMPlus_ZapDisable', 'COMPlus_HeapVerify']
545 def scenarioName = scenario.toLowerCase()
546 def isGCStressTesting = false
547 Constants.jitStressModeScenarios[scenario].each{ k, v ->
548 if (k in gcStressTestEnvVars) {
549 isGCStressTesting = true;
552 return isGCStressTesting
555 def static isCoreFxScenario(def scenario) {
556 def corefx_prefix = 'corefx_'
557 if (scenario.length() < corefx_prefix.length()) {
560 return scenario.substring(0,corefx_prefix.length()) == corefx_prefix
563 def static isR2RBaselineScenario(def scenario) {
564 return (scenario == 'r2r')
567 def static isR2RStressScenario(def scenario) {
568 return Constants.r2rStressScenarios.containsKey(scenario)
571 def static isR2RScenario(def scenario) {
572 return isR2RBaselineScenario(scenario) || isR2RStressScenario(scenario)
575 def static isJitStressScenario(def scenario) {
576 return Constants.jitStressModeScenarios.containsKey(scenario)
579 def static isLongGc(def scenario) {
580 return (scenario == 'longgc' || scenario == 'gcsimulator')
583 def static isJitDiff(def scenario) {
584 return (scenario == 'jitdiff')
587 def static isGcReliabilityFramework(def scenario) {
588 return (scenario == 'gc_reliability_framework')
591 def static isArmWindowsScenario(def scenario) {
592 return Constants.validArmWindowsScenarios.containsKey(scenario)
595 def static isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly) {
596 if (isBuildOnly == true) {
597 os = 'Windows_NT_buildOnly'
600 def validOsPrTriggerArchConfigs = Constants.prTriggeredValidInnerLoopCombos[os]
602 if (validOsPrTriggerArchConfigs == null) {
606 if (validOsPrTriggerArchConfigs[architecture] != null) {
607 def validOsPrTriggerConfigs = validOsPrTriggerArchConfigs[architecture]
609 if (!(configuration in validOsPrTriggerConfigs)) {
619 def static setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly) {
620 // 2 hours (120 minutes) is the default timeout
622 def innerLoop = (scenario == "innerloop")
625 // Pri-1 test builds take a long time. Default PR jobs are Pri-0; everything else is Pri-1
626 // (see calculateBuildCommands()). So up the Pri-1 build jobs timeout.
631 // Note that these can only increase, never decrease, the Pri-1 timeout possibly set above.
632 if (isGCStressRelatedTesting(scenario)) {
635 else if (isCoreFxScenario(scenario)) {
638 else if (isJitStressScenario(scenario)) {
641 else if (isR2RBaselineScenario(scenario)) {
644 else if (isLongGc(scenario)) {
647 else if (isJitDiff(scenario)) {
650 else if (isGcReliabilityFramework(scenario)) {
653 else if (architecture == 'arm' || architecture == 'armlb' || architecture == 'arm64') {
658 if (configuration == 'Debug') {
659 // Debug runs can be very slow. Add an hour.
663 // If we've changed the timeout from the default, set it in the job.
665 if (timeout != 120) {
666 Utilities.setJobTimeout(newJob, timeout)
670 def static getJobFolder(def scenario) {
671 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
674 if (scenario == 'illink') {
680 def static getStressModeDisplayName(def scenario) {
682 Constants.jitStressModeScenarios[scenario].each{ k, v ->
683 def prefixLength = 'COMPlus_'.length()
684 if (k.length() >= prefixLength) {
685 def modeName = k.substring(prefixLength, k.length())
686 displayStr += ' ' + modeName + '=' + v
690 if (isCoreFxScenario(scenario)) {
691 displayStr = ('CoreFx ' + displayStr).trim()
697 def static getR2RDisplayName(def scenario) {
698 // Assume the scenario name is one from the r2rStressScenarios dict, and remove its "r2r_" prefix.
699 def displayStr = scenario
700 def prefixLength = 'r2r_'.length()
701 if (displayStr.length() >= prefixLength) {
702 displayStr = "R2R " + displayStr.substring(prefixLength, displayStr.length())
703 } else if (scenario == 'r2r') {
710 // Functions to create an environment script.
711 // envScriptCreate -- initialize the script (call first)
712 // envScriptFinalize -- finalize the script (call last)
713 // envScriptSetStressModeVariables -- set stress mode variables in the env script
714 // envScriptAppendExistingScript -- append an existing script to the generated script
716 // Each script returns a string of commands. Concatenate all the strings together before
717 // adding them to the builds commands, to make sure they get executed as one Jenkins script.
720 // Initialize the environment setting script.
721 def static envScriptCreate(def os, def stepScriptLocation) {
723 if (os == 'Windows_NT') {
724 stepScript += "echo Creating TestEnv script\r\n"
725 stepScript += "if exist ${stepScriptLocation} del ${stepScriptLocation}\r\n"
727 // Create at least an empty script.
728 stepScript += "echo. > ${stepScriptLocation}\r\n"
731 stepScript += "echo Creating environment setting script\n"
732 stepScript += "echo \\#\\!/usr/bin/env bash > ${stepScriptLocation}\n"
738 // Generates the string for setting stress mode variables.
739 def static envScriptSetStressModeVariables(def os, def stressModeVars, def stepScriptLocation) {
741 if (os == 'Windows_NT') {
742 stressModeVars.each{ k, v ->
743 // Write out what we are writing to the script file
744 stepScript += "echo Setting ${k}=${v}\r\n"
745 // Write out the set itself to the script file`
746 stepScript += "echo set ${k}=${v} >> ${stepScriptLocation}\r\n"
750 stressModeVars.each{ k, v ->
751 // Write out what we are writing to the script file
752 stepScript += "echo Setting ${k}=${v}\n"
753 // Write out the set itself to the script file`
754 stepScript += "echo export ${k}=${v} >> ${stepScriptLocation}\n"
761 // Append an existing script to an environment script.
762 // Returns string of commands to do this.
763 def static envScriptAppendExistingScript(def os, def appendScript, def stepScriptLocation) {
764 assert (os == 'Windows_NT')
767 stepScript += "echo Appending ${appendScript} to ${stepScriptLocation}\r\n"
768 stepScript += "type ${appendScript} >> ${stepScriptLocation}\r\n"
773 // Finalize an environment setting script.
774 // Returns string of commands to do this.
775 def static envScriptFinalize(def os, def stepScriptLocation) {
778 if (os == 'Windows_NT') {
779 // Display the resulting script. This is useful when looking at the output log file.
780 stepScript += "echo Display the total script ${stepScriptLocation}\r\n"
781 stepScript += "type ${stepScriptLocation}\r\n"
784 stepScript += "chmod +x ${stepScriptLocation}\n"
790 def static isNeedDocker(def architecture, def os, def isBuild) {
792 if (architecture == 'x86' && os == 'Ubuntu') {
795 else if (architecture == 'arm') {
796 if (os == 'Ubuntu' || os == 'Ubuntu16.04' || os == 'Tizen') {
802 if (architecture == 'x86' && os == 'Ubuntu') {
809 def static getDockerImageName(def architecture, def os, def isBuild) {
810 // We must change some docker private images to official later
812 if (architecture == 'x86' && os == 'Ubuntu') {
813 return "hseok82/dotnet-buildtools-prereqs:ubuntu-16.04-crossx86-ef0ac75-20175511035548"
815 else if (architecture == 'arm') {
816 if (os == 'Ubuntu') {
817 return "microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20172211042239"
819 else if (os == 'Ubuntu16.04') {
820 return "microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-ef0ac75-20175511035548"
822 else if (os == 'Tizen') {
823 return "hqueue/dotnetcore:ubuntu1404_cross_prereqs_v4-tizen_rootfs"
828 if (architecture == 'x86' && os == 'Ubuntu') {
829 return "hseok82/dotnet-buildtools-prereqs:ubuntu1604_x86_test"
832 println("Unknown architecture to use docker: ${architecture} ${os}");
836 // Calculates the name of the build job based on some typical parameters.
838 def static getJobName(def configuration, def architecture, def os, def scenario, def isBuildOnly) {
839 // If the architecture is x64, do not add that info into the build name.
840 // Need to change around some systems and other builds to pick up the right builds
843 def suffix = scenario != 'normal' ? "_${scenario}" : '';
848 switch (architecture) {
850 if (scenario == 'normal') {
851 // For now we leave x64 off of the name for compatibility with other jobs
852 baseName = configuration.toLowerCase() + '_' + os.toLowerCase()
854 else if (scenario == 'formatting') {
855 // we don't care about the configuration for the formatting job. It runs all configs
856 baseName = architecture.toLowerCase() + '_' + os.toLowerCase()
859 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
863 if (os.toLowerCase() == "windows_nt") {
864 // These are cross builds
865 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
868 // Defaults to a small page size set of machines.
869 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + "small_page_size"
873 // These are cross builds
876 baseName = 'armel_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
879 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
883 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
886 case 'x86_arm_altjit':
887 case 'x64_arm64_altjit':
888 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
891 println("Unknown architecture: ${architecture}");
896 return baseName + suffix
899 def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob, def bidailyCrossList) {
901 // Limited Windows ARM64 hardware is restricted for non-PR triggers to certain branches.
902 if (os == 'Windows_NT') {
903 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
904 if (!(branch in Constants.WindowsArm64Branches)) {
915 switch (architecture) {
918 if (isFlowJob && architecture == 'x86' && os == 'Ubuntu') {
919 addPeriodicTriggerHelper(job, '@daily')
921 else if (isFlowJob || os == 'Windows_NT' || !(os in Constants.crossList)) {
922 addGithubPushTriggerHelper(job)
927 case 'x86_arm_altjit':
928 case 'x64_arm64_altjit':
929 addGithubPushTriggerHelper(job)
932 // We would normally want a per-push trigger, but with limited hardware we can't keep up
933 addPeriodicTriggerHelper(job, "H H/4 * * *")
936 println("Unknown architecture: ${architecture}");
942 assert !(os in bidailyCrossList)
943 // r2r gets a push trigger for checked/release
944 if (configuration == 'Checked' || configuration == 'Release') {
945 assert (os == 'Windows_NT') || (os in Constants.crossList)
946 if (architecture == 'x64' && os != 'OSX10.12') {
947 //Flow jobs should be Windows, Ubuntu, OSX0.12, or CentOS
948 if (isFlowJob || os == 'Windows_NT') {
949 addGithubPushTriggerHelper(job)
951 // OSX10.12 r2r jobs should only run every 12 hours, not daily.
952 } else if (architecture == 'x64' && os == 'OSX10.12'){
954 addPeriodicTriggerHelper(job, 'H H/12 * * *')
957 // For x86, only add per-commit jobs for Windows
958 else if (architecture == 'x86') {
959 if (os == 'Windows_NT') {
960 addGithubPushTriggerHelper(job)
963 // arm64 r2r jobs should only run daily.
964 else if (architecture == 'arm64') {
965 if (os == 'Windows_NT') {
966 addPeriodicTriggerHelper(job, '@daily')
971 case 'r2r_jitstress1':
972 case 'r2r_jitstress2':
973 case 'r2r_jitstressregs1':
974 case 'r2r_jitstressregs2':
975 case 'r2r_jitstressregs3':
976 case 'r2r_jitstressregs4':
977 case 'r2r_jitstressregs8':
978 case 'r2r_jitstressregs0x10':
979 case 'r2r_jitstressregs0x80':
980 case 'r2r_jitstressregs0x1000':
981 case 'r2r_jitminopts':
982 case 'r2r_jitforcerelocs':
983 case 'r2r_gcstress15':
984 assert !(os in bidailyCrossList)
986 // GCStress=C is currently not supported on OS X
987 if (os == 'OSX10.12' && isGCStressRelatedTesting(scenario)) {
991 // GC Stress 15 r2r gets a push trigger for checked/release
992 if (configuration == 'Checked' || configuration == 'Release') {
993 assert (os == 'Windows_NT') || (os in Constants.crossList)
994 if (architecture == 'x64') {
995 //Flow jobs should be Windows, Ubuntu, OSX10.12, or CentOS
996 if (isFlowJob || os == 'Windows_NT') {
997 // Add a weekly periodic trigger
998 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1001 // For x86, only add per-commit jobs for Windows
1002 else if (architecture == 'x86') {
1003 if (os == 'Windows_NT') {
1004 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1010 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1011 assert configuration == 'Release'
1012 assert architecture == 'x64'
1013 addPeriodicTriggerHelper(job, '@daily')
1014 // TODO: Add once external email sending is available again
1015 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1018 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1019 assert configuration == 'Release'
1020 assert architecture == 'x64'
1021 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1022 // TODO: Add once external email sending is available again
1023 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1025 case 'standalone_gc':
1026 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1027 assert (configuration == 'Release' || configuration == 'Checked')
1028 // TODO: Add once external email sending is available again
1029 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1030 addPeriodicTriggerHelper(job, '@daily')
1032 case 'gc_reliability_framework':
1033 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1034 assert (configuration == 'Release' || configuration == 'Checked')
1035 // Only triggered by phrase.
1038 assert !(os in bidailyCrossList)
1039 // ILASM/ILDASM roundtrip one gets a daily build, and only for release
1040 if (architecture == 'x64' && configuration == 'Release') {
1041 // We don't expect to see a job generated except in these scenarios
1042 assert (os == 'Windows_NT') || (os in Constants.crossList)
1043 if (isFlowJob || os == 'Windows_NT') {
1044 addPeriodicTriggerHelper(job, '@daily')
1049 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1050 assert configuration == 'Checked'
1051 assert (architecture == 'x64' || architecture == 'x86')
1052 addGithubPushTriggerHelper(job)
1055 assert (os == 'Windows_NT' || os == "Ubuntu")
1056 assert architecture == 'x64'
1057 addGithubPushTriggerHelper(job)
1059 case 'jitstressregs1':
1060 case 'jitstressregs2':
1061 case 'jitstressregs3':
1062 case 'jitstressregs4':
1063 case 'jitstressregs8':
1064 case 'jitstressregs0x10':
1065 case 'jitstressregs0x80':
1066 case 'jitstressregs0x1000':
1071 case 'jitstress2_jitstressregs1':
1072 case 'jitstress2_jitstressregs2':
1073 case 'jitstress2_jitstressregs3':
1074 case 'jitstress2_jitstressregs4':
1075 case 'jitstress2_jitstressregs8':
1076 case 'jitstress2_jitstressregs0x10':
1077 case 'jitstress2_jitstressregs0x80':
1078 case 'jitstress2_jitstressregs0x1000':
1079 case 'tailcallstress':
1082 case 'jitnox86hwintrinsic':
1083 case 'jitincompletehwintrinsic':
1084 case 'jitx86hwintrinsicnoavx':
1085 case 'jitx86hwintrinsicnoavx2':
1086 case 'jitx86hwintrinsicnosimd':
1087 case 'corefx_baseline':
1088 case 'corefx_minopts':
1089 case 'corefx_jitstress1':
1090 case 'corefx_jitstress2':
1091 case 'corefx_jitstressregs1':
1092 case 'corefx_jitstressregs2':
1093 case 'corefx_jitstressregs3':
1094 case 'corefx_jitstressregs4':
1095 case 'corefx_jitstressregs8':
1096 case 'corefx_jitstressregs0x10':
1097 case 'corefx_jitstressregs0x80':
1098 case 'corefx_jitstressregs0x1000':
1100 if (os != 'CentOS7.1' && !(os in bidailyCrossList)) {
1101 assert (os == 'Windows_NT') || (os in Constants.crossList)
1102 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
1103 if (os == 'Windows_NT') {
1104 // We don't have enough ARM64 machines to run these more frequently than weekly.
1105 addPeriodicTriggerHelper(job, '@weekly')
1109 addPeriodicTriggerHelper(job, '@daily')
1115 if (os != 'CentOS7.1' && !(os in bidailyCrossList)) {
1116 assert (os == 'Windows_NT') || (os in Constants.crossList)
1117 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
1118 if (os == 'Windows_NT') {
1119 // We don't have enough ARM64 machines to run these more frequently than weekly.
1120 addPeriodicTriggerHelper(job, '@weekly')
1122 // TODO: Add once external email sending is available again
1123 // addEmailPublisher(job, 'dotnetonarm64@microsoft.com')
1126 addPeriodicTriggerHelper(job, '@weekly')
1131 case 'gcstress0xc_zapdisable':
1132 case 'gcstress0xc_zapdisable_jitstress2':
1133 case 'gcstress0xc_zapdisable_heapverify1':
1134 case 'gcstress0xc_jitstress1':
1135 case 'gcstress0xc_jitstress2':
1136 case 'gcstress0xc_minopts_heapverify1':
1137 // GCStress=C is currently not supported on OS X
1138 if (os != 'CentOS7.1' && os != 'OSX10.12' && !(os in bidailyCrossList)) {
1139 assert (os == 'Windows_NT') || (os in Constants.crossList)
1140 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
1141 if (os == 'Windows_NT') {
1142 // We don't have enough ARM64 machines to run these more frequently than weekly.
1143 addPeriodicTriggerHelper(job, '@weekly')
1145 // TODO: Add once external email sending is available again
1146 // addEmailPublisher(job, 'dotnetonarm64@microsoft.com')
1149 addPeriodicTriggerHelper(job, '@weekly')
1155 // Testing on other operating systems TBD
1156 assert (os == 'Windows_NT' || os == 'Ubuntu')
1157 if (architecture == 'x64' || architecture == 'x86') {
1158 if (configuration == 'Checked') {
1159 addPeriodicTriggerHelper(job, '@daily')
1164 case 'tieredcompilation':
1165 case 'corefx_tieredcompilation':
1166 // No periodic jobs just yet, still testing
1170 println("Unknown scenario: ${scenario}");
1177 // **************************
1178 // Define the basic inner loop builds for PR and commit. This is basically just the set
1179 // of coreclr builds over linux/osx 10.12/windows and debug/release/checked. In addition, the windows
1180 // builds will do a couple extra steps.
1181 // **************************
1183 // Adds a trigger for the PR build if one is needed. If isFlowJob is true, then this is the
1184 // flow job that rolls up the build and test for non-windows OS's. // If the job is a windows build only job,
1185 // it's just used for internal builds
1186 // If you add a job with a trigger phrase, please add that phrase to coreclr/Documentation/project-docs/ci-trigger-phrases.md
1187 def static addTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob) {
1188 def isNormalOrInnerloop = (scenario == "normal" || scenario == "innerloop")
1190 if (isWindowsBuildOnlyJob) {
1194 def bidailyCrossList = ['RHEL7.2', 'Debian8.4']
1195 // Non pull request builds.
1197 addNonPRTriggers(job, branch, isPR, architecture, os, configuration, scenario, isFlowJob, isWindowsBuildOnlyJob, bidailyCrossList)
1224 // Pull request builds. Generally these fall into two categories: default triggers and on-demand triggers
1225 // We generally only have a distinct set of default triggers but a bunch of on-demand ones.
1226 def osGroup = getOSGroup(os)
1227 switch (architecture) {
1228 case 'x64': // editor brace matching: {
1229 if (scenario == 'formatting') {
1230 assert configuration == 'Checked'
1231 if (os == 'Windows_NT' || os == 'Ubuntu') {
1232 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Formatting")
1239 // OpenSUSE, Debian & RedHat get trigger phrases for pri 0 build, and pri 1 build & test
1242 if (scenario == 'innerloop') {
1244 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build")
1246 else if (scenario == 'normal') {
1247 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build", "(?i).*test\\W+${os}\\W+${architecture}.*")
1253 assert scenario != 'innerloop'
1254 // Distinguish with the other architectures (arm and x86)
1255 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build", "(?i).*test\\W+${os}\\W+${architecture}.*")
1261 assert scenario != 'innerloop'
1262 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build", "(?i).*test\\W+${os}\\W+.*")
1266 if (scenario == 'illink') {
1267 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} via ILLink", "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1273 // Triggers on the non-flow jobs aren't necessary here
1274 // Corefx testing uses non-flow jobs.
1275 if (!isFlowJob && !isCoreFxScenario(scenario)) {
1280 // PR Triggered jobs. These jobs will run pri0 tests.
1281 if (configuration == 'Checked') {
1282 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test.*")
1287 // OSX uses checked for default PR tests
1288 if (configuration == 'Checked') {
1290 assert !job.name.contains("centos")
1291 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test", "(?i).*test\\W+${os}\\W+${architecture}\\W+Build and Test.*")
1296 if (configuration == 'Checked') {
1297 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Jit Diff Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1302 if (configuration == 'Release') {
1303 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} IL RoundTrip Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1308 if (configuration == 'Release') {
1309 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Long-Running GC Build & Test", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1314 if (configuration == 'Release') {
1315 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Simulator", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1319 case 'standalone_gc':
1320 if (configuration == 'Release' || configuration == 'Checked') {
1321 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Standalone GC", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1325 case 'gc_reliability_framework':
1326 if (configuration == 'Release' || configuration == 'Checked') {
1327 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Reliability Framework", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1332 if (isJitStressScenario(scenario)) {
1333 def displayStr = getStressModeDisplayName(scenario)
1334 assert (os == 'Windows_NT') || (os in Constants.crossList)
1335 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test (Jit - ${displayStr})",
1336 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1338 else if (isR2RScenario(scenario)) {
1339 if (configuration == 'Release' || configuration == 'Checked') {
1340 def displayStr = getR2RDisplayName(scenario)
1341 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build and Test",
1342 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1346 println("Unknown scenario: ${scenario}");
1357 // CentOS uses checked for default PR tests while debug is build only
1358 if (configuration == 'Debug') {
1360 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build")
1363 // Make sure this is a flow job to get build and test.
1364 if (configuration == 'Checked' && isFlowJob) {
1365 assert job.name.contains("flow")
1367 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test")
1372 // Make sure this is a flow job to get build and test.
1373 if (configuration == 'Checked' && isFlowJob) {
1374 assert job.name.contains("flow")
1376 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test", "(?i).*test\\W+${os}\\W+${architecture}\\W+Build and Test.*")
1381 if (isR2RScenario(scenario)) {
1382 if (configuration == 'Release' || configuration == 'Checked') {
1383 def displayStr = getR2RDisplayName(scenario)
1384 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build & Test",
1385 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1397 if (configuration == 'Checked' || configuration == 'Release') {
1398 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test")
1403 if (configuration == 'Checked') {
1404 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test", "(?i).*test\\W+${os}\\W+${architecture}\\W+Build and Test.*")
1409 if (configuration == 'Checked') {
1410 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Jit Diff Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1415 if (configuration == 'Release') {
1416 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} IL RoundTrip Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1421 if (configuration == 'Release') {
1422 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Long-Running GC Build & Test", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1427 if (configuration == 'Release') {
1428 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Simulator", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1432 case 'standalone_gc':
1433 if (configuration == 'Release' || configuration == 'Checked') {
1434 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Standalone GC", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1438 case 'gc_reliability_framework':
1439 if (configuration == 'Release' || configuration == 'Checked') {
1440 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Reliability Framework", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1445 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} via ILLink", "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1449 if (isJitStressScenario(scenario)) {
1450 def displayStr = getStressModeDisplayName(scenario)
1451 assert (os == 'Windows_NT') || (os in Constants.crossList)
1452 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test (Jit - ${displayStr})",
1453 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1455 else if (isR2RScenario(scenario)) {
1456 if (configuration == 'Release' || configuration == 'Checked') {
1457 def displayStr = getR2RDisplayName(scenario)
1458 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build & Test",
1459 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1463 println("Unknown scenario: ${scenario}");
1472 println("Unknown os: ${os}");
1480 // editor brace matching: }
1482 case 'arm': // editor brace matching: {
1486 if (architecture == 'armlb') { // No arm legacy backend testing for Ubuntu
1490 assert scenario != 'innerloop'
1493 azureVMAgentPostBuildAction {
1494 agentPostBuildAction('Delete agent if the build was not successful (when idle).')
1498 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Build",
1499 "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}\\W+Build.*")
1503 if (architecture == 'armlb') { // No arm legacy backend testing for Tizen armel
1507 architecture = 'armel'
1510 azureVMAgentPostBuildAction {
1511 agentPostBuildAction('Delete agent if the build was not successful (when idle).')
1516 if (scenario == 'innerloop') {
1517 if (configuration == 'Checked') {
1518 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Innerloop Build and Test")
1522 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Build",
1523 "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}\\W+Build.*")
1528 // Triggers on the non-flow jobs aren't necessary here
1533 // Set up a private trigger
1534 def contextString = "${os} ${architecture} Cross ${configuration}"
1535 def triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
1536 if (scenario == 'innerloop') {
1537 contextString += " Innerloop"
1538 triggerString += "\\W+Innerloop"
1541 contextString += " ${scenario}"
1542 triggerString += "\\W+${scenario}"
1545 if (configuration == 'Debug') {
1546 contextString += " Build"
1547 triggerString += "\\W+Build"
1549 contextString += " Build and Test"
1550 triggerString += "\\W+Build and Test"
1553 triggerString += ".*"
1557 // Only Checked is an innerloop trigger.
1558 if (configuration == 'Checked')
1560 Utilities.addDefaultPrivateGithubPRTriggerForBranch(job, branch, contextString, null, arm64Users)
1564 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1567 // Stress jobs will use this code path.
1568 if (isArmWindowsScenario(scenario)) {
1569 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1575 println("NYI os: ${os}");
1580 // editor brace matching: }
1581 case 'arm64': // editor brace matching: {
1582 // Set up a private trigger
1583 def contextString = "${os} ${architecture} Cross ${configuration}"
1584 def triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
1586 if (scenario == 'innerloop') {
1587 contextString += " Innerloop"
1588 triggerString += "\\W+Innerloop"
1591 contextString += " ${scenario}"
1592 triggerString += "\\W+${scenario}"
1595 if (configuration == 'Debug') {
1596 contextString += " Build"
1597 triggerString += "\\W+Build"
1599 contextString += " Build and Test"
1600 triggerString += "\\W+Build and Test"
1603 triggerString += ".*"
1610 if (configuration == 'Debug' && !isFlowJob) {
1611 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Innerloop Build")
1616 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test", triggerString)
1619 if (isR2RScenario(scenario)) {
1620 if (configuration == 'Checked' || configuration == 'Release') {
1621 def displayStr = getR2RDisplayName(scenario)
1622 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build and Test", triggerString)
1630 // Triggers on the non-flow jobs aren't necessary here
1635 assert isArmWindowsScenario(scenario)
1638 if (configuration == 'Checked') {
1639 Utilities.addDefaultPrivateGithubPRTriggerForBranch(job, branch, contextString, null, arm64Users)
1644 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1647 // Stress jobs will use this code path.
1648 if (isArmWindowsScenario(scenario)) {
1649 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1655 println("NYI os: ${os}");
1661 // editor brace matching: }
1662 case 'x86': // editor brace matching: {
1663 assert ((os == 'Windows_NT') || ((os == 'Ubuntu') && isNormalOrInnerloop))
1664 if (os == 'Ubuntu') {
1665 // Triggers on the non-flow jobs aren't necessary here
1670 // on-demand only for ubuntu x86
1671 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build",
1672 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}.*")
1678 if (configuration == 'Checked' || configuration == 'Release') {
1679 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test")
1684 if (configuration == 'Checked') {
1685 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test",
1686 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+Build and Test.*")
1691 if (configuration == 'Release') {
1692 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} IL RoundTrip Build and Test",
1693 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1698 if (configuration == 'Release') {
1699 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Long-Running GC Build & Test",
1700 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1705 if (configuration == 'Release') {
1706 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Simulator",
1707 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1711 case 'standalone_gc':
1712 if (configuration == 'Release' || configuration == 'Checked') {
1713 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Standalone GC",
1714 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1719 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} via ILLink", "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1723 if (isJitStressScenario(scenario)) {
1724 def displayStr = getStressModeDisplayName(scenario)
1725 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test (Jit - ${displayStr})",
1726 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1728 else if (isR2RScenario(scenario)) {
1729 if (configuration == 'Release' || configuration == 'Checked') {
1730 def displayStr = getR2RDisplayName(scenario)
1731 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build & Test",
1732 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1736 println("Unknown scenario: ${os} ${architecture} ${scenario}");
1744 // editor brace matching: }
1745 case 'x64_arm64_altjit':
1746 case 'x86_arm_altjit': // editor brace matching: {
1747 assert (os == 'Windows_NT')
1750 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test",
1751 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+Build and Test.*")
1754 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${scenario}",
1755 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1760 // editor brace matching: }
1762 println("Unknown architecture: ${architecture}");
1768 def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR, def architecture, def configuration, def os, def isBuildOnly) {
1769 def buildCommands = [];
1770 def osGroup = getOSGroup(os)
1771 def lowerConfiguration = configuration.toLowerCase()
1774 if (scenario == 'innerloop') {
1778 setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly)
1780 def enableCorefxTesting = isCoreFxScenario(scenario)
1782 // Calculate the build steps, archival, and xunit results
1784 case 'Windows_NT': // editor brace matching: {
1785 switch (architecture) {
1788 case 'x86_arm_altjit':
1789 case 'x64_arm64_altjit':
1790 def arch = architecture
1792 if (architecture == 'x86_arm_altjit') {
1795 else if (architecture == 'x64_arm64_altjit') {
1799 if (scenario == 'formatting') {
1800 buildCommands += "python -u tests\\scripts\\format.py -c %WORKSPACE% -o Windows_NT -a ${arch}"
1801 Utilities.addArchival(newJob, "format.patch", "", true, false)
1805 if (scenario == 'illink') {
1806 buildCommands += "tests\\scripts\\build_illink.cmd clone ${arch}"
1809 // If it is a release build for windows, ensure PGO is used, else fail the build
1810 if ((lowerConfiguration == 'release') &&
1811 (scenario in Constants.basicScenarios) &&
1812 (architecture != 'x86_arm_altjit') &&
1813 (architecture != 'x64_arm64_altjit')) {
1815 buildOpts += ' -enforcepgo'
1818 if (enableCorefxTesting) {
1819 // We shouldn't need to build the tests. However, run-corefx-tests.py currently depends on having the restored corefx
1820 // package available, to determine the correct corefx version git commit hash, and we need to build the tests before
1821 // running "tests\\runtest.cmd GenerateLayoutOnly". So build the pri-0 tests to make this happen.
1823 // buildOpts += ' skiptests';
1824 buildOpts += " -priority=0"
1826 buildOpts += " -priority=${priority}"
1829 // Set __TestIntermediateDir to something short. If __TestIntermediateDir is already set, build-test.cmd will
1830 // output test binaries to that directory. If it is not set, the binaries are sent to a default directory whose name is about
1831 // 35 characters long.
1833 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${arch} ${buildOpts}"
1836 def runtestArguments = ''
1837 def testOpts = 'collectdumps'
1839 if (isR2RScenario(scenario)) {
1841 // If this is a ReadyToRun scenario, pass 'crossgen' or 'crossgenaltjit'
1842 // to cause framework assemblies to be crossgen'ed. Pass 'runcrossgentests'
1843 // to cause the tests to be crossgen'ed.
1845 if ((architecture == 'x86_arm_altjit') || (architecture == 'x64_arm64_altjit')) {
1846 testOpts += ' crossgenaltjit protononjit.dll'
1848 testOpts += ' crossgen'
1851 testOpts += ' runcrossgentests'
1853 else if (scenario == 'jitdiff') {
1854 testOpts += ' jitdisasm crossgen'
1856 else if (scenario == 'ilrt') {
1857 testOpts += ' ilasmroundtrip'
1859 else if (isLongGc(scenario)) {
1860 testOpts += " ${scenario} sequential"
1862 else if (scenario == 'standalone_gc') {
1863 testOpts += ' gcname clrgc.dll'
1865 else if (scenario == 'illink') {
1866 testOpts += " link %WORKSPACE%\\linker\\linker\\bin\\netcore_Release\\netcoreapp2.0\\win10-${arch}\\publish\\illink.exe"
1869 // Default per-test timeout is 10 minutes. For stress modes and Debug scenarios, increase this
1870 // to 30 minutes (30 * 60 * 1000 = 180000). The "timeout" argument to runtest.cmd sets this, by
1871 // taking a timeout value in milliseconds. (Note that it sets the __TestTimeout environment variable,
1872 // which is read by the xunit harness.)
1873 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario) || (lowerConfiguration == 'debug'))
1875 def timeout = 1800000
1876 testOpts += " timeout ${timeout}"
1879 // If we are running a stress mode, we should write out the set of key
1880 // value env pairs to a file at this point and then we'll pass that to runtest.cmd
1882 def envScriptPath = ''
1883 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
1884 def buildCommandsStr = ''
1885 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
1886 buildCommandsStr += envScriptCreate(os, envScriptPath)
1888 if (isJitStressScenario(scenario)) {
1889 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
1891 else if (isR2RStressScenario(scenario)) {
1892 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.r2rStressScenarios[scenario], envScriptPath)
1895 if (architecture == 'x86_arm_altjit') {
1896 buildCommandsStr += envScriptAppendExistingScript(os, "%WORKSPACE%\\tests\\x86_arm_altjit.cmd", envScriptPath)
1898 else if (architecture == 'x64_arm64_altjit') {
1899 buildCommandsStr += envScriptAppendExistingScript(os, "%WORKSPACE%\\tests\\x64_arm64_altjit.cmd", envScriptPath)
1902 envScriptFinalize(os, envScriptPath)
1904 // Note that buildCommands is an array of individually executed commands; we want all the commands used to
1905 // create the SetStressModes.bat script to be executed together, hence we accumulate them as strings
1906 // into a single script.
1907 buildCommands += buildCommandsStr
1909 else if (architecture == 'x86_arm_altjit') {
1910 envScriptPath = "%WORKSPACE%\\tests\\x86_arm_altjit.cmd"
1912 else if (architecture == 'x64_arm64_altjit') {
1913 envScriptPath = "%WORKSPACE%\\tests\\x64_arm64_altjit.cmd"
1915 if (envScriptPath != '') {
1916 testOpts += " TestEnv ${envScriptPath}"
1919 runtestArguments = "${lowerConfiguration} ${arch} ${testOpts}"
1921 if (enableCorefxTesting) {
1922 // Generate the test layout because it restores the corefx package which allows run-corefx-tests.py
1923 // to determine the correct matching corefx version git commit hash.
1924 buildCommands += "tests\\runtest.cmd ${runtestArguments} GenerateLayoutOnly"
1926 def workspaceRelativeFxRoot = "_/fx"
1927 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
1929 buildCommands += "python -u %WORKSPACE%\\tests\\scripts\\run-corefx-tests.py -arch ${arch} -ci_arch ${architecture} -build_type ${configuration} -fx_root ${absoluteFxRoot} -fx_branch ${branch} -env_script ${envScriptPath}"
1931 // Archive and process (only) the test results
1932 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
1933 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
1935 //Archive additional build stuff to diagnose why my attempt at fault injection isn't causing CI to fail
1936 Utilities.addArchival(newJob, "SetStressModes.bat", "", true, false)
1937 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/bin/testhost/**", "", true, false)
1939 else if (isGcReliabilityFramework(scenario)) {
1940 buildCommands += "tests\\runtest.cmd ${runtestArguments} GenerateLayoutOnly"
1941 buildCommands += "tests\\scripts\\run-gc-reliability-framework.cmd ${arch} ${configuration}"
1944 buildCommands += "tests\\runtest.cmd ${runtestArguments}"
1948 if (!enableCorefxTesting) {
1949 // Run the rest of the build
1950 // Build the mscorlib for the other OS's
1951 buildCommands += "build.cmd ${lowerConfiguration} ${arch} linuxmscorlib"
1952 buildCommands += "build.cmd ${lowerConfiguration} ${arch} osxmscorlib"
1954 if (arch == "x64") {
1955 buildCommands += "build.cmd ${lowerConfiguration} arm64 linuxmscorlib"
1958 // Zip up the tests directory so that we don't use so much space/time copying
1959 // 10s of thousands of files around.
1960 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')\"";
1962 if (!isJitStressScenario(scenario)) {
1963 // For windows, pull full test results and test drops for x86/x64.
1964 // No need to pull for stress mode scenarios (downstream builds use the default scenario)
1965 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
1968 if (scenario == 'jitdiff') {
1969 // retrive jit-dasm output for base commit, and run jit-diff
1971 // if this is a build only job, we want to keep the default (build) artifacts for the flow job
1972 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${arch}.${configuration}/dasm/**")
1977 Utilities.addXUnitDotNETResults(newJob, 'bin/**/TestRun*.xml', true)
1983 assert isArmWindowsScenario(scenario)
1985 def machineAffinityOptions = ['use_arm64_build_machine' : true]
1986 setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
1988 def buildArchitecture = 'arm'
1990 // For 'armlb' (the JIT LEGACY_BACKEND architecture for arm), tell build.cmd to use legacy backend for crossgen compilation.
1991 // Legacy backend is not the default JIT; it is an aljit. So, this is a special case.
1992 def armCrossgenOpt = ''
1993 if (architecture == 'armlb') {
1994 armCrossgenOpt = '-crossgenaltjit legacyjit.dll'
1997 // This is now a build only job. Do not run tests. Use the flow job.
1998 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${buildArchitecture} -priority=${priority} ${armCrossgenOpt}"
2000 // Zip up the tests directory so that we don't use so much space/time copying
2001 // 10s of thousands of files around.
2002 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('.\\bin\\tests\\${osGroup}.${buildArchitecture}.${configuration}', '.\\bin\\tests\\tests.zip')\"";
2005 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2008 assert isArmWindowsScenario(scenario)
2010 def machineAffinityOptions = ['use_arm64_build_machine' : true]
2011 setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
2013 // This is now a build only job. Do not run tests. Use the flow job.
2014 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} toolset_dir C:\\ats2 -priority=${priority}"
2016 // Zip up the tests directory so that we don't use so much space/time copying
2017 // 10s of thousands of files around.
2018 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')\"";
2021 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2024 println("Unknown architecture: ${architecture}");
2029 // editor brace matching: }
2038 case 'Fedora24': // editor brace matching: {
2039 switch (architecture) {
2042 if (architecture == 'x86' && os == 'Ubuntu') {
2043 // build and PAL test
2044 def dockerImage = getDockerImageName(architecture, os, true)
2045 buildCommands += "docker run -i --rm -v \${WORKSPACE}:/opt/code -w /opt/code -e ROOTFS_DIR=/crossrootfs/x86 ${dockerImage} ./build.sh ${architecture} cross ${lowerConfiguration}"
2046 dockerImage = getDockerImageName(architecture, os, false)
2047 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"
2048 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2049 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2053 if (scenario == 'formatting') {
2054 buildCommands += "python tests/scripts/format.py -c \${WORKSPACE} -o Linux -a ${architecture}"
2055 Utilities.addArchival(newJob, "format.patch", "", true, false)
2059 if (scenario == 'illink') {
2060 assert(os == 'Ubuntu')
2061 buildCommands += "./tests/scripts/build_illink.sh --clone --arch=${architecture}"
2064 if (!enableCorefxTesting) {
2065 // We run pal tests on all OS but generate mscorlib (and thus, nuget packages)
2066 // only on supported OS platforms.
2067 def bootstrapRid = Utilities.getBoostrapPublishRid(os)
2068 def bootstrapRidEnv = bootstrapRid != null ? "__PUBLISH_RID=${bootstrapRid} " : ''
2070 buildCommands += "${bootstrapRidEnv}./build.sh verbose ${lowerConfiguration} ${architecture}"
2071 buildCommands += "src/pal/tests/palsuite/runpaltests.sh \${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration} \${WORKSPACE}/bin/paltestout"
2073 // Basic archiving of the build
2074 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2076 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2079 // Corefx stress testing
2080 assert os == 'Ubuntu'
2081 assert architecture == 'x64'
2082 assert lowerConfiguration == 'checked'
2083 assert isJitStressScenario(scenario)
2086 buildCommands += "./build.sh verbose ${lowerConfiguration} ${architecture}"
2088 // Generate the test layout, which restores the corefx package, and allows run-corefx-tests.py to determine the
2089 // matching corefx version git commit hash.
2090 buildCommands += "./build-test.sh ${architecture} ${lowerConfiguration} generatelayoutonly"
2092 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2094 def envScriptCmds = envScriptCreate(os, scriptFileName)
2095 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2096 envScriptCmds += envScriptFinalize(os, scriptFileName)
2097 buildCommands += envScriptCmds
2099 // Build and text corefx
2100 def workspaceRelativeFxRoot = "_/fx"
2101 def absoluteFxRoot = "\$WORKSPACE/${workspaceRelativeFxRoot}"
2103 buildCommands += "python -u \$WORKSPACE/tests/scripts/run-corefx-tests.py -arch ${architecture} -ci_arch ${architecture} -build_type ${configuration} -fx_root ${absoluteFxRoot} -fx_branch ${branch} -env_script ${scriptFileName}"
2105 // Archive and process (only) the test results
2106 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
2107 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
2111 if (!enableCorefxTesting) {
2112 buildCommands += "ROOTFS_DIR=/opt/arm64-xenial-rootfs ./build.sh verbose ${lowerConfiguration} ${architecture} cross clang3.8"
2114 // HACK -- Arm64 does not have corefx jobs yet.
2115 buildCommands += "git clone https://github.com/dotnet/corefx fx"
2116 buildCommands += "ROOTFS_DIR=/opt/arm64-xenial-rootfs-corefx ./fx/build-native.sh -release -buildArch=arm64 -- verbose cross clang3.8"
2117 buildCommands += "mkdir ./bin/Product/Linux.arm64.${configuration}/corefxNative"
2118 buildCommands += "cp fx/bin/Linux.arm64.Release/native/* ./bin/Product/Linux.arm64.${configuration}/corefxNative"
2120 // Basic archiving of the build
2121 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2125 // Cross builds for ARM runs on Ubuntu, Ubuntu16.04 and Tizen currently
2126 assert (os == 'Ubuntu') || (os == 'Ubuntu16.04') || (os == 'Tizen')
2128 // default values for Ubuntu
2130 def linuxCodeName="trusty"
2131 if (os == 'Ubuntu16.04') {
2132 linuxCodeName="xenial"
2134 else if (os == 'Tizen') {
2136 linuxCodeName="tizen"
2139 // Unzip the Windows test binaries first. Exit with 0
2140 buildCommands += "unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/Windows_NT.x64.${configuration} || exit 0"
2142 // Unpack the corefx binaries
2143 buildCommands += "mkdir ./bin/CoreFxBinDir"
2144 buildCommands += "tar -xf ./bin/build.tar.gz -C ./bin/CoreFxBinDir"
2145 if (os != 'Tizen') {
2146 buildCommands += "chmod a+x ./bin/CoreFxBinDir/corerun"
2148 // Test environment emulation using docker and qemu has some problem to use lttng library.
2149 // We should remove libcoreclrtraceptprovider.so to avoid test hang.
2150 if (os == 'Ubuntu') {
2151 buildCommands += "rm -f -v ./bin/CoreFxBinDir/libcoreclrtraceptprovider.so"
2154 // Call the ARM CI script to cross build and test using docker
2155 buildCommands += """./tests/scripts/arm32_ci_script.sh \\
2158 --linuxCodeName=${linuxCodeName} \\
2159 --buildConfig=${lowerConfiguration} \\
2160 --testRootDir=./bin/tests/Windows_NT.x64.${configuration} \\
2161 --coreFxBinDir=./bin/CoreFxBinDir \\
2162 --testDirFile=./tests/testsRunningInsideARM.txt"""
2164 // Basic archiving of the build, no pal tests
2165 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2168 println("Unknown architecture: ${architecture}");
2173 // editor brace matching: }
2175 println("Unknown os: ${os}");
2180 return buildCommands
2183 Constants.allScenarios.each { scenario ->
2184 [true, false].each { isPR ->
2185 Constants.architectureList.each { architecture ->
2186 Constants.configurationList.each { configuration ->
2187 Constants.osList.each { os ->
2188 // If the OS is Windows_NT_BuildOnly, set the isBuildOnly flag to true
2189 // and reset the os to Windows_NT
2190 def isBuildOnly = false
2191 if (os == 'Windows_NT_BuildOnly') {
2196 // Tizen is only supported for arm architecture
2197 if (os == 'Tizen' && architecture != 'arm') {
2201 // Skip totally unimplemented (in CI) configurations.
2202 switch (architecture) {
2204 if (os == 'Ubuntu16.04') {
2208 // Windows and Ubuntu only
2209 if ((os != 'Windows_NT' && os != 'Ubuntu') || isBuildOnly) {
2214 if ((os != 'Ubuntu') && (os != 'Ubuntu16.04') && (os != 'Tizen') && (os != 'Windows_NT')) {
2219 if (os != 'Windows_NT') {
2224 if ((os != 'Ubuntu') && (os != 'Windows_NT')) {
2228 case 'x86_arm_altjit':
2229 case 'x64_arm64_altjit':
2230 if (os != 'Windows_NT') {
2235 // Everything implemented
2238 println("Unknown architecture: ${architecture}")
2243 // Skip scenarios (blanket skipping for jit stress modes, which are good most everywhere
2244 // with checked builds)
2245 if (isJitStressScenario(scenario)) {
2246 if (configuration != 'Checked') {
2250 // Since these are just execution time differences,
2251 // skip platforms that don't execute the tests here (Windows_NT only)
2252 def isEnabledOS = (os == 'Windows_NT') || (os == 'Ubuntu' && isCoreFxScenario(scenario))
2253 if (!isEnabledOS || isBuildOnly) {
2257 switch (architecture) {
2260 case 'x86_arm_altjit':
2261 case 'x64_arm64_altjit':
2262 // x86 ubuntu: default only
2263 if ((os == 'Ubuntu') && (architecture == 'x86')) {
2266 // Windows: Everything implemented
2270 // arm, arm64, armlb: stress is handled through flow jobs.
2274 else if (isR2RScenario(scenario)) {
2275 if (os != 'Windows_NT') {
2278 // Stress scenarios only run with Checked builds, not Release (they would work with Debug, but be slow).
2279 if ((configuration != 'Checked') && isR2RStressScenario(scenario)) {
2287 // The ilrt build isn't necessary except for Windows_NT2003. Non-Windows NT uses
2288 // the default scenario build
2289 if (os != 'Windows_NT') {
2293 if (architecture != 'x64') {
2297 if (configuration != 'Release') {
2302 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2305 if (architecture != 'x64') {
2308 if (configuration != 'Checked') {
2314 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2317 if (architecture != 'x64') {
2320 if (configuration != 'Release') {
2324 case 'gc_reliability_framework':
2325 case 'standalone_gc':
2326 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2330 if (architecture != 'x64') {
2334 if (configuration != 'Release' && configuration != 'Checked') {
2338 // We only run Windows and Ubuntu x64 Checked for formatting right now
2340 if (os != 'Windows_NT' && os != 'Ubuntu') {
2343 if (architecture != 'x64') {
2346 if (configuration != 'Checked') {
2354 if (os != 'Windows_NT' && (os != 'Ubuntu' || architecture != 'x64')) {
2357 if (architecture != 'x64' && architecture != 'x86') {
2368 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly)) {
2373 println("Unknown scenario: ${scenario}")
2379 // For altjit, don't do any scenarios that don't change compilation. That is, scenarios that only change
2380 // runtime behavior, not compile-time behavior, are not interesting.
2381 switch (architecture) {
2382 case 'x86_arm_altjit':
2383 case 'x64_arm64_altjit':
2384 if (isGCStressRelatedTesting(scenario)) {
2393 def lowerConfiguration = configuration.toLowerCase()
2394 def jobName = getJobName(configuration, architecture, os, scenario, isBuildOnly)
2395 def folderName = getJobFolder(scenario)
2397 // Create the new job
2398 def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folderName)) {}
2399 addToViews(newJob, isPR, architecture, os)
2401 def machineAffinityOptions = null
2403 if (os != 'Windows_NT') {
2404 machineAffinityOptions = architecture == 'arm64' ? ['is_build_only': true] : null
2407 machineAffinityOptions = (architecture == 'arm' || architecture == 'armlb' || architecture == 'arm64') ? ['use_arm64_build_machine': false] : null
2410 setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
2412 // Add all the standard options
2413 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
2414 addTriggers(newJob, branch, isPR, architecture, os, configuration, scenario, false, isBuildOnly) // isFlowJob==false
2416 def buildCommands = calculateBuildCommands(newJob, scenario, branch, isPR, architecture, configuration, os, isBuildOnly)
2417 def osGroup = getOSGroup(os)
2421 if (os == 'Windows_NT') {
2422 buildCommands.each { buildCommand ->
2423 batchFile(buildCommand)
2427 // Setup corefx and Windows test binaries for Linux cross build for ubuntu-arm, ubuntu16.04-arm and tizen-armel
2428 if ( architecture == 'arm' && ( os == 'Ubuntu' || os == 'Ubuntu16.04' || os == 'Tizen')) {
2429 // Cross build for ubuntu-arm, ubuntu16.04-arm and tizen-armel
2430 // Define the Windows Tests and Corefx build job names
2431 def WindowsTestsName = projectFolder + '/' +
2432 Utilities.getFullJobName(project,
2433 getJobName(lowerConfiguration, 'x64' , 'windows_nt', 'normal', true),
2435 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' +
2436 Utilities.getFolderName(branch)
2438 // Copy the Windows test binaries and the Corefx build binaries
2439 copyArtifacts(WindowsTestsName) {
2440 includePatterns('bin/tests/tests.zip')
2442 latestSuccessful(true)
2447 def corefx_os = 'linux'
2448 if (os == 'Tizen') {
2453 // Let's use release CoreFX to test checked CoreCLR,
2454 // because we do not generate checked CoreFX in CoreFX CI yet.
2455 def corefx_lowerConfiguration = lowerConfiguration
2456 if ( lowerConfiguration == 'checked' ) {
2457 corefx_lowerConfiguration='release'
2460 copyArtifacts("${corefxFolder}/${corefx_os}_${arm_abi}_cross_${corefx_lowerConfiguration}") {
2461 includePatterns('bin/build.tar.gz')
2463 latestSuccessful(true)
2468 buildCommands.each { buildCommand ->
2482 // Create jobs requiring flow jobs. This includes x64 non-Windows, arm64 Ubuntu, and arm/arm64/armlb Windows.
2483 Constants.allScenarios.each { scenario ->
2484 def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
2486 [true, false].each { isPR ->
2487 ['arm', 'armlb', 'x64', 'arm64', 'x86'].each { architecture ->
2488 Constants.crossList.each { os ->
2489 if (architecture == 'arm64') {
2490 if (os != "Ubuntu" && os != "Windows_NT") {
2493 } else if (architecture == 'arm' || architecture == 'armlb') {
2494 if (os != 'Windows_NT') {
2497 } else if (architecture == 'x86') {
2498 if (os != "Ubuntu") {
2503 def validWindowsNTCrossArches = ["arm", "armlb", "arm64"]
2505 if (os == "Windows_NT" && !(architecture in validWindowsNTCrossArches)) {
2509 Constants.configurationList.each { configuration ->
2511 // First, filter based on OS.
2513 if (os == 'Windows_NT') {
2514 if (!isArmWindowsScenario(scenario)) {
2520 if (architecture == 'arm64') {
2521 if (!(scenario in Constants.validLinuxArm64Scenarios)) {
2525 else if (architecture == 'x86') {
2526 // Linux/x86 only want innerloop and default test
2527 if (!isNormalOrInnerloop) {
2533 // For CentOS, we only want Checked/Release builds.
2534 if (os == 'CentOS7.1') {
2535 if (configuration != 'Checked' && configuration != 'Release') {
2538 if (!isNormalOrInnerloop && !isR2RScenario(scenario) && !isJitStressScenario(scenario)) {
2543 // For RedHat and Debian, we only do Release builds.
2544 else if (os == 'RHEL7.2' || os == 'Debian8.4') {
2545 if (configuration != 'Release') {
2548 if (!isNormalOrInnerloop) {
2553 // Next, filter based on scenario.
2555 if (isJitStressScenario(scenario)) {
2556 if (configuration != 'Checked') {
2559 // CoreFx JIT stress tests currently not implemented for flow jobs.
2560 if (isCoreFxScenario(scenario)) {
2564 else if (isR2RBaselineScenario(scenario)) {
2565 if (configuration != 'Checked' && configuration != 'Release') {
2569 else if (isR2RStressScenario(scenario)) {
2570 if (configuration != 'Checked') {
2580 // Long GC tests take a long time on non-Release builds
2581 // ilrt is also Release only
2582 if (configuration != 'Release') {
2588 if (configuration != 'Checked') {
2593 case 'gc_reliability_framework':
2594 case 'standalone_gc':
2595 if (configuration != 'Release' && configuration != 'Checked') {
2603 if (os != 'Windows_NT' && os != 'Ubuntu') {
2614 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, false)) {
2620 println("Unknown scenario: ${scenario}")
2626 // Done filtering. Now, create the jobs.
2628 def lowerConfiguration = configuration.toLowerCase()
2629 def osGroup = getOSGroup(os)
2630 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
2632 def buildScenario = scenario == 'innerloop' ? 'innerloop' : 'normal'
2634 def inputCoreCLRBuildName = projectFolder + '/' +
2635 Utilities.getFullJobName(project, getJobName(configuration, architecture, os, buildScenario, false), isPR)
2637 // If this is a stress scenario, there isn't any difference in the build job, so we didn't create a build only
2638 // job for Windows_NT specific to that stress mode. Just copy from the default scenario.
2639 def testBuildScenario = scenario == 'innerloop' ? 'innerloop' : 'normal'
2640 def inputWindowsTestBuildArch = architecture
2641 if (architecture == "arm64" && os != "Windows_NT") {
2642 // Use the x64 test build for arm64 unix
2643 inputWindowsTestBuildArch = "x64"
2646 def inputWindowsTestsBuildName = ""
2648 if (isJitStressScenario(scenario)) {
2649 inputWindowsTestsBuildName = projectFolder + '/' +
2650 Utilities.getFullJobName(project, getJobName(configuration, inputWindowsTestBuildArch, 'windows_nt', testBuildScenario, false), isPR)
2652 inputWindowsTestsBuildName = projectFolder + '/' +
2653 Utilities.getFullJobName(project, getJobName(configuration, inputWindowsTestBuildArch, 'windows_nt', testBuildScenario, true), isPR)
2658 // Enable Server GC for Ubuntu PR builds
2659 def serverGCString = ''
2660 if (os == 'Ubuntu' && isPR) {
2661 serverGCString = '--useServerGC'
2666 if (isR2RScenario(scenario)) {
2668 testOpts += ' --crossgen --runcrossgentests'
2670 if (scenario == 'r2r_jitstress1') {
2671 testOpts += ' --jitstress=1'
2673 else if (scenario == 'r2r_jitstress2') {
2674 testOpts += ' --jitstress=2'
2676 else if (scenario == 'r2r_jitstressregs1') {
2677 testOpts += ' --jitstressregs=1'
2679 else if (scenario == 'r2r_jitstressregs2') {
2680 testOpts += ' --jitstressregs=2'
2682 else if (scenario == 'r2r_jitstressregs3') {
2683 testOpts += ' --jitstressregs=3'
2685 else if (scenario == 'r2r_jitstressregs4') {
2686 testOpts += ' --jitstressregs=4'
2688 else if (scenario == 'r2r_jitstressregs8') {
2689 testOpts += ' --jitstressregs=8'
2691 else if (scenario == 'r2r_jitstressregs0x10') {
2692 testOpts += ' --jitstressregs=0x10'
2694 else if (scenario == 'r2r_jitstressregs0x80') {
2695 testOpts += ' --jitstressregs=0x80'
2697 else if (scenario == 'r2r_jitstressregs0x1000') {
2698 testOpts += ' --jitstressregs=0x1000'
2700 else if (scenario == 'r2r_jitminopts') {
2701 testOpts += ' --jitminopts'
2703 else if (scenario == 'r2r_jitforcerelocs') {
2704 testOpts += ' --jitforcerelocs'
2706 else if (scenario == 'r2r_gcstress15') {
2707 testOpts += ' --gcstresslevel=0xF'
2710 else if (scenario == 'jitdiff') {
2711 testOpts += ' --jitdisasm --crossgen'
2713 else if (scenario == 'illink') {
2714 testOpts += ' --link=\$WORKSPACE/linker/linker/bin/netcore_Release/netcoreapp2.0/ubuntu-x64/publish/illink'
2716 else if (isLongGc(scenario)) {
2717 // Long GC tests behave very poorly when they are not
2718 // the only test running (many of them allocate until OOM).
2719 testOpts += ' --sequential'
2721 // A note - runtest.sh does have "--long-gc" and "--gcsimulator" options
2722 // for running long GC and GCSimulator tests, respectively. We don't use them
2723 // here because using a playlist file produces much more readable output on the CI machines
2724 // and reduces running time.
2726 // The Long GC playlist contains all of the tests that are
2727 // going to be run. The GCSimulator playlist contains all of
2728 // the GC simulator tests.
2729 if (scenario == 'longgc') {
2730 testOpts += ' --long-gc --playlist=./tests/longRunningGcTests.txt'
2732 else if (scenario == 'gcsimulator') {
2733 testOpts += ' --gcsimulator --playlist=./tests/gcSimulatorTests.txt'
2736 else if (isGcReliabilityFramework(scenario)) {
2737 testOpts += ' --build-overlay-only'
2739 else if (scenario == 'standalone_gc') {
2740 if (osGroup == 'OSX') {
2741 testOpts += ' --gcname=libclrgc.dylib'
2743 else if (osGroup == 'Linux') {
2744 testOpts += ' --gcname=libclrgc.so'
2747 println("Unexpected OS group: ${osGroup} for os ${os}")
2752 def windowsArmJob = (os == "Windows_NT" && architecture in validWindowsNTCrossArches)
2754 def folder = getJobFolder(scenario)
2755 def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folder)) {
2756 // Add parameters for the inputs
2758 if (windowsArmJob == true) {
2760 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
2765 stringParam('CORECLR_WINDOWS_BUILD', '', 'Build number to copy CoreCLR windows test binaries from')
2766 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
2771 // Set up the copies
2773 // Coreclr build containing the tests and mscorlib
2774 // pri1 jobs still need to copy windows_nt built tests
2775 if (windowsArmJob != true) {
2776 copyArtifacts(inputWindowsTestsBuildName) {
2777 excludePatterns('**/testResults.xml', '**/*.ni.dll')
2779 buildNumber('${CORECLR_WINDOWS_BUILD}')
2784 // Coreclr build we are trying to test
2786 // ** NOTE ** This will, correctly, overwrite over the CORE_ROOT from the windows test archive
2788 copyArtifacts(inputCoreCLRBuildName) {
2789 excludePatterns('**/testResults.xml', '**/*.ni.dll')
2791 buildNumber('${CORECLR_BUILD}')
2795 // Windows CoreCLR Arm(64) will restore corefx
2796 // packages correctly.
2798 // In addition, test steps are entirely different
2799 // because we do not have a unified runner
2800 if (windowsArmJob != true) {
2801 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' + Utilities.getFolderName(branch)
2803 // HACK -- Arm64 does not have corefx jobs yet.
2804 // Clone corefx and build the native packages overwriting the x64 packages.
2805 if (architecture == 'arm64') {
2806 shell("cp ./bin/Product/Linux.arm64.${configuration}/corefxNative/* ./bin/CoreFxBinDir")
2807 shell("chmod +x ./bin/Product/Linux.arm64.${configuration}/corerun")
2809 else if (architecture == 'x86') {
2810 shell("mkdir ./bin/CoreFxNative")
2812 copyArtifacts("${corefxFolder}/ubuntu16.04_x86_release") {
2813 includePatterns('bin/build.tar.gz')
2814 targetDirectory('bin/CoreFxNative')
2816 latestSuccessful(true)
2820 shell("tar -xf ./bin/CoreFxNative/bin/build.tar.gz -C ./bin/CoreFxBinDir")
2823 // Unzip the tests first. Exit with 0
2824 shell("unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/${osGroup}.${architecture}.${configuration} || exit 0")
2825 shell("rm -r ./bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root || exit 0")
2827 shell("./build-test.sh ${architecture} ${configuration} generatelayoutonly")
2829 // Execute the tests
2830 def runDocker = isNeedDocker(architecture, os, false)
2831 def dockerPrefix = ""
2834 def dockerImage = getDockerImageName(architecture, os, false)
2835 dockerPrefix = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} "
2836 dockerCmd = dockerPrefix + "${dockerImage} "
2839 // If we are running a stress mode, we'll set those variables first
2841 if (isJitStressScenario(scenario)) {
2842 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2843 def envScriptCmds = envScriptCreate(os, scriptFileName)
2844 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2845 envScriptCmds += envScriptFinalize(os, scriptFileName)
2846 shell("${envScriptCmds}")
2847 testEnvOpt = "--test-env=" + scriptFileName
2850 if (isGCStressRelatedTesting(scenario)) {
2851 shell('./init-tools.sh')
2854 shell("""${dockerCmd}./tests/runtest.sh \\
2855 --testRootDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}\" \\
2856 --coreOverlayDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root\" \\
2857 --testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
2858 --copyNativeTestBin --limitedDumpGeneration ${testEnvOpt} ${serverGCString} ${testOpts}""")
2860 if (isGcReliabilityFramework(scenario)) {
2861 // runtest.sh doesn't actually execute the reliability framework - do it here.
2862 if (serverGCString != '') {
2864 dockerCmd = dockerPrefix + "-e COMPlus_gcServer=1 ${dockerImage} "
2867 shell("export COMPlus_gcServer=1")
2871 shell("${dockerCmd}./tests/scripts/run-gc-reliability-framework.sh ${architecture} ${configuration}")
2875 else { // windowsArmJob == true
2877 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}')")
2879 // Build the build commands
2880 def buildCommands = ""
2882 def coreRootLocation = "%WORKSPACE%\\bin\\tests\\Windows_NT.${architecture}.${configuration}\\Tests\\Core_Root"
2883 def addEnvVariable = { variable, value -> buildCommands += "set ${variable}=${value}\r\n"}
2884 def addCommand = { cmd -> buildCommands += "${cmd}\r\n"}
2886 // Make sure Command Extensions are enabled. Used so %ERRORLEVEL% is available.
2887 addCommand("SETLOCAL ENABLEEXTENSIONS")
2890 addEnvVariable("CORE_ROOT", coreRootLocation)
2892 addEnvVariable("COMPlus_NoGuiOnAssert", "1")
2893 addEnvVariable("COMPlus_ContinueOnAssert", "0")
2895 // ARM legacy backend; this is an altjit.
2896 if (architecture == "armlb") {
2897 addEnvVariable("COMPlus_AltJit", "*")
2898 addEnvVariable("COMPlus_AltJitNgen", "*")
2899 addEnvVariable("COMPlus_AltJitName", "legacyjit.dll")
2900 addEnvVariable("COMPlus_AltJitAssertOnNYI", "1")
2903 // If we are running a stress mode, we'll set those variables as well
2904 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
2905 def stressValues = null
2906 if (isJitStressScenario(scenario)) {
2907 stressValues = Constants.jitStressModeScenarios[scenario]
2910 stressValues = Constants.r2rStressScenarios[scenario]
2913 stressValues.each { key, value ->
2914 addEnvVariable(key, value)
2918 if (isR2RScenario(scenario)) {
2919 // Crossgen the framework assemblies.
2920 buildCommands += """
2921 @for %%F in (%CORE_ROOT%\\*.dll) do @call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nxF
2922 @goto skip_PrecompileAssembly
2925 @REM Skip mscorlib since it is already precompiled.
2926 @if /I "%3" == "mscorlib.dll" exit /b 0
2927 @if /I "%3" == "mscorlib.ni.dll" exit /b 0
2929 "%CORE_ROOT%\\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" %2 >nul 2>nul
2930 @if "%errorlevel%" == "-2146230517" (
2931 echo %2 is not a managed assembly.
2932 ) else if "%errorlevel%" == "-2146234344" (
2933 echo %2 is not a managed assembly.
2934 ) else if %errorlevel% neq 0 (
2935 echo Unable to precompile %2
2941 :skip_PrecompileAssembly
2944 // Set RunCrossGen variable to cause test wrappers to invoke their logic to run
2945 // crossgen on tests before running them.
2946 addEnvVariable("RunCrossGen", "true")
2949 // Create the smarty command
2950 def smartyCommand = "C:\\Tools\\Smarty.exe /noecid /noie /workers 9 /inc EXPECTED_PASS "
2951 def addSmartyFlag = { flag -> smartyCommand += flag + " "}
2952 def addExclude = { exclude -> addSmartyFlag("/exc " + exclude)}
2954 def addArchSpecificExclude = { architectureToExclude, exclude -> if (architectureToExclude == "armlb") { addExclude("LEGACYJIT_" + exclude) } else { addExclude(exclude) } }
2956 if (architecture == "armlb") {
2957 addExclude("LEGACYJIT_FAIL")
2960 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
2961 def failTag = "JITSTRESS_FAIL"
2962 def excludeTag = "JITSTRESS_EXCLUDE"
2964 if (scenario.contains('gc')) {
2965 failTag = "GCSTRESS_FAIL"
2966 excludeTag = "GCSTRESS_EXCLUDE"
2969 addArchSpecificExclude(architecture, failTag)
2970 addArchSpecificExclude(architecture, excludeTag)
2976 // Exclude any test marked LONG_RUNNING; these often exceed the standard timeout and fail as a result.
2977 // TODO: We should create a "long running" job that runs these with a longer timeout.
2978 addExclude("LONG_RUNNING")
2980 smartyCommand += "/lstFile Tests.lst"
2982 def testListArch = [
2988 def archLocation = testListArch[architecture]
2990 addCommand("copy %WORKSPACE%\\tests\\${archLocation}\\Tests.lst bin\\tests\\${osGroup}.${architecture}.${configuration}")
2991 addCommand("pushd bin\\tests\\${osGroup}.${architecture}.${configuration}")
2992 addCommand("${smartyCommand}")
2994 // Save the errorlevel from the smarty command to be used as the errorlevel of this batch file.
2995 // However, we also need to remove all the variables that were set during this batch file, so we
2996 // can run the ZIP powershell command (below) in a clean environment. (We can't run the powershell
2997 // command with the COMPlus_AltJit variables set, for example.) To do that, we do ENDLOCAL as well
2998 // as save the current errorlevel on the same line. This works because CMD evaluates the %errorlevel%
2999 // variable expansion (or any variable expansion on the line) BEFORE it executes the ENDLOCAL command.
3000 // Note that the ENDLOCAL also undoes the pushd command, but we add the popd here for clarity.
3001 addCommand("popd & ENDLOCAL & set __save_smarty_errorlevel=%errorlevel%")
3003 // ZIP up the smarty output, no matter what the smarty result.
3004 addCommand("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('.\\bin\\tests\\${osGroup}.${architecture}.${configuration}\\Smarty.run.0', '.\\bin\\tests\\${osGroup}.${architecture}.${configuration}\\Smarty.run.0.zip')\"")
3006 addCommand("echo %errorlevel%")
3007 addCommand("dir .\\bin\\tests\\${osGroup}.${architecture}.${configuration}")
3009 // Use the smarty errorlevel as the script errorlevel.
3010 addCommand("exit /b %__save_smarty_errorlevel%")
3012 batchFile(buildCommands)
3017 addToViews(newJob, isPR, architecture, os)
3019 if (scenario == 'jitdiff') {
3020 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/dasm/**")
3023 // Experimental: If on Ubuntu 14.04, then attempt to pull in crash dump links
3024 if (os in ['Ubuntu']) {
3025 SummaryBuilder summaries = new SummaryBuilder()
3026 summaries.addLinksSummaryFromFile('Crash dumps from this run:', 'dumplings.txt')
3027 summaries.emit(newJob)
3030 def affinityOptions = null
3032 if (windowsArmJob == true) {
3034 "use_arm64_build_machine" : false
3038 else if (architecture == 'arm64' && os != 'Windows_NT') {
3040 "large_pages" : false
3044 setMachineAffinity(newJob, os, architecture, affinityOptions)
3045 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
3047 setJobTimeout(newJob, isPR, architecture, configuration, scenario, false)
3049 if (windowsArmJob != true) {
3050 Utilities.addXUnitDotNETResults(newJob, '**/coreclrtests.xml')
3053 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/Smarty.run.0/*.smrt", '', true, false)
3055 // Archive a ZIP file of the entire Smarty.run.0 directory. This is possibly a little too much,
3056 // but there is no easy way to only archive the HTML/TXT files of the failing tests, so we get
3057 // all the passing test info as well. Not necessarily a bad thing, but possibly somewhat large.
3058 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/Smarty.run.0.zip", '', true, false)
3061 // Create a build flow to join together the build and tests required to run this test.
3062 // Windows CoreCLR build and Linux CoreCLR build (in parallel) ->
3063 // Linux CoreCLR test
3064 def flowJobName = getJobName(configuration, architecture, os, scenario, false) + "_flow"
3065 def fullTestJobName = projectFolder + '/' + newJob.name
3066 // Add a reference to the input jobs for report purposes
3067 JobReport.Report.addReference(inputCoreCLRBuildName)
3068 JobReport.Report.addReference(inputWindowsTestsBuildName)
3069 JobReport.Report.addReference(fullTestJobName)
3070 def newFlowJob = null
3072 if (os == 'RHEL7.2' || os == 'Debian8.4') {
3073 // Do not create the flow job for RHEL jobs.
3077 // For pri0 jobs we can build tests on unix
3078 if (windowsArmJob) {
3079 // For Windows arm jobs there is no reason to build a parallel test job.
3080 // The product build supports building and archiving the tests.
3082 newFlowJob = buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, folder)) {
3084 coreclrBuildJob = build(params, '${inputCoreCLRBuildName}')
3086 // And then build the test build
3087 build(params + [CORECLR_BUILD: coreclrBuildJob.build.number], '${fullTestJobName}')
3092 newFlowJob = buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, folder)) {
3094 // Build the input jobs in parallel
3096 { coreclrBuildJob = build(params, '${inputCoreCLRBuildName}') },
3097 { windowsBuildJob = build(params, '${inputWindowsTestsBuildName}') }
3100 // And then build the test build
3101 build(params + [CORECLR_BUILD: coreclrBuildJob.build.number,
3102 CORECLR_WINDOWS_BUILD: windowsBuildJob.build.number], '${fullTestJobName}')
3107 addToViews(newFlowJob, isPR, architecture, os)
3109 // For the flow jobs set the machine affinity as x64 if an armarch.
3110 def flowArch = architecture
3112 if (flowArch in validWindowsNTCrossArches) {
3114 affinityOptions = null
3117 setMachineAffinity(newFlowJob, os, flowArch, affinityOptions)
3118 Utilities.standardJobSetup(newFlowJob, project, isPR, "*/${branch}")
3119 addTriggers(newFlowJob, branch, isPR, architecture, os, configuration, scenario, true, false) // isFlowJob==true, isWindowsBuildOnlyJob==false
3126 JobReport.Report.generateJobReport(out)
3128 // Make the call to generate the help job
3129 Utilities.createHelperJob(this, project, branch,
3130 "Welcome to the ${project} Repository", // This is prepended to the help message
3131 "Have a nice day!") // This is appended to the help message. You might put known issues here.
3133 Utilities.addCROSSCheck(this, project, branch)