1+ #! /usr/bin/env bash
2+
3+ source_directory=$BUILD_SOURCESDIRECTORY
4+ core_root_directory=
5+ architecture=x64
6+ framework=netcoreapp3.0
7+ compilation_mode=tiered
8+ repository=$BUILD_REPOSITORY_NAME
9+ branch=$BUILD_SOURCEBRANCH
10+ commit_sha=$BUILD_SOURCEVERSION
11+ build_number=$BUILD_BUILDNUMBER
12+ internal=false
13+ kind=" micro"
14+ run_categories=" coreclr corefx"
15+ csproj=" src\benchmarks\micro\MicroBenchmarks.csproj"
16+ configurations=
17+ run_from_perf_repo=false
18+ use_core_run=true
19+
20+ while (( $# > 0 )) ; do
21+ lowerI=" $( echo $1 | awk ' {print tolower($0)}' ) "
22+ case $lowerI in
23+ --sourcedirectory)
24+ source_directory=$2
25+ shift 2
26+ ;;
27+ --corerootdirectory)
28+ core_root_directory=$2
29+ shift 2
30+ ;;
31+ --architecture)
32+ architecture=$2
33+ shift 2
34+ ;;
35+ --framework)
36+ framework=$2
37+ shift 2
38+ ;;
39+ --compilationmode)
40+ compilation_mode=$2
41+ shift 2
42+ ;;
43+ --repository)
44+ repository=$2
45+ shift 2
46+ ;;
47+ --branch)
48+ branch=$2
49+ shift 2
50+ ;;
51+ --commitsha)
52+ commit_sha=$2
53+ shift 2
54+ ;;
55+ --buildnumber)
56+ build_number=$2
57+ shift 2
58+ ;;
59+ --kind)
60+ kind=$2
61+ shift 2
62+ ;;
63+ --runcategories)
64+ run_categories=$2
65+ shift 2
66+ ;;
67+ --csproj)
68+ csproj=$2
69+ shift 2
70+ ;;
71+ --internal)
72+ internal=true
73+ shift 1
74+ ;;
75+ --configurations)
76+ configurations=$2
77+ shift 2
78+ ;;
79+ --help)
80+ echo " Common settings:"
81+ echo " --corerootdirectory <value> Directory where Core_Root exists, if running perf testing with --corerun"
82+ echo " --architecture <value> Architecture of the testing being run"
83+ echo " --configurations <value> List of key=value pairs that will be passed to perf testing infrastructure."
84+ echo " ex: --configurations \" CompilationMode=Tiered OptimzationLevel=PGO\" "
85+ echo " --help Print help and exit"
86+ echo " "
87+ echo " Advanced settings:"
88+ echo " --framework <value> The framework to run, if not running in master"
89+ echo " --compliationmode <value> The compilation mode if not passing --configurations"
90+ echo " --sourcedirectory <value> The directory of the sources. Defaults to env:BUILD_SOURCESDIRECTORY"
91+ echo " --repository <value> The name of the repository in the <owner>/<repository name> format. Defaults to env:BUILD_REPOSITORY_NAME"
92+ echo " --branch <value> The name of the branch. Defaults to env:BUILD_SOURCEBRANCH"
93+ echo " --commitsha <value> The commit sha1 to run against. Defaults to env:BUILD_SOURCEVERSION"
94+ echo " --buildnumber <value> The build number currently running. Defaults to env:BUILD_BUILDNUMBER"
95+ echo " --csproj The relative path to the benchmark csproj whose tests should be run. Defaults to src\benchmarks\micro\MicroBenchmarks.csproj"
96+ echo " --kind <value> Related to csproj. The kind of benchmarks that should be run. Defaults to micro"
97+ echo " --runcategories <value> Related to csproj. Categories of benchmarks to run. Defaults to \" coreclr corefx\" "
98+ echo " --internal If the benchmarks are running as an official job."
99+ echo " "
100+ exit 0
101+ ;;
102+ esac
103+ done
104+
105+ if [[ " $repository " == " dotnet/performance" ]]; then
106+ run_from_perf_repo=true
107+ fi
108+
109+ if [ -z " $configurations " ]; then
110+ configurations=" CompliationMode=$compilation_mode "
111+ fi
112+
113+ if [ -z " $core_root_directory " ]; then
114+ use_core_run=false
115+ fi
116+
117+ payload_directory=$source_directory /Payload
118+ performance_directory=$payload_directory /performance
119+ workitem_directory=$source_directory /workitem
120+ extra_benchmark_dotnet_arguments=" --iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true"
121+ perflab_arguments=
122+ queue=Ubuntu.1804.Amd64.Open
123+ creator=$BUILD_DEFINITIONNAME
124+ helix_source_prefix=" pr"
125+
126+ if [[ " $internal " == true ]]; then
127+ perflab_arguments=" --upload-to-perflab-container"
128+ helix_source_prefix=" official"
129+ creator=
130+ extra_benchmark_dotnet_arguments=
131+
132+ if [[ " $architecture " = " arm64" ]]; then
133+ queue=Ubuntu.1804.Arm64.Perf
134+ else
135+ queue=Ubuntu.1804.Amd64.Perf
136+ fi
137+ fi
138+
139+ common_setup_arguments=" --frameworks $framework --queue $queue --build-number $build_number --build-configs $configurations "
140+ setup_arguments=" --repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments "
141+
142+ if [[ " $run_from_perf_repo " = true ]]; then
143+ payload_directory=
144+ workitem_directory=$source_directory
145+ performance_directory=$workitem_directory
146+ setup_arguments=" --perf-hash $commit_sha $common_setup_arguments "
147+ else
148+ git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $performance_directory
149+
150+ docs_directory=$performance_directory /docs
151+ mv $docs_directory $workitem_directory
152+ fi
153+
154+ if [[ " $use_core_run " = true ]]; then
155+ new_core_root=$payload_directory /Core_Root
156+ mv $core_root_directory $new_core_root
157+ fi
158+
159+ # Make sure all of our variables are available for future steps
160+ echo " ##vso[task.setvariable variable=UseCoreRun]$use_core_run "
161+ echo " ##vso[task.setvariable variable=Architecture]$architecture "
162+ echo " ##vso[task.setvariable variable=PayloadDirectory]$payload_directory "
163+ echo " ##vso[task.setvariable variable=PerformanceDirectory]$performance_directory "
164+ echo " ##vso[task.setvariable variable=WorkItemDirectory]$workitem_directory "
165+ echo " ##vso[task.setvariable variable=Queue]$queue "
166+ echo " ##vso[task.setvariable variable=SetupArguments]$setup_arguments "
167+ echo " ##vso[task.setvariable variable=Python]python3"
168+ echo " ##vso[task.setvariable variable=PerfLabArguments]$perflab_arguments "
169+ echo " ##vso[task.setvariable variable=ExtraBenchmarkDotNetArguments]$extra_benchmark_dotnet_arguments "
170+ echo " ##vso[task.setvariable variable=BDNCategories]$run_categories "
171+ echo " ##vso[task.setvariable variable=TargetCsproj]$csproj "
172+ echo " ##vso[task.setvariable variable=RunFromPerfRepo]$run_from_perf_repo "
173+ echo " ##vso[task.setvariable variable=Creator]$creator "
174+ echo " ##vso[task.setvariable variable=HelixSourcePrefix]$helix_source_prefix "
175+ echo " ##vso[task.setvariable variable=Kind]$kind "
176+ echo " ##vso[task.setvariable variable=_BuildConfig]$architecture .$kind .$framework "
0 commit comments