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 = [
220 'r2r': ["R2R_FAIL", "R2R_EXCLUDE"],
226 // 'gc_reliability_framework'
228 'r2r_jitstress1': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
229 'r2r_jitstress2': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
230 'r2r_jitstressregs1': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
231 'r2r_jitstressregs2': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
232 'r2r_jitstressregs3': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
233 'r2r_jitstressregs4': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
234 'r2r_jitstressregs8': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
235 'r2r_jitstressregs0x10': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
236 'r2r_jitstressregs0x80': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
237 'r2r_jitstressregs0x1000': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
238 'r2r_jitminopts': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE", "MINOPTS_FAIL", "MINOPTS_EXCLUDE"],
239 'r2r_jitforcerelocs': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
240 'r2r_gcstress15': ["R2R_FAIL", "R2R_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE", "GCSTRESS_FAIL", "GCSTRESS_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.
265 // 'jitincompletehwintrinsic'
266 // 'jitx86hwintrinsicnoavx'
267 // 'jitx86hwintrinsicnoavx2'
268 // 'jitx86hwintrinsicnosimd'
269 // 'jitnox86hwintrinsic'
270 'corefx_baseline': [], // corefx tests don't use smarty
271 'corefx_minopts': [], // corefx tests don't use smarty
272 'corefx_tieredcompilation': [], // corefx tests don't use smarty
273 'corefx_jitstress1': [], // corefx tests don't use smarty
274 'corefx_jitstress2': [], // corefx tests don't use smarty
275 'corefx_jitstressregs1': [], // corefx tests don't use smarty
276 'corefx_jitstressregs2': [], // corefx tests don't use smarty
277 'corefx_jitstressregs3': [], // corefx tests don't use smarty
278 'corefx_jitstressregs4': [], // corefx tests don't use smarty
279 'corefx_jitstressregs8': [], // corefx tests don't use smarty
280 'corefx_jitstressregs0x10': [], // corefx tests don't use smarty
281 'corefx_jitstressregs0x80': [], // corefx tests don't use smarty
282 'corefx_jitstressregs0x1000': [], // corefx tests don't use smarty
283 'gcstress0x3': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE"],
284 'gcstress0xc': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE"],
285 'zapdisable': ["ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE"],
287 'gcstress0xc_zapdisable': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE"],
288 'gcstress0xc_zapdisable_jitstress2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
289 'gcstress0xc_zapdisable_heapverify1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE"],
290 'gcstress0xc_jitstress1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
291 'gcstress0xc_jitstress2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
292 'gcstress0xc_minopts_heapverify1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "MINOPTS_FAIL", "MINOPTS_EXCLUDE"],
295 // NOTE: the following scenarios are not defined in the 'allScenarios' list! Is this a bug?
298 'minopts_zapdisable': ["ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE", "MINOPTS_FAIL", "MINOPTS_EXCLUDE"],
299 'gcstress0x3_jitstress1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
300 'gcstress0x3_jitstress2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
301 'gcstress0x3_jitstressregs1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
302 'gcstress0x3_jitstressregs2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
303 'gcstress0x3_jitstressregs3': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
304 'gcstress0x3_jitstressregs4': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
305 'gcstress0x3_jitstressregs8': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
306 'gcstress0x3_jitstressregs0x10': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
307 'gcstress0x3_jitstressregs0x80': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
308 'gcstress0x3_jitstressregs0x1000': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
309 'gcstress0xc_jitstressregs1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
310 'gcstress0xc_jitstressregs2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
311 'gcstress0xc_jitstressregs3': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
312 'gcstress0xc_jitstressregs4': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
313 'gcstress0xc_jitstressregs8': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
314 'gcstress0xc_jitstressregs0x10': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
315 'gcstress0xc_jitstressregs0x80': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
316 'gcstress0xc_jitstressregs0x1000': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"]
319 def static validLinuxArm64Scenarios = [
327 def static configurationList = ['Debug', 'Checked', 'Release']
329 // This is the set of architectures
330 def static architectureList = ['arm', 'armlb', 'x86_arm_altjit', 'x64_arm64_altjit', 'arm64', 'x64', 'x86']
333 // **************************************************************
334 // Create some specific views
336 // These aren't using the Utilities.addStandardFolderView() function, because that creates
337 // views based on a single regular expression. These views will be generated by adding a
338 // specific set of jobs to them.
340 // Utilities.addStandardFolderView() also creates a lot of additional stuff around the
341 // view, like "Build Statistics", "Job Statistics", "Unstable Jobs". Until it is determined
342 // those are required, don't add them (which simplifies the view pages, as well).
343 // **************************************************************
346 def static MergeJobView = null
347 def static PeriodicJobView = null
348 def static ArchitectureViews = [:]
349 def static OSViews = [:]
352 // MergeJobView: include all jobs that execute when a PR change is merged.
353 Views.MergeJobView = listView('Merge') {
366 // PeriodicJobView: include all jobs that execute on a schedule
367 Views.PeriodicJobView = listView('Periodic') {
380 // Create a view for non-PR jobs for each architecture.
381 Constants.architectureList.each { architecture ->
382 Views.ArchitectureViews[architecture] = listView(architecture) {
396 // Create a view for non-PR jobs for each OS.
397 Constants.osList.each { os ->
398 // Don't create one for the special 'Windows_NT_BuildOnly'
399 if (os == 'Windows_NT_BuildOnly') {
402 Views.OSViews[os] = listView(os) {
416 def static addToMergeView(def job) {
417 Views.MergeJobView.with {
424 def static addToPeriodicView(def job) {
425 Views.PeriodicJobView.with {
432 def static addToViews(def job, def isPR, def architecture, def os) {
434 // No views want PR jobs currently.
438 // Add to architecture view.
439 Views.ArchitectureViews[architecture].with {
446 Views.OSViews[os].with {
453 def static addPeriodicTriggerHelper(def job, String cronString, boolean alwaysRuns = false) {
454 addToPeriodicView(job)
455 Utilities.addPeriodicTrigger(job, cronString, alwaysRuns)
458 def static addGithubPushTriggerHelper(def job) {
460 Utilities.addGithubPushTrigger(job)
464 def static setMachineAffinity(def job, def os, def architecture, def options = null) {
465 assert os instanceof String
466 assert architecture instanceof String
468 def armArches = ['arm', 'armlb', 'arm64']
469 def supportedArmLinuxOs = ['Ubuntu', 'Ubuntu16.04', 'Tizen']
471 if (!(architecture in armArches)) {
472 assert options == null
473 Utilities.setMachineAffinity(job, os, 'latest-or-auto')
478 // This is an arm(64) job.
480 // There are several options.
484 // Arm32 (Build) -> latest-arm64
485 // |-> os == "Windows_NT" && architecture == "arm" || architecture == "armlb" && options['use_arm64_build_machine'] == true
486 // Arm32 (Test) -> arm64-windows_nt
487 // |-> os == "Windows_NT" && architecture == "arm" || architecture == "armlb" && options['use_arm64_build_machine'] == false
489 // Arm64 (Build) -> latest-arm64
490 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == true
491 // Arm64 (Test) -> arm64-windows_nt
492 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == false
496 // Arm32 (Build) -> arm-cross-latest
497 // |-> os in supportedArmLinuxOs && architecture == "arm" || architecture == "armlb"
498 // Arm32 (Test) -> NYI Arch not supported
501 // Arm64 (Build) -> arm64-cross-latest
502 // |-> os != "Windows_NT" && architecture == "arm64" && options['is_build_only'] == true
503 // Arm64 Small Page Size (Test) -> arm64-small-page-size
504 // |-> os != "Windows_NT" && architecture == "arm64" && options['large_pages'] == false
505 // Arm64 Large Page Size (Test) -> arm64-huge-page-size
506 // |-> os != "Windows_NT" && architecture == "arm64" && options['large_pages'] == true
508 // This has to be a arm arch
509 assert architecture in armArches
510 if (os == "Windows_NT") {
511 // Arm(64) Windows jobs share the same machines for now
512 def isBuild = options['use_arm64_build_machine'] == true
514 if (isBuild == true) {
515 Utilities.setMachineAffinity(job, os, 'latest-arm64')
517 Utilities.setMachineAffinity(job, os, 'arm64-windows_nt')
520 assert os != 'Windows_NT'
521 assert os in supportedArmLinuxOs
523 if (architecture == 'arm' || architecture == 'armlb') {
524 Utilities.setMachineAffinity(job, 'Ubuntu', 'arm-cross-latest')
527 if (options['is_build_only'] == true) {
528 Utilities.setMachineAffinity(job, os, 'arm64-cross-latest')
530 // Arm64 Test Machines
531 if (options['large_pages'] == false) {
532 Utilities.setMachineAffinity(job, os, 'arm64-small-page-size')
534 Utilities.setMachineAffinity(job, os, 'arm64-huge-page-size')
541 def static isGCStressRelatedTesting(def scenario) {
542 // The 'r2r_gcstress15' scenario is a basic scenario.
543 // Detect it and make it a GCStress related.
544 if (scenario == 'r2r_gcstress15')
549 def gcStressTestEnvVars = [ 'COMPlus_GCStress', 'COMPlus_ZapDisable', 'COMPlus_HeapVerify']
550 def scenarioName = scenario.toLowerCase()
551 def isGCStressTesting = false
552 Constants.jitStressModeScenarios[scenario].each{ k, v ->
553 if (k in gcStressTestEnvVars) {
554 isGCStressTesting = true;
557 return isGCStressTesting
560 def static isCoreFxScenario(def scenario) {
561 def corefx_prefix = 'corefx_'
562 if (scenario.length() < corefx_prefix.length()) {
565 return scenario.substring(0,corefx_prefix.length()) == corefx_prefix
568 def static isR2RBaselineScenario(def scenario) {
569 return (scenario == 'r2r')
572 def static isR2RStressScenario(def scenario) {
573 return Constants.r2rStressScenarios.containsKey(scenario)
576 def static isR2RScenario(def scenario) {
577 return isR2RBaselineScenario(scenario) || isR2RStressScenario(scenario)
580 def static isJitStressScenario(def scenario) {
581 return Constants.jitStressModeScenarios.containsKey(scenario)
584 def static isLongGc(def scenario) {
585 return (scenario == 'longgc' || scenario == 'gcsimulator')
588 def static isJitDiff(def scenario) {
589 return (scenario == 'jitdiff')
592 def static isGcReliabilityFramework(def scenario) {
593 return (scenario == 'gc_reliability_framework')
596 def static isArmWindowsScenario(def scenario) {
597 return Constants.validArmWindowsScenarios.containsKey(scenario)
600 def static isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly) {
601 if (isBuildOnly == true) {
602 os = 'Windows_NT_buildOnly'
605 def validOsPrTriggerArchConfigs = Constants.prTriggeredValidInnerLoopCombos[os]
607 if (validOsPrTriggerArchConfigs == null) {
611 if (validOsPrTriggerArchConfigs[architecture] != null) {
612 def validOsPrTriggerConfigs = validOsPrTriggerArchConfigs[architecture]
614 if (!(configuration in validOsPrTriggerConfigs)) {
624 def static setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly) {
625 // 2 hours (120 minutes) is the default timeout
627 def innerLoop = (scenario == "innerloop")
630 // Pri-1 test builds take a long time. Default PR jobs are Pri-0; everything else is Pri-1
631 // (see calculateBuildCommands()). So up the Pri-1 build jobs timeout.
636 // Note that these can only increase, never decrease, the Pri-1 timeout possibly set above.
637 if (isGCStressRelatedTesting(scenario)) {
640 else if (isCoreFxScenario(scenario)) {
643 else if (isJitStressScenario(scenario)) {
646 else if (isR2RBaselineScenario(scenario)) {
649 else if (isLongGc(scenario)) {
652 else if (isJitDiff(scenario)) {
655 else if (isGcReliabilityFramework(scenario)) {
658 else if (architecture == 'arm' || architecture == 'armlb' || architecture == 'arm64') {
663 if (configuration == 'Debug') {
664 // Debug runs can be very slow. Add an hour.
668 // If we've changed the timeout from the default, set it in the job.
670 if (timeout != 120) {
671 Utilities.setJobTimeout(newJob, timeout)
675 def static getJobFolder(def scenario) {
676 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
679 if (scenario == 'illink') {
685 def static getStressModeDisplayName(def scenario) {
687 Constants.jitStressModeScenarios[scenario].each{ k, v ->
688 def prefixLength = 'COMPlus_'.length()
689 if (k.length() >= prefixLength) {
690 def modeName = k.substring(prefixLength, k.length())
691 displayStr += ' ' + modeName + '=' + v
695 if (isCoreFxScenario(scenario)) {
696 displayStr = ('CoreFx ' + displayStr).trim()
702 def static getR2RDisplayName(def scenario) {
703 // Assume the scenario name is one from the r2rStressScenarios dict, and remove its "r2r_" prefix.
704 def displayStr = scenario
705 def prefixLength = 'r2r_'.length()
706 if (displayStr.length() >= prefixLength) {
707 displayStr = "R2R " + displayStr.substring(prefixLength, displayStr.length())
708 } else if (scenario == 'r2r') {
715 // Functions to create an environment script.
716 // envScriptCreate -- initialize the script (call first)
717 // envScriptFinalize -- finalize the script (call last)
718 // envScriptSetStressModeVariables -- set stress mode variables in the env script
719 // envScriptAppendExistingScript -- append an existing script to the generated script
721 // Each script returns a string of commands. Concatenate all the strings together before
722 // adding them to the builds commands, to make sure they get executed as one Jenkins script.
725 // Initialize the environment setting script.
726 def static envScriptCreate(def os, def stepScriptLocation) {
728 if (os == 'Windows_NT') {
729 stepScript += "echo Creating TestEnv script\r\n"
730 stepScript += "if exist ${stepScriptLocation} del ${stepScriptLocation}\r\n"
732 // Create at least an empty script.
733 stepScript += "echo. > ${stepScriptLocation}\r\n"
736 stepScript += "echo Creating environment setting script\n"
737 stepScript += "echo \\#\\!/usr/bin/env bash > ${stepScriptLocation}\n"
743 // Generates the string for setting stress mode variables.
744 def static envScriptSetStressModeVariables(def os, def stressModeVars, def stepScriptLocation) {
746 if (os == 'Windows_NT') {
747 stressModeVars.each{ k, v ->
748 // Write out what we are writing to the script file
749 stepScript += "echo Setting ${k}=${v}\r\n"
750 // Write out the set itself to the script file`
751 stepScript += "echo set ${k}=${v} >> ${stepScriptLocation}\r\n"
755 stressModeVars.each{ k, v ->
756 // Write out what we are writing to the script file
757 stepScript += "echo Setting ${k}=${v}\n"
758 // Write out the set itself to the script file`
759 stepScript += "echo export ${k}=${v} >> ${stepScriptLocation}\n"
766 // Append an existing script to an environment script.
767 // Returns string of commands to do this.
768 def static envScriptAppendExistingScript(def os, def appendScript, def stepScriptLocation) {
769 assert (os == 'Windows_NT')
772 stepScript += "echo Appending ${appendScript} to ${stepScriptLocation}\r\n"
773 stepScript += "type ${appendScript} >> ${stepScriptLocation}\r\n"
778 // Finalize an environment setting script.
779 // Returns string of commands to do this.
780 def static envScriptFinalize(def os, def stepScriptLocation) {
783 if (os == 'Windows_NT') {
784 // Display the resulting script. This is useful when looking at the output log file.
785 stepScript += "echo Display the total script ${stepScriptLocation}\r\n"
786 stepScript += "type ${stepScriptLocation}\r\n"
789 stepScript += "chmod +x ${stepScriptLocation}\n"
795 def static isNeedDocker(def architecture, def os, def isBuild) {
797 if (architecture == 'x86' && os == 'Ubuntu') {
800 else if (architecture == 'arm') {
801 if (os == 'Ubuntu' || os == 'Ubuntu16.04' || os == 'Tizen') {
807 if (architecture == 'x86' && os == 'Ubuntu') {
814 def static getDockerImageName(def architecture, def os, def isBuild) {
815 // We must change some docker private images to official later
817 if (architecture == 'x86' && os == 'Ubuntu') {
818 return "hseok82/dotnet-buildtools-prereqs:ubuntu-16.04-crossx86-ef0ac75-20175511035548"
820 else if (architecture == 'arm') {
821 if (os == 'Ubuntu') {
822 return "microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20172211042239"
824 else if (os == 'Ubuntu16.04') {
825 return "microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-ef0ac75-20175511035548"
827 else if (os == 'Tizen') {
828 return "hqueue/dotnetcore:ubuntu1404_cross_prereqs_v4-tizen_rootfs"
833 if (architecture == 'x86' && os == 'Ubuntu') {
834 return "hseok82/dotnet-buildtools-prereqs:ubuntu1604_x86_test"
837 println("Unknown architecture to use docker: ${architecture} ${os}");
841 // Calculates the name of the build job based on some typical parameters.
843 def static getJobName(def configuration, def architecture, def os, def scenario, def isBuildOnly) {
844 // If the architecture is x64, do not add that info into the build name.
845 // Need to change around some systems and other builds to pick up the right builds
848 def suffix = scenario != 'normal' ? "_${scenario}" : '';
853 switch (architecture) {
855 if (scenario == 'normal') {
856 // For now we leave x64 off of the name for compatibility with other jobs
857 baseName = configuration.toLowerCase() + '_' + os.toLowerCase()
859 else if (scenario == 'formatting') {
860 // we don't care about the configuration for the formatting job. It runs all configs
861 baseName = architecture.toLowerCase() + '_' + os.toLowerCase()
864 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
868 if (os.toLowerCase() == "windows_nt") {
869 // These are cross builds
870 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
873 // Defaults to a small page size set of machines.
874 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + "small_page_size"
878 // These are cross builds
881 baseName = 'armel_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
884 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
888 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
891 case 'x86_arm_altjit':
892 case 'x64_arm64_altjit':
893 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
896 println("Unknown architecture: ${architecture}");
901 return baseName + suffix
904 def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob, def bidailyCrossList) {
906 // Limited Windows ARM64 hardware is restricted for non-PR triggers to certain branches.
907 if (os == 'Windows_NT') {
908 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
909 if (!(branch in Constants.WindowsArm64Branches)) {
920 switch (architecture) {
923 if (isFlowJob && architecture == 'x86' && os == 'Ubuntu') {
924 addPeriodicTriggerHelper(job, '@daily')
926 else if (isFlowJob || os == 'Windows_NT' || !(os in Constants.crossList)) {
927 addGithubPushTriggerHelper(job)
932 case 'x86_arm_altjit':
933 case 'x64_arm64_altjit':
934 addGithubPushTriggerHelper(job)
937 // We would normally want a per-push trigger, but with limited hardware we can't keep up
938 addPeriodicTriggerHelper(job, "H H/4 * * *")
941 println("Unknown architecture: ${architecture}");
947 assert !(os in bidailyCrossList)
948 // r2r gets a push trigger for checked/release
949 if (configuration == 'Checked' || configuration == 'Release') {
950 assert (os == 'Windows_NT') || (os in Constants.crossList)
951 if (architecture == 'x64' && os != 'OSX10.12') {
952 //Flow jobs should be Windows, Ubuntu, OSX0.12, or CentOS
953 if (isFlowJob || os == 'Windows_NT') {
954 addGithubPushTriggerHelper(job)
956 // OSX10.12 r2r jobs should only run every 12 hours, not daily.
957 } else if (architecture == 'x64' && os == 'OSX10.12'){
959 addPeriodicTriggerHelper(job, 'H H/12 * * *')
962 // For x86, only add per-commit jobs for Windows
963 else if (architecture == 'x86') {
964 if (os == 'Windows_NT') {
965 addGithubPushTriggerHelper(job)
968 // arm64 r2r jobs should only run daily.
969 else if (architecture == 'arm64') {
970 if (os == 'Windows_NT') {
971 addPeriodicTriggerHelper(job, '@daily')
976 case 'r2r_jitstress1':
977 case 'r2r_jitstress2':
978 case 'r2r_jitstressregs1':
979 case 'r2r_jitstressregs2':
980 case 'r2r_jitstressregs3':
981 case 'r2r_jitstressregs4':
982 case 'r2r_jitstressregs8':
983 case 'r2r_jitstressregs0x10':
984 case 'r2r_jitstressregs0x80':
985 case 'r2r_jitstressregs0x1000':
986 case 'r2r_jitminopts':
987 case 'r2r_jitforcerelocs':
988 case 'r2r_gcstress15':
989 assert !(os in bidailyCrossList)
991 // GCStress=C is currently not supported on OS X
992 if (os == 'OSX10.12' && isGCStressRelatedTesting(scenario)) {
996 // GC Stress 15 r2r gets a push trigger for checked/release
997 if (configuration == 'Checked' || configuration == 'Release') {
998 assert (os == 'Windows_NT') || (os in Constants.crossList)
999 if (architecture == 'x64') {
1000 //Flow jobs should be Windows, Ubuntu, OSX10.12, or CentOS
1001 if (isFlowJob || os == 'Windows_NT') {
1002 // Add a weekly periodic trigger
1003 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1006 // For x86, only add per-commit jobs for Windows
1007 else if (architecture == 'x86') {
1008 if (os == 'Windows_NT') {
1009 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1015 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1016 assert configuration == 'Release'
1017 assert architecture == 'x64'
1018 addPeriodicTriggerHelper(job, '@daily')
1019 // TODO: Add once external email sending is available again
1020 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1023 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1024 assert configuration == 'Release'
1025 assert architecture == 'x64'
1026 addPeriodicTriggerHelper(job, 'H H * * 3,6') // some time every Wednesday and Saturday
1027 // TODO: Add once external email sending is available again
1028 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1030 case 'standalone_gc':
1031 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1032 assert (configuration == 'Release' || configuration == 'Checked')
1033 // TODO: Add once external email sending is available again
1034 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
1035 addPeriodicTriggerHelper(job, '@daily')
1037 case 'gc_reliability_framework':
1038 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1039 assert (configuration == 'Release' || configuration == 'Checked')
1040 // Only triggered by phrase.
1043 assert !(os in bidailyCrossList)
1044 // ILASM/ILDASM roundtrip one gets a daily build, and only for release
1045 if (architecture == 'x64' && configuration == 'Release') {
1046 // We don't expect to see a job generated except in these scenarios
1047 assert (os == 'Windows_NT') || (os in Constants.crossList)
1048 if (isFlowJob || os == 'Windows_NT') {
1049 addPeriodicTriggerHelper(job, '@daily')
1054 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
1055 assert configuration == 'Checked'
1056 assert (architecture == 'x64' || architecture == 'x86')
1057 addGithubPushTriggerHelper(job)
1060 assert (os == 'Windows_NT' || os == "Ubuntu")
1061 assert architecture == 'x64'
1062 addGithubPushTriggerHelper(job)
1064 case 'jitstressregs1':
1065 case 'jitstressregs2':
1066 case 'jitstressregs3':
1067 case 'jitstressregs4':
1068 case 'jitstressregs8':
1069 case 'jitstressregs0x10':
1070 case 'jitstressregs0x80':
1071 case 'jitstressregs0x1000':
1076 case 'jitstress2_jitstressregs1':
1077 case 'jitstress2_jitstressregs2':
1078 case 'jitstress2_jitstressregs3':
1079 case 'jitstress2_jitstressregs4':
1080 case 'jitstress2_jitstressregs8':
1081 case 'jitstress2_jitstressregs0x10':
1082 case 'jitstress2_jitstressregs0x80':
1083 case 'jitstress2_jitstressregs0x1000':
1084 case 'tailcallstress':
1087 case 'jitnox86hwintrinsic':
1088 case 'jitincompletehwintrinsic':
1089 case 'jitx86hwintrinsicnoavx':
1090 case 'jitx86hwintrinsicnoavx2':
1091 case 'jitx86hwintrinsicnosimd':
1092 case 'corefx_baseline':
1093 case 'corefx_minopts':
1094 case 'corefx_jitstress1':
1095 case 'corefx_jitstress2':
1096 case 'corefx_jitstressregs1':
1097 case 'corefx_jitstressregs2':
1098 case 'corefx_jitstressregs3':
1099 case 'corefx_jitstressregs4':
1100 case 'corefx_jitstressregs8':
1101 case 'corefx_jitstressregs0x10':
1102 case 'corefx_jitstressregs0x80':
1103 case 'corefx_jitstressregs0x1000':
1105 if (os != 'CentOS7.1' && !(os in bidailyCrossList)) {
1106 assert (os == 'Windows_NT') || (os in Constants.crossList)
1107 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
1108 if (os == 'Windows_NT') {
1109 // We don't have enough ARM64 machines to run these more frequently than weekly.
1110 addPeriodicTriggerHelper(job, '@weekly')
1114 addPeriodicTriggerHelper(job, '@daily')
1120 if (os != 'CentOS7.1' && !(os in bidailyCrossList)) {
1121 assert (os == 'Windows_NT') || (os in Constants.crossList)
1122 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
1123 if (os == 'Windows_NT') {
1124 // We don't have enough ARM64 machines to run these more frequently than weekly.
1125 addPeriodicTriggerHelper(job, '@weekly')
1127 // TODO: Add once external email sending is available again
1128 // addEmailPublisher(job, 'dotnetonarm64@microsoft.com')
1131 addPeriodicTriggerHelper(job, '@weekly')
1136 case 'gcstress0xc_zapdisable':
1137 case 'gcstress0xc_zapdisable_jitstress2':
1138 case 'gcstress0xc_zapdisable_heapverify1':
1139 case 'gcstress0xc_jitstress1':
1140 case 'gcstress0xc_jitstress2':
1141 case 'gcstress0xc_minopts_heapverify1':
1142 // GCStress=C is currently not supported on OS X
1143 if (os != 'CentOS7.1' && os != 'OSX10.12' && !(os in bidailyCrossList)) {
1144 assert (os == 'Windows_NT') || (os in Constants.crossList)
1145 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
1146 if (os == 'Windows_NT') {
1147 // We don't have enough ARM64 machines to run these more frequently than weekly.
1148 addPeriodicTriggerHelper(job, '@weekly')
1150 // TODO: Add once external email sending is available again
1151 // addEmailPublisher(job, 'dotnetonarm64@microsoft.com')
1154 addPeriodicTriggerHelper(job, '@weekly')
1160 // Testing on other operating systems TBD
1161 assert (os == 'Windows_NT' || os == 'Ubuntu')
1162 if (architecture == 'x64' || architecture == 'x86') {
1163 if (configuration == 'Checked') {
1164 addPeriodicTriggerHelper(job, '@daily')
1169 case 'tieredcompilation':
1170 case 'corefx_tieredcompilation':
1171 // No periodic jobs just yet, still testing
1175 println("Unknown scenario: ${scenario}");
1182 // **************************
1183 // Define the basic inner loop builds for PR and commit. This is basically just the set
1184 // of coreclr builds over linux/osx 10.12/windows and debug/release/checked. In addition, the windows
1185 // builds will do a couple extra steps.
1186 // **************************
1188 // Adds a trigger for the PR build if one is needed. If isFlowJob is true, then this is the
1189 // flow job that rolls up the build and test for non-windows OS's. // If the job is a windows build only job,
1190 // it's just used for internal builds
1191 // If you add a job with a trigger phrase, please add that phrase to coreclr/Documentation/project-docs/ci-trigger-phrases.md
1192 def static addTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob) {
1193 def isNormalOrInnerloop = (scenario == "normal" || scenario == "innerloop")
1195 if (isWindowsBuildOnlyJob) {
1199 def bidailyCrossList = ['RHEL7.2', 'Debian8.4']
1200 // Non pull request builds.
1202 addNonPRTriggers(job, branch, isPR, architecture, os, configuration, scenario, isFlowJob, isWindowsBuildOnlyJob, bidailyCrossList)
1229 // Pull request builds. Generally these fall into two categories: default triggers and on-demand triggers
1230 // We generally only have a distinct set of default triggers but a bunch of on-demand ones.
1231 def osGroup = getOSGroup(os)
1232 switch (architecture) {
1233 case 'x64': // editor brace matching: {
1234 if (scenario == 'formatting') {
1235 assert configuration == 'Checked'
1236 if (os == 'Windows_NT' || os == 'Ubuntu') {
1237 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Formatting")
1244 // OpenSUSE, Debian & RedHat get trigger phrases for pri 0 build, and pri 1 build & test
1247 if (scenario == 'innerloop') {
1249 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build")
1251 else if (scenario == 'normal') {
1252 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build", "(?i).*test\\W+${os}\\W+${architecture}.*")
1258 assert scenario != 'innerloop'
1259 // Distinguish with the other architectures (arm and x86)
1260 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build", "(?i).*test\\W+${os}\\W+${architecture}.*")
1266 assert scenario != 'innerloop'
1267 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build", "(?i).*test\\W+${os}\\W+.*")
1271 if (scenario == 'illink') {
1272 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} via ILLink", "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1278 // Triggers on the non-flow jobs aren't necessary here
1279 // Corefx testing uses non-flow jobs.
1280 if (!isFlowJob && !isCoreFxScenario(scenario)) {
1285 // PR Triggered jobs. These jobs will run pri0 tests.
1286 if (configuration == 'Checked') {
1287 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test")
1292 // OSX uses checked for default PR tests
1293 if (configuration == 'Checked') {
1295 assert !job.name.contains("centos")
1296 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test", "(?i).*test\\W+${os}\\W+${architecture}\\W+Build and Test.*")
1301 if (configuration == 'Checked') {
1302 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Jit Diff Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1307 if (configuration == 'Release') {
1308 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} IL RoundTrip Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1313 if (configuration == 'Release') {
1314 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Long-Running GC Build & Test", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1319 if (configuration == 'Release') {
1320 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Simulator", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1324 case 'standalone_gc':
1325 if (configuration == 'Release' || configuration == 'Checked') {
1326 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Standalone GC", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1330 case 'gc_reliability_framework':
1331 if (configuration == 'Release' || configuration == 'Checked') {
1332 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Reliability Framework", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1337 if (isJitStressScenario(scenario)) {
1338 def displayStr = getStressModeDisplayName(scenario)
1339 assert (os == 'Windows_NT') || (os in Constants.crossList)
1340 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test (Jit - ${displayStr})",
1341 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1343 else if (isR2RScenario(scenario)) {
1344 if (configuration == 'Release' || configuration == 'Checked') {
1345 def displayStr = getR2RDisplayName(scenario)
1346 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build and Test",
1347 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1351 println("Unknown scenario: ${scenario}");
1362 // CentOS uses checked for default PR tests while debug is build only
1363 if (configuration == 'Debug') {
1365 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build")
1368 // Make sure this is a flow job to get build and test.
1369 if (configuration == 'Checked' && isFlowJob) {
1370 assert job.name.contains("flow")
1372 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test")
1377 // Make sure this is a flow job to get build and test.
1378 if (configuration == 'Checked' && isFlowJob) {
1379 assert job.name.contains("flow")
1381 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test", "(?i).*test\\W+${os}\\W+${architecture}\\W+Build and Test.*")
1386 if (isR2RScenario(scenario)) {
1387 if (configuration == 'Release' || configuration == 'Checked') {
1388 def displayStr = getR2RDisplayName(scenario)
1389 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build & Test",
1390 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1402 if (configuration == 'Checked' || configuration == 'Release') {
1403 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test")
1408 if (configuration == 'Checked') {
1409 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test", "(?i).*test\\W+${os}\\W+${architecture}\\W+Build and Test.*")
1414 if (configuration == 'Checked') {
1415 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Jit Diff Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1420 if (configuration == 'Release') {
1421 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} IL RoundTrip Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1426 if (configuration == 'Release') {
1427 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Long-Running GC Build & Test", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1432 if (configuration == 'Release') {
1433 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Simulator", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1437 case 'standalone_gc':
1438 if (configuration == 'Release' || configuration == 'Checked') {
1439 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Standalone GC", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1443 case 'gc_reliability_framework':
1444 if (configuration == 'Release' || configuration == 'Checked') {
1445 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Reliability Framework", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1450 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} via ILLink", "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1454 if (isJitStressScenario(scenario)) {
1455 def displayStr = getStressModeDisplayName(scenario)
1456 assert (os == 'Windows_NT') || (os in Constants.crossList)
1457 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test (Jit - ${displayStr})",
1458 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1460 else if (isR2RScenario(scenario)) {
1461 if (configuration == 'Release' || configuration == 'Checked') {
1462 def displayStr = getR2RDisplayName(scenario)
1463 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build & Test",
1464 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1468 println("Unknown scenario: ${scenario}");
1477 println("Unknown os: ${os}");
1485 // editor brace matching: }
1487 case 'arm': // editor brace matching: {
1491 if (architecture == 'armlb') { // No arm legacy backend testing for Ubuntu
1495 assert scenario != 'innerloop'
1498 azureVMAgentPostBuildAction {
1499 agentPostBuildAction('Delete agent if the build was not successful (when idle).')
1503 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Build",
1504 "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}\\W+Build.*")
1508 if (architecture == 'armlb') { // No arm legacy backend testing for Tizen armel
1512 architecture = 'armel'
1515 azureVMAgentPostBuildAction {
1516 agentPostBuildAction('Delete agent if the build was not successful (when idle).')
1521 if (scenario == 'innerloop') {
1522 if (configuration == 'Checked') {
1523 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Innerloop Build and Test")
1527 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Build",
1528 "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}\\W+Build.*")
1533 if (architecture == "armlb") {
1534 // Disable armlb windows jobs
1538 // Triggers on the non-flow jobs aren't necessary here
1543 // Set up a private trigger
1544 def contextString = "${os} ${architecture} Cross ${configuration}"
1545 def triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
1546 if (scenario == 'innerloop') {
1547 contextString += " Innerloop"
1548 triggerString += "\\W+Innerloop"
1551 contextString += " ${scenario}"
1552 triggerString += "\\W+${scenario}"
1555 if (configuration == 'Debug') {
1556 contextString += " Build"
1557 triggerString += "\\W+Build"
1559 contextString += " Build and Test"
1560 triggerString += "\\W+Build and Test"
1563 triggerString += ".*"
1567 // Only Checked is an innerloop trigger.
1568 if (configuration == 'Checked')
1570 Utilities.addDefaultPrivateGithubPRTriggerForBranch(job, branch, contextString, null, arm64Users)
1574 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1577 // Stress jobs will use this code path.
1578 if (isArmWindowsScenario(scenario)) {
1579 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1585 println("NYI os: ${os}");
1590 // editor brace matching: }
1591 case 'arm64': // editor brace matching: {
1592 // Set up a private trigger
1593 def contextString = "${os} ${architecture} Cross ${configuration}"
1594 def triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
1596 if (scenario == 'innerloop') {
1597 contextString += " Innerloop"
1598 triggerString += "\\W+Innerloop"
1601 contextString += " ${scenario}"
1602 triggerString += "\\W+${scenario}"
1605 if (configuration == 'Debug') {
1606 contextString += " Build"
1607 triggerString += "\\W+Build"
1609 contextString += " Build and Test"
1610 triggerString += "\\W+Build and Test"
1613 triggerString += ".*"
1620 if (configuration == 'Debug' && !isFlowJob) {
1621 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Innerloop Build")
1626 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test", triggerString)
1629 if (isR2RScenario(scenario)) {
1630 if (configuration == 'Checked' || configuration == 'Release') {
1631 def displayStr = getR2RDisplayName(scenario)
1632 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build and Test", triggerString)
1640 // Triggers on the non-flow jobs aren't necessary here
1645 assert isArmWindowsScenario(scenario)
1648 if (configuration == 'Checked') {
1649 Utilities.addDefaultPrivateGithubPRTriggerForBranch(job, branch, contextString, null, arm64Users)
1654 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1657 // Stress jobs will use this code path.
1658 if (isArmWindowsScenario(scenario)) {
1659 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1665 println("NYI os: ${os}");
1671 // editor brace matching: }
1672 case 'x86': // editor brace matching: {
1673 assert ((os == 'Windows_NT') || ((os == 'Ubuntu') && isNormalOrInnerloop))
1674 if (os == 'Ubuntu') {
1675 // Triggers on the non-flow jobs aren't necessary here
1680 // on-demand only for ubuntu x86
1681 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build",
1682 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}.*")
1688 if (configuration == 'Checked' || configuration == 'Release') {
1689 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test")
1694 if (configuration == 'Checked') {
1695 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test",
1696 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+Build and Test.*")
1701 if (configuration == 'Release') {
1702 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} IL RoundTrip Build and Test",
1703 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1708 if (configuration == 'Release') {
1709 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Long-Running GC Build & Test",
1710 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1715 if (configuration == 'Release') {
1716 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Simulator",
1717 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1721 case 'standalone_gc':
1722 if (configuration == 'Release' || configuration == 'Checked') {
1723 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Standalone GC",
1724 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1729 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} via ILLink", "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1733 if (isJitStressScenario(scenario)) {
1734 def displayStr = getStressModeDisplayName(scenario)
1735 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test (Jit - ${displayStr})",
1736 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1738 else if (isR2RScenario(scenario)) {
1739 if (configuration == 'Release' || configuration == 'Checked') {
1740 def displayStr = getR2RDisplayName(scenario)
1741 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build & Test",
1742 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1746 println("Unknown scenario: ${os} ${architecture} ${scenario}");
1754 // editor brace matching: }
1755 case 'x64_arm64_altjit':
1756 case 'x86_arm_altjit': // editor brace matching: {
1757 assert (os == 'Windows_NT')
1760 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test",
1761 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+Build and Test.*")
1764 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${scenario}",
1765 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1770 // editor brace matching: }
1772 println("Unknown architecture: ${architecture}");
1778 def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR, def architecture, def configuration, def os, def isBuildOnly) {
1779 def buildCommands = [];
1780 def osGroup = getOSGroup(os)
1781 def lowerConfiguration = configuration.toLowerCase()
1784 if (scenario == 'innerloop') {
1788 setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly)
1790 def enableCorefxTesting = isCoreFxScenario(scenario)
1792 // Calculate the build steps, archival, and xunit results
1794 case 'Windows_NT': // editor brace matching: {
1795 switch (architecture) {
1798 case 'x86_arm_altjit':
1799 case 'x64_arm64_altjit':
1800 def arch = architecture
1802 if (architecture == 'x86_arm_altjit') {
1805 else if (architecture == 'x64_arm64_altjit') {
1809 if (scenario == 'formatting') {
1810 buildCommands += "python -u tests\\scripts\\format.py -c %WORKSPACE% -o Windows_NT -a ${arch}"
1811 Utilities.addArchival(newJob, "format.patch", "", true, false)
1815 if (scenario == 'illink') {
1816 buildCommands += "tests\\scripts\\build_illink.cmd clone ${arch}"
1819 // If it is a release build for windows, ensure PGO is used, else fail the build
1820 if ((lowerConfiguration == 'release') &&
1821 (scenario in Constants.basicScenarios) &&
1822 (architecture != 'x86_arm_altjit') &&
1823 (architecture != 'x64_arm64_altjit')) {
1825 buildOpts += ' -enforcepgo'
1828 if (enableCorefxTesting) {
1829 buildOpts += ' skiptests';
1831 buildOpts += " -priority=${priority}"
1834 // Set __TestIntermediateDir to something short. If __TestIntermediateDir is already set, build-test.cmd will
1835 // output test binaries to that directory. If it is not set, the binaries are sent to a default directory whose name is about
1836 // 35 characters long.
1838 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${arch} ${buildOpts}"
1841 def runtestArguments = ''
1842 def testOpts = 'collectdumps'
1844 if (isR2RScenario(scenario)) {
1846 // If this is a ReadyToRun scenario, pass 'crossgen' or 'crossgenaltjit'
1847 // to cause framework assemblies to be crossgen'ed. Pass 'runcrossgentests'
1848 // to cause the tests to be crossgen'ed.
1850 if ((architecture == 'x86_arm_altjit') || (architecture == 'x64_arm64_altjit')) {
1851 testOpts += ' crossgenaltjit protononjit.dll'
1853 testOpts += ' crossgen'
1856 testOpts += ' runcrossgentests'
1858 else if (scenario == 'jitdiff') {
1859 testOpts += ' jitdisasm crossgen'
1861 else if (scenario == 'ilrt') {
1862 testOpts += ' ilasmroundtrip'
1864 else if (isLongGc(scenario)) {
1865 testOpts += " ${scenario} sequential"
1867 else if (scenario == 'standalone_gc') {
1868 testOpts += ' gcname clrgc.dll'
1870 else if (scenario == 'illink') {
1871 testOpts += " link %WORKSPACE%\\linker\\linker\\bin\\netcore_Release\\netcoreapp2.0\\win10-${arch}\\publish\\illink.exe"
1874 // Default per-test timeout is 10 minutes. For stress modes and Debug scenarios, increase this
1875 // to 30 minutes (30 * 60 * 1000 = 180000). The "timeout" argument to runtest.cmd sets this, by
1876 // taking a timeout value in milliseconds. (Note that it sets the __TestTimeout environment variable,
1877 // which is read by the xunit harness.)
1878 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario) || (lowerConfiguration == 'debug'))
1880 def timeout = 1800000
1881 testOpts += " timeout ${timeout}"
1884 // If we are running a stress mode, we should write out the set of key
1885 // value env pairs to a file at this point and then we'll pass that to runtest.cmd
1887 def envScriptPath = ''
1888 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
1889 def buildCommandsStr = ''
1890 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
1891 buildCommandsStr += envScriptCreate(os, envScriptPath)
1893 if (isJitStressScenario(scenario)) {
1894 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
1896 else if (isR2RStressScenario(scenario)) {
1897 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.r2rStressScenarios[scenario], envScriptPath)
1900 if (architecture == 'x86_arm_altjit') {
1901 buildCommandsStr += envScriptAppendExistingScript(os, "%WORKSPACE%\\tests\\x86_arm_altjit.cmd", envScriptPath)
1903 else if (architecture == 'x64_arm64_altjit') {
1904 buildCommandsStr += envScriptAppendExistingScript(os, "%WORKSPACE%\\tests\\x64_arm64_altjit.cmd", envScriptPath)
1907 envScriptFinalize(os, envScriptPath)
1909 // Note that buildCommands is an array of individually executed commands; we want all the commands used to
1910 // create the SetStressModes.bat script to be executed together, hence we accumulate them as strings
1911 // into a single script.
1912 buildCommands += buildCommandsStr
1914 else if (architecture == 'x86_arm_altjit') {
1915 envScriptPath = "%WORKSPACE%\\tests\\x86_arm_altjit.cmd"
1917 else if (architecture == 'x64_arm64_altjit') {
1918 envScriptPath = "%WORKSPACE%\\tests\\x64_arm64_altjit.cmd"
1920 if (envScriptPath != '') {
1921 testOpts += " TestEnv ${envScriptPath}"
1924 runtestArguments = "${lowerConfiguration} ${arch} ${testOpts}"
1926 if (enableCorefxTesting) {
1927 def workspaceRelativeFxRoot = "_/fx"
1928 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
1930 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}"
1932 // Archive and process (only) the test results
1933 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
1934 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
1936 //Archive additional build stuff to diagnose why my attempt at fault injection isn't causing CI to fail
1937 Utilities.addArchival(newJob, "SetStressModes.bat", "", true, false)
1938 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/bin/testhost/**", "", true, false)
1940 else if (isGcReliabilityFramework(scenario)) {
1941 buildCommands += "tests\\runtest.cmd ${runtestArguments} GenerateLayoutOnly"
1942 buildCommands += "tests\\scripts\\run-gc-reliability-framework.cmd ${arch} ${configuration}"
1945 buildCommands += "tests\\runtest.cmd ${runtestArguments}"
1949 if (!enableCorefxTesting) {
1950 // Run the rest of the build
1951 // Build the mscorlib for the other OS's
1952 buildCommands += "build.cmd ${lowerConfiguration} ${arch} linuxmscorlib"
1953 buildCommands += "build.cmd ${lowerConfiguration} ${arch} osxmscorlib"
1955 if (arch == "x64") {
1956 buildCommands += "build.cmd ${lowerConfiguration} arm64 linuxmscorlib"
1959 // Zip up the tests directory so that we don't use so much space/time copying
1960 // 10s of thousands of files around.
1961 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')\"";
1963 if (!isJitStressScenario(scenario)) {
1964 // For Windows, pull full test results and test drops for x86/x64.
1965 // No need to pull for stress mode scenarios (downstream builds use the default scenario)
1966 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
1969 if (scenario == 'jitdiff') {
1970 // retrieve jit-dasm output for base commit, and run jit-diff
1972 // if this is a build only job, we want to keep the default (build) artifacts for the flow job
1973 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${arch}.${configuration}/dasm/**")
1978 Utilities.addXUnitDotNETResults(newJob, 'bin/**/TestRun*.xml', true)
1984 assert isArmWindowsScenario(scenario)
1986 def machineAffinityOptions = ['use_arm64_build_machine' : true]
1987 setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
1989 def buildArchitecture = 'arm'
1993 // For 'armlb' (the JIT LEGACY_BACKEND architecture for arm), tell build.cmd to use legacy backend for crossgen compilation.
1994 // Legacy backend is not the default JIT; it is an aljit. So, this is a special case.
1995 if (architecture == 'armlb') {
1996 buildOpts += ' -crossgenaltjit legacyjit.dll'
1999 if (enableCorefxTesting) {
2000 // We shouldn't need to build the tests. However, run-corefx-tests.py currently depends on having the restored corefx
2001 // package available, to determine the correct corefx version git commit hash, and we need to build the tests before
2002 // running "tests\\runtest.cmd GenerateLayoutOnly". So build the pri-0 tests to make this happen.
2004 // buildOpts += ' skiptests';
2005 buildOpts += " -priority=0"
2007 buildOpts += " -priority=${priority}"
2010 // This is now a build only job. Do not run tests. Use the flow job.
2011 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${buildArchitecture} ${buildOpts}"
2013 if (enableCorefxTesting) {
2015 assert architecture == 'arm'
2017 // Generate the test layout because it restores the corefx package which allows run-corefx-tests.py
2018 // to determine the correct matching corefx version git commit hash.
2019 buildCommands += "tests\\runtest.cmd ${lowerConfiguration} ${architecture} GenerateLayoutOnly"
2021 // Set the stress mode variables; this is incorporated into the generated CoreFx RunTests.cmd files.
2022 def envScriptPath = ''
2023 def buildCommandsStr = ''
2024 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
2025 buildCommandsStr += envScriptCreate(os, envScriptPath)
2026 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
2027 envScriptFinalize(os, envScriptPath)
2028 buildCommands += buildCommandsStr
2030 def workspaceRelativeFxRootLinux = "_/fx"
2031 def workspaceRelativeFxRootWin = "_\\fx"
2032 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
2034 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 ${envScriptPath} -no_run_tests"
2036 // Zip up the CoreFx runtime and tests. We don't need the CoreCLR binaries; they have been copied to the CoreFX tree.
2037 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('${workspaceRelativeFxRootWin}\\bin\\testhost\\netcoreapp-Windows_NT-Release-arm', '${workspaceRelativeFxRootWin}\\fxruntime.zip')\"";
2038 buildCommands += "powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('${workspaceRelativeFxRootWin}\\bin\\tests', '${workspaceRelativeFxRootWin}\\fxtests.zip')\"";
2040 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxruntime.zip")
2041 Utilities.addArchival(newJob, "${workspaceRelativeFxRootLinux}/fxtests.zip")
2043 // Zip up the tests directory so that we don't use so much space/time copying
2044 // 10s of thousands of files around.
2045 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')\"";
2048 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2052 assert isArmWindowsScenario(scenario)
2054 def machineAffinityOptions = ['use_arm64_build_machine' : true]
2055 setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
2057 // This is now a build only job. Do not run tests. Use the flow job.
2058 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} toolset_dir C:\\ats2 -priority=${priority}"
2060 // Zip up the tests directory so that we don't use so much space/time copying
2061 // 10s of thousands of files around.
2062 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')\"";
2065 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
2068 println("Unknown architecture: ${architecture}");
2073 // editor brace matching: }
2082 case 'Fedora24': // editor brace matching: {
2083 switch (architecture) {
2086 if (architecture == 'x86' && os == 'Ubuntu') {
2087 // build and PAL test
2088 def dockerImage = getDockerImageName(architecture, os, true)
2089 buildCommands += "docker run -i --rm -v \${WORKSPACE}:/opt/code -w /opt/code -e ROOTFS_DIR=/crossrootfs/x86 ${dockerImage} ./build.sh ${architecture} cross ${lowerConfiguration}"
2090 dockerImage = getDockerImageName(architecture, os, false)
2091 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"
2092 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2093 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2097 if (scenario == 'formatting') {
2098 buildCommands += "python tests/scripts/format.py -c \${WORKSPACE} -o Linux -a ${architecture}"
2099 Utilities.addArchival(newJob, "format.patch", "", true, false)
2103 if (scenario == 'illink') {
2104 assert(os == 'Ubuntu')
2105 buildCommands += "./tests/scripts/build_illink.sh --clone --arch=${architecture}"
2108 if (!enableCorefxTesting) {
2109 // We run pal tests on all OS but generate mscorlib (and thus, nuget packages)
2110 // only on supported OS platforms.
2111 def bootstrapRid = Utilities.getBoostrapPublishRid(os)
2112 def bootstrapRidEnv = bootstrapRid != null ? "__PUBLISH_RID=${bootstrapRid} " : ''
2114 buildCommands += "${bootstrapRidEnv}./build.sh verbose ${lowerConfiguration} ${architecture}"
2115 buildCommands += "src/pal/tests/palsuite/runpaltests.sh \${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration} \${WORKSPACE}/bin/paltestout"
2117 // Basic archiving of the build
2118 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2120 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
2123 // Corefx stress testing
2124 assert os == 'Ubuntu'
2125 assert architecture == 'x64'
2126 assert lowerConfiguration == 'checked'
2127 assert isJitStressScenario(scenario)
2130 buildCommands += "./build.sh verbose ${lowerConfiguration} ${architecture}"
2132 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2134 def envScriptCmds = envScriptCreate(os, scriptFileName)
2135 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2136 envScriptCmds += envScriptFinalize(os, scriptFileName)
2137 buildCommands += envScriptCmds
2139 // Build and text corefx
2140 def workspaceRelativeFxRoot = "_/fx"
2141 def absoluteFxRoot = "\$WORKSPACE/${workspaceRelativeFxRoot}"
2143 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}"
2145 // Archive and process (only) the test results
2146 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
2147 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
2151 if (!enableCorefxTesting) {
2152 buildCommands += "ROOTFS_DIR=/opt/arm64-xenial-rootfs ./build.sh verbose ${lowerConfiguration} ${architecture} cross clang3.8"
2154 // HACK -- Arm64 does not have corefx jobs yet.
2155 buildCommands += "git clone https://github.com/dotnet/corefx fx"
2156 buildCommands += "ROOTFS_DIR=/opt/arm64-xenial-rootfs-corefx ./fx/build-native.sh -release -buildArch=arm64 -- verbose cross clang3.8"
2157 buildCommands += "mkdir ./bin/Product/Linux.arm64.${configuration}/corefxNative"
2158 buildCommands += "cp fx/bin/Linux.arm64.Release/native/* ./bin/Product/Linux.arm64.${configuration}/corefxNative"
2160 // Basic archiving of the build
2161 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2165 // Cross builds for ARM runs on Ubuntu, Ubuntu16.04 and Tizen currently
2166 assert (os == 'Ubuntu') || (os == 'Ubuntu16.04') || (os == 'Tizen')
2168 // default values for Ubuntu
2170 def linuxCodeName="trusty"
2171 if (os == 'Ubuntu16.04') {
2172 linuxCodeName="xenial"
2174 else if (os == 'Tizen') {
2176 linuxCodeName="tizen"
2179 // Unzip the Windows test binaries first. Exit with 0
2180 buildCommands += "unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/Windows_NT.x64.${configuration} || exit 0"
2182 // Unpack the corefx binaries
2183 buildCommands += "mkdir ./bin/CoreFxBinDir"
2184 buildCommands += "tar -xf ./bin/build.tar.gz -C ./bin/CoreFxBinDir"
2185 if (os != 'Tizen') {
2186 buildCommands += "chmod a+x ./bin/CoreFxBinDir/corerun"
2188 // Test environment emulation using docker and qemu has some problem to use lttng library.
2189 // We should remove libcoreclrtraceptprovider.so to avoid test hang.
2190 if (os == 'Ubuntu') {
2191 buildCommands += "rm -f -v ./bin/CoreFxBinDir/libcoreclrtraceptprovider.so"
2194 // Call the ARM CI script to cross build and test using docker
2195 buildCommands += """./tests/scripts/arm32_ci_script.sh \\
2198 --linuxCodeName=${linuxCodeName} \\
2199 --buildConfig=${lowerConfiguration} \\
2200 --testRootDir=./bin/tests/Windows_NT.x64.${configuration} \\
2201 --coreFxBinDir=./bin/CoreFxBinDir \\
2202 --testDirFile=./tests/testsRunningInsideARM.txt"""
2204 // Basic archiving of the build, no pal tests
2205 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
2208 println("Unknown architecture: ${architecture}");
2213 // editor brace matching: }
2215 println("Unknown os: ${os}");
2220 return buildCommands
2223 Constants.allScenarios.each { scenario ->
2224 [true, false].each { isPR ->
2225 Constants.architectureList.each { architecture ->
2226 Constants.configurationList.each { configuration ->
2227 Constants.osList.each { os ->
2228 // If the OS is Windows_NT_BuildOnly, set the isBuildOnly flag to true
2229 // and reset the os to Windows_NT
2230 def isBuildOnly = false
2231 if (os == 'Windows_NT_BuildOnly') {
2236 // Tizen is only supported for arm architecture
2237 if (os == 'Tizen' && architecture != 'arm') {
2241 // Skip totally unimplemented (in CI) configurations.
2242 switch (architecture) {
2244 if (os == 'Ubuntu16.04') {
2248 // Windows and Ubuntu only
2249 if ((os != 'Windows_NT' && os != 'Ubuntu') || isBuildOnly) {
2254 if ((os != 'Ubuntu') && (os != 'Ubuntu16.04') && (os != 'Tizen') && (os != 'Windows_NT')) {
2259 // Do not create armlb jobs
2263 if ((os != 'Ubuntu') && (os != 'Windows_NT')) {
2267 case 'x86_arm_altjit':
2268 case 'x64_arm64_altjit':
2269 if (os != 'Windows_NT') {
2274 // Everything implemented
2277 println("Unknown architecture: ${architecture}")
2282 // Skip scenarios (blanket skipping for jit stress modes, which are good most everywhere
2283 // with checked builds)
2284 if (isJitStressScenario(scenario)) {
2285 if (configuration != 'Checked') {
2289 // Since these are just execution time differences,
2290 // skip platforms that don't execute the tests here (Windows_NT only)
2291 def isEnabledOS = (os == 'Windows_NT') || (os == 'Ubuntu' && isCoreFxScenario(scenario))
2296 switch (architecture) {
2299 case 'x86_arm_altjit':
2300 case 'x64_arm64_altjit':
2301 // x86 ubuntu: default only
2302 if ((os == 'Ubuntu') && (architecture == 'x86')) {
2311 // We use build only jobs for Windows arm cross-compilation corefx testing, so we need to generate builds for that.
2312 if (!isBuildOnly || !isCoreFxScenario(scenario)) {
2318 // arm64, armlb: stress is handled through flow jobs.
2322 else if (isR2RScenario(scenario)) {
2323 if (os != 'Windows_NT') {
2326 // Stress scenarios only run with Checked builds, not Release (they would work with Debug, but be slow).
2327 if ((configuration != 'Checked') && isR2RStressScenario(scenario)) {
2335 // The ilrt build isn't necessary except for Windows_NT2003. Non-Windows NT uses
2336 // the default scenario build
2337 if (os != 'Windows_NT') {
2341 if (architecture != 'x64') {
2345 if (configuration != 'Release') {
2350 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2353 if (architecture != 'x64') {
2356 if (configuration != 'Checked') {
2362 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2365 if (architecture != 'x64') {
2368 if (configuration != 'Release') {
2372 case 'gc_reliability_framework':
2373 case 'standalone_gc':
2374 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2378 if (architecture != 'x64') {
2382 if (configuration != 'Release' && configuration != 'Checked') {
2386 // We only run Windows and Ubuntu x64 Checked for formatting right now
2388 if (os != 'Windows_NT' && os != 'Ubuntu') {
2391 if (architecture != 'x64') {
2394 if (configuration != 'Checked') {
2402 if (os != 'Windows_NT' && (os != 'Ubuntu' || architecture != 'x64')) {
2405 if (architecture != 'x64' && architecture != 'x86') {
2416 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly)) {
2421 println("Unknown scenario: ${scenario}")
2427 // For altjit, don't do any scenarios that don't change compilation. That is, scenarios that only change
2428 // runtime behavior, not compile-time behavior, are not interesting.
2429 switch (architecture) {
2430 case 'x86_arm_altjit':
2431 case 'x64_arm64_altjit':
2432 if (isGCStressRelatedTesting(scenario)) {
2441 def lowerConfiguration = configuration.toLowerCase()
2442 def jobName = getJobName(configuration, architecture, os, scenario, isBuildOnly)
2443 def folderName = getJobFolder(scenario)
2445 // Create the new job
2446 def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folderName)) {}
2447 addToViews(newJob, isPR, architecture, os)
2449 def machineAffinityOptions = null
2451 if (os != 'Windows_NT') {
2452 machineAffinityOptions = architecture == 'arm64' ? ['is_build_only': true] : null
2455 machineAffinityOptions = (architecture == 'arm' || architecture == 'armlb' || architecture == 'arm64') ? ['use_arm64_build_machine': false] : null
2458 setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
2460 // Add all the standard options
2461 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
2462 addTriggers(newJob, branch, isPR, architecture, os, configuration, scenario, false, isBuildOnly) // isFlowJob==false
2464 def buildCommands = calculateBuildCommands(newJob, scenario, branch, isPR, architecture, configuration, os, isBuildOnly)
2465 def osGroup = getOSGroup(os)
2469 if (os == 'Windows_NT') {
2470 buildCommands.each { buildCommand ->
2471 batchFile(buildCommand)
2475 // Setup corefx and Windows test binaries for Linux cross build for ubuntu-arm, ubuntu16.04-arm and tizen-armel
2476 if ( architecture == 'arm' && ( os == 'Ubuntu' || os == 'Ubuntu16.04' || os == 'Tizen')) {
2477 // Cross build for ubuntu-arm, ubuntu16.04-arm and tizen-armel
2478 // Define the Windows Tests and Corefx build job names
2479 def WindowsTestsName = projectFolder + '/' +
2480 Utilities.getFullJobName(project,
2481 getJobName(lowerConfiguration, 'x64' , 'windows_nt', 'normal', true),
2483 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' +
2484 Utilities.getFolderName(branch)
2486 // Copy the Windows test binaries and the Corefx build binaries
2487 copyArtifacts(WindowsTestsName) {
2488 includePatterns('bin/tests/tests.zip')
2490 latestSuccessful(true)
2495 def corefx_os = 'linux'
2496 if (os == 'Tizen') {
2501 // Let's use release CoreFX to test checked CoreCLR,
2502 // because we do not generate checked CoreFX in CoreFX CI yet.
2503 def corefx_lowerConfiguration = lowerConfiguration
2504 if ( lowerConfiguration == 'checked' ) {
2505 corefx_lowerConfiguration='release'
2508 copyArtifacts("${corefxFolder}/${corefx_os}_${arm_abi}_cross_${corefx_lowerConfiguration}") {
2509 includePatterns('bin/build.tar.gz')
2511 latestSuccessful(true)
2516 buildCommands.each { buildCommand ->
2530 // Create jobs requiring flow jobs. This includes x64 non-Windows, arm64 Ubuntu, and arm/arm64/armlb Windows.
2531 Constants.allScenarios.each { scenario ->
2532 def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
2534 [true, false].each { isPR ->
2535 ['arm', 'armlb', 'x64', 'arm64', 'x86'].each { architecture ->
2536 Constants.crossList.each { os ->
2537 if (architecture == 'arm64') {
2538 if (os != "Ubuntu" && os != "Windows_NT") {
2541 } else if (architecture == 'arm') {
2542 if (os != 'Windows_NT') {
2545 } else if (architecture == 'armlb') {
2546 // Do not create armlb windows jobs.
2548 } else if (architecture == 'x86') {
2549 if (os != "Ubuntu") {
2554 def validWindowsNTCrossArches = ["arm", "armlb", "arm64"]
2556 if (os == "Windows_NT" && !(architecture in validWindowsNTCrossArches)) {
2560 Constants.configurationList.each { configuration ->
2562 // First, filter based on OS.
2564 if (os == 'Windows_NT') {
2565 if (!isArmWindowsScenario(scenario)) {
2571 if (architecture == 'arm64') {
2572 if (!(scenario in Constants.validLinuxArm64Scenarios)) {
2576 else if (architecture == 'x86') {
2577 // Linux/x86 only want innerloop and default test
2578 if (!isNormalOrInnerloop) {
2584 // For CentOS, we only want Checked/Release builds.
2585 if (os == 'CentOS7.1') {
2586 if (configuration != 'Checked' && configuration != 'Release') {
2589 if (!isNormalOrInnerloop && !isR2RScenario(scenario) && !isJitStressScenario(scenario)) {
2594 // For RedHat and Debian, we only do Release builds.
2595 else if (os == 'RHEL7.2' || os == 'Debian8.4') {
2596 if (configuration != 'Release') {
2599 if (!isNormalOrInnerloop) {
2604 // Next, filter based on scenario.
2606 if (isJitStressScenario(scenario)) {
2607 if (configuration != 'Checked') {
2611 // CoreFx JIT stress tests currently only implemented for ARM.
2612 if (isCoreFxScenario(scenario) && (architecture != 'arm')) {
2616 else if (isR2RBaselineScenario(scenario)) {
2617 if (configuration != 'Checked' && configuration != 'Release') {
2621 else if (isR2RStressScenario(scenario)) {
2622 if (configuration != 'Checked') {
2632 // Long GC tests take a long time on non-Release builds
2633 // ilrt is also Release only
2634 if (configuration != 'Release') {
2640 if (configuration != 'Checked') {
2645 case 'gc_reliability_framework':
2646 case 'standalone_gc':
2647 if (configuration != 'Release' && configuration != 'Checked') {
2655 if (os != 'Windows_NT' && os != 'Ubuntu') {
2666 if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, false)) {
2672 println("Unknown scenario: ${scenario}")
2678 // Done filtering. Now, create the jobs.
2680 // =============================================================================================
2681 // Create the test job
2682 // =============================================================================================
2684 def windowsArmJob = (os == "Windows_NT" && architecture in validWindowsNTCrossArches)
2686 def lowerConfiguration = configuration.toLowerCase()
2687 def osGroup = getOSGroup(os)
2688 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
2690 def inputCoreCLRBuildScenario = scenario == 'innerloop' ? 'innerloop' : 'normal'
2691 def inputCoreCLRBuildIsBuildOnly = false
2692 if (isCoreFxScenario(scenario)) {
2693 // Every CoreFx test depends on its own unique build.
2694 inputCoreCLRBuildScenario = scenario
2695 inputCoreCLRBuildIsBuildOnly = true
2697 def inputCoreCLRFolderName = getJobFolder(inputCoreCLRBuildScenario)
2698 def inputCoreCLRBuildName = projectFolder + '/' +
2699 Utilities.getFullJobName(project, getJobName(configuration, architecture, os, inputCoreCLRBuildScenario, inputCoreCLRBuildIsBuildOnly), isPR, inputCoreCLRFolderName)
2701 def inputWindowsTestsBuildName = ""
2702 if (windowsArmJob != true) {
2703 // If this is a stress scenario, there isn't any difference in the build job, so we didn't create a build only
2704 // job for Windows_NT specific to that stress mode. Just copy from the default scenario.
2706 def testBuildScenario = scenario == 'innerloop' ? 'innerloop' : 'normal'
2708 def inputWindowsTestBuildArch = architecture
2709 if (architecture == "arm64" && os != "Windows_NT") {
2710 // Use the x64 test build for arm64 unix
2711 inputWindowsTestBuildArch = "x64"
2714 if (isJitStressScenario(scenario)) {
2715 inputWindowsTestsBuildName = projectFolder + '/' +
2716 Utilities.getFullJobName(project, getJobName(configuration, inputWindowsTestBuildArch, 'windows_nt', testBuildScenario, false), isPR)
2718 inputWindowsTestsBuildName = projectFolder + '/' +
2719 Utilities.getFullJobName(project, getJobName(configuration, inputWindowsTestBuildArch, 'windows_nt', testBuildScenario, true), isPR)
2721 } // if (windowsArmJob != true)
2723 def serverGCString = ''
2726 if (windowsArmJob != true) {
2727 // Enable Server GC for Ubuntu PR builds
2728 if (os == 'Ubuntu' && isPR) {
2729 serverGCString = '--useServerGC'
2732 if (isR2RScenario(scenario)) {
2734 testOpts += ' --crossgen --runcrossgentests'
2736 if (scenario == 'r2r_jitstress1') {
2737 testOpts += ' --jitstress=1'
2739 else if (scenario == 'r2r_jitstress2') {
2740 testOpts += ' --jitstress=2'
2742 else if (scenario == 'r2r_jitstressregs1') {
2743 testOpts += ' --jitstressregs=1'
2745 else if (scenario == 'r2r_jitstressregs2') {
2746 testOpts += ' --jitstressregs=2'
2748 else if (scenario == 'r2r_jitstressregs3') {
2749 testOpts += ' --jitstressregs=3'
2751 else if (scenario == 'r2r_jitstressregs4') {
2752 testOpts += ' --jitstressregs=4'
2754 else if (scenario == 'r2r_jitstressregs8') {
2755 testOpts += ' --jitstressregs=8'
2757 else if (scenario == 'r2r_jitstressregs0x10') {
2758 testOpts += ' --jitstressregs=0x10'
2760 else if (scenario == 'r2r_jitstressregs0x80') {
2761 testOpts += ' --jitstressregs=0x80'
2763 else if (scenario == 'r2r_jitstressregs0x1000') {
2764 testOpts += ' --jitstressregs=0x1000'
2766 else if (scenario == 'r2r_jitminopts') {
2767 testOpts += ' --jitminopts'
2769 else if (scenario == 'r2r_jitforcerelocs') {
2770 testOpts += ' --jitforcerelocs'
2772 else if (scenario == 'r2r_gcstress15') {
2773 testOpts += ' --gcstresslevel=0xF'
2776 else if (scenario == 'jitdiff') {
2777 testOpts += ' --jitdisasm --crossgen'
2779 else if (scenario == 'illink') {
2780 testOpts += ' --link=\$WORKSPACE/linker/linker/bin/netcore_Release/netcoreapp2.0/ubuntu-x64/publish/illink'
2782 else if (isLongGc(scenario)) {
2783 // Long GC tests behave very poorly when they are not
2784 // the only test running (many of them allocate until OOM).
2785 testOpts += ' --sequential'
2787 // A note - runtest.sh does have "--long-gc" and "--gcsimulator" options
2788 // for running long GC and GCSimulator tests, respectively. We don't use them
2789 // here because using a playlist file produces much more readable output on the CI machines
2790 // and reduces running time.
2792 // The Long GC playlist contains all of the tests that are
2793 // going to be run. The GCSimulator playlist contains all of
2794 // the GC simulator tests.
2795 if (scenario == 'longgc') {
2796 testOpts += ' --long-gc --playlist=./tests/longRunningGcTests.txt'
2798 else if (scenario == 'gcsimulator') {
2799 testOpts += ' --gcsimulator --playlist=./tests/gcSimulatorTests.txt'
2802 else if (isGcReliabilityFramework(scenario)) {
2803 testOpts += ' --build-overlay-only'
2805 else if (scenario == 'standalone_gc') {
2806 if (osGroup == 'OSX') {
2807 testOpts += ' --gcname=libclrgc.dylib'
2809 else if (osGroup == 'Linux') {
2810 testOpts += ' --gcname=libclrgc.so'
2813 println("Unexpected OS group: ${osGroup} for os ${os}")
2817 } // if (windowsArmJob != true)
2819 def folder = getJobFolder(scenario)
2820 def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folder)) {
2821 // Add parameters for the inputs
2823 if (windowsArmJob == true) {
2825 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
2830 stringParam('CORECLR_WINDOWS_BUILD', '', 'Build number to copy CoreCLR Windows test binaries from')
2831 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
2836 // Set up the copies
2838 // Coreclr build containing the tests and mscorlib
2839 // pri1 jobs still need to copy windows_nt built tests
2840 if (windowsArmJob != true) {
2841 copyArtifacts(inputWindowsTestsBuildName) {
2842 excludePatterns('**/testResults.xml', '**/*.ni.dll')
2844 buildNumber('${CORECLR_WINDOWS_BUILD}')
2849 // Coreclr build we are trying to test
2851 // ** NOTE ** This will, correctly, overwrite the CORE_ROOT from the Windows test archive
2853 copyArtifacts(inputCoreCLRBuildName) {
2854 excludePatterns('**/testResults.xml', '**/*.ni.dll')
2856 buildNumber('${CORECLR_BUILD}')
2860 // Windows CoreCLR Arm(64) will restore corefx
2861 // packages correctly.
2863 // In addition, test steps are entirely different
2864 // because we do not have a unified runner
2865 if (windowsArmJob != true) {
2866 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' + Utilities.getFolderName(branch)
2868 // HACK -- Arm64 does not have corefx jobs yet.
2869 // Clone corefx and build the native packages overwriting the x64 packages.
2870 if (architecture == 'arm64') {
2871 shell("cp ./bin/Product/Linux.arm64.${configuration}/corefxNative/* ./bin/CoreFxBinDir")
2872 shell("chmod +x ./bin/Product/Linux.arm64.${configuration}/corerun")
2874 else if (architecture == 'x86') {
2875 shell("mkdir ./bin/CoreFxNative")
2877 copyArtifacts("${corefxFolder}/ubuntu16.04_x86_release") {
2878 includePatterns('bin/build.tar.gz')
2879 targetDirectory('bin/CoreFxNative')
2881 latestSuccessful(true)
2885 shell("tar -xf ./bin/CoreFxNative/bin/build.tar.gz -C ./bin/CoreFxBinDir")
2888 // Unzip the tests first. Exit with 0
2889 shell("unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/${osGroup}.${architecture}.${configuration} || exit 0")
2890 shell("rm -r ./bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root || exit 0")
2892 shell("./build-test.sh ${architecture} ${configuration} generatelayoutonly")
2894 // Execute the tests
2895 def runDocker = isNeedDocker(architecture, os, false)
2896 def dockerPrefix = ""
2899 def dockerImage = getDockerImageName(architecture, os, false)
2900 dockerPrefix = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} "
2901 dockerCmd = dockerPrefix + "${dockerImage} "
2904 // If we are running a stress mode, we'll set those variables first
2906 if (isJitStressScenario(scenario)) {
2907 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2908 def envScriptCmds = envScriptCreate(os, scriptFileName)
2909 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2910 envScriptCmds += envScriptFinalize(os, scriptFileName)
2911 shell("${envScriptCmds}")
2912 testEnvOpt = "--test-env=" + scriptFileName
2915 if (isGCStressRelatedTesting(scenario)) {
2916 shell('./init-tools.sh')
2919 shell("""${dockerCmd}./tests/runtest.sh \\
2920 --testRootDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}\" \\
2921 --coreOverlayDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root\" \\
2922 --testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
2923 --copyNativeTestBin --limitedDumpGeneration ${testEnvOpt} ${serverGCString} ${testOpts}""")
2925 if (isGcReliabilityFramework(scenario)) {
2926 // runtest.sh doesn't actually execute the reliability framework - do it here.
2927 if (serverGCString != '') {
2929 dockerCmd = dockerPrefix + "-e COMPlus_gcServer=1 ${dockerImage} "
2932 shell("export COMPlus_gcServer=1")
2936 shell("${dockerCmd}./tests/scripts/run-gc-reliability-framework.sh ${architecture} ${configuration}")
2939 else { // windowsArmJob == true
2941 if (isCoreFxScenario(scenario)) {
2943 // Only arm supported for corefx testing now.
2944 assert architecture == 'arm'
2946 // Unzip CoreFx runtime
2947 batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('_\\fx\\fxruntime.zip', '_\\fx\\bin\\testhost\\netcoreapp-Windows_NT-Release-arm')")
2949 // Unzip CoreFx tests.
2950 batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('_\\fx\\fxtests.zip', '_\\fx\\bin\\tests')")
2952 // Add the script to run the corefx tests
2953 def corefx_runtime_path = "%WORKSPACE%\\_\\fx\\bin\\testhost\\netcoreapp-Windows_NT-Release-arm"
2954 def corefx_tests_dir = "%WORKSPACE%\\_\\fx\\bin\\tests"
2955 def corefx_exclusion_file = "%WORKSPACE%\\tests\\arm\\corefx_test_exclusions.txt"
2956 batchFile("call %WORKSPACE%\\tests\\scripts\\run-corefx-tests.bat ${corefx_runtime_path} ${corefx_tests_dir} ${corefx_exclusion_file}")
2958 } else { // !isCoreFxScenario(scenario)
2961 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}')")
2963 def buildCommands = ""
2965 def coreRootLocation = "%WORKSPACE%\\bin\\tests\\Windows_NT.${architecture}.${configuration}\\Tests\\Core_Root"
2966 def addEnvVariable = { variable, value -> buildCommands += "set ${variable}=${value}\r\n"}
2967 def addCommand = { cmd -> buildCommands += "${cmd}\r\n"}
2969 // Make sure Command Extensions are enabled. Used so %ERRORLEVEL% is available.
2970 addCommand("SETLOCAL ENABLEEXTENSIONS")
2973 addEnvVariable("CORE_ROOT", coreRootLocation)
2975 addEnvVariable("COMPlus_NoGuiOnAssert", "1")
2976 addEnvVariable("COMPlus_ContinueOnAssert", "0")
2978 // ARM legacy backend; this is an altjit.
2979 if (architecture == "armlb") {
2980 addEnvVariable("COMPlus_AltJit", "*")
2981 addEnvVariable("COMPlus_AltJitNgen", "*")
2982 addEnvVariable("COMPlus_AltJitName", "legacyjit.dll")
2983 addEnvVariable("COMPlus_AltJitAssertOnNYI", "1")
2986 // If we are running a stress mode, we'll set those variables as well
2987 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
2988 def stressValues = null
2989 if (isJitStressScenario(scenario)) {
2990 stressValues = Constants.jitStressModeScenarios[scenario]
2993 stressValues = Constants.r2rStressScenarios[scenario]
2996 stressValues.each { key, value ->
2997 addEnvVariable(key, value)
3001 if (isR2RScenario(scenario)) {
3002 // Crossgen the framework assemblies.
3003 buildCommands += """
3004 @for %%F in (%CORE_ROOT%\\*.dll) do @call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nxF
3005 @goto skip_PrecompileAssembly
3008 @REM Skip mscorlib since it is already precompiled.
3009 @if /I "%3" == "mscorlib.dll" exit /b 0
3010 @if /I "%3" == "mscorlib.ni.dll" exit /b 0
3012 "%CORE_ROOT%\\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" %2 >nul 2>nul
3013 @if "%errorlevel%" == "-2146230517" (
3014 echo %2 is not a managed assembly.
3015 ) else if "%errorlevel%" == "-2146234344" (
3016 echo %2 is not a managed assembly.
3017 ) else if %errorlevel% neq 0 (
3018 echo Unable to precompile %2
3024 :skip_PrecompileAssembly
3027 // Set RunCrossGen variable to cause test wrappers to invoke their logic to run
3028 // crossgen on tests before running them.
3029 addEnvVariable("RunCrossGen", "true")
3030 } // isR2RScenario(scenario)
3032 // Create the smarty command
3033 def smartyCommand = "C:\\Tools\\Smarty.exe /noecid /noie /workers 9 /inc EXPECTED_PASS "
3034 def addSmartyFlag = { flag -> smartyCommand += flag + " "}
3035 def addExclude = { exclude -> addSmartyFlag("/exc " + exclude)}
3037 def addArchSpecificExclude = { architectureToExclude, exclude -> if (architectureToExclude == "armlb") { addExclude("LEGACYJIT_" + exclude) } else { addExclude(exclude) } }
3039 if (architecture == "armlb") {
3040 addExclude("LEGACYJIT_FAIL")
3043 // Exclude tests based on scenario.
3044 Constants.validArmWindowsScenarios[scenario].each { excludeTag ->
3045 addArchSpecificExclude(architecture, excludeTag)
3048 // Innerloop jobs run Pri-0 tests; everyone else runs Pri-1.
3049 if (scenario == 'innerloop') {
3053 // Exclude any test marked LONG_RUNNING; these often exceed the standard timeout and fail as a result.
3054 // TODO: We should create a "long running" job that runs these with a longer timeout.
3055 addExclude("LONG_RUNNING")
3057 smartyCommand += "/lstFile Tests.lst"
3059 def testListArch = [
3065 def archLocation = testListArch[architecture]
3067 addCommand("copy %WORKSPACE%\\tests\\${archLocation}\\Tests.lst bin\\tests\\${osGroup}.${architecture}.${configuration}")
3068 addCommand("pushd bin\\tests\\${osGroup}.${architecture}.${configuration}")
3069 addCommand("${smartyCommand}")
3071 // Save the errorlevel from the smarty command to be used as the errorlevel of this batch file.
3072 // However, we also need to remove all the variables that were set during this batch file, so we
3073 // can run the ZIP powershell command (below) in a clean environment. (We can't run the powershell
3074 // command with the COMPlus_AltJit variables set, for example.) To do that, we do ENDLOCAL as well
3075 // as save the current errorlevel on the same line. This works because CMD evaluates the %errorlevel%
3076 // variable expansion (or any variable expansion on the line) BEFORE it executes the ENDLOCAL command.
3077 // Note that the ENDLOCAL also undoes the pushd command, but we add the popd here for clarity.
3078 addCommand("popd & ENDLOCAL & set __save_smarty_errorlevel=%errorlevel%")
3080 // ZIP up the smarty output, no matter what the smarty result.
3081 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')\"")
3083 addCommand("echo %errorlevel%")
3084 addCommand("dir .\\bin\\tests\\${osGroup}.${architecture}.${configuration}")
3086 // Use the smarty errorlevel as the script errorlevel.
3087 addCommand("exit /b %__save_smarty_errorlevel%")
3089 batchFile(buildCommands)
3090 } // non-corefx testing
3091 } // windowsArmJob == true
3095 addToViews(newJob, isPR, architecture, os)
3097 if (scenario == 'jitdiff') {
3098 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/dasm/**")
3101 // Experimental: If on Ubuntu 14.04, then attempt to pull in crash dump links
3102 if (os in ['Ubuntu']) {
3103 SummaryBuilder summaries = new SummaryBuilder()
3104 summaries.addLinksSummaryFromFile('Crash dumps from this run:', 'dumplings.txt')
3105 summaries.emit(newJob)
3108 def affinityOptions = null
3110 if (windowsArmJob == true) {
3112 "use_arm64_build_machine" : false
3116 else if (architecture == 'arm64' && os != 'Windows_NT') {
3118 "large_pages" : false
3122 setMachineAffinity(newJob, os, architecture, affinityOptions)
3123 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
3125 setJobTimeout(newJob, isPR, architecture, configuration, scenario, false)
3127 if (windowsArmJob != true) {
3128 Utilities.addXUnitDotNETResults(newJob, '**/coreclrtests.xml')
3131 if (!isCoreFxScenario(scenario)) {
3132 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/Smarty.run.0/*.smrt", '', true, false)
3134 // Archive a ZIP file of the entire Smarty.run.0 directory. This is possibly a little too much,
3135 // but there is no easy way to only archive the HTML/TXT files of the failing tests, so we get
3136 // all the passing test info as well. Not necessarily a bad thing, but possibly somewhat large.
3137 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/Smarty.run.0.zip", '', true, false)
3141 // =============================================================================================
3142 // Create a build flow to join together the build and tests required to run this test.
3143 // =============================================================================================
3145 // Windows CoreCLR build and Linux CoreCLR build (in parallel) ->
3146 // Linux CoreCLR test
3147 def flowJobName = getJobName(configuration, architecture, os, scenario, false) + "_flow"
3148 def fullTestJobName = projectFolder + '/' + newJob.name
3149 // Add a reference to the input jobs for report purposes
3150 JobReport.Report.addReference(inputCoreCLRBuildName)
3151 if (windowsArmJob != true) {
3152 JobReport.Report.addReference(inputWindowsTestsBuildName)
3154 JobReport.Report.addReference(fullTestJobName)
3155 def newFlowJob = null
3157 if (os == 'RHEL7.2' || os == 'Debian8.4') {
3158 // Do not create the flow job for RHEL jobs.
3162 // For pri0 jobs we can build tests on unix
3163 if (windowsArmJob) {
3164 // For Windows arm jobs there is no reason to build a parallel test job.
3165 // The product build supports building and archiving the tests.
3167 newFlowJob = buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, folder)) {
3169 coreclrBuildJob = build(params, '${inputCoreCLRBuildName}')
3171 // And then build the test build
3172 build(params + [CORECLR_BUILD: coreclrBuildJob.build.number], '${fullTestJobName}')
3177 newFlowJob = buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, folder)) {
3179 // Build the input jobs in parallel
3181 { coreclrBuildJob = build(params, '${inputCoreCLRBuildName}') },
3182 { windowsBuildJob = build(params, '${inputWindowsTestsBuildName}') }
3185 // And then build the test build
3186 build(params + [CORECLR_BUILD: coreclrBuildJob.build.number,
3187 CORECLR_WINDOWS_BUILD: windowsBuildJob.build.number], '${fullTestJobName}')
3192 addToViews(newFlowJob, isPR, architecture, os)
3194 // For the flow jobs set the machine affinity as x64 if an armarch.
3195 def flowArch = architecture
3197 if (flowArch in validWindowsNTCrossArches) {
3199 affinityOptions = null
3202 setMachineAffinity(newFlowJob, os, flowArch, affinityOptions)
3203 Utilities.standardJobSetup(newFlowJob, project, isPR, "*/${branch}")
3204 addTriggers(newFlowJob, branch, isPR, architecture, os, configuration, scenario, true, false) // isFlowJob==true, isWindowsBuildOnlyJob==false
3211 JobReport.Report.generateJobReport(out)
3213 // Make the call to generate the help job
3214 Utilities.createHelperJob(this, project, branch,
3215 "Welcome to the ${project} Repository", // This is prepended to the help message
3216 "Have a nice day!") // This is appended to the help message. You might put known issues here.
3218 Utilities.addCROSSCheck(this, project, branch)