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 'corefx_baseline' : [ : ], // corefx baseline
90 'corefx_minopts' : ['COMPlus_JITMinOpts' : '1'],
91 'corefx_tieredcompilation' : ['COMPlus_EXPERIMENTAL_TieredCompilation' : '1'],
92 'corefx_jitstress1' : ['COMPlus_JitStress' : '1'],
93 'corefx_jitstress2' : ['COMPlus_JitStress' : '2'],
94 'corefx_jitstressregs1' : ['COMPlus_JitStressRegs' : '1'],
95 'corefx_jitstressregs2' : ['COMPlus_JitStressRegs' : '2'],
96 'corefx_jitstressregs3' : ['COMPlus_JitStressRegs' : '3'],
97 'corefx_jitstressregs4' : ['COMPlus_JitStressRegs' : '4'],
98 'corefx_jitstressregs8' : ['COMPlus_JitStressRegs' : '8'],
99 'corefx_jitstressregs0x10' : ['COMPlus_JitStressRegs' : '0x10'],
100 'corefx_jitstressregs0x80' : ['COMPlus_JitStressRegs' : '0x80'],
101 'corefx_jitstressregs0x1000' : ['COMPlus_JitStressRegs' : '0x1000'],
102 'gcstress0x3' : ['COMPlus_GCStress' : '0x3'],
103 'gcstress0xc' : ['COMPlus_GCStress' : '0xC'],
104 'zapdisable' : ['COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0'],
105 'heapverify1' : ['COMPlus_HeapVerify' : '1'],
106 'gcstress0xc_zapdisable' : ['COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0'],
107 'gcstress0xc_zapdisable_jitstress2' : ['COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0', 'COMPlus_JitStress' : '2'],
108 'gcstress0xc_zapdisable_heapverify1' : ['COMPlus_GCStress' : '0xC', 'COMPlus_ZapDisable' : '1', 'COMPlus_ReadyToRun' : '0', 'COMPlus_HeapVerify' : '1'],
109 'gcstress0xc_jitstress1' : ['COMPlus_GCStress' : '0xC', 'COMPlus_JitStress' : '1'],
110 'gcstress0xc_jitstress2' : ['COMPlus_GCStress' : '0xC', 'COMPlus_JitStress' : '2'],
111 'gcstress0xc_minopts_heapverify1' : ['COMPlus_GCStress' : '0xC', 'COMPlus_JITMinOpts' : '1', 'COMPlus_HeapVerify' : '1']
114 // This is a set of ReadyToRun stress scenarios
115 def static r2rStressScenarios = [
116 'r2r_jitstress1' : ["COMPlus_JitStress": "1"],
117 'r2r_jitstress2' : ["COMPlus_JitStress": "2"],
118 'r2r_jitstressregs1' : ["COMPlus_JitStressRegs": "1"],
119 'r2r_jitstressregs2' : ["COMPlus_JitStressRegs": "2"],
120 'r2r_jitstressregs3' : ["COMPlus_JitStressRegs": "3"],
121 'r2r_jitstressregs4' : ["COMPlus_JitStressRegs": "4"],
122 'r2r_jitstressregs8' : ["COMPlus_JitStressRegs": "8"],
123 'r2r_jitstressregs0x10' : ["COMPlus_JitStressRegs": "0x10"],
124 'r2r_jitstressregs0x80' : ["COMPlus_JitStressRegs": "0x80"],
125 'r2r_jitstressregs0x1000' : ["COMPlus_JitStressRegs": "0x1000"],
126 'r2r_jitminopts' : ["COMPlus_JITMinOpts": "1"],
127 'r2r_jitforcerelocs' : ["COMPlus_ForceRelocs": "1"],
128 'r2r_gcstress15' : ["COMPlus_GCStress": "0xF"]
131 // This is the basic set of scenarios
132 def static basicScenarios = [
141 'gc_reliability_framework',
144 def static allScenarios = basicScenarios + r2rStressScenarios.keySet() + jitStressModeScenarios.keySet()
146 // A set of scenarios that are valid for arm/arm64/armlb tests run on hardware. This is a map from valid scenario name
147 // to Tests.lst file categories to exclude.
149 // This list should contain a subset of the scenarios from `allScenarios`. Please keep this in the same order as that,
150 // and with the same values, with some commented out, for easier maintenance.
152 // Note that some scenarios that are commented out should be enabled, but haven't yet been.
154 def static validArmWindowsScenarios = [
163 // 'gc_reliability_framework'
165 'r2r_jitstress1': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
166 'r2r_jitstress2': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
167 'r2r_jitstressregs1': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
168 'r2r_jitstressregs2': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
169 'r2r_jitstressregs3': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
170 'r2r_jitstressregs4': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
171 'r2r_jitstressregs8': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
172 'r2r_jitstressregs0x10': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
173 'r2r_jitstressregs0x80': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
174 'r2r_jitstressregs0x1000': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
175 'r2r_jitminopts': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
176 'r2r_jitforcerelocs': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
177 'r2r_gcstress15': ["R2R_FAIL", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
178 'minopts': ["MINOPTS_FAIL", "MINOPTS_EXCLUDE"],
179 'tieredcompilation': [],
181 'jitstress1': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
182 'jitstress2': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
183 'jitstressregs1': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
184 'jitstressregs2': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
185 'jitstressregs3': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
186 'jitstressregs4': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
187 'jitstressregs8': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
188 'jitstressregs0x10': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
189 'jitstressregs0x80': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
190 'jitstressregs0x1000': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
191 'jitstress2_jitstressregs1': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
192 'jitstress2_jitstressregs2': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
193 'jitstress2_jitstressregs3': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
194 'jitstress2_jitstressregs4': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
195 'jitstress2_jitstressregs8': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
196 'jitstress2_jitstressregs0x10': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
197 'jitstress2_jitstressregs0x80': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
198 'jitstress2_jitstressregs0x1000': ["JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
199 'tailcallstress': ["TAILCALLSTRESS_FAIL", "TAILCALLSTRESS_EXCLUDE"],
200 // 'jitsse2only' // Only relevant to xarch
201 'jitnosimd': [], // Only interesting on platforms where SIMD support exists.
204 // 'corefx_tieredcompilation'
205 // 'corefx_jitstress1'
206 // 'corefx_jitstress2'
207 // 'corefx_jitstressregs1'
208 // 'corefx_jitstressregs2'
209 // 'corefx_jitstressregs3'
210 // 'corefx_jitstressregs4'
211 // 'corefx_jitstressregs8'
212 // 'corefx_jitstressregs0x10'
213 // 'corefx_jitstressregs0x80'
214 // 'corefx_jitstressregs0x1000'
215 'gcstress0x3': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE"],
216 'gcstress0xc': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE"],
217 'zapdisable': ["ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE"],
219 'gcstress0xc_zapdisable': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE"],
220 'gcstress0xc_zapdisable_jitstress2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
221 'gcstress0xc_zapdisable_heapverify1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE"],
222 'gcstress0xc_jitstress1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
223 'gcstress0xc_jitstress2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
224 'gcstress0xc_minopts_heapverify1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "MINOPTS_FAIL", "MINOPTS_EXCLUDE"],
227 // NOTE: the following scenarios are not defined in the 'allScenarios' list! Is this a bug?
230 'minopts_zapdisable': ["ZAPDISABLE_FAIL", "ZAPDISABLE_EXCLUDE", "MINOPTS_FAIL", "MINOPTS_EXCLUDE"],
231 'gcstress0x3_jitstress1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
232 'gcstress0x3_jitstress2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
233 'gcstress0x3_jitstressregs1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
234 'gcstress0x3_jitstressregs2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
235 'gcstress0x3_jitstressregs3': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
236 'gcstress0x3_jitstressregs4': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
237 'gcstress0x3_jitstressregs8': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
238 'gcstress0x3_jitstressregs0x10': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
239 'gcstress0x3_jitstressregs0x80': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
240 'gcstress0x3_jitstressregs0x1000': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
241 'gcstress0xc_jitstressregs1': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
242 'gcstress0xc_jitstressregs2': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
243 'gcstress0xc_jitstressregs3': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
244 'gcstress0xc_jitstressregs4': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
245 'gcstress0xc_jitstressregs8': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
246 'gcstress0xc_jitstressregs0x10': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
247 'gcstress0xc_jitstressregs0x80': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"],
248 'gcstress0xc_jitstressregs0x1000': ["GCSTRESS_FAIL", "GCSTRESS_EXCLUDE", "JITSTRESS_FAIL", "JITSTRESS_EXCLUDE"]
251 def static configurationList = ['Debug', 'Checked', 'Release']
253 // This is the set of architectures
254 def static architectureList = ['arm', 'armlb', 'x86_arm_altjit', 'x64_arm64_altjit', 'arm64', 'x64', 'x86']
257 def static setMachineAffinity(def job, def os, def architecture, def options = null) {
258 assert os instanceof String
259 assert architecture instanceof String
261 def armArches = ['arm', 'armlb', 'arm64']
262 def supportedArmLinuxOs = ['Ubuntu', 'Ubuntu16.04', 'Tizen']
264 if (!(architecture in armArches)) {
265 assert options == null
266 Utilities.setMachineAffinity(job, os, 'latest-or-auto')
271 // This is an arm(64) job.
273 // There are several options.
277 // Arm32 (Build) -> latest-arm64
278 // |-> os == "Windows_NT" && architecture == "arm" || architecture == "armlb" && options['use_arm64_build_machine'] == true
279 // Arm32 (Test) -> arm64-windows_nt
280 // |-> os == "Windows_NT" && architecture == "arm" || architecture == "armlb" && options['use_arm64_build_machine'] == false
282 // Arm64 (Build) -> latest-arm64
283 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == true
284 // Arm64 (Test) -> arm64-windows_nt
285 // |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == false
289 // Arm32 (Build) -> arm-cross-latest
290 // |-> os in supportedArmLinuxOs && architecture == "arm" || architecture == "armlb"
291 // Arm32 (Test) -> NYI Arch not supported
294 // Arm64 (Build) -> arm64-cross-latest
295 // |-> os != "Windows_NT" && architecture == "arm64" && options['is_build_only'] == true
296 // Arm64 Small Page Size (Test) -> arm64-small-page-size
297 // |-> os != "Windows_NT" && architecture == "arm64" && options['large_pages'] == false
298 // Arm64 Large Page Size (Test) -> arm64-huge-page-size
299 // |-> os != "Windows_NT" && architecture == "arm64" && options['large_pages'] == true
301 // This has to be a arm arch
302 assert architecture in armArches
303 if (os == "Windows_NT") {
304 // Arm(64) Windows jobs share the same machines for now
305 def isBuild = options['use_arm64_build_machine'] == true
307 if (isBuild == true) {
308 Utilities.setMachineAffinity(job, os, 'latest-arm64')
310 Utilities.setMachineAffinity(job, os, 'arm64-windows_nt')
313 assert os != 'Windows_NT'
314 assert os in supportedArmLinuxOs
316 if (architecture == 'arm' || architecture == 'armlb') {
317 Utilities.setMachineAffinity(job, 'Ubuntu', 'arm-cross-latest')
320 if (options['is_build_only'] == true) {
321 Utilities.setMachineAffinity(job, os, 'arm64-cross-latest')
323 // Arm64 Test Machines
324 if (options['large_pages'] == false) {
325 Utilities.setMachineAffinity(job, os, 'arm64-small-page-size')
327 Utilities.setMachineAffinity(job, os, 'arm64-huge-page-size')
334 def static isGCStressRelatedTesting(def scenario) {
335 // The 'r2r_gcstress15' scenario is a basic scenario.
336 // Detect it and make it a GCStress related.
337 if (scenario == 'r2r_gcstress15')
342 def gcStressTestEnvVars = [ 'COMPlus_GCStress', 'COMPlus_ZapDisable', 'COMPlus_HeapVerify']
343 def scenarioName = scenario.toLowerCase()
344 def isGCStressTesting = false
345 Constants.jitStressModeScenarios[scenario].each{ k, v ->
346 if (k in gcStressTestEnvVars) {
347 isGCStressTesting = true;
350 return isGCStressTesting
353 def static isCoreFxScenario(def scenario) {
354 def corefx_prefix = 'corefx_'
355 if (scenario.length() < corefx_prefix.length()) {
358 return scenario.substring(0,corefx_prefix.length()) == corefx_prefix
361 def static isR2RBaselineScenario(def scenario) {
362 return (scenario == 'r2r')
365 def static isR2RStressScenario(def scenario) {
366 return Constants.r2rStressScenarios.containsKey(scenario)
369 def static isR2RScenario(def scenario) {
370 return isR2RBaselineScenario(scenario) || isR2RStressScenario(scenario)
373 def static isJitStressScenario(def scenario) {
374 return Constants.jitStressModeScenarios.containsKey(scenario)
377 def static isLongGc(def scenario) {
378 return (scenario == 'longgc' || scenario == 'gcsimulator')
381 def static isJitDiff(def scenario) {
382 return (scenario == 'jitdiff')
385 def static isGcReliabilityFramework(def scenario) {
386 return (scenario == 'gc_reliability_framework')
389 def static isArmWindowsScenario(def scenario) {
390 return Constants.validArmWindowsScenarios.containsKey(scenario)
393 def static setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly) {
394 // 2 hours (120 minutes) is the default timeout
397 if (!(scenario == 'default' && isPR == true)) {
398 // Pri-1 test builds take a long time. Default PR jobs are Pri-0; everything else is Pri-1
399 // (see calculateBuildCommands()). So up the Pri-1 build jobs timeout.
404 // Note that these can only increase, never decrease, the Pri-1 timeout possibly set above.
405 if (isGCStressRelatedTesting(scenario)) {
408 else if (isCoreFxScenario(scenario)) {
411 else if (isJitStressScenario(scenario)) {
414 else if (isR2RBaselineScenario(scenario)) {
417 else if (isLongGc(scenario)) {
420 else if (isJitDiff(scenario)) {
423 else if (isGcReliabilityFramework(scenario)) {
426 else if (architecture == 'arm' || architecture == 'armlb' || architecture == 'arm64') {
431 if (configuration == 'Debug') {
432 // Debug runs can be very slow. Add an hour.
436 // If we've changed the timeout from the default, set it in the job.
438 if (timeout != 120) {
439 Utilities.setJobTimeout(newJob, timeout)
443 def static getJobFolder(def scenario) {
444 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
447 if (scenario == 'illink') {
453 def static getStressModeDisplayName(def scenario) {
455 Constants.jitStressModeScenarios[scenario].each{ k, v ->
456 def prefixLength = 'COMPlus_'.length()
457 if (k.length() >= prefixLength) {
458 def modeName = k.substring(prefixLength, k.length())
459 displayStr += ' ' + modeName + '=' + v
463 if (isCoreFxScenario(scenario)) {
464 displayStr = ('CoreFx ' + displayStr).trim()
470 def static getR2RDisplayName(def scenario) {
471 // Assume the scenario name is one from the r2rStressScenarios dict, and remove its "r2r_" prefix.
472 def displayStr = scenario
473 def prefixLength = 'r2r_'.length()
474 if (displayStr.length() >= prefixLength) {
475 displayStr = "R2R " + displayStr.substring(prefixLength, displayStr.length())
476 } else if (scenario == 'r2r') {
483 // Functions to create an environment script.
484 // envScriptCreate -- initialize the script (call first)
485 // envScriptFinalize -- finalize the script (call last)
486 // envScriptSetStressModeVariables -- set stress mode variables in the env script
487 // envScriptAppendExistingScript -- append an existing script to the generated script
489 // Each script returns a string of commands. Concatenate all the strings together before
490 // adding them to the builds commands, to make sure they get executed as one Jenkins script.
493 // Initialize the environment setting script.
494 def static envScriptCreate(def os, def stepScriptLocation) {
496 if (os == 'Windows_NT') {
497 stepScript += "echo Creating TestEnv script\r\n"
498 stepScript += "if exist ${stepScriptLocation} del ${stepScriptLocation}\r\n"
500 // Create at least an empty script.
501 stepScript += "echo. > ${stepScriptLocation}\r\n"
504 stepScript += "echo Creating environment setting script\n"
505 stepScript += "echo \\#\\!/usr/bin/env bash > ${stepScriptLocation}\n"
511 // Generates the string for setting stress mode variables.
512 def static envScriptSetStressModeVariables(def os, def stressModeVars, def stepScriptLocation) {
514 if (os == 'Windows_NT') {
515 stressModeVars.each{ k, v ->
516 // Write out what we are writing to the script file
517 stepScript += "echo Setting ${k}=${v}\r\n"
518 // Write out the set itself to the script file`
519 stepScript += "echo set ${k}=${v} >> ${stepScriptLocation}\r\n"
523 stressModeVars.each{ k, v ->
524 // Write out what we are writing to the script file
525 stepScript += "echo Setting ${k}=${v}\n"
526 // Write out the set itself to the script file`
527 stepScript += "echo export ${k}=${v} >> ${stepScriptLocation}\n"
534 // Append an existing script to an environment script.
535 // Returns string of commands to do this.
536 def static envScriptAppendExistingScript(def os, def appendScript, def stepScriptLocation) {
537 assert (os == 'Windows_NT')
540 stepScript += "echo Appending ${appendScript} to ${stepScriptLocation}\r\n"
541 stepScript += "type ${appendScript} >> ${stepScriptLocation}\r\n"
546 // Finalize an environment setting script.
547 // Returns string of commands to do this.
548 def static envScriptFinalize(def os, def stepScriptLocation) {
551 if (os == 'Windows_NT') {
552 // Display the resulting script. This is useful when looking at the output log file.
553 stepScript += "echo Display the total script ${stepScriptLocation}\r\n"
554 stepScript += "type ${stepScriptLocation}\r\n"
557 stepScript += "chmod +x ${stepScriptLocation}\n"
563 def static isNeedDocker(def architecture, def os, def isBuild) {
565 if (architecture == 'x86' && os == 'Ubuntu') {
568 else if (architecture == 'arm') {
569 if (os == 'Ubuntu' || os == 'Ubuntu16.04' || os == 'Tizen') {
575 if (architecture == 'x86' && os == 'Ubuntu') {
582 def static getDockerImageName(def architecture, def os, def isBuild) {
583 // We must change some docker private images to official later
585 if (architecture == 'x86' && os == 'Ubuntu') {
586 return "hseok82/dotnet-buildtools-prereqs:ubuntu-16.04-crossx86-ef0ac75-20175511035548"
588 else if (architecture == 'arm') {
589 if (os == 'Ubuntu') {
590 return "microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20172211042239"
592 else if (os == 'Ubuntu16.04') {
593 return "microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-ef0ac75-20175511035548"
595 else if (os == 'Tizen') {
596 return "hqueue/dotnetcore:ubuntu1404_cross_prereqs_v4-tizen_rootfs"
601 if (architecture == 'x86' && os == 'Ubuntu') {
602 return "hseok82/dotnet-buildtools-prereqs:ubuntu1604_x86_test"
605 println("Unknown architecture to use docker: ${architecture} ${os}");
609 // Calculates the name of the build job based on some typical parameters.
611 def static getJobName(def configuration, def architecture, def os, def scenario, def isBuildOnly) {
612 // If the architecture is x64, do not add that info into the build name.
613 // Need to change around some systems and other builds to pick up the right builds
616 def suffix = scenario != 'default' ? "_${scenario}" : '';
621 switch (architecture) {
623 if (scenario == 'default') {
624 // For now we leave x64 off of the name for compatibility with other jobs
625 baseName = configuration.toLowerCase() + '_' + os.toLowerCase()
627 else if (scenario == 'formatting') {
628 // we don't care about the configuration for the formatting job. It runs all configs
629 baseName = architecture.toLowerCase() + '_' + os.toLowerCase()
632 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
636 if (os.toLowerCase() == "windows_nt") {
637 // These are cross builds
638 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
641 // Defaults to a small page size set of machines.
642 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + "small_page_size"
646 // These are cross builds
649 baseName = 'armel_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
652 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
656 baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
659 case 'x86_arm_altjit':
660 case 'x64_arm64_altjit':
661 baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
664 println("Unknown architecture: ${architecture}");
669 return baseName + suffix
672 def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob, def bidailyCrossList) {
674 // Limited Windows ARM64 hardware is restricted for non-PR triggers to certain branches.
675 if (os == 'Windows_NT') {
676 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
677 if (!(branch in Constants.WindowsArm64Branches)) {
686 switch (architecture) {
689 if (isFlowJob && architecture == 'x86' && os == 'Ubuntu') {
690 Utilities.addPeriodicTrigger(job, '@daily')
692 else if (isFlowJob || os == 'Windows_NT' || !(os in Constants.crossList)) {
693 Utilities.addGithubPushTrigger(job)
698 case 'x86_arm_altjit':
699 case 'x64_arm64_altjit':
700 Utilities.addGithubPushTrigger(job)
703 // We would normally want a per-push trigger, but with limited hardware we can't keep up
704 Utilities.addPeriodicTrigger(job, "H H/4 * * *")
707 println("Unknown architecture: ${architecture}");
713 assert !(os in bidailyCrossList)
714 // r2r gets a push trigger for checked/release
715 if (configuration == 'Checked' || configuration == 'Release') {
716 assert (os == 'Windows_NT') || (os in Constants.crossList)
717 if (architecture == 'x64' && os != 'OSX10.12') {
718 //Flow jobs should be Windows, Ubuntu, OSX0.12, or CentOS
719 if (isFlowJob || os == 'Windows_NT') {
720 Utilities.addGithubPushTrigger(job)
722 // OSX10.12 r2r jobs should only run every 12 hours, not daily.
723 } else if (architecture == 'x64' && os == 'OSX10.12'){
725 Utilities.addPeriodicTrigger(job, 'H H/12 * * *')
728 // For x86, only add per-commit jobs for Windows
729 else if (architecture == 'x86') {
730 if (os == 'Windows_NT') {
731 Utilities.addGithubPushTrigger(job)
734 // arm64 r2r jobs should only run daily.
735 else if (architecture == 'arm64') {
736 if (os == 'Windows_NT') {
737 Utilities.addPeriodicTrigger(job, '@daily')
742 case 'r2r_jitstress1':
743 case 'r2r_jitstress2':
744 case 'r2r_jitstressregs1':
745 case 'r2r_jitstressregs2':
746 case 'r2r_jitstressregs3':
747 case 'r2r_jitstressregs4':
748 case 'r2r_jitstressregs8':
749 case 'r2r_jitstressregs0x10':
750 case 'r2r_jitstressregs0x80':
751 case 'r2r_jitstressregs0x1000':
752 case 'r2r_jitminopts':
753 case 'r2r_jitforcerelocs':
754 case 'r2r_gcstress15':
755 assert !(os in bidailyCrossList)
757 // GCStress=C is currently not supported on OS X
758 if (os == 'OSX10.12' && isGCStressRelatedTesting(scenario)) {
762 // GC Stress 15 r2r gets a push trigger for checked/release
763 if (configuration == 'Checked' || configuration == 'Release') {
764 assert (os == 'Windows_NT') || (os in Constants.crossList)
765 if (architecture == 'x64') {
766 //Flow jobs should be Windows, Ubuntu, OSX10.12, or CentOS
767 if (isFlowJob || os == 'Windows_NT') {
768 // Add a weekly periodic trigger
769 Utilities.addPeriodicTrigger(job, 'H H * * 3,6') // some time every Wednesday and Saturday
772 // For x86, only add per-commit jobs for Windows
773 else if (architecture == 'x86') {
774 if (os == 'Windows_NT') {
775 Utilities.addPeriodicTrigger(job, 'H H * * 3,6') // some time every Wednesday and Saturday
781 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
782 assert configuration == 'Release'
783 assert architecture == 'x64'
784 Utilities.addPeriodicTrigger(job, '@daily')
785 // TODO: Add once external email sending is available again
786 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
789 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
790 assert configuration == 'Release'
791 assert architecture == 'x64'
792 Utilities.addPeriodicTrigger(job, 'H H * * 3,6') // some time every Wednesday and Saturday
793 // TODO: Add once external email sending is available again
794 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
796 case 'standalone_gc':
797 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
798 assert (configuration == 'Release' || configuration == 'Checked')
799 // TODO: Add once external email sending is available again
800 // addEmailPublisher(job, 'dotnetgctests@microsoft.com')
801 Utilities.addPeriodicTrigger(job, '@daily')
803 case 'gc_reliability_framework':
804 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
805 assert (configuration == 'Release' || configuration == 'Checked')
806 // Only triggered by phrase.
809 assert !(os in bidailyCrossList)
810 // ILASM/ILDASM roundtrip one gets a daily build, and only for release
811 if (architecture == 'x64' && configuration == 'Release') {
812 // We don't expect to see a job generated except in these scenarios
813 assert (os == 'Windows_NT') || (os in Constants.crossList)
814 if (isFlowJob || os == 'Windows_NT') {
815 Utilities.addPeriodicTrigger(job, '@daily')
820 assert (os == 'Ubuntu' || os == 'Windows_NT' || os == 'OSX10.12')
821 assert configuration == 'Checked'
822 assert (architecture == 'x64' || architecture == 'x86')
823 Utilities.addGithubPushTrigger(job)
826 assert (os == 'Windows_NT' || os == "Ubuntu")
827 assert architecture == 'x64'
828 Utilities.addGithubPushTrigger(job)
830 case 'jitstressregs1':
831 case 'jitstressregs2':
832 case 'jitstressregs3':
833 case 'jitstressregs4':
834 case 'jitstressregs8':
835 case 'jitstressregs0x10':
836 case 'jitstressregs0x80':
837 case 'jitstressregs0x1000':
842 case 'jitstress2_jitstressregs1':
843 case 'jitstress2_jitstressregs2':
844 case 'jitstress2_jitstressregs3':
845 case 'jitstress2_jitstressregs4':
846 case 'jitstress2_jitstressregs8':
847 case 'jitstress2_jitstressregs0x10':
848 case 'jitstress2_jitstressregs0x80':
849 case 'jitstress2_jitstressregs0x1000':
850 case 'tailcallstress':
853 case 'corefx_baseline':
854 case 'corefx_minopts':
855 case 'corefx_jitstress1':
856 case 'corefx_jitstress2':
857 case 'corefx_jitstressregs1':
858 case 'corefx_jitstressregs2':
859 case 'corefx_jitstressregs3':
860 case 'corefx_jitstressregs4':
861 case 'corefx_jitstressregs8':
862 case 'corefx_jitstressregs0x10':
863 case 'corefx_jitstressregs0x80':
864 case 'corefx_jitstressregs0x1000':
866 if (os != 'CentOS7.1' && !(os in bidailyCrossList)) {
867 assert (os == 'Windows_NT') || (os in Constants.crossList)
868 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
869 if (os == 'Windows_NT') {
870 // We don't have enough ARM64 machines to run these more frequently than weekly.
871 Utilities.addPeriodicTrigger(job, '@weekly')
875 Utilities.addPeriodicTrigger(job, '@daily')
881 if (os != 'CentOS7.1' && !(os in bidailyCrossList)) {
882 assert (os == 'Windows_NT') || (os in Constants.crossList)
883 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
884 if (os == 'Windows_NT') {
885 // We don't have enough ARM64 machines to run these more frequently than weekly.
886 Utilities.addPeriodicTrigger(job, '@weekly')
888 // TODO: Add once external email sending is available again
889 // addEmailPublisher(job, 'dotnetonarm64@microsoft.com')
892 Utilities.addPeriodicTrigger(job, '@weekly')
897 case 'gcstress0xc_zapdisable':
898 case 'gcstress0xc_zapdisable_jitstress2':
899 case 'gcstress0xc_zapdisable_heapverify1':
900 case 'gcstress0xc_jitstress1':
901 case 'gcstress0xc_jitstress2':
902 case 'gcstress0xc_minopts_heapverify1':
903 // GCStress=C is currently not supported on OS X
904 if (os != 'CentOS7.1' && os != 'OSX10.12' && !(os in bidailyCrossList)) {
905 assert (os == 'Windows_NT') || (os in Constants.crossList)
906 if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
907 if (os == 'Windows_NT') {
908 // We don't have enough ARM64 machines to run these more frequently than weekly.
909 Utilities.addPeriodicTrigger(job, '@weekly')
911 // TODO: Add once external email sending is available again
912 // addEmailPublisher(job, 'dotnetonarm64@microsoft.com')
915 Utilities.addPeriodicTrigger(job, '@weekly')
921 // Testing on other operating systems TBD
922 assert (os == 'Windows_NT' || os == 'Ubuntu')
923 if (architecture == 'x64' || architecture == 'x86') {
924 if (configuration == 'Checked') {
925 Utilities.addPeriodicTrigger(job, '@daily')
930 case 'tieredcompilation':
931 case 'corefx_tieredcompilation':
932 // No periodic jobs just yet, still testing
936 println("Unknown scenario: ${scenario}");
943 // **************************
944 // Define the basic inner loop builds for PR and commit. This is basically just the set
945 // of coreclr builds over linux/osx 10.12/windows and debug/release/checked. In addition, the windows
946 // builds will do a couple extra steps.
947 // **************************
949 // Adds a trigger for the PR build if one is needed. If isFlowJob is true, then this is the
950 // flow job that rolls up the build and test for non-windows OS's. // If the job is a windows build only job,
951 // it's just used for internal builds
952 // If you add a job with a trigger phrase, please add that phrase to coreclr/Documentation/project-docs/ci-trigger-phrases.md
953 def static addTriggers(def job, def branch, def isPR, def architecture, def os, def configuration, def scenario, def isFlowJob, def isWindowsBuildOnlyJob) {
954 if (isWindowsBuildOnlyJob) {
958 def bidailyCrossList = ['RHEL7.2', 'Debian8.4']
959 // Non pull request builds.
961 addNonPRTriggers(job, branch, isPR, architecture, os, configuration, scenario, isFlowJob, isWindowsBuildOnlyJob, bidailyCrossList)
988 // Pull request builds. Generally these fall into two categories: default triggers and on-demand triggers
989 // We generally only have a distinct set of default triggers but a bunch of on-demand ones.
990 def osGroup = getOSGroup(os)
991 switch (architecture) {
992 case 'x64': // editor brace matching: {
993 if (scenario == 'formatting') {
994 assert configuration == 'Checked'
995 if (os == 'Windows_NT' || os == 'Ubuntu') {
996 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Innerloop Formatting")
1002 // OpenSUSE, Debian & RedHat get trigger phrases for pri 0 build, and pri 1 build & test
1005 if (scenario == 'default') {
1007 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build", "(?i).*test\\W+${os}.*")
1012 assert scenario == 'default'
1013 // Distinguish with the other architectures (arm and x86)
1014 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build", "(?i).*test\\W+${os}\\W+${architecture}.*")
1019 assert scenario == 'default'
1020 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build", "(?i).*test\\W+${os}\\W+.*")
1023 if (scenario == 'illink') {
1024 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} via ILLink", "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1029 // Triggers on the non-flow jobs aren't necessary here
1030 // Corefx testing uses non-flow jobs.
1031 if (!isFlowJob && !isCoreFxScenario(scenario)) {
1036 // OSX uses checked for default PR tests
1037 if (configuration == 'Checked') {
1039 assert !job.name.contains("centos")
1040 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test")
1044 if (configuration == 'Checked') {
1045 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Jit Diff Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1049 if (configuration == 'Release') {
1050 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} IL RoundTrip Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1054 if (configuration == 'Release') {
1055 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Long-Running GC Build & Test", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1059 if (configuration == 'Release') {
1060 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Simulator", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1063 case 'standalone_gc':
1064 if (configuration == 'Release' || configuration == 'Checked') {
1065 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Standalone GC", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1068 case 'gc_reliability_framework':
1069 if (configuration == 'Release' || configuration == 'Checked') {
1070 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Reliability Framework", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1074 if (isJitStressScenario(scenario)) {
1075 def displayStr = getStressModeDisplayName(scenario)
1076 assert (os == 'Windows_NT') || (os in Constants.crossList)
1077 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test (Jit - ${displayStr})",
1078 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1080 else if (isR2RScenario(scenario)) {
1081 if (configuration == 'Release' || configuration == 'Checked') {
1082 def displayStr = getR2RDisplayName(scenario)
1083 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build and Test",
1084 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1088 println("Unknown scenario: ${scenario}");
1098 // CentOS uses checked for default PR tests while debug is build only
1099 if (configuration == 'Debug') {
1101 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build")
1104 // Make sure this is a flow job to get build and test.
1105 if (configuration == 'Checked' && isFlowJob) {
1106 assert job.name.contains("flow")
1108 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test")
1112 if (isR2RScenario(scenario)) {
1113 if (configuration == 'Release' || configuration == 'Checked') {
1114 def displayStr = getR2RDisplayName(scenario)
1115 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build & Test",
1116 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1127 if (configuration == 'Checked') {
1128 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test")
1132 if (configuration == 'Checked') {
1133 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Jit Diff Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1137 if (configuration == 'Release') {
1138 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} IL RoundTrip Build and Test", "(?i).*test\\W+${os}\\W+${scenario}.*")
1142 if (configuration == 'Release') {
1143 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Long-Running GC Build & Test", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1147 if (configuration == 'Release') {
1148 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Simulator", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1151 case 'standalone_gc':
1152 if (configuration == 'Release' || configuration == 'Checked') {
1153 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Standalone GC", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1156 case 'gc_reliability_framework':
1157 if (configuration == 'Release' || configuration == 'Checked') {
1158 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Reliability Framework", "(?i).*test\\W+${os}\\W+${configuration}\\W+${scenario}.*")
1162 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} via ILLink", "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1165 if (isJitStressScenario(scenario)) {
1166 def displayStr = getStressModeDisplayName(scenario)
1167 assert (os == 'Windows_NT') || (os in Constants.crossList)
1168 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test (Jit - ${displayStr})",
1169 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1171 else if (isR2RScenario(scenario)) {
1172 if (configuration == 'Release' || configuration == 'Checked') {
1173 def displayStr = getR2RDisplayName(scenario)
1174 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build & Test",
1175 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1179 println("Unknown scenario: ${scenario}");
1186 println("Unknown os: ${os}");
1191 // editor brace matching: }
1193 case 'arm': // editor brace matching: {
1197 if (architecture == 'armlb') { // No arm legacy backend testing for Ubuntu
1200 assert scenario == 'default'
1203 azureVMAgentPostBuildAction {
1204 agentPostBuildAction('Delete agent if the build was not successful (when idle).')
1208 if (configuration == 'Debug') {
1209 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Innerloop Build")
1212 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Build",
1213 "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}\\W+Build.*")
1217 if (architecture == 'armlb') { // No arm legacy backend testing for Tizen armel
1220 architecture='armel'
1223 azureVMAgentPostBuildAction {
1224 agentPostBuildAction('Delete agent if the build was not successful (when idle).')
1228 if (configuration == 'Checked') {
1229 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Innerloop Build and Test")
1232 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Build",
1233 "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}\\W+Build.*")
1237 // Triggers on the non-flow jobs aren't necessary here
1242 // Set up a private trigger
1243 def contextString = "${os} ${architecture} Cross ${configuration}"
1244 def triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
1245 if (scenario == 'default') {
1246 contextString += " Innerloop"
1247 triggerString += "\\W+Innerloop"
1250 contextString += " ${scenario}"
1251 triggerString += "\\W+${scenario}"
1254 if (configuration == 'Debug') {
1255 contextString += " Build"
1256 triggerString += "\\W+Build"
1258 contextString += " Build and Test"
1259 triggerString += "\\W+Build and Test"
1262 triggerString += ".*"
1266 // Only Checked is a default trigger.
1267 if (configuration == 'Checked')
1269 Utilities.addDefaultPrivateGithubPRTriggerForBranch(job, branch, contextString, null, arm64Users)
1273 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1277 // Stress jobs will use this code path.
1278 if (isArmWindowsScenario(scenario)) {
1279 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1285 println("NYI os: ${os}");
1290 // editor brace matching: }
1291 case 'arm64': // editor brace matching: {
1292 // Set up a private trigger
1293 def contextString = "${os} ${architecture} Cross ${configuration}"
1294 def triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
1295 if (scenario == 'default') {
1296 contextString += " Innerloop"
1297 triggerString += "\\W+Innerloop"
1300 contextString += " ${scenario}"
1301 triggerString += "\\W+${scenario}"
1304 if (configuration == 'Debug') {
1305 contextString += " Build"
1306 triggerString += "\\W+Build"
1308 contextString += " Build and Test"
1309 triggerString += "\\W+Build and Test"
1312 triggerString += ".*"
1319 if (configuration == 'Debug' && !isFlowJob) {
1320 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Innerloop Build")
1323 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test", triggerString)
1328 if (isR2RScenario(scenario)) {
1329 if (configuration == 'Checked' || configuration == 'Release') {
1330 def displayStr = getR2RDisplayName(scenario)
1331 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build and Test", triggerString)
1338 // Triggers on the non-flow jobs aren't necessary here
1343 assert isArmWindowsScenario(scenario)
1346 if (configuration == 'Checked') {
1347 Utilities.addDefaultPrivateGithubPRTriggerForBranch(job, branch, contextString, null, arm64Users)
1350 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1354 // Stress jobs will use this code path.
1355 if (isArmWindowsScenario(scenario)) {
1356 Utilities.addPrivateGithubPRTriggerForBranch(job, branch, contextString, triggerString, null, arm64Users)
1362 println("NYI os: ${os}");
1367 // editor brace matching: }
1368 case 'x86': // editor brace matching: {
1369 assert ((os == 'Windows_NT') || ((os == 'Ubuntu') && (scenario == 'default')))
1370 if (os == 'Ubuntu') {
1371 // Triggers on the non-flow jobs aren't necessary here
1375 // on-demand only for ubuntu x86
1376 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build",
1377 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}.*")
1382 if (configuration == 'Checked') {
1383 assert !job.name.contains("centos")
1384 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Innerloop Build and Test")
1387 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test",
1388 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}.*")
1392 if (configuration == 'Release') {
1393 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} IL RoundTrip Build and Test",
1394 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1398 if (configuration == 'Release') {
1399 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Long-Running GC Build & Test",
1400 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1404 if (configuration == 'Release') {
1405 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} GC Simulator",
1406 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1409 case 'standalone_gc':
1410 if (configuration == 'Release' || configuration == 'Checked') {
1411 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Standalone GC",
1412 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1416 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} via ILLink", "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1419 if (isJitStressScenario(scenario)) {
1420 def displayStr = getStressModeDisplayName(scenario)
1421 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test (Jit - ${displayStr})",
1422 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1424 else if (isR2RScenario(scenario)) {
1425 if (configuration == 'Release' || configuration == 'Checked') {
1426 def displayStr = getR2RDisplayName(scenario)
1427 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${displayStr} Build & Test",
1428 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1432 println("Unknown scenario: ${os} ${architecture} ${scenario}");
1438 // editor brace matching: }
1439 case 'x64_arm64_altjit':
1440 case 'x86_arm_altjit': // editor brace matching: {
1441 assert (os == 'Windows_NT')
1444 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build and Test",
1445 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+Build and Test.*")
1448 Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} ${scenario}",
1449 "(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}\\W+${scenario}.*")
1453 // editor brace matching: }
1455 println("Unknown architecture: ${architecture}");
1461 def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR, def architecture, def configuration, def os, def isBuildOnly) {
1462 def buildCommands = [];
1463 def osGroup = getOSGroup(os)
1464 def lowerConfiguration = configuration.toLowerCase()
1467 if (scenario == 'default' && isPR == true) {
1471 setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly)
1473 def enableCorefxTesting = isCoreFxScenario(scenario)
1475 // Calculate the build steps, archival, and xunit results
1477 case 'Windows_NT': // editor brace matching: {
1478 switch (architecture) {
1481 case 'x86_arm_altjit':
1482 case 'x64_arm64_altjit':
1483 def arch = architecture
1485 if (architecture == 'x86_arm_altjit') {
1488 else if (architecture == 'x64_arm64_altjit') {
1492 if (scenario == 'formatting') {
1493 buildCommands += "python -u tests\\scripts\\format.py -c %WORKSPACE% -o Windows_NT -a ${arch}"
1494 Utilities.addArchival(newJob, "format.patch", "", true, false)
1498 if (scenario == 'illink') {
1499 buildCommands += "tests\\scripts\\build_illink.cmd clone ${arch}"
1502 // If it is a release build for windows, ensure PGO is used, else fail the build
1503 if ((lowerConfiguration == 'release') &&
1504 (scenario in Constants.basicScenarios) &&
1505 (architecture != 'x86_arm_altjit') &&
1506 (architecture != 'x64_arm64_altjit')) {
1508 buildOpts += ' -enforcepgo'
1511 if (enableCorefxTesting) {
1512 buildOpts += ' skiptests';
1514 buildOpts += " -priority=${priority}"
1517 // Set __TestIntermediateDir to something short. If __TestIntermediateDir is already set, build-test.cmd will
1518 // output test binaries to that directory. If it is not set, the binaries are sent to a default directory whose name is about
1519 // 35 characters long.
1521 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${arch} ${buildOpts}"
1524 def runtestArguments = ''
1525 def testOpts = 'collectdumps'
1527 if (isR2RScenario(scenario)) {
1529 // If this is a ReadyToRun scenario, pass 'crossgen' or 'crossgenaltjit'
1530 // to cause framework assemblies to be crossgen'ed. Pass 'runcrossgentests'
1531 // to cause the tests to be crossgen'ed.
1533 if ((architecture == 'x86_arm_altjit') || (architecture == 'x64_arm64_altjit')) {
1534 testOpts += ' crossgenaltjit protononjit.dll'
1536 testOpts += ' crossgen'
1539 testOpts += ' runcrossgentests'
1541 else if (scenario == 'jitdiff') {
1542 testOpts += ' jitdisasm crossgen'
1544 else if (scenario == 'ilrt') {
1545 testOpts += ' ilasmroundtrip'
1547 else if (isLongGc(scenario)) {
1548 testOpts += " ${scenario} sequential"
1550 else if (scenario == 'standalone_gc') {
1551 testOpts += ' gcname clrgc.dll'
1553 else if (scenario == 'illink') {
1554 testOpts += " link %WORKSPACE%\\linker\\linker\\bin\\netcore_Release\\netcoreapp2.0\\win10-${arch}\\publish\\illink.exe"
1557 // Default per-test timeout is 10 minutes. For stress modes and Debug scenarios, increase this
1558 // to 30 minutes (30 * 60 * 1000 = 180000). The "timeout" argument to runtest.cmd sets this, by
1559 // taking a timeout value in milliseconds. (Note that it sets the __TestTimeout environment variable,
1560 // which is read by the xunit harness.)
1561 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario) || (lowerConfiguration == 'debug'))
1563 def timeout = 1800000
1564 testOpts += " timeout ${timeout}"
1567 // If we are running a stress mode, we should write out the set of key
1568 // value env pairs to a file at this point and then we'll pass that to runtest.cmd
1570 def envScriptPath = ''
1571 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
1572 def buildCommandsStr = ''
1573 envScriptPath = "%WORKSPACE%\\SetStressModes.bat"
1574 buildCommandsStr += envScriptCreate(os, envScriptPath)
1576 if (isJitStressScenario(scenario)) {
1577 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], envScriptPath)
1579 else if (isR2RStressScenario(scenario)) {
1580 buildCommandsStr += envScriptSetStressModeVariables(os, Constants.r2rStressScenarios[scenario], envScriptPath)
1583 if (architecture == 'x86_arm_altjit') {
1584 buildCommandsStr += envScriptAppendExistingScript(os, "%WORKSPACE%\\tests\\x86_arm_altjit.cmd", envScriptPath)
1586 else if (architecture == 'x64_arm64_altjit') {
1587 buildCommandsStr += envScriptAppendExistingScript(os, "%WORKSPACE%\\tests\\x64_arm64_altjit.cmd", envScriptPath)
1590 envScriptFinalize(os, envScriptPath)
1592 // Note that buildCommands is an array of individually executed commands; we want all the commands used to
1593 // create the SetStressModes.bat script to be executed together, hence we accumulate them as strings
1594 // into a single script.
1595 buildCommands += buildCommandsStr
1597 else if (architecture == 'x86_arm_altjit') {
1598 envScriptPath = "%WORKSPACE%\\tests\\x86_arm_altjit.cmd"
1600 else if (architecture == 'x64_arm64_altjit') {
1601 envScriptPath = "%WORKSPACE%\\tests\\x64_arm64_altjit.cmd"
1603 if (envScriptPath != '') {
1604 testOpts += " TestEnv ${envScriptPath}"
1607 runtestArguments = "${lowerConfiguration} ${arch} ${testOpts}"
1609 if (enableCorefxTesting) {
1610 def workspaceRelativeFxRoot = "_/fx"
1611 def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
1613 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}"
1615 // Archive and process (only) the test results
1616 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
1617 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
1619 //Archive additional build stuff to diagnose why my attempt at fault injection isn't causing CI to fail
1620 Utilities.addArchival(newJob, "SetStressModes.bat", "", true, false)
1621 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/bin/testhost/**", "", true, false)
1623 else if (isGcReliabilityFramework(scenario)) {
1624 buildCommands += "tests\\runtest.cmd ${runtestArguments} GenerateLayoutOnly"
1625 buildCommands += "tests\\scripts\\run-gc-reliability-framework.cmd ${arch} ${configuration}"
1628 buildCommands += "tests\\runtest.cmd ${runtestArguments}"
1632 if (!enableCorefxTesting) {
1633 // Run the rest of the build
1634 // Build the mscorlib for the other OS's
1635 buildCommands += "build.cmd ${lowerConfiguration} ${arch} linuxmscorlib"
1636 buildCommands += "build.cmd ${lowerConfiguration} ${arch} osxmscorlib"
1638 if (arch == "x64") {
1639 buildCommands += "build.cmd ${lowerConfiguration} arm64 linuxmscorlib"
1642 // Zip up the tests directory so that we don't use so much space/time copying
1643 // 10s of thousands of files around.
1644 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')\"";
1646 if (!isJitStressScenario(scenario)) {
1647 // For windows, pull full test results and test drops for x86/x64.
1648 // No need to pull for stress mode scenarios (downstream builds use the default scenario)
1649 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
1652 if (scenario == 'jitdiff') {
1653 // retrive jit-dasm output for base commit, and run jit-diff
1655 // if this is a build only job, we want to keep the default (build) artifacts for the flow job
1656 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${arch}.${configuration}/dasm/**")
1661 Utilities.addXUnitDotNETResults(newJob, 'bin/**/TestRun*.xml', true)
1667 assert isArmWindowsScenario(scenario)
1669 def machineAffinityOptions = ['use_arm64_build_machine' : true]
1670 setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
1672 def buildArchitecture = 'arm'
1674 // For 'armlb' (the JIT LEGACY_BACKEND architecture for arm), tell build.cmd to use legacy backend for crossgen compilation.
1675 // Legacy backend is not the default JIT; it is an aljit. So, this is a special case.
1676 def armCrossgenOpt = ''
1677 if (architecture == 'armlb') {
1678 armCrossgenOpt = '-crossgenaltjit legacyjit.dll'
1681 // Hack: build pri1 tests for arm/armlb/arm64 build job, until we have separate pri0 and pri1 builds for the flow job to use.
1684 // This is now a build only job. Do not run tests. Use the flow job.
1685 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${buildArchitecture} -priority=${priority} ${armCrossgenOpt}"
1687 // Zip up the tests directory so that we don't use so much space/time copying
1688 // 10s of thousands of files around.
1689 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')\"";
1692 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
1695 assert isArmWindowsScenario(scenario)
1697 def machineAffinityOptions = ['use_arm64_build_machine' : true]
1698 setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
1700 // Hack: build pri1 tests for arm/armlb/arm64 build job, until we have separate pri0 and pri1 builds for the flow job to use.
1703 // This is now a build only job. Do not run tests. Use the flow job.
1704 buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} toolset_dir C:\\ats2 -priority=${priority}"
1706 // Zip up the tests directory so that we don't use so much space/time copying
1707 // 10s of thousands of files around.
1708 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')\"";
1711 Utilities.addArchival(newJob, "bin/Product/**,bin/tests/tests.zip", "bin/Product/**/.nuget/**")
1714 println("Unknown architecture: ${architecture}");
1719 // editor brace matching: }
1728 case 'Fedora24': // editor brace matching: {
1729 switch (architecture) {
1732 if (architecture == 'x86' && os == 'Ubuntu') {
1733 // build and PAL test
1734 def dockerImage = getDockerImageName(architecture, os, true)
1735 buildCommands += "docker run -i --rm -v \${WORKSPACE}:/opt/code -w /opt/code -e ROOTFS_DIR=/crossrootfs/x86 ${dockerImage} ./build.sh ${architecture} cross ${lowerConfiguration}"
1736 dockerImage = getDockerImageName(architecture, os, false)
1737 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"
1738 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
1739 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
1743 if (scenario == 'formatting') {
1744 buildCommands += "python tests/scripts/format.py -c \${WORKSPACE} -o Linux -a ${architecture}"
1745 Utilities.addArchival(newJob, "format.patch", "", true, false)
1749 if (scenario == 'illink') {
1750 assert(os == 'Ubuntu')
1751 buildCommands += "./tests/scripts/build_illink.sh --clone --arch=${architecture}"
1754 if (!enableCorefxTesting) {
1755 // We run pal tests on all OS but generate mscorlib (and thus, nuget packages)
1756 // only on supported OS platforms.
1757 def bootstrapRid = Utilities.getBoostrapPublishRid(os)
1758 def bootstrapRidEnv = bootstrapRid != null ? "__PUBLISH_RID=${bootstrapRid} " : ''
1760 buildCommands += "${bootstrapRidEnv}./build.sh verbose ${lowerConfiguration} ${architecture}"
1761 buildCommands += "src/pal/tests/palsuite/runpaltests.sh \${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration} \${WORKSPACE}/bin/paltestout"
1763 // Basic archiving of the build
1764 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
1766 Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
1769 // Corefx stress testing
1770 assert os == 'Ubuntu'
1771 assert architecture == 'x64'
1772 assert lowerConfiguration == 'checked'
1773 assert isJitStressScenario(scenario)
1776 buildCommands += "./build.sh verbose ${lowerConfiguration} ${architecture}"
1778 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
1780 def envScriptCmds = envScriptCreate(os, scriptFileName)
1781 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
1782 envScriptCmds += envScriptFinalize(os, scriptFileName)
1783 buildCommands += envScriptCmds
1785 // Build and text corefx
1786 def workspaceRelativeFxRoot = "_/fx"
1787 def absoluteFxRoot = "\$WORKSPACE/${workspaceRelativeFxRoot}"
1789 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}"
1791 // Archive and process (only) the test results
1792 Utilities.addArchival(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
1793 Utilities.addXUnitDotNETResults(newJob, "${workspaceRelativeFxRoot}/bin/**/testResults.xml")
1797 if (!enableCorefxTesting) {
1798 buildCommands += "ROOTFS_DIR=/opt/arm64-xenial-rootfs ./build.sh verbose ${lowerConfiguration} ${architecture} cross clang3.8"
1800 // HACK -- Arm64 does not have corefx jobs yet.
1801 buildCommands += "git clone https://github.com/dotnet/corefx fx"
1802 buildCommands += "ROOTFS_DIR=/opt/arm64-xenial-rootfs-corefx ./fx/build-native.sh -release -buildArch=arm64 -- verbose cross clang3.8"
1803 buildCommands += "mkdir ./bin/Product/Linux.arm64.${configuration}/corefxNative"
1804 buildCommands += "cp fx/bin/Linux.arm64.Release/native/* ./bin/Product/Linux.arm64.${configuration}/corefxNative"
1806 // Basic archiving of the build
1807 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
1811 // Cross builds for ARM runs on Ubuntu, Ubuntu16.04 and Tizen currently
1812 assert (os == 'Ubuntu') || (os == 'Ubuntu16.04') || (os == 'Tizen')
1814 // default values for Ubuntu
1816 def linuxCodeName="trusty"
1817 if (os == 'Ubuntu16.04') {
1818 linuxCodeName="xenial"
1820 else if (os == 'Tizen') {
1822 linuxCodeName="tizen"
1825 // Unzip the Windows test binaries first. Exit with 0
1826 buildCommands += "unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/Windows_NT.x64.${configuration} || exit 0"
1828 // Unpack the corefx binaries
1829 buildCommands += "mkdir ./bin/CoreFxBinDir"
1830 buildCommands += "tar -xf ./bin/build.tar.gz -C ./bin/CoreFxBinDir"
1831 if (os != 'Tizen') {
1832 buildCommands += "chmod a+x ./bin/CoreFxBinDir/corerun"
1834 // Test environment emulation using docker and qemu has some problem to use lttng library.
1835 // We should remove libcoreclrtraceptprovider.so to avoid test hang.
1836 if (os == 'Ubuntu') {
1837 buildCommands += "rm -f -v ./bin/CoreFxBinDir/libcoreclrtraceptprovider.so"
1840 // Call the ARM CI script to cross build and test using docker
1841 buildCommands += """./tests/scripts/arm32_ci_script.sh \\
1844 --linuxCodeName=${linuxCodeName} \\
1845 --buildConfig=${lowerConfiguration} \\
1846 --testRootDir=./bin/tests/Windows_NT.x64.${configuration} \\
1847 --coreFxBinDir=./bin/CoreFxBinDir \\
1848 --testDirFile=./tests/testsRunningInsideARM.txt"""
1850 // Basic archiving of the build, no pal tests
1851 Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
1854 println("Unknown architecture: ${architecture}");
1859 // editor brace matching: }
1861 println("Unknown os: ${os}");
1866 return buildCommands
1869 Constants.allScenarios.each { scenario ->
1870 [true, false].each { isPR ->
1871 Constants.architectureList.each { architecture ->
1872 Constants.configurationList.each { configuration ->
1873 Constants.osList.each { os ->
1874 // If the OS is Windows_NT_BuildOnly, set the isBuildOnly flag to true
1875 // and reset the os to Windows_NT
1876 def isBuildOnly = false
1877 if (os == 'Windows_NT_BuildOnly') {
1882 // Tizen is only supported for arm architecture
1883 if (os == 'Tizen' && architecture != 'arm') {
1887 // Skip totally unimplemented (in CI) configurations.
1888 switch (architecture) {
1890 if (os == 'Ubuntu16.04') {
1894 // Windows and Ubuntu only
1895 if ((os != 'Windows_NT' && os != 'Ubuntu') || isBuildOnly) {
1900 if ((os != 'Ubuntu') && (os != 'Ubuntu16.04') && (os != 'Tizen') && (os != 'Windows_NT')) {
1905 if (os != 'Windows_NT') {
1910 if ((os != 'Ubuntu') && (os != 'Windows_NT')) {
1914 case 'x86_arm_altjit':
1915 case 'x64_arm64_altjit':
1916 if (os != 'Windows_NT') {
1921 // Everything implemented
1924 println("Unknown architecture: ${architecture}")
1929 // Skip scenarios (blanket skipping for jit stress modes, which are good most everywhere
1930 // with checked builds)
1931 if (isJitStressScenario(scenario)) {
1932 if (configuration != 'Checked') {
1936 // Since these are just execution time differences,
1937 // skip platforms that don't execute the tests here (Windows_NT only)
1938 def isEnabledOS = (os == 'Windows_NT') || (os == 'Ubuntu' && isCoreFxScenario(scenario))
1939 if (!isEnabledOS || isBuildOnly) {
1943 switch (architecture) {
1946 case 'x86_arm_altjit':
1947 case 'x64_arm64_altjit':
1948 // x86 ubuntu: default only
1949 if ((os == 'Ubuntu') && (architecture == 'x86')) {
1952 // Windows: Everything implemented
1956 // arm, arm64, armlb: stress is handled through flow jobs.
1960 else if (isR2RScenario(scenario)) {
1961 if (os != 'Windows_NT') {
1964 // Stress scenarios only run with Checked builds, not Release (they would work with Debug, but be slow).
1965 if ((configuration != 'Checked') && isR2RStressScenario(scenario)) {
1973 // The ilrt build isn't necessary except for Windows_NT2003. Non-Windows NT uses
1974 // the default scenario build
1975 if (os != 'Windows_NT') {
1979 if (architecture != 'x64') {
1983 if (configuration != 'Release') {
1988 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
1991 if (architecture != 'x64') {
1994 if (configuration != 'Checked') {
2000 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2003 if (architecture != 'x64') {
2006 if (configuration != 'Release') {
2010 case 'gc_reliability_framework':
2011 case 'standalone_gc':
2012 if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
2016 if (architecture != 'x64') {
2020 if (configuration != 'Release' && configuration != 'Checked') {
2024 // We only run Windows and Ubuntu x64 Checked for formatting right now
2026 if (os != 'Windows_NT' && os != 'Ubuntu') {
2029 if (architecture != 'x64') {
2032 if (configuration != 'Checked') {
2040 if (os != 'Windows_NT' && (os != 'Ubuntu' || architecture != 'x64')) {
2043 if (architecture != 'x64' && architecture != 'x86') {
2054 println("Unknown scenario: ${scenario}")
2060 // For altjit, don't do any scenarios that don't change compilation. That is, scenarios that only change
2061 // runtime behavior, not compile-time behavior, are not interesting.
2062 switch (architecture) {
2063 case 'x86_arm_altjit':
2064 case 'x64_arm64_altjit':
2065 if (isGCStressRelatedTesting(scenario)) {
2074 def lowerConfiguration = configuration.toLowerCase()
2075 def jobName = getJobName(configuration, architecture, os, scenario, isBuildOnly)
2076 def folderName = getJobFolder(scenario)
2078 // Create the new job
2079 def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folderName)) {}
2081 def machineAffinityOptions = null
2083 if (os != 'Windows_NT') {
2084 machineAffinityOptions = architecture == 'arm64' ? ['is_build_only': true] : null
2087 machineAffinityOptions = (architecture == 'arm' || architecture == 'armlb' || architecture == 'arm64') ? ['use_arm64_build_machine': false] : null
2090 setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
2092 // Add all the standard options
2093 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
2094 addTriggers(newJob, branch, isPR, architecture, os, configuration, scenario, false, isBuildOnly) // isFlowJob==false
2096 def buildCommands = calculateBuildCommands(newJob, scenario, branch, isPR, architecture, configuration, os, isBuildOnly)
2097 def osGroup = getOSGroup(os)
2101 if (os == 'Windows_NT') {
2102 buildCommands.each { buildCommand ->
2103 batchFile(buildCommand)
2107 // Setup corefx and Windows test binaries for Linux cross build for ubuntu-arm, ubuntu16.04-arm and tizen-armel
2108 if ( architecture == 'arm' && ( os == 'Ubuntu' || os == 'Ubuntu16.04' || os == 'Tizen')) {
2109 // Cross build for ubuntu-arm, ubuntu16.04-arm and tizen-armel
2110 // Define the Windows Tests and Corefx build job names
2111 def WindowsTestsName = projectFolder + '/' +
2112 Utilities.getFullJobName(project,
2113 getJobName(lowerConfiguration, 'x64' , 'windows_nt', 'default', true),
2115 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' +
2116 Utilities.getFolderName(branch)
2118 // Copy the Windows test binaries and the Corefx build binaries
2119 copyArtifacts(WindowsTestsName) {
2120 includePatterns('bin/tests/tests.zip')
2122 latestSuccessful(true)
2127 def corefx_os = 'linux'
2128 if (os == 'Tizen') {
2133 // Let's use release CoreFX to test checked CoreCLR,
2134 // because we do not generate checked CoreFX in CoreFX CI yet.
2135 def corefx_lowerConfiguration = lowerConfiguration
2136 if ( lowerConfiguration == 'checked' ) {
2137 corefx_lowerConfiguration='release'
2140 copyArtifacts("${corefxFolder}/${corefx_os}_${arm_abi}_cross_${corefx_lowerConfiguration}") {
2141 includePatterns('bin/build.tar.gz')
2143 latestSuccessful(true)
2148 buildCommands.each { buildCommand ->
2162 // Create jobs requiring flow jobs. This includes x64 non-Windows, arm64 Ubuntu, and arm/arm64/armlb Windows.
2163 Constants.allScenarios.each { scenario ->
2164 [true, false].each { isPR ->
2165 ['arm', 'armlb', 'x64', 'arm64', 'x86'].each { architecture ->
2166 Constants.crossList.each { os ->
2167 if (architecture == 'arm64') {
2168 if (os != "Ubuntu" && os != "Windows_NT") {
2171 } else if (architecture == 'arm' || architecture == 'armlb') {
2172 if (os != 'Windows_NT') {
2176 else if (architecture == 'x86') {
2177 if (os != "Ubuntu") {
2182 def validWindowsNTCrossArches = ["arm", "armlb", "arm64"]
2184 if (os == "Windows_NT" && !(architecture in validWindowsNTCrossArches)) {
2188 Constants.configurationList.each { configuration ->
2190 // First, filter based on OS.
2192 if (os == 'Windows_NT') {
2193 if (!isArmWindowsScenario(scenario)) {
2199 if (architecture == 'arm64') {
2200 if (scenario != 'default' && scenario != 'r2r' && scenario != 'gcstress0x3' && scenario != 'gcstress0xc') {
2204 else if (architecture == 'x86') {
2205 // Linux/x86 only want default test
2206 if (scenario != 'default') {
2212 // For CentOS, we only want Checked/Release builds.
2213 if (os == 'CentOS7.1') {
2214 if (configuration != 'Checked' && configuration != 'Release') {
2217 if (scenario != 'default' && !isR2RScenario(scenario) && !isJitStressScenario(scenario)) {
2222 // For RedHat and Debian, we only do Release builds.
2223 else if (os == 'RHEL7.2' || os == 'Debian8.4') {
2224 if (configuration != 'Release') {
2227 if (scenario != 'default') {
2232 // Next, filter based on scenario.
2234 if (isJitStressScenario(scenario)) {
2235 if (configuration != 'Checked') {
2238 // CoreFx JIT stress tests currently not implemented for flow jobs.
2239 if (isCoreFxScenario(scenario)) {
2243 else if (isR2RBaselineScenario(scenario)) {
2244 if (configuration != 'Checked' && configuration != 'Release') {
2248 else if (isR2RStressScenario(scenario)) {
2249 if (configuration != 'Checked') {
2259 // Long GC tests take a long time on non-Release builds
2260 // ilrt is also Release only
2261 if (configuration != 'Release') {
2266 if (configuration != 'Checked') {
2270 case 'gc_reliability_framework':
2271 case 'standalone_gc':
2272 if (configuration != 'Release' && configuration != 'Checked') {
2279 if (os != 'Windows_NT' && os != 'Ubuntu') {
2287 println("Unknown scenario: ${scenario}")
2293 // Done filtering. Now, create the jobs.
2295 def lowerConfiguration = configuration.toLowerCase()
2296 def osGroup = getOSGroup(os)
2297 def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
2299 def inputCoreCLRBuildName = projectFolder + '/' +
2300 Utilities.getFullJobName(project, getJobName(configuration, architecture, os, 'default', false), isPR)
2302 // If this is a stress scenario, there isn't any difference in the build job, so we didn't create a build only
2303 // job for Windows_NT specific to that stress mode. Just copy from the default scenario.
2304 def testBuildScenario = scenario
2305 if (isJitStressScenario(testBuildScenario) || isR2RScenario(testBuildScenario) || isLongGc(testBuildScenario)) {
2306 testBuildScenario = 'default'
2309 def inputWindowsTestBuildArch = architecture
2310 if (architecture == "arm64" && os != "Windows_NT") {
2311 // Use the x64 test build for arm64 unix
2312 inputWindowsTestBuildArch = "x64"
2315 def inputWindowsTestsBuildName = ""
2317 if (isJitStressScenario(scenario)) {
2318 inputWindowsTestsBuildName = projectFolder + '/' +
2319 Utilities.getFullJobName(project, getJobName(configuration, inputWindowsTestBuildArch, 'windows_nt', testBuildScenario, false), isPR)
2321 inputWindowsTestsBuildName = projectFolder + '/' +
2322 Utilities.getFullJobName(project, getJobName(configuration, inputWindowsTestBuildArch, 'windows_nt', testBuildScenario, true), isPR)
2327 // Enable Server GC for Ubuntu PR builds
2328 def serverGCString = ''
2329 if (os == 'Ubuntu' && isPR) {
2330 serverGCString = '--useServerGC'
2335 if (isR2RScenario(scenario)) {
2337 testOpts += ' --crossgen --runcrossgentests'
2339 if (scenario == 'r2r_jitstress1') {
2340 testOpts += ' --jitstress=1'
2342 else if (scenario == 'r2r_jitstress2') {
2343 testOpts += ' --jitstress=2'
2345 else if (scenario == 'r2r_jitstressregs1') {
2346 testOpts += ' --jitstressregs=1'
2348 else if (scenario == 'r2r_jitstressregs2') {
2349 testOpts += ' --jitstressregs=2'
2351 else if (scenario == 'r2r_jitstressregs3') {
2352 testOpts += ' --jitstressregs=3'
2354 else if (scenario == 'r2r_jitstressregs4') {
2355 testOpts += ' --jitstressregs=4'
2357 else if (scenario == 'r2r_jitstressregs8') {
2358 testOpts += ' --jitstressregs=8'
2360 else if (scenario == 'r2r_jitstressregs0x10') {
2361 testOpts += ' --jitstressregs=0x10'
2363 else if (scenario == 'r2r_jitstressregs0x80') {
2364 testOpts += ' --jitstressregs=0x80'
2366 else if (scenario == 'r2r_jitstressregs0x1000') {
2367 testOpts += ' --jitstressregs=0x1000'
2369 else if (scenario == 'r2r_jitminopts') {
2370 testOpts += ' --jitminopts'
2372 else if (scenario == 'r2r_jitforcerelocs') {
2373 testOpts += ' --jitforcerelocs'
2375 else if (scenario == 'r2r_gcstress15') {
2376 testOpts += ' --gcstresslevel=0xF'
2379 else if (scenario == 'jitdiff') {
2380 testOpts += ' --jitdisasm --crossgen'
2382 else if (scenario == 'illink') {
2383 testOpts += ' --link=\$WORKSPACE/linker/linker/bin/netcore_Release/netcoreapp2.0/ubuntu-x64/publish/illink'
2385 else if (isLongGc(scenario)) {
2386 // Long GC tests behave very poorly when they are not
2387 // the only test running (many of them allocate until OOM).
2388 testOpts += ' --sequential'
2390 // A note - runtest.sh does have "--long-gc" and "--gcsimulator" options
2391 // for running long GC and GCSimulator tests, respectively. We don't use them
2392 // here because using a playlist file produces much more readable output on the CI machines
2393 // and reduces running time.
2395 // The Long GC playlist contains all of the tests that are
2396 // going to be run. The GCSimulator playlist contains all of
2397 // the GC simulator tests.
2398 if (scenario == 'longgc') {
2399 testOpts += ' --long-gc --playlist=./tests/longRunningGcTests.txt'
2401 else if (scenario == 'gcsimulator') {
2402 testOpts += ' --gcsimulator --playlist=./tests/gcSimulatorTests.txt'
2405 else if (isGcReliabilityFramework(scenario)) {
2406 testOpts += ' --build-overlay-only'
2408 else if (scenario == 'standalone_gc') {
2409 if (osGroup == 'OSX') {
2410 testOpts += ' --gcname=libclrgc.dylib'
2412 else if (osGroup == 'Linux') {
2413 testOpts += ' --gcname=libclrgc.so'
2416 println("Unexpected OS group: ${osGroup} for os ${os}")
2421 def windowsArmJob = (os == "Windows_NT" && architecture in validWindowsNTCrossArches)
2423 def folder = getJobFolder(scenario)
2424 def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folder)) {
2425 // Add parameters for the inputs
2427 if (windowsArmJob == true) {
2429 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
2434 stringParam('CORECLR_WINDOWS_BUILD', '', 'Build number to copy CoreCLR windows test binaries from')
2435 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
2440 // Set up the copies
2442 // Coreclr build containing the tests and mscorlib
2443 // pri1 jobs still need to copy windows_nt built tests
2444 if (windowsArmJob != true) {
2445 copyArtifacts(inputWindowsTestsBuildName) {
2446 excludePatterns('**/testResults.xml', '**/*.ni.dll')
2448 buildNumber('${CORECLR_WINDOWS_BUILD}')
2453 // Coreclr build we are trying to test
2455 // ** NOTE ** This will, correctly, overwrite over the CORE_ROOT from the windows test archive
2457 copyArtifacts(inputCoreCLRBuildName) {
2458 excludePatterns('**/testResults.xml', '**/*.ni.dll')
2460 buildNumber('${CORECLR_BUILD}')
2464 // Windows CoreCLR Arm(64) will restore corefx
2465 // packages correctly.
2467 // In addition, test steps are entirely different
2468 // because we do not have a unified runner
2469 if (windowsArmJob != true) {
2470 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' + Utilities.getFolderName(branch)
2472 // HACK -- Arm64 does not have corefx jobs yet.
2473 // Clone corefx and build the native packages overwriting the x64 packages.
2474 if (architecture == 'arm64') {
2475 shell("cp ./bin/Product/Linux.arm64.${configuration}/corefxNative/* ./bin/CoreFxBinDir")
2476 shell("chmod +x ./bin/Product/Linux.arm64.${configuration}/corerun")
2478 else if (architecture == 'x86') {
2479 shell("mkdir ./bin/CoreFxNative")
2481 copyArtifacts("${corefxFolder}/ubuntu16.04_x86_release") {
2482 includePatterns('bin/build.tar.gz')
2483 targetDirectory('bin/CoreFxNative')
2485 latestSuccessful(true)
2489 shell("tar -xf ./bin/CoreFxNative/bin/build.tar.gz -C ./bin/CoreFxBinDir")
2492 // Unzip the tests first. Exit with 0
2493 shell("unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/${osGroup}.${architecture}.${configuration} || exit 0")
2494 shell("rm -r ./bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root || exit 0")
2496 shell("./build-test.sh ${architecture} ${configuration} generatelayoutonly")
2498 // Execute the tests
2499 def runDocker = isNeedDocker(architecture, os, false)
2500 def dockerPrefix = ""
2503 def dockerImage = getDockerImageName(architecture, os, false)
2504 dockerPrefix = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} "
2505 dockerCmd = dockerPrefix + "${dockerImage} "
2508 // If we are running a stress mode, we'll set those variables first
2510 if (isJitStressScenario(scenario)) {
2511 def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
2512 def envScriptCmds = envScriptCreate(os, scriptFileName)
2513 envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
2514 envScriptCmds += envScriptFinalize(os, scriptFileName)
2515 shell("${envScriptCmds}")
2516 testEnvOpt = "--test-env=" + scriptFileName
2519 if (isGCStressRelatedTesting(scenario)) {
2520 shell('./init-tools.sh')
2523 shell("""${dockerCmd}./tests/runtest.sh \\
2524 --testRootDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}\" \\
2525 --coreOverlayDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root\" \\
2526 --testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
2527 --copyNativeTestBin --limitedDumpGeneration ${testEnvOpt} ${serverGCString} ${testOpts}""")
2529 if (isGcReliabilityFramework(scenario)) {
2530 // runtest.sh doesn't actually execute the reliability framework - do it here.
2531 if (serverGCString != '') {
2533 dockerCmd = dockerPrefix + "-e COMPlus_gcServer=1 ${dockerImage} "
2536 shell("export COMPlus_gcServer=1")
2540 shell("${dockerCmd}./tests/scripts/run-gc-reliability-framework.sh ${architecture} ${configuration}")
2544 else { // windowsArmJob == true
2546 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}')")
2548 // Build the build commands
2549 def buildCommands = ""
2551 def coreRootLocation = "%WORKSPACE%\\bin\\tests\\Windows_NT.${architecture}.${configuration}\\Tests\\Core_Root"
2552 def addEnvVariable = { variable, value -> buildCommands += "set ${variable}=${value}\r\n"}
2553 def addCommand = { cmd -> buildCommands += "${cmd}\r\n"}
2555 // Make sure Command Extensions are enabled. Used so %ERRORLEVEL% is available.
2556 addCommand("SETLOCAL ENABLEEXTENSIONS")
2559 addEnvVariable("CORE_ROOT", coreRootLocation)
2561 addEnvVariable("COMPlus_NoGuiOnAssert", "1")
2562 addEnvVariable("COMPlus_ContinueOnAssert", "0")
2564 // ARM legacy backend; this is an altjit.
2565 if (architecture == "armlb") {
2566 addEnvVariable("COMPlus_AltJit", "*")
2567 addEnvVariable("COMPlus_AltJitNgen", "*")
2568 addEnvVariable("COMPlus_AltJitName", "legacyjit.dll")
2569 addEnvVariable("COMPlus_AltJitAssertOnNYI", "1")
2572 // If we are running a stress mode, we'll set those variables as well
2573 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
2574 def stressValues = null
2575 if (isJitStressScenario(scenario)) {
2576 stressValues = Constants.jitStressModeScenarios[scenario]
2579 stressValues = Constants.r2rStressScenarios[scenario]
2582 stressValues.each { key, value ->
2583 addEnvVariable(key, value)
2587 if (isR2RScenario(scenario)) {
2588 // Crossgen the framework assemblies.
2589 buildCommands += """
2590 @for %%F in (%CORE_ROOT%\\*.dll) do @call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nxF
2591 @goto skip_PrecompileAssembly
2594 @REM Skip mscorlib since it is already precompiled.
2595 @if /I "%3" == "mscorlib.dll" exit /b 0
2596 @if /I "%3" == "mscorlib.ni.dll" exit /b 0
2598 "%CORE_ROOT%\\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" %2 >nul 2>nul
2599 @if "%errorlevel%" == "-2146230517" (
2600 echo %2 is not a managed assembly.
2601 ) else if "%errorlevel%" == "-2146234344" (
2602 echo %2 is not a managed assembly.
2603 ) else if %errorlevel% neq 0 (
2604 echo Unable to precompile %2
2610 :skip_PrecompileAssembly
2613 // Set RunCrossGen variable to cause test wrappers to invoke their logic to run
2614 // crossgen on tests before running them.
2615 addEnvVariable("RunCrossGen", "true")
2618 // Create the smarty command
2619 def smartyCommand = "C:\\Tools\\Smarty.exe /noecid /noie /workers 9 /inc EXPECTED_PASS "
2620 def addSmartyFlag = { flag -> smartyCommand += flag + " "}
2621 def addExclude = { exclude -> addSmartyFlag("/exc " + exclude)}
2623 def addArchSpecificExclude = { architectureToExclude, exclude -> if (architectureToExclude == "armlb") { addExclude("LEGACYJIT_" + exclude) } else { addExclude(exclude) } }
2625 if (architecture == "armlb") {
2626 addExclude("LEGACYJIT_FAIL")
2629 if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
2630 def failTag = "JITSTRESS_FAIL"
2631 def excludeTag = "JITSTRESS_EXCLUDE"
2633 if (scenario.contains('gc')) {
2634 failTag = "GCSTRESS_FAIL"
2635 excludeTag = "GCSTRESS_EXCLUDE"
2638 addArchSpecificExclude(architecture, failTag)
2639 addArchSpecificExclude(architecture, excludeTag)
2645 // Exclude any test marked LONG_RUNNING; these often exceed the standard timeout and fail as a result.
2646 // TODO: We should create a "long running" job that runs these with a longer timeout.
2647 addExclude("LONG_RUNNING")
2649 smartyCommand += "/lstFile Tests.lst"
2651 def testListArch = [
2657 def archLocation = testListArch[architecture]
2659 addCommand("copy %WORKSPACE%\\tests\\${archLocation}\\Tests.lst bin\\tests\\${osGroup}.${architecture}.${configuration}")
2660 addCommand("pushd bin\\tests\\${osGroup}.${architecture}.${configuration}")
2661 addCommand("${smartyCommand}")
2663 // Save the errorlevel from the smarty command to be used as the errorlevel of this batch file.
2664 // However, we also need to remove all the variables that were set during this batch file, so we
2665 // can run the ZIP powershell command (below) in a clean environment. (We can't run the powershell
2666 // command with the COMPlus_AltJit variables set, for example.) To do that, we do ENDLOCAL as well
2667 // as save the current errorlevel on the same line. This works because CMD evaluates the %errorlevel%
2668 // variable expansion (or any variable expansion on the line) BEFORE it executes the ENDLOCAL command.
2669 // Note that the ENDLOCAL also undoes the pushd command, but we add the popd here for clarity.
2670 addCommand("popd & ENDLOCAL & set __save_smarty_errorlevel=%errorlevel%")
2672 // ZIP up the smarty output, no matter what the smarty result.
2673 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')\"")
2675 addCommand("echo %errorlevel%")
2676 addCommand("dir .\\bin\\tests\\${osGroup}.${architecture}.${configuration}")
2678 // Use the smarty errorlevel as the script errorlevel.
2679 addCommand("exit /b %__save_smarty_errorlevel%")
2681 batchFile(buildCommands)
2686 if (scenario == 'jitdiff') {
2687 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/dasm/**")
2690 // Experimental: If on Ubuntu 14.04, then attempt to pull in crash dump links
2691 if (os in ['Ubuntu']) {
2692 SummaryBuilder summaries = new SummaryBuilder()
2693 summaries.addLinksSummaryFromFile('Crash dumps from this run:', 'dumplings.txt')
2694 summaries.emit(newJob)
2697 def affinityOptions = null
2699 if (windowsArmJob == true) {
2701 "use_arm64_build_machine" : false
2705 else if (architecture == 'arm64' && os != 'Windows_NT') {
2707 "large_pages" : false
2711 setMachineAffinity(newJob, os, architecture, affinityOptions)
2712 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
2714 setJobTimeout(newJob, isPR, architecture, configuration, scenario, false)
2716 if (windowsArmJob != true) {
2717 Utilities.addXUnitDotNETResults(newJob, '**/coreclrtests.xml')
2720 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/Smarty.run.0/*.smrt", '', true, false)
2722 // Archive a ZIP file of the entire Smarty.run.0 directory. This is possibly a little too much,
2723 // but there is no easy way to only archive the HTML/TXT files of the failing tests, so we get
2724 // all the passing test info as well. Not necessarily a bad thing, but possibly somewhat large.
2725 Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/Smarty.run.0.zip", '', true, false)
2728 // Create a build flow to join together the build and tests required to run this test.
2729 // Windows CoreCLR build and Linux CoreCLR build (in parallel) ->
2730 // Linux CoreCLR test
2731 def flowJobName = getJobName(configuration, architecture, os, scenario, false) + "_flow"
2732 def fullTestJobName = projectFolder + '/' + newJob.name
2733 // Add a reference to the input jobs for report purposes
2734 JobReport.Report.addReference(inputCoreCLRBuildName)
2735 JobReport.Report.addReference(inputWindowsTestsBuildName)
2736 JobReport.Report.addReference(fullTestJobName)
2737 def newFlowJob = null
2739 if (os == 'RHEL7.2' || os == 'Debian8.4') {
2740 // Do not create the flow job for RHEL jobs.
2744 // For pri0 jobs we can build tests on unix
2745 if (windowsArmJob) {
2746 // For Windows arm jobs there is no reason to build a parallel test job.
2747 // The product build supports building and archiving the tests.
2749 newFlowJob = buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, folder)) {
2751 coreclrBuildJob = build(params, '${inputCoreCLRBuildName}')
2753 // And then build the test build
2754 build(params + [CORECLR_BUILD: coreclrBuildJob.build.number], '${fullTestJobName}')
2759 newFlowJob = buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, folder)) {
2761 // Build the input jobs in parallel
2763 { coreclrBuildJob = build(params, '${inputCoreCLRBuildName}') },
2764 { windowsBuildJob = build(params, '${inputWindowsTestsBuildName}') }
2767 // And then build the test build
2768 build(params + [CORECLR_BUILD: coreclrBuildJob.build.number,
2769 CORECLR_WINDOWS_BUILD: windowsBuildJob.build.number], '${fullTestJobName}')
2774 // For the flow jobs set the machine affinity as x64 if an armarch.
2775 def flowArch = architecture
2777 if (flowArch in validWindowsNTCrossArches) {
2779 affinityOptions = null
2782 setMachineAffinity(newFlowJob, os, flowArch, affinityOptions)
2783 Utilities.standardJobSetup(newFlowJob, project, isPR, "*/${branch}")
2784 addTriggers(newFlowJob, branch, isPR, architecture, os, configuration, scenario, true, false) // isFlowJob==true, isWindowsBuildOnlyJob==false
2791 JobReport.Report.generateJobReport(out)
2793 // Make the call to generate the help job
2794 Utilities.createHelperJob(this, project, branch,
2795 "Welcome to the ${project} Repository", // This is prepended to the help message
2796 "Have a nice day!") // This is appended to the help message. You might put known issues here.
2798 Utilities.addCROSSCheck(this, project, branch)