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 ->
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")
77 batchFile("tests\\scripts\\run-xunit-perf.cmd -arch ${arch} -configuration ${configuration} ${testEnv} -testBinLoc bin\\tests\\Windows_NT.${architecture}.${configuration}\\performance\\perflab\\Perflab -library -uploadToBenchview \"%WORKSPACE%\\Microsoft.Benchview.JSONFormat\\tools\" -runtype ${runType}")
78 batchFile("tests\\scripts\\run-xunit-perf.cmd -arch ${arch} -configuration ${configuration} ${testEnv} -testBinLoc bin\\tests\\Windows_NT.${architecture}.${configuration}\\Jit\\Performance\\CodeQuality -uploadToBenchview \"%WORKSPACE%\\Microsoft.Benchview.JSONFormat\\tools\" -runtype ${runType}")
82 // Save machinedata.json to /artifact/bin/ Jenkins dir
83 def archiveSettings = new ArchivalSettings()
84 archiveSettings.addFiles('perf-*.xml')
85 archiveSettings.addFiles('perf-*.etl')
86 Utilities.addArchival(newJob, archiveSettings)
88 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
91 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
92 builder.setGithubContext("${os} ${arch} CoreCLR Perf Tests")
93 builder.triggerOnlyOnComment()
94 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}_${arch}\\W+perf.*")
95 builder.triggerForBranch(branch)
96 builder.emitTrigger(newJob)
100 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
101 builder.emitTrigger(newJob)
107 // Create the Linux/OSX/CentOS coreclr test leg for debug and release and each scenario
108 [true, false].each { isPR ->
109 ['Ubuntu14.04'].each { os ->
110 def newJob = job(Utilities.getFullJobName(project, "perf_${os}", isPR)) {
112 label('linux_clr_perf')
115 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
123 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')
126 def osGroup = getOSGroup(os)
127 def architecture = 'x64'
128 def configuration = 'Release'
129 def runType = isPR ? 'private' : 'rolling'
130 def benchViewName = isPR ? 'coreclr private \$BenchviewCommitName' : 'coreclr rolling \$GIT_BRANCH_WITHOUT_ORIGIN \$GIT_COMMIT'
133 shell("bash ./tests/scripts/perf-prep.sh")
134 shell("./init-tools.sh")
135 shell("./build.sh ${architecture} ${configuration}")
136 shell("GIT_BRANCH_WITHOUT_ORIGIN=\$(echo \$GIT_BRANCH | sed \"s/[^/]*\\/\\(.*\\)/\\1 /\")\n" +
137 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/submission-metadata.py\" --name " + "\"" + benchViewName + "\"" + " --user " + "\"dotnet-bot@microsoft.com\"\n" +
138 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/build.py\" git --branch \$GIT_BRANCH_WITHOUT_ORIGIN --type " + runType)
139 shell("""sudo -E bash ./tests/scripts/run-xunit-perf.sh \\
140 --testRootDir=\"\${WORKSPACE}/bin/tests/Windows_NT.${architecture}.${configuration}\" \\
141 --testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
142 --coreClrBinDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
143 --mscorlibDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
144 --coreFxBinDir=\"\${WORKSPACE}/corefx\" \\
145 --runType=\"${runType}\" \\
146 --benchViewOS=\"${os}\" \\
147 --uploadToBenchview""")
151 // Save machinedata.json to /artifact/bin/ Jenkins dir
152 def archiveSettings = new ArchivalSettings()
153 archiveSettings.addFiles('sandbox/perf-*.xml')
154 archiveSettings.addFiles('machinedata.json')
155 Utilities.addArchival(newJob, archiveSettings)
157 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
159 // For perf, we need to keep the run results longer
161 // Enable the log rotator
163 artifactDaysToKeep(7)
165 artifactNumToKeep(25)
170 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
171 builder.setGithubContext("${os} Perf Tests")
172 builder.triggerOnlyOnComment()
173 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+perf.*")
174 builder.triggerForBranch(branch)
175 builder.emitTrigger(newJob)
178 // Set a push trigger
179 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
180 builder.emitTrigger(newJob)