Skip to content

Commit fa9ca3d

Browse files
darrengebadrishc
andauthored
Update BDN tests base to only run framework that is current instead of both 8.0 and 9.0 each time (#1159)
* Trying to scrub out framework (net8.0 or .net9.0) from the results file that is part of that specific test run. DEbug info in there now as it will only run one test. * Remove debug code so ready to try full test run. * Will just try this out in the pipeline * Updated BDN Base Config to only run one Framework (current framework) instead of both net8.0 and net.9.0 each time. Also removed the code from the test script that was scrubbing out the data from the log file as that is no longer needed. * Add ability for user to pass framework as an argument ... but if not passed, then it does both net80 and net90 * Got BDN work with ablity to send framework want to test on and if not specified then it will run on both .net80 and .net90 * Changed it to use a BDNRUNPARAM env var to pass what framework want to run BDN tests under. If don't specify the env var, then it will run both net8.0 and net9.0 * Formatting check failure ... looks like from extra spaces had after a line * minor reorg of code --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
1 parent 0ce6ee6 commit fa9ca3d

3 files changed

Lines changed: 33 additions & 17 deletions

File tree

.github/workflows/ci-bdnbenchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
run: dotnet restore
5757

5858
- name: Run BDN.benchmark Perf Test
59-
run: ./test/BDNPerfTests/run_bdnperftest.ps1 ${{ matrix.test }}
59+
run: ./test/BDNPerfTests/run_bdnperftest.ps1 ${{ matrix.test }} ${{ matrix.framework }}
6060
shell: pwsh
6161
continue-on-error: false
6262

benchmark/BDN.benchmark/Program.cs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,37 @@ public class BaseConfig : ManualConfig
2525

2626
public BaseConfig()
2727
{
28-
AddLogger(ConsoleLogger.Default);
29-
AddExporter(DefaultExporters.Markdown);
30-
AddColumnProvider(DefaultColumnProviders.Instance);
31-
WithSummaryStyle(SummaryStyle.Default.WithSizeUnit(SizeUnit.B));
28+
_ = AddLogger(ConsoleLogger.Default);
29+
_ = AddExporter(DefaultExporters.Markdown);
30+
_ = AddColumnProvider(DefaultColumnProviders.Instance);
31+
_ = WithSummaryStyle(SummaryStyle.Default.WithSizeUnit(SizeUnit.B));
3232

3333
var baseJob = Job.Default.WithGcServer(true);
3434

35-
Net8BaseJob = baseJob.WithRuntime(CoreRuntime.Core80)
35+
Net8BaseJob = baseJob
36+
.WithRuntime(CoreRuntime.Core80)
3637
.WithEnvironmentVariables(new EnvironmentVariable("DOTNET_TieredPGO", "0"));
37-
Net9BaseJob = baseJob.WithRuntime(CoreRuntime.Core90)
38+
Net9BaseJob = baseJob
39+
.WithRuntime(CoreRuntime.Core90)
3840
.WithEnvironmentVariables(new EnvironmentVariable("DOTNET_TieredPGO", "0"));
3941

40-
AddJob(
41-
Net8BaseJob.WithId(".NET 8"),
42-
Net9BaseJob.WithId(".NET 9")
43-
);
42+
// Get value of environment variable BDNRUNPARAM - determines if running net8.0, net9.0 or both (if env var is not set or invalid)
43+
var bdnRunParam = Environment.GetEnvironmentVariable("BDNRUNPARAM");
44+
45+
switch (bdnRunParam)
46+
{
47+
case "net8.0":
48+
_ = AddJob(Net8BaseJob.WithId(".NET 8"));
49+
break;
50+
case "net9.0":
51+
_ = AddJob(Net9BaseJob.WithId(".NET 9"));
52+
break;
53+
default:
54+
_ = AddJob(
55+
Net8BaseJob.WithId(".NET 8"),
56+
Net9BaseJob.WithId(".NET 9")
57+
);
58+
break;
59+
}
4460
}
4561
}

test/BDNPerfTests/run_bdnperftest.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
./run_bdnperftest.ps1
1616
./run_bdnperftest.ps1 BDN.benchmark.Operations.BasicOperations.*
1717
./run_bdnperftest.ps1 Operations.BasicOperations <-- can run this way but this is how specify in ci-bdnbenchmark.yml
18+
./run_bdnperftest.ps1 Operations.BasicOperations net9.0
1819
#>
1920

2021
param (
21-
[string]$currentTest = "BDN.benchmark.Operations.BasicOperations.*"
22+
[string]$currentTest = "BDN.benchmark.Operations.BasicOperations.*",
23+
[string]$framework = "net8.0"
2224
)
2325

2426
$OFS = "`r`n"
@@ -57,7 +59,6 @@ function AnalyzeResult {
5759
return $false # the values are too different
5860
}
5961
}
60-
6162

6263
######### ParseValueFromResults ###########
6364
#
@@ -95,7 +96,6 @@ param ($ResultsLine, $columnNum)
9596
# Set all the config options
9697
$configFile = "BDN_Benchmark_Config.json"
9798
$configuration = "Release"
98-
$framework = "net8.0"
9999
$allocatedColumn = "-1" # last one is allocated, just to ensure in case other column gets added
100100
$acceptableAllocatedRange = "10" # percent allowed variance when comparing expected vs actual found value - same for linux and windows.
101101

@@ -184,16 +184,16 @@ $resultsFileName = $currentTestStripped + "_" + $CurrentOS + ".results"
184184
$resultsFile = "$resultsDir/$resultsFileName"
185185
$BDNbenchmarkErrorFile = "$errorLogDir/$currentTestStripped" + "_StandardError_" +$CurrentOS+".log"
186186
$filter = $currentTest
187+
$exporter = "json"
187188

188189
Write-Output " "
189-
Write-Output "** Start: dotnet run -c $configuration -f $framework --filter $filter --project $BDNbenchmarkPath --exporters json > $resultsFile 2> $BDNbenchmarkErrorFile"
190-
dotnet run -c $configuration -f $framework --filter $filter --project $BDNbenchmarkPath --exporters json > $resultsFile 2> $BDNbenchmarkErrorFile
190+
Write-Output "** Start: dotnet run -c $configuration -f $framework --project $BDNbenchmarkPath --filter $filter --exporters $exporter -e BDNRUNPARAM=$framework > $resultsFile 2> $BDNbenchmarkErrorFile"
191+
dotnet run -c $configuration -f $framework --project $BDNbenchmarkPath --filter $filter --exporters $exporter -e BDNRUNPARAM=$framework > $resultsFile 2> $BDNbenchmarkErrorFile
191192

192193
Write-Output "** BDN Benchmark for $filter finished"
193194
Write-Output " "
194195

195196
Write-Output "**** ANALYZE THE RESULTS FILE $resultsFile ****"
196-
197197
# First check if results file is there and if not, error out gracefully
198198
if (-not (Test-Path -Path $resultsFile)) {
199199
Write-Error -Message "The test results file $resultsFile does not exist. Check to make sure the test was ran." -Category ObjectNotFound

0 commit comments

Comments
 (0)