1 // Import the utility functionality.
3 import jobs.generation.*;
5 def project = GithubProject
6 def branch = GithubBranchName
7 def projectName = Utilities.getFolderName(project)
8 def projectFolder = projectName + '/' + Utilities.getFolderName(branch)
10 def static getOSGroup(def os) {
11 def osGroupMap = ['Ubuntu14.04':'Linux',
13 'Ubuntu16.04': 'Linux',
17 'Windows_NT':'Windows_NT',
20 'OpenSUSE13.2': 'Linux',
21 'OpenSUSE42.1': 'Linux',
22 'LinuxARMEmulator': 'Linux']
23 def osGroup = osGroupMap.get(os, null)
24 assert osGroup != null : "Could not find os group for ${os}"
27 // Setup perflab tests runs
28 [true, false].each { isPR ->
29 ['Windows_NT'].each { os ->
30 ['x64', 'x86', 'x86jit32'].each { arch ->
31 def architecture = arch
34 if (arch == 'x86jit32')
37 testEnv = '-testEnv %WORKSPACE%\\tests\\x86\\compatjit_x86_testenv.cmd'
39 else if (arch == 'x86')
41 testEnv = '-testEnv %WORKSPACE%\\tests\\x86\\ryujit_x86_testenv.cmd'
44 def newJob = job(Utilities.getFullJobName(project, "perf_perflab_${os}_${arch}", isPR)) {
46 label('windows_clr_perf')
49 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
57 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form <branch> private BenchviewCommitName')
60 def configuration = 'Release'
61 def runType = isPR ? 'private' : 'rolling'
62 def benchViewName = isPR ? 'coreclr private %BenchviewCommitName%' : 'coreclr rolling %GIT_BRANCH_WITHOUT_ORIGIN% %GIT_COMMIT%'
67 batchFile("if exist \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\" rmdir /s /q \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\"")
68 batchFile("C:\\Tools\\nuget.exe install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion")
69 //Do this here to remove the origin but at the front of the branch name as this is a problem for BenchView
70 //we have to do it all as one statement because cmd is called each time and we lose the set environment variable
71 batchFile("if [%GIT_BRANCH:~0,7%] == [origin/] (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH:origin/=%) else (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH%)\n" +
72 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\submission-metadata.py\" --name \"${benchViewName}\" --user \"dotnet-bot@microsoft.com\"\n" +
73 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\build.py\" git --branch %GIT_BRANCH_WITHOUT_ORIGIN% --type ${runType}")
74 batchFile("py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\machinedata.py\"")
75 batchFile("set __TestIntermediateDir=int&&build.cmd ${configuration} ${architecture}")
76 batchFile("tests\\runtest.cmd ${configuration} ${architecture} GenerateLayoutOnly")
78 if (arch == 'x86jit32')
80 // Download package and copy compatjit into Core_Root
81 batchFile("C:\\Tools\\nuget.exe install runtime.win7-${architecture}.Microsoft.NETCore.Jit -Source https://dotnet.myget.org/F/dotnet-core -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion\n" +
82 "xcopy \"%WORKSPACE%\\runtime.win7-x86.Microsoft.NETCore.Jit\\runtimes\\win7-x86\\native\\compatjit.dll\" \"%WORKSPACE%\\bin\\Product\\${os}.${architecture}.${configuration}\" /Y")
85 batchFile("tests\\scripts\\run-xunit-perf.cmd -arch ${arch} -configuration ${configuration} ${testEnv} -testBinLoc bin\\tests\\${os}.${architecture}.${configuration}\\performance\\perflab\\Perflab -library -uploadToBenchview \"%WORKSPACE%\\Microsoft.Benchview.JSONFormat\\tools\" -runtype ${runType}")
86 batchFile("tests\\scripts\\run-xunit-perf.cmd -arch ${arch} -configuration ${configuration} ${testEnv} -testBinLoc bin\\tests\\${os}.${architecture}.${configuration}\\Jit\\Performance\\CodeQuality -uploadToBenchview \"%WORKSPACE%\\Microsoft.Benchview.JSONFormat\\tools\" -runtype ${runType}")
90 // Save machinedata.json to /artifact/bin/ Jenkins dir
91 def archiveSettings = new ArchivalSettings()
92 archiveSettings.addFiles('Perf-*.xml')
93 archiveSettings.addFiles('Perf-*.etl')
94 Utilities.addArchival(newJob, archiveSettings)
96 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
107 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
108 builder.setGithubContext("${os} ${arch} CoreCLR Perf Tests")
109 builder.triggerOnlyOnComment()
110 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+${arch}\\W+perf.*")
111 builder.triggerForBranch(branch)
112 builder.emitTrigger(newJob)
115 // Set a push trigger
116 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
117 builder.emitTrigger(newJob)
123 // Setup throughput perflab tests runs
124 [true, false].each { isPR ->
125 ['Windows_NT'].each { os ->
126 ['x64', 'x86', 'x86jit32'].each { arch ->
127 def architecture = arch
129 if (arch == 'x86jit32')
134 def newJob = job(Utilities.getFullJobName(project, "perf_throughput_perflab_${os}_${arch}", isPR)) {
136 label('windows_clr_perf')
139 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
147 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form <branch> private BenchviewCommitName')
150 def configuration = 'Release'
151 def runType = isPR ? 'private' : 'rolling'
152 def benchViewName = isPR ? 'coreclr-throughput private %BenchviewCommitName%' : 'coreclr-throughput rolling %GIT_BRANCH_WITHOUT_ORIGIN% %GIT_COMMIT%'
157 batchFile("if exist \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\" rmdir /s /q \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\"")
158 batchFile("if exist \"%WORKSPACE%\\Microsoft.BenchView.ThroughputBenchmarks.${architecture}.${os}\" rmdir /s /q \"%WORKSPACE%\\Microsoft.BenchView.ThroughputBenchmarks.${architecture}.${os}\"")
159 batchFile("C:\\Tools\\nuget.exe install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion")
160 batchFile("C:\\Tools\\nuget.exe install Microsoft.BenchView.ThroughputBenchmarks.${architecture}.${os} -Source https://dotnet.myget.org/F/dotnet-core -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion")
161 //Do this here to remove the origin but at the front of the branch name as this is a problem for BenchView
162 //we have to do it all as one statement because cmd is called each time and we lose the set environment variable
163 batchFile("if [%GIT_BRANCH:~0,7%] == [origin/] (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH:origin/=%) else (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH%)\n" +
164 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\submission-metadata.py\" --name \"${benchViewName}\" --user \"dotnet-bot@microsoft.com\"\n" +
165 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\build.py\" git --branch %GIT_BRANCH_WITHOUT_ORIGIN% --type ${runType}")
166 batchFile("py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\machinedata.py\"")
167 batchFile("set __TestIntermediateDir=int&&build.cmd ${configuration} ${architecture} skiptests")
168 batchFile("tests\\runtest.cmd ${configuration} ${architecture} GenerateLayoutOnly")
169 if (arch == 'x86jit32')
171 // Download package and copy compatjit into Core_Root
172 batchFile("C:\\Tools\\nuget.exe install runtime.win7-${architecture}.Microsoft.NETCore.Jit -Source https://dotnet.myget.org/F/dotnet-core -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion\n" +
173 "xcopy \"%WORKSPACE%\\runtime.win7-x86.Microsoft.NETCore.Jit\\runtimes\\win7-x86\\native\\compatjit.dll\" \"%WORKSPACE%\\bin\\Product\\${os}.${architecture}.${configuration}\" /Y")
175 batchFile("py -u tests\\scripts\\run-throughput-perf.py -arch ${arch} -os ${os} -configuration ${configuration} -clr_root \"%WORKSPACE%\" -assembly_root \"%WORKSPACE%\\Microsoft.BenchView.ThroughputBenchmarks.${architecture}.${os}\\lib\" -benchview_path \"%WORKSPACE%\\Microsoft.Benchview.JSONFormat\\tools\" -run_type ${runType}")
179 // Save machinedata.json to /artifact/bin/ Jenkins dir
180 def archiveSettings = new ArchivalSettings()
181 archiveSettings.addFiles('throughput-*.csv')
182 Utilities.addArchival(newJob, archiveSettings)
184 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
187 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
188 builder.setGithubContext("${os} ${arch} CoreCLR Throughput Perf Tests")
189 builder.triggerOnlyOnComment()
190 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+${arch}\\W+throughput.*")
191 builder.triggerForBranch(branch)
192 builder.emitTrigger(newJob)
195 // Set a push trigger
196 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
197 builder.emitTrigger(newJob)
203 // Create the Linux/OSX/CentOS coreclr test leg for debug and release and each scenario
204 [true, false].each { isPR ->
205 ['Ubuntu14.04'].each { os ->
206 def newJob = job(Utilities.getFullJobName(project, "perf_${os}", isPR)) {
208 label('linux_clr_perf')
211 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
219 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form <branch> private BenchviewCommitName')
222 def osGroup = getOSGroup(os)
223 def architecture = 'x64'
224 def configuration = 'Release'
225 def runType = isPR ? 'private' : 'rolling'
226 def benchViewName = isPR ? 'coreclr private \$BenchviewCommitName' : 'coreclr rolling \$GIT_BRANCH_WITHOUT_ORIGIN \$GIT_COMMIT'
229 shell("bash ./tests/scripts/perf-prep.sh")
230 shell("./init-tools.sh")
231 shell("./build.sh ${architecture} ${configuration}")
232 shell("GIT_BRANCH_WITHOUT_ORIGIN=\$(echo \$GIT_BRANCH | sed \"s/[^/]*\\/\\(.*\\)/\\1 /\")\n" +
233 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/submission-metadata.py\" --name \" ${benchViewName} \" --user \"dotnet-bot@microsoft.com\"\n" +
234 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/build.py\" git --branch \$GIT_BRANCH_WITHOUT_ORIGIN --type ${runType}")
235 shell("""sudo -E bash ./tests/scripts/run-xunit-perf.sh \\
236 --testRootDir=\"\${WORKSPACE}/bin/tests/Windows_NT.${architecture}.${configuration}\" \\
237 --testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
238 --coreClrBinDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
239 --mscorlibDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
240 --coreFxBinDir=\"\${WORKSPACE}/corefx\" \\
241 --runType=\"${runType}\" \\
242 --benchViewOS=\"${os}\" \\
243 --uploadToBenchview""")
247 // Save machinedata.json to /artifact/bin/ Jenkins dir
248 def archiveSettings = new ArchivalSettings()
249 archiveSettings.addFiles('sandbox/perf-*.xml')
250 archiveSettings.addFiles('machinedata.json')
251 Utilities.addArchival(newJob, archiveSettings)
253 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
255 // For perf, we need to keep the run results longer
257 // Enable the log rotator
259 artifactDaysToKeep(7)
261 artifactNumToKeep(25)
266 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
267 builder.setGithubContext("${os} Perf Tests")
268 builder.triggerOnlyOnComment()
269 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+perf.*")
270 builder.triggerForBranch(branch)
271 builder.emitTrigger(newJob)
274 // Set a push trigger
275 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
276 builder.emitTrigger(newJob)
281 // Create the Linux/OSX/CentOS coreclr test leg for debug and release and each scenario
282 [true, false].each { isPR ->
283 ['Ubuntu14.04'].each { os ->
284 def newJob = job(Utilities.getFullJobName(project, "perf_throughput_${os}", isPR)) {
286 label('linux_clr_perf')
289 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
297 stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form <branch> private BenchviewCommitName')
300 def osGroup = getOSGroup(os)
301 def architecture = 'x64'
302 def configuration = 'Release'
303 def runType = isPR ? 'private' : 'rolling'
304 def benchViewName = isPR ? 'coreclr private \$BenchviewCommitName' : 'coreclr rolling \$GIT_BRANCH_WITHOUT_ORIGIN \$GIT_COMMIT'
307 shell("bash ./tests/scripts/perf-prep.sh --throughput")
308 shell("./init-tools.sh")
309 shell("./build.sh ${architecture} ${configuration}")
310 shell("GIT_BRANCH_WITHOUT_ORIGIN=\$(echo \$GIT_BRANCH | sed \"s/[^/]*\\/\\(.*\\)/\\1 /\")\n" +
311 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/submission-metadata.py\" --name \" ${benchViewName} \" --user \"dotnet-bot@microsoft.com\"\n" +
312 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/build.py\" git --branch \$GIT_BRANCH_WITHOUT_ORIGIN --type ${runType}")
313 shell("""sudo -E python3.5 ./tests/scripts/run-throughput-perf.py \\
314 -arch \"${architecture}\" \\
316 -configuration \"${configuration}\" \\
317 -clr_root \"\${WORKSPACE}\" \\
318 -assembly_root \"\${WORKSPACE}/_/fx/bin/runtime/netcoreapp-${osGroup}-${configuration}-${architecture}\" \\
319 -run_type \"${runType}\" \\
320 -benchview_path \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools\"""")
324 // Save machinedata.json to /artifact/bin/ Jenkins dir
325 def archiveSettings = new ArchivalSettings()
326 archiveSettings.addFiles('throughput-*.csv')
327 archiveSettings.addFiles('machinedata.json')
328 Utilities.addArchival(newJob, archiveSettings)
330 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
332 // For perf, we need to keep the run results longer
334 // Enable the log rotator
336 artifactDaysToKeep(7)
338 artifactNumToKeep(25)
343 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
344 builder.setGithubContext("${os} Throughput Perf Tests")
345 builder.triggerOnlyOnComment()
346 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+throughput.*")
347 builder.triggerForBranch(branch)
348 builder.emitTrigger(newJob)
351 // Set a push trigger
352 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
353 builder.emitTrigger(newJob)