Add the missing ICU APIs to the ICU shim (#7840)
[platform/upstream/coreclr.git] / perf.groovy
1 // Import the utility functionality.
2
3 import jobs.generation.*;
4
5 def project = GithubProject
6 def branch = GithubBranchName
7 def projectName = Utilities.getFolderName(project)
8 def projectFolder = projectName + '/' + Utilities.getFolderName(branch)
9
10 def static getOSGroup(def os) {
11     def osGroupMap = ['Ubuntu':'Linux',
12         'RHEL7.2': 'Linux',
13         'Ubuntu16.04': 'Linux',
14         'Debian8.4':'Linux',
15         'Fedora23':'Linux',
16         'OSX':'OSX',
17         'Windows_NT':'Windows_NT',
18         'FreeBSD':'FreeBSD',
19         'CentOS7.1': 'Linux',
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}"
25     return osGroupMap[os]
26 }
27
28 [true, false].each { isPR ->
29     ['Windows_NT'].each { os ->
30         def architecture = 'x64'
31         def configuration = 'Release'
32         def newJob = job(Utilities.getFullJobName(project, "perf_${os}", isPR)) {
33             // Set the label.
34             label('performance')
35             steps {
36                     // Batch
37                     batchFile("C:\\tools\\nuget install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory C:\\tools -Prerelease -ExcludeVersion")
38                     batchFile("python C:\\tools\\Microsoft.BenchView.JSONFormat\\tools\\machinedata.py")
39                     batchFile("set __TestIntermediateDir=int&&build.cmd release ${architecture}")
40                     batchFile("tests\\runtest.cmd release ${architecture}")
41                     batchFile("tests\\scripts\\run-xunit-perf.cmd")
42             }
43         }
44
45         // Save machinedata.json to /artifact/bin/ Jenkins dir
46         def archiveSettings = new ArchivalSettings()
47         archiveSettings.addFiles('sandbox\\perf-*.xml')
48         archiveSettings.addFiles('machinedata.json')
49         Utilities.addArchival(newJob, archiveSettings)
50
51         Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
52
53         // For perf, we need to keep the run results longer
54         newJob.with {
55             // Enable the log rotator
56             logRotator {
57                 artifactDaysToKeep(7)
58                 daysToKeep(300)
59                 artifactNumToKeep(25)
60                 numToKeep(1000)
61             }
62         }
63         if (isPR) {
64             TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
65             builder.setGithubContext("${os} Perf Tests")
66             builder.triggerOnlyOnComment()
67             builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+perf.*")
68             builder.triggerForBranch(branch)
69             builder.emitTrigger(newJob)
70         }
71         else {
72             // Set a push trigger
73             TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
74             builder.emitTrigger(newJob)
75         }
76     }
77 }
78
79 // Create the Linux/OSX/CentOS coreclr test leg for debug and release and each scenario
80 [true, false].each { isPR ->
81     ['Ubuntu'].each { os ->
82         def osGroup = getOSGroup(os)
83         def architecture = 'x64'
84         def configuration = 'Release'
85         def newJob = job(Utilities.getFullJobName(project, "perf_${os}", isPR)) {
86             steps {
87                 shell("sudo bash ./tests/scripts/perf-prep.sh --branch=${projectName}")
88                 shell("sudo ./init-tools.sh")
89                 shell("""sudo bash ./tests/scripts/run-xunit-perf.sh \\
90                 --testRootDir=\"\${WORKSPACE}/bin/tests/Windows_NT.${architecture}.${configuration}\" \\
91                 --testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
92                 --coreClrBinDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
93                 --mscorlibDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
94                 --coreFxBinDir=\"\${WORKSPACE}/bin/${osGroup}.AnyCPU.${configuration};\${WORKSPACE}/bin/Unix.AnyCPU.${configuration};\${WORKSPACE}/bin/AnyOS.AnyCPU.${configuration}\" \\
95                 --coreFxNativeBinDir=\"\${WORKSPACE}/bin/${osGroup}.${architecture}.${configuration}\"""")
96             }
97         }
98
99         Utilities.setMachineAffinity(newJob, os, 'latest-or-auto') // Just run against Linux VM\92s for now.
100
101         // Save machinedata.json to /artifact/bin/ Jenkins dir
102         def archiveSettings = new ArchivalSettings()
103         archiveSettings.addFiles('sandbox/perf-*.xml')
104         archiveSettings.addFiles('machinedata.json')
105         Utilities.addArchival(newJob, archiveSettings)
106
107         Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
108
109         // For perf, we need to keep the run results longer
110         newJob.with {
111             // Enable the log rotator
112             logRotator {
113                 artifactDaysToKeep(7)
114                 daysToKeep(300)
115                 artifactNumToKeep(25)
116                 numToKeep(1000)
117             }
118         }
119         if (isPR) {
120             TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
121             builder.setGithubContext("${os} Perf Tests")
122             builder.triggerOnlyOnComment()
123             builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+perf.*")
124             builder.triggerForBranch(branch)
125             builder.emitTrigger(newJob)
126         }
127         else {
128             // Set a push trigger
129             TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
130             builder.emitTrigger(newJob)
131         }
132     } // os
133 } // isPR