1 // Import the utility functionality.
3 import jobs.generation.*;
5 def project = GithubProject
6 def branch = GithubBranchName
7 def projectFolder = Utilities.getFolderName(project) + '/' + Utilities.getFolderName(branch)
9 def static getOSGroup(def os) {
10 def osGroupMap = ['Ubuntu':'Linux',
12 'Ubuntu16.04': 'Linux',
16 'Windows_NT':'Windows_NT',
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}"
27 [true, false].each { isPR ->
28 ['Windows_NT'].each { os ->
29 def newJob = job(Utilities.getFullJobName(project, "perf_${os}", isPR)) {
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")
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)
48 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
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)
59 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
60 builder.emitTrigger(newJob)
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)) {
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")
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')
83 buildNumber('${CORECLR_WINDOWS_BUILD}')
87 // Coreclr build we are trying to test
88 copyArtifacts("dotnet_coreclr/master/checked_ubuntu") {
89 excludePatterns('**/testResults.xml', '**/*.ni.dll')
91 buildNumber('${CORECLR_BUILD}')
95 def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' + 'master'
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')
102 latestSuccessful(true)
106 // Unpack the corefx binaries
107 shell("tar -xf ./bin/build.tar.gz")
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")
113 shell('./init-tools.sh')
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\"""")
125 // Save machinedata.json to /artifact/bin/ Jenkins dir
126 def archiveSettings = new ArchivalSettings()
127 archiveSettings.addFiles('perf-*.xml')
128 Utilities.addArchival(newJob, archiveSettings)
130 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
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)
140 // Set a push trigger
141 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
142 builder.emitTrigger(newJob)