ConcurrentDictionary<TKey, TValue> Exceptions to ThrowHelper (#7079)
[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 projectFolder = Utilities.getFolderName(project) + '/' + Utilities.getFolderName(branch)
8
9 def static getOSGroup(def os) {
10     def osGroupMap = ['Ubuntu':'Linux',
11         'RHEL7.2': 'Linux',
12         'Ubuntu16.04': 'Linux',
13         'Debian8.4':'Linux',
14         'Fedora23':'Linux',
15         'OSX':'OSX',
16         'Windows_NT':'Windows_NT',
17         'FreeBSD':'FreeBSD',
18         'CentOS7.1': 'Linux',
19         'OpenSUSE13.2': 'Linux',
20         'OpenSUSE42.1': 'Linux',
21         'LinuxARMEmulator': 'Linux']
22     def osGroup = osGroupMap.get(os, null) 
23     assert osGroup != null : "Could not find os group for ${os}"
24     return osGroupMap[os]
25 }
26
27 [true, false].each { isPR ->
28     ['Windows_NT'].each { os ->
29         def newJob = job(Utilities.getFullJobName(project, "perf_${os}", isPR)) {
30             // Set the label.
31             label('performance')
32             steps {
33                     // Batch
34                     batchFile("C:\\tools\\nuget install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory C:\\tools -Prerelease")
35                     batchFile("python C:\\tools\\Microsoft.BenchView.JSONFormat.0.1.0-pre008\\tools\\machinedata.py")
36                     batchFile("set __TestIntermediateDir=int&&build.cmd release x64")
37                     batchFile("tests\\runtest.cmd release x64")
38                     batchFile("tests\\scripts\\run-xunit-perf.cmd")
39             }
40         }
41
42         // Save machinedata.json to /artifact/bin/ Jenkins dir
43         def archiveSettings = new ArchivalSettings()
44         archiveSettings.addFiles('sandbox\\perf-*.xml')
45         archiveSettings.addFiles('machinedata.json')
46         Utilities.addArchival(newJob, archiveSettings)
47
48         Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
49         if (isPR) {
50             TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
51             builder.setGithubContext("${os} Perf Tests")
52             builder.triggerOnlyOnComment()
53             builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+perf.*")
54             builder.triggerForBranch(branch)
55             builder.emitTrigger(newJob)
56         }
57         else {
58             // Set a push trigger
59             TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
60             builder.emitTrigger(newJob)
61         }
62     }
63 }
64
65 // Create the Linux/OSX/CentOS coreclr test leg for debug and release and each scenario
66 [true, false].each { isPR ->
67     ['Ubuntu'].each { os ->
68         def osGroup = getOSGroup(os)
69         def architecture = 'x64'
70         def configuration = 'Checked'
71         def newJob = job(Utilities.getFullJobName(project, "perf_${osGroup}", isPR)) {
72             parameters {
73                 stringParam('CORECLR_WINDOWS_BUILD', '', 'Build number to copy CoreCLR windows test binaries from')
74                 stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
75             }
76                     
77             steps {
78                 // Set up the copies
79                 // Coreclr build containing the tests and mscorlib
80                 copyArtifacts("dotnet_coreclr/master/x64_checked_windows_nt_pri1_bld") {
81                     excludePatterns('**/testResults.xml', '**/*.ni.dll')
82                     buildSelector {
83                         buildNumber('${CORECLR_WINDOWS_BUILD}')
84                     }
85                 }
86
87                 // Coreclr build we are trying to test
88                 copyArtifacts("dotnet_coreclr/master/checked_ubuntu") {
89                     excludePatterns('**/testResults.xml', '**/*.ni.dll')
90                     buildSelector {
91                         buildNumber('${CORECLR_BUILD}')
92                     }
93                 }
94
95                 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' + 'master'
96                         
97                 // Corefx components.  We now have full stack builds on all distros we test here, so we can copy straight from CoreFX jobs.
98                 def osJobName = (os == 'Ubuntu') ? 'ubuntu14.04' : os.toLowerCase()
99                 copyArtifacts("${corefxFolder}/${osJobName}_release") {
100                     includePatterns('bin/build.tar.gz')
101                     buildSelector {
102                         latestSuccessful(true)
103                     }
104                 }
105                         
106                 // Unpack the corefx binaries
107                 shell("tar -xf ./bin/build.tar.gz")
108
109                 // Unzip the tests first.  Exit with 0
110                 shell("unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/Windows_NT.${architecture}.${configuration} || exit 0")
111                             
112                 // Execute the tests                               
113                 shell('./init-tools.sh')
114
115                 shell("""sudo bash ./tests/scripts/run-xunit-perf.sh \\
116                 --testRootDir=\"\${WORKSPACE}/bin/tests/Windows_NT.${architecture}.${configuration}\" \\
117                 --testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
118                 --coreClrBinDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
119                 --mscorlibDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
120                 --coreFxBinDir=\"\${WORKSPACE}/bin/${osGroup}.AnyCPU.Release;\${WORKSPACE}/bin/Unix.AnyCPU.Release;\${WORKSPACE}/bin/AnyOS.AnyCPU.Release\" \\
121                 --coreFxNativeBinDir=\"\${WORKSPACE}/bin/${osGroup}.${architecture}.Release\"""")
122             }
123         }
124
125         // Save machinedata.json to /artifact/bin/ Jenkins dir
126         def archiveSettings = new ArchivalSettings()
127         archiveSettings.addFiles('perf-*.xml')
128         Utilities.addArchival(newJob, archiveSettings)
129
130         Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
131         if (isPR) {
132             TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
133             builder.setGithubContext("${os} Perf Tests")
134             builder.triggerOnlyOnComment()
135             builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+perf.*")
136             builder.triggerForBranch(branch)
137             builder.emitTrigger(newJob)
138         }
139         else {
140             // Set a push trigger
141             TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
142             builder.emitTrigger(newJob)
143         }
144     } // os
145 } // isPR