From 112da804924bea926df6c8857d2c4cfd70b35d4b Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 09:47:35 -0700 Subject: [PATCH 01/17] Perf scripts --- scripts/perftests/PerformanceTestRunner.ps1 | 7 ++- .../perftests/PerformanceTestUtilities.ps1 | 18 ++++--- .../perftests/testCases/Test-NuGetClient.ps1 | 48 +++++++++++-------- .../perftests/testCases/Test-OrchardCore.ps1 | 26 +++++----- scripts/perftests/testCases/Test-Orleans.ps1 | 26 +++++----- 5 files changed, 70 insertions(+), 55 deletions(-) diff --git a/scripts/perftests/PerformanceTestRunner.ps1 b/scripts/perftests/PerformanceTestRunner.ps1 index c09569bea4f..8a44e431d0c 100644 --- a/scripts/perftests/PerformanceTestRunner.ps1 +++ b/scripts/perftests/PerformanceTestRunner.ps1 @@ -20,6 +20,7 @@ How many times to run each test. The default is 3 .PARAMETER skipRepoCleanup Whether to delete the checked out repos from the test cases. +.PARAMETER extraArguments .EXAMPLE .\PerformanceTestRunner.ps1 -resultsFolderPath resultsFolder -nugetClientFilePaths F:\NuGetExe\NuGet.exe,"C:\Program Files\dotnet\dotnet.exe" #> @@ -31,7 +32,8 @@ Param( [string] $testRootFolderPath, [string] $logsFolderPath, [int] $iterationCount = 3, - [switch] $skipRepoCleanup + [switch] $skipRepoCleanup, + [string] $extraArguments ) . "$PSScriptRoot\PerformanceTestUtilities.ps1" @@ -100,7 +102,8 @@ Try -resultsFolderPath $resultsFolderPath ` -logsFolderPath $logsFolderPath ` -nugetFoldersPath $nugetFoldersPath ` - -iterationCount $iterationCount + -iterationCount $iterationCount ` + -extraArguments $extraArguments } Catch { diff --git a/scripts/perftests/PerformanceTestUtilities.ps1 b/scripts/perftests/PerformanceTestUtilities.ps1 index 01086fd4516..417ed06b32f 100644 --- a/scripts/perftests/PerformanceTestUtilities.ps1 +++ b/scripts/perftests/PerformanceTestUtilities.ps1 @@ -102,12 +102,13 @@ Function DownloadRepository([string] $repository, [string] $commitHash, [string] { If (Test-Path $sourceFolderPath) { - Log "Skipping the cloning of $repository as $sourceFolderPath is not empty" -color "Yellow" + Log "Skipping the cloning of $repository as $sourceFolderPath is not empty. Running git clean" -color "Yellow" + git clean -xdf } Else { git clone $repository $sourceFolderPath - git -C $sourceFolderPath checkout $commitHash + git -C $sourceFolderPath checkout $commitHash | out-null } } @@ -124,7 +125,7 @@ Function GetSolutionFilePath([string] $repository, [string] $sourceFolderPath) } Else { - $possibleSln = Get-ChildItem $sourceFolderPath *.sln + $possibleSln = Get-ChildItem $sourceFolderPath *.sln | Where-Object{$_.FullName -notlike '*.slnf'} If ($possibleSln.Length -eq 0) { Log "No solution files found in $sourceFolderPath" "red" @@ -224,7 +225,7 @@ Function SetupNuGetFolders([string] $nugetClientFilePath, [string] $nugetFolders # This should only be invoked by the the performance tests Function CleanNuGetFolders([string] $nugetClientFilePath, [string] $nugetFoldersPath) { - Log "Cleanup up the NuGet folders - global packages folder, http/plugins caches. Client: $nugetClientFilePath. Folders: $nugetFoldersPath" + Log "Cleanup the NuGet folders - global packages folder, http/plugins caches. Client: $nugetClientFilePath. Folders: $nugetFoldersPath" LocalsClearAll $nugetClientFilePath @@ -249,8 +250,12 @@ Function RunPerformanceTestsOnGitRepository( [string] $nugetFoldersPath, [string] $logsFolderPath, [int] $iterationCount, - [switch] $staticGraphRestore) + [switch] $staticGraphRestore, + [string] $extraArguments) { + Log $extraArguments "red" + $sb = [scriptblock]::Create($extraArguments) + Log $sb "green" $solutionFilePath = SetupGitRepository -repository $repoUrl -commitHash $commitHash -sourceFolderPath $([System.IO.Path]::Combine($sourceRootFolderPath, $testCaseName)) SetupNuGetFolders $nugetClientFilePath $nugetFoldersPath . "$PSScriptRoot\RunPerformanceTests.ps1" ` @@ -260,7 +265,8 @@ Function RunPerformanceTestsOnGitRepository( -logsFolderPath $logsFolderPath ` -nugetFoldersPath $nugetFoldersPath ` -iterationCount $iterationCount ` - -staticGraphRestore:$staticGraphRestore + -staticGraphRestore:$staticGraphRestore ` + $sb } Function GetProcessorInfo() diff --git a/scripts/perftests/testCases/Test-NuGetClient.ps1 b/scripts/perftests/testCases/Test-NuGetClient.ps1 index d6f553a5584..75450d8b2e5 100644 --- a/scripts/perftests/testCases/Test-NuGetClient.ps1 +++ b/scripts/perftests/testCases/Test-NuGetClient.ps1 @@ -8,36 +8,42 @@ Param( [Parameter(Mandatory = $True)] [string] $logsFolderPath, [string] $nugetFoldersPath, - [int] $iterationCount + [int] $iterationCount, + [string] $extraArguments ) +Log $extraArguments "blue" + . "$PSScriptRoot\..\PerformanceTestUtilities.ps1" $repoUrl = "https://github.com/NuGet/NuGet.Client.git" -$commitHash = "37c31cd7c1c2429a643a881fe637dc1d718d7259" -$repoName = GenerateNameFromGitUrl $repoUrl -$resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$repoName.csv") -$sourcePath = $([System.IO.Path]::Combine($sourceRootFolderPath, $repoName)) -$solutionFilePath = SetupGitRepository $repoUrl $commitHash $sourcePath -# It's fine if this is run from here. It is run again the performance test script, but it'll set it to the same values. -# Additionally, this will cleanup the extras from the bootstrapping which are already in the local folder, allowing us to get more accurate measurements -SetupNuGetFolders $nugetClientFilePath $nugetFoldersPath -$currentWorkingDirectory = $pwd +$testCaseName = GenerateNameFromGitUrl $repoUrl +$resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") -Try -{ - Set-Location $sourcePath - . "$sourcePath\configure.ps1" *>>$null -} -Finally +if(![string]::IsNullOrEmpty($extraArguments)) { - Set-Location $currentWorkingDirectory -} +RunPerformanceTestsOnGitRepository ` + -nugetClientFilePath $nugetClientFilePath ` + -sourceRootFolderPath $sourceRootFolderPath ` + -testCaseName $testCaseName ` + -repoUrl $repoUrl ` + -commitHash "f6279fb833960d9128d16c4e911705167e0bb754" ` + -resultsFilePath $resultsFilePath ` + -logsFolderPath $logsFolderPath ` + -nugetFoldersPath $nugetFoldersPath ` + -iterationCount $iterationCount ` + -extraArguments $extraArguments +} +Else { -. "$PSScriptRoot\..\RunPerformanceTests.ps1" ` +RunPerformanceTestsOnGitRepository ` -nugetClientFilePath $nugetClientFilePath ` - -solutionFilePath $solutionFilePath ` + -sourceRootFolderPath $sourceRootFolderPath ` + -testCaseName $testCaseName ` + -repoUrl $repoUrl ` + -commitHash "f6279fb833960d9128d16c4e911705167e0bb754" ` -resultsFilePath $resultsFilePath ` -logsFolderPath $logsFolderPath ` -nugetFoldersPath $nugetFoldersPath ` - -iterationCount $iterationCount \ No newline at end of file + -iterationCount $iterationCount +} \ No newline at end of file diff --git a/scripts/perftests/testCases/Test-OrchardCore.ps1 b/scripts/perftests/testCases/Test-OrchardCore.ps1 index 8e87770acab..b3b17902493 100644 --- a/scripts/perftests/testCases/Test-OrchardCore.ps1 +++ b/scripts/perftests/testCases/Test-OrchardCore.ps1 @@ -13,17 +13,17 @@ Param( . "$PSScriptRoot\..\PerformanceTestUtilities.ps1" -$repoUrl = "https://github.com/OrchardCMS/OrchardCore.git" -$testCaseName = GenerateNameFromGitUrl $repoUrl -$resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") +# $repoUrl = "https://github.com/OrchardCMS/OrchardCore.git" +# $testCaseName = GenerateNameFromGitUrl $repoUrl +# $resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") -RunPerformanceTestsOnGitRepository ` - -nugetClientFilePath $nugetClientFilePath ` - -sourceRootFolderPath $sourceRootFolderPath ` - -testCaseName $testCaseName ` - -repoUrl $repoUrl ` - -commitHash "991ff7b536811c8ff2c603e30d754b858d009fa2" ` - -resultsFilePath $resultsFilePath ` - -logsFolderPath $logsFolderPath ` - -nugetFoldersPath $nugetFoldersPath ` - -iterationCount $iterationCount \ No newline at end of file +# RunPerformanceTestsOnGitRepository ` +# -nugetClientFilePath $nugetClientFilePath ` +# -sourceRootFolderPath $sourceRootFolderPath ` +# -testCaseName $testCaseName ` +# -repoUrl $repoUrl ` +# -commitHash "991ff7b536811c8ff2c603e30d754b858d009fa2" ` +# -resultsFilePath $resultsFilePath ` +# -logsFolderPath $logsFolderPath ` +# -nugetFoldersPath $nugetFoldersPath ` +# -iterationCount $iterationCount \ No newline at end of file diff --git a/scripts/perftests/testCases/Test-Orleans.ps1 b/scripts/perftests/testCases/Test-Orleans.ps1 index 7a3790cedec..b15832e3836 100644 --- a/scripts/perftests/testCases/Test-Orleans.ps1 +++ b/scripts/perftests/testCases/Test-Orleans.ps1 @@ -13,17 +13,17 @@ Param( . "$PSScriptRoot\..\PerformanceTestUtilities.ps1" -$repoUrl = "https://github.com/dotnet/orleans.git" -$testCaseName = GenerateNameFromGitUrl $repoUrl -$resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") +# $repoUrl = "https://github.com/dotnet/orleans.git" +# $testCaseName = GenerateNameFromGitUrl $repoUrl +# $resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") -RunPerformanceTestsOnGitRepository ` - -nugetClientFilePath $nugetClientFilePath ` - -sourceRootFolderPath $sourceRootFolderPath ` - -testCaseName $testCaseName ` - -repoUrl $repoUrl ` - -commitHash "00fe587cc9d18db3bb238f1e78abf46835b97457" ` - -resultsFilePath $resultsFilePath ` - -logsFolderPath $logsFolderPath ` - -nugetFoldersPath $nugetFoldersPath ` - -iterationCount $iterationCount \ No newline at end of file +# RunPerformanceTestsOnGitRepository ` +# -nugetClientFilePath $nugetClientFilePath ` +# -sourceRootFolderPath $sourceRootFolderPath ` +# -testCaseName $testCaseName ` +# -repoUrl $repoUrl ` +# -commitHash "00fe587cc9d18db3bb238f1e78abf46835b97457" ` +# -resultsFilePath $resultsFilePath ` +# -logsFolderPath $logsFolderPath ` +# -nugetFoldersPath $nugetFoldersPath ` +# -iterationCount $iterationCount \ No newline at end of file From f8dc493e7440384c5a057cab96bef75909b10c1e Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 12:31:38 -0700 Subject: [PATCH 02/17] Fix up scripts --- scripts/perftests/PerformanceTestUtilities.ps1 | 18 +++++------------- .../perftests/testCases/Test-NuGetClient.ps1 | 6 ++---- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/scripts/perftests/PerformanceTestUtilities.ps1 b/scripts/perftests/PerformanceTestUtilities.ps1 index 417ed06b32f..e3d3df0ebe8 100644 --- a/scripts/perftests/PerformanceTestUtilities.ps1 +++ b/scripts/perftests/PerformanceTestUtilities.ps1 @@ -253,20 +253,12 @@ Function RunPerformanceTestsOnGitRepository( [switch] $staticGraphRestore, [string] $extraArguments) { - Log $extraArguments "red" - $sb = [scriptblock]::Create($extraArguments) - Log $sb "green" $solutionFilePath = SetupGitRepository -repository $repoUrl -commitHash $commitHash -sourceFolderPath $([System.IO.Path]::Combine($sourceRootFolderPath, $testCaseName)) + + $sb = [scriptblock]::Create("$PSScriptRoot\RunPerformanceTests.ps1 -nugetClientFilePath ""$nugetClientFilePath"" -solutionFilePath $solutionFilePath -resultsFilePath $resultsFilePath -logsFolderPath $logsFolderPath -nugetFoldersPath $nugetFoldersPath -iterationCount $iterationCount " + $extraArguments) + Log $sb "green" SetupNuGetFolders $nugetClientFilePath $nugetFoldersPath - . "$PSScriptRoot\RunPerformanceTests.ps1" ` - -nugetClientFilePath $nugetClientFilePath ` - -solutionFilePath $solutionFilePath ` - -resultsFilePath $resultsFilePath ` - -logsFolderPath $logsFolderPath ` - -nugetFoldersPath $nugetFoldersPath ` - -iterationCount $iterationCount ` - -staticGraphRestore:$staticGraphRestore ` - $sb + & $sb } Function GetProcessorInfo() @@ -537,5 +529,5 @@ Function RunRestore( Add-Content -Path $resultsFilePath -Value $data - Log "Finished measuring." + Log "Finished measuring in $totalTime sec" } \ No newline at end of file diff --git a/scripts/perftests/testCases/Test-NuGetClient.ps1 b/scripts/perftests/testCases/Test-NuGetClient.ps1 index 75450d8b2e5..6b4cd1108d0 100644 --- a/scripts/perftests/testCases/Test-NuGetClient.ps1 +++ b/scripts/perftests/testCases/Test-NuGetClient.ps1 @@ -12,8 +12,6 @@ Param( [string] $extraArguments ) -Log $extraArguments "blue" - . "$PSScriptRoot\..\PerformanceTestUtilities.ps1" $repoUrl = "https://github.com/NuGet/NuGet.Client.git" @@ -34,8 +32,8 @@ RunPerformanceTestsOnGitRepository ` -iterationCount $iterationCount ` -extraArguments $extraArguments } -Else { - +Else +{ RunPerformanceTestsOnGitRepository ` -nugetClientFilePath $nugetClientFilePath ` -sourceRootFolderPath $sourceRootFolderPath ` From 7508a979d9abd1704cdd38993a794b53034c9cd5 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 12:46:20 -0700 Subject: [PATCH 03/17] cleanup --- scripts/perftests/PerformanceTestRunner.ps1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/perftests/PerformanceTestRunner.ps1 b/scripts/perftests/PerformanceTestRunner.ps1 index 8a44e431d0c..eec721ce928 100644 --- a/scripts/perftests/PerformanceTestRunner.ps1 +++ b/scripts/perftests/PerformanceTestRunner.ps1 @@ -32,6 +32,7 @@ Param( [string] $testRootFolderPath, [string] $logsFolderPath, [int] $iterationCount = 3, + [string] $testCaseDirectory [switch] $skipRepoCleanup, [string] $extraArguments ) @@ -88,10 +89,16 @@ Try Exit 1 } - Log "Discovering the test cases." - $testFiles = $(Get-ChildItem $PSScriptRoot\testCases "Test-*.ps1" ) | ForEach-Object { $_.FullName } - Log "Discovered test cases: $testFiles" "green" + $testCasesDirectory = $PSScriptRoot\testCases + If ([string]::IsNullOrWhiteSpace($testCaseDirectory)) + { + $testCasesDirectory = $testCaseDirectory + } + Log "Discovering the test cases in $testCasesDirectory" + $testFiles = $(Get-ChildItem $testCasesDirectory "Test-*.ps1" ) | ForEach-Object { $_.FullName } + Log "Discovered test cases: $testFiles" "green" + $testFiles | ForEach-Object { $testCase = $_ Try From 03900f21153007353e7047d6b8d1372ebb85708b Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 13:01:20 -0700 Subject: [PATCH 04/17] fix up tests --- .../perftests/PerformanceTestUtilities.ps1 | 6 ++++ .../perftests/testCases/Test-OrchardCore.ps1 | 29 ++++++++++--------- scripts/perftests/testCases/Test-Orleans.ps1 | 29 ++++++++++--------- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/scripts/perftests/PerformanceTestUtilities.ps1 b/scripts/perftests/PerformanceTestUtilities.ps1 index e3d3df0ebe8..9adb1f32837 100644 --- a/scripts/perftests/PerformanceTestUtilities.ps1 +++ b/scripts/perftests/PerformanceTestUtilities.ps1 @@ -477,6 +477,12 @@ Function RunRestore( $staticGraphOutputValue = "N/A" } + If($isClientDotnetExe -Or $isClientMSBuild) + { + # Always disable NuGetAudit. It's something impacted by the time of execution + $arguments.Add("/p:NuGetAudit=false") + } + $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() $logs = . $nugetClientFilePath $arguments | Out-String diff --git a/scripts/perftests/testCases/Test-OrchardCore.ps1 b/scripts/perftests/testCases/Test-OrchardCore.ps1 index b3b17902493..11925bc0573 100644 --- a/scripts/perftests/testCases/Test-OrchardCore.ps1 +++ b/scripts/perftests/testCases/Test-OrchardCore.ps1 @@ -8,22 +8,23 @@ Param( [Parameter(Mandatory = $True)] [string] $logsFolderPath, [string] $nugetFoldersPath, - [int] $iterationCount + [int] $iterationCount, + [string] $extraArguments ) . "$PSScriptRoot\..\PerformanceTestUtilities.ps1" -# $repoUrl = "https://github.com/OrchardCMS/OrchardCore.git" -# $testCaseName = GenerateNameFromGitUrl $repoUrl -# $resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") +$repoUrl = "https://github.com/OrchardCMS/OrchardCore.git" +$testCaseName = GenerateNameFromGitUrl $repoUrl +$resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") -# RunPerformanceTestsOnGitRepository ` -# -nugetClientFilePath $nugetClientFilePath ` -# -sourceRootFolderPath $sourceRootFolderPath ` -# -testCaseName $testCaseName ` -# -repoUrl $repoUrl ` -# -commitHash "991ff7b536811c8ff2c603e30d754b858d009fa2" ` -# -resultsFilePath $resultsFilePath ` -# -logsFolderPath $logsFolderPath ` -# -nugetFoldersPath $nugetFoldersPath ` -# -iterationCount $iterationCount \ No newline at end of file +RunPerformanceTestsOnGitRepository ` + -nugetClientFilePath $nugetClientFilePath ` + -sourceRootFolderPath $sourceRootFolderPath ` + -testCaseName $testCaseName ` + -repoUrl $repoUrl ` + -commitHash "991ff7b536811c8ff2c603e30d754b858d009fa2" ` + -resultsFilePath $resultsFilePath ` + -logsFolderPath $logsFolderPath ` + -nugetFoldersPath $nugetFoldersPath ` + -iterationCount $iterationCount \ No newline at end of file diff --git a/scripts/perftests/testCases/Test-Orleans.ps1 b/scripts/perftests/testCases/Test-Orleans.ps1 index b15832e3836..ae57420d6f0 100644 --- a/scripts/perftests/testCases/Test-Orleans.ps1 +++ b/scripts/perftests/testCases/Test-Orleans.ps1 @@ -8,22 +8,23 @@ Param( [Parameter(Mandatory = $True)] [string] $logsFolderPath, [string] $nugetFoldersPath, - [int] $iterationCount + [int] $iterationCount, + [string] $extraArguments ) . "$PSScriptRoot\..\PerformanceTestUtilities.ps1" -# $repoUrl = "https://github.com/dotnet/orleans.git" -# $testCaseName = GenerateNameFromGitUrl $repoUrl -# $resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") +$repoUrl = "https://github.com/dotnet/orleans.git" +$testCaseName = GenerateNameFromGitUrl $repoUrl +$resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") -# RunPerformanceTestsOnGitRepository ` -# -nugetClientFilePath $nugetClientFilePath ` -# -sourceRootFolderPath $sourceRootFolderPath ` -# -testCaseName $testCaseName ` -# -repoUrl $repoUrl ` -# -commitHash "00fe587cc9d18db3bb238f1e78abf46835b97457" ` -# -resultsFilePath $resultsFilePath ` -# -logsFolderPath $logsFolderPath ` -# -nugetFoldersPath $nugetFoldersPath ` -# -iterationCount $iterationCount \ No newline at end of file +RunPerformanceTestsOnGitRepository ` + -nugetClientFilePath $nugetClientFilePath ` + -sourceRootFolderPath $sourceRootFolderPath ` + -testCaseName $testCaseName ` + -repoUrl $repoUrl ` + -commitHash "00fe587cc9d18db3bb238f1e78abf46835b97457" ` + -resultsFilePath $resultsFilePath ` + -logsFolderPath $logsFolderPath ` + -nugetFoldersPath $nugetFoldersPath ` + -iterationCount $iterationCount \ No newline at end of file From d031f66f89d9f60cafe922a8333ce9d3ff21a9d2 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 13:20:01 -0700 Subject: [PATCH 05/17] cleanup --- scripts/perftests/PerformanceTestRunner.ps1 | 6 ++--- .../perftests/PerformanceTestUtilities.ps1 | 5 ++-- .../perftests/testCases/Test-NuGetClient.ps1 | 14 ++++------ .../perftests/testCases/Test-OrchardCore.ps1 | 27 ++++++++++++++----- scripts/perftests/testCases/Test-Orleans.ps1 | 27 ++++++++++++++----- 5 files changed, 51 insertions(+), 28 deletions(-) diff --git a/scripts/perftests/PerformanceTestRunner.ps1 b/scripts/perftests/PerformanceTestRunner.ps1 index eec721ce928..fdede79a255 100644 --- a/scripts/perftests/PerformanceTestRunner.ps1 +++ b/scripts/perftests/PerformanceTestRunner.ps1 @@ -32,7 +32,7 @@ Param( [string] $testRootFolderPath, [string] $logsFolderPath, [int] $iterationCount = 3, - [string] $testCaseDirectory + [string] $testCaseDirectory, [switch] $skipRepoCleanup, [string] $extraArguments ) @@ -89,8 +89,8 @@ Try Exit 1 } - $testCasesDirectory = $PSScriptRoot\testCases - If ([string]::IsNullOrWhiteSpace($testCaseDirectory)) + $testCasesDirectory = "$PSScriptRoot\testCases" + If (-not [string]::IsNullOrWhiteSpace($testCaseDirectory)) { $testCasesDirectory = $testCaseDirectory } diff --git a/scripts/perftests/PerformanceTestUtilities.ps1 b/scripts/perftests/PerformanceTestUtilities.ps1 index 9adb1f32837..47f04208525 100644 --- a/scripts/perftests/PerformanceTestUtilities.ps1 +++ b/scripts/perftests/PerformanceTestUtilities.ps1 @@ -243,16 +243,17 @@ Function CleanNuGetFolders([string] $nugetClientFilePath, [string] $nugetFolders Function RunPerformanceTestsOnGitRepository( [string] $nugetClientFilePath, [string] $sourceRootFolderPath, - [string] $testCaseName, [string] $repoUrl, [string] $commitHash, - [string] $resultsFilePath, + [string] $resultsFolderPath, [string] $nugetFoldersPath, [string] $logsFolderPath, [int] $iterationCount, [switch] $staticGraphRestore, [string] $extraArguments) { + $testCaseName = GenerateNameFromGitUrl $repoUrl + $resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") $solutionFilePath = SetupGitRepository -repository $repoUrl -commitHash $commitHash -sourceFolderPath $([System.IO.Path]::Combine($sourceRootFolderPath, $testCaseName)) $sb = [scriptblock]::Create("$PSScriptRoot\RunPerformanceTests.ps1 -nugetClientFilePath ""$nugetClientFilePath"" -solutionFilePath $solutionFilePath -resultsFilePath $resultsFilePath -logsFolderPath $logsFolderPath -nugetFoldersPath $nugetFoldersPath -iterationCount $iterationCount " + $extraArguments) diff --git a/scripts/perftests/testCases/Test-NuGetClient.ps1 b/scripts/perftests/testCases/Test-NuGetClient.ps1 index 6b4cd1108d0..ce449a5f251 100644 --- a/scripts/perftests/testCases/Test-NuGetClient.ps1 +++ b/scripts/perftests/testCases/Test-NuGetClient.ps1 @@ -14,19 +14,15 @@ Param( . "$PSScriptRoot\..\PerformanceTestUtilities.ps1" -$repoUrl = "https://github.com/NuGet/NuGet.Client.git" -$testCaseName = GenerateNameFromGitUrl $repoUrl -$resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") - if(![string]::IsNullOrEmpty($extraArguments)) { RunPerformanceTestsOnGitRepository ` -nugetClientFilePath $nugetClientFilePath ` -sourceRootFolderPath $sourceRootFolderPath ` -testCaseName $testCaseName ` - -repoUrl $repoUrl ` + -repoUrl "https://github.com/NuGet/NuGet.Client.git" ` -commitHash "f6279fb833960d9128d16c4e911705167e0bb754" ` - -resultsFilePath $resultsFilePath ` + -resultsFolderPath $resultsFolderPath ` -logsFolderPath $logsFolderPath ` -nugetFoldersPath $nugetFoldersPath ` -iterationCount $iterationCount ` @@ -38,10 +34,10 @@ RunPerformanceTestsOnGitRepository ` -nugetClientFilePath $nugetClientFilePath ` -sourceRootFolderPath $sourceRootFolderPath ` -testCaseName $testCaseName ` - -repoUrl $repoUrl ` + -repoUrl "https://github.com/NuGet/NuGet.Client.git" ` -commitHash "f6279fb833960d9128d16c4e911705167e0bb754" ` - -resultsFilePath $resultsFilePath ` + -resultsFolderPath $resultsFolderPath ` -logsFolderPath $logsFolderPath ` -nugetFoldersPath $nugetFoldersPath ` - -iterationCount $iterationCount + -iterationCount $iterationCount } \ No newline at end of file diff --git a/scripts/perftests/testCases/Test-OrchardCore.ps1 b/scripts/perftests/testCases/Test-OrchardCore.ps1 index 11925bc0573..acbb0624329 100644 --- a/scripts/perftests/testCases/Test-OrchardCore.ps1 +++ b/scripts/perftests/testCases/Test-OrchardCore.ps1 @@ -14,17 +14,30 @@ Param( . "$PSScriptRoot\..\PerformanceTestUtilities.ps1" -$repoUrl = "https://github.com/OrchardCMS/OrchardCore.git" -$testCaseName = GenerateNameFromGitUrl $repoUrl -$resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") - +if(![string]::IsNullOrEmpty($extraArguments)) +{ +RunPerformanceTestsOnGitRepository ` + -nugetClientFilePath $nugetClientFilePath ` + -sourceRootFolderPath $sourceRootFolderPath ` + -testCaseName $testCaseName ` + -repoUrl "https://github.com/OrchardCMS/OrchardCore.git" ` + -commitHash "991ff7b536811c8ff2c603e30d754b858d009fa2" ` + -resultsFolderPath $resultsFolderPath ` + -logsFolderPath $logsFolderPath ` + -nugetFoldersPath $nugetFoldersPath ` + -iterationCount $iterationCount ` + -extraArguments $extraArguments +} +Else +{ RunPerformanceTestsOnGitRepository ` -nugetClientFilePath $nugetClientFilePath ` -sourceRootFolderPath $sourceRootFolderPath ` -testCaseName $testCaseName ` - -repoUrl $repoUrl ` + -repoUrl "https://github.com/OrchardCMS/OrchardCore.git" ` -commitHash "991ff7b536811c8ff2c603e30d754b858d009fa2" ` - -resultsFilePath $resultsFilePath ` + -resultsFolderPath $resultsFolderPath ` -logsFolderPath $logsFolderPath ` -nugetFoldersPath $nugetFoldersPath ` - -iterationCount $iterationCount \ No newline at end of file + -iterationCount $iterationCount +} \ No newline at end of file diff --git a/scripts/perftests/testCases/Test-Orleans.ps1 b/scripts/perftests/testCases/Test-Orleans.ps1 index ae57420d6f0..64e4e83b482 100644 --- a/scripts/perftests/testCases/Test-Orleans.ps1 +++ b/scripts/perftests/testCases/Test-Orleans.ps1 @@ -14,17 +14,30 @@ Param( . "$PSScriptRoot\..\PerformanceTestUtilities.ps1" -$repoUrl = "https://github.com/dotnet/orleans.git" -$testCaseName = GenerateNameFromGitUrl $repoUrl -$resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") - +if(![string]::IsNullOrEmpty($extraArguments)) +{ +RunPerformanceTestsOnGitRepository ` + -nugetClientFilePath $nugetClientFilePath ` + -sourceRootFolderPath $sourceRootFolderPath ` + -testCaseName $testCaseName ` + -repoUrl "https://github.com/dotnet/orleans.git" ` + -commitHash "00fe587cc9d18db3bb238f1e78abf46835b97457" ` + -resultsFolderPath $resultsFolderPath ` + -logsFolderPath $logsFolderPath ` + -nugetFoldersPath $nugetFoldersPath ` + -iterationCount $iterationCount ` + -extraArguments $extraArguments +} +Else +{ RunPerformanceTestsOnGitRepository ` -nugetClientFilePath $nugetClientFilePath ` -sourceRootFolderPath $sourceRootFolderPath ` -testCaseName $testCaseName ` - -repoUrl $repoUrl ` + -repoUrl "https://github.com/dotnet/orleans.git" ` -commitHash "00fe587cc9d18db3bb238f1e78abf46835b97457" ` - -resultsFilePath $resultsFilePath ` + -resultsFolderPath $resultsFolderPath ` -logsFolderPath $logsFolderPath ` -nugetFoldersPath $nugetFoldersPath ` - -iterationCount $iterationCount \ No newline at end of file + -iterationCount $iterationCount +} \ No newline at end of file From 15dc0e055737322bb5308589bde074f193612ed4 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 14:29:45 -0700 Subject: [PATCH 06/17] Cleanup --- scripts/perftests/PerformanceTestUtilities.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/perftests/PerformanceTestUtilities.ps1 b/scripts/perftests/PerformanceTestUtilities.ps1 index 47f04208525..661523f26fa 100644 --- a/scripts/perftests/PerformanceTestUtilities.ps1 +++ b/scripts/perftests/PerformanceTestUtilities.ps1 @@ -103,7 +103,7 @@ Function DownloadRepository([string] $repository, [string] $commitHash, [string] If (Test-Path $sourceFolderPath) { Log "Skipping the cloning of $repository as $sourceFolderPath is not empty. Running git clean" -color "Yellow" - git clean -xdf + git clean -xdf | out-null } Else { @@ -255,9 +255,9 @@ Function RunPerformanceTestsOnGitRepository( $testCaseName = GenerateNameFromGitUrl $repoUrl $resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") $solutionFilePath = SetupGitRepository -repository $repoUrl -commitHash $commitHash -sourceFolderPath $([System.IO.Path]::Combine($sourceRootFolderPath, $testCaseName)) - + $sb = [scriptblock]::Create("$PSScriptRoot\RunPerformanceTests.ps1 -nugetClientFilePath ""$nugetClientFilePath"" -solutionFilePath $solutionFilePath -resultsFilePath $resultsFilePath -logsFolderPath $logsFolderPath -nugetFoldersPath $nugetFoldersPath -iterationCount $iterationCount " + $extraArguments) - Log $sb "green" + Log $sb "cyan" SetupNuGetFolders $nugetClientFilePath $nugetFoldersPath & $sb } From a8eb87812a203117ef960189bd178d094af2e138 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 14:30:49 -0700 Subject: [PATCH 07/17] Cleanup --- scripts/perftests/PerformanceTestUtilities.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/perftests/PerformanceTestUtilities.ps1 b/scripts/perftests/PerformanceTestUtilities.ps1 index 661523f26fa..2ccc2dfc4d6 100644 --- a/scripts/perftests/PerformanceTestUtilities.ps1 +++ b/scripts/perftests/PerformanceTestUtilities.ps1 @@ -255,9 +255,7 @@ Function RunPerformanceTestsOnGitRepository( $testCaseName = GenerateNameFromGitUrl $repoUrl $resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") $solutionFilePath = SetupGitRepository -repository $repoUrl -commitHash $commitHash -sourceFolderPath $([System.IO.Path]::Combine($sourceRootFolderPath, $testCaseName)) - $sb = [scriptblock]::Create("$PSScriptRoot\RunPerformanceTests.ps1 -nugetClientFilePath ""$nugetClientFilePath"" -solutionFilePath $solutionFilePath -resultsFilePath $resultsFilePath -logsFolderPath $logsFolderPath -nugetFoldersPath $nugetFoldersPath -iterationCount $iterationCount " + $extraArguments) - Log $sb "cyan" SetupNuGetFolders $nugetClientFilePath $nugetFoldersPath & $sb } From 312356f65bcc12f0e2aed24f3aca81fc15c2cb4d Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 15:14:28 -0700 Subject: [PATCH 08/17] make the perf scripts better --- scripts/perftests/PerformanceTestUtilities.ps1 | 17 ++++++++++++----- scripts/perftests/RunPerformanceTests.ps1 | 6 +++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/scripts/perftests/PerformanceTestUtilities.ps1 b/scripts/perftests/PerformanceTestUtilities.ps1 index 2ccc2dfc4d6..58257ba9a6d 100644 --- a/scripts/perftests/PerformanceTestUtilities.ps1 +++ b/scripts/perftests/PerformanceTestUtilities.ps1 @@ -103,7 +103,7 @@ Function DownloadRepository([string] $repository, [string] $commitHash, [string] If (Test-Path $sourceFolderPath) { Log "Skipping the cloning of $repository as $sourceFolderPath is not empty. Running git clean" -color "Yellow" - git clean -xdf | out-null + git -C $sourceFolderPath clean -xdf | out-null } Else { @@ -347,7 +347,8 @@ Function RunRestore( [switch] $cleanPluginsCache, [switch] $killMsBuildAndDotnetExeProcesses, [switch] $force, - [switch] $staticGraphRestore) + [switch] $staticGraphRestore, + [switch] $cleanRepository) { $isClientDotnetExe = IsClientDotnetExe $nugetClientFilePath $isClientMSBuild = IsClientMSBuildExe $nugetClientFilePath @@ -359,7 +360,7 @@ Function RunRestore( Return } - Log "Running $nugetClientFilePath restore with cleanGlobalPackagesFolder:$cleanGlobalPackagesFolder cleanHttpCache:$cleanHttpCache cleanPluginsCache:$cleanPluginsCache killMsBuildAndDotnetExeProcesses:$killMsBuildAndDotnetExeProcesses force:$force" + Log "Running $nugetClientFilePath restore with cleanGlobalPackagesFolder:$cleanGlobalPackagesFolder cleanHttpCache:$cleanHttpCache cleanPluginsCache:$cleanPluginsCache killMsBuildAndDotnetExeProcesses:$killMsBuildAndDotnetExeProcesses force:$force staticGraphRestore:$staticGraphRestore cleanRepository:$cleanRepository" $solutionPackagesFolderPath = $Env:NUGET_SOLUTION_PACKAGES_FOLDER_PATH @@ -407,6 +408,12 @@ Function RunRestore( } } + if($cleanRepository) + { + $repositoryPath = [System.IO.Path]::GetDirectoryName($solutionFilePath) + git -C $repositoryPath clean -xdf | out-null + } + if($killMsBuildAndDotnetExeProcesses) { Stop-Process -name msbuild*,dotnet* -Force @@ -521,7 +528,7 @@ Function RunRestore( { $columnHeaders = "Client Name,Client Version,Solution Name,Test Run ID,Scenario Name,Total Time (seconds),Core Restore Time (seconds),Force,Static Graph," + ` "Global Packages Folder .nupkg Count,Global Packages Folder .nupkg Size (MB),Global Packages Folder File Count,Global Packages Folder File Size (MB),Clean Global Packages Folder," + ` - "HTTP Cache File Count,HTTP Cache File Size (MB),Clean HTTP Cache,Plugins Cache File Count,Plugins Cache File Size (MB),Clean Plugins Cache,Kill MSBuild and dotnet Processes," + ` + "HTTP Cache File Count,HTTP Cache File Size (MB),Clean HTTP Cache,Plugins Cache File Count,Plugins Cache File Size (MB),Clean Plugins Cache,Kill MSBuild and dotnet Processes,Clean git repo," + ` "Processor Name,Processor Physical Core Count,Processor Logical Core Count" OutFileWithCreateFolders $resultsFilePath $columnHeaders @@ -529,7 +536,7 @@ Function RunRestore( $data = "$clientName,$clientVersion,$solutionName,$testRunId,$scenarioName,$totalTime,$restoreCoreTime,$force,$staticGraphOutputValue," + ` "$($globalPackagesFolderNupkgFilesInfo.Count),$($globalPackagesFolderNupkgFilesInfo.TotalSizeInMB),$($globalPackagesFolderFilesInfo.Count),$($globalPackagesFolderFilesInfo.TotalSizeInMB),$cleanGlobalPackagesFolder," + ` - "$($httpCacheFilesInfo.Count),$($httpCacheFilesInfo.TotalSizeInMB),$cleanHttpCache,$($pluginsCacheFilesInfo.Count),$($pluginsCacheFilesInfo.TotalSizeInMB),$cleanPluginsCache,$killMsBuildAndDotnetExeProcesses," + ` + "$($httpCacheFilesInfo.Count),$($httpCacheFilesInfo.TotalSizeInMB),$cleanHttpCache,$($pluginsCacheFilesInfo.Count),$($pluginsCacheFilesInfo.TotalSizeInMB),$cleanPluginsCache,$killMsBuildAndDotnetExeProcesses,$cleanRepository" + ` "$($processorInfo.Name),$($processorInfo.NumberOfCores),$($processorInfo.NumberOfLogicalProcessors)" Add-Content -Path $resultsFilePath -Value $data diff --git a/scripts/perftests/RunPerformanceTests.ps1 b/scripts/perftests/RunPerformanceTests.ps1 index 7d3ec2ad565..94f16153337 100644 --- a/scripts/perftests/RunPerformanceTests.ps1 +++ b/scripts/perftests/RunPerformanceTests.ps1 @@ -182,7 +182,7 @@ Try If (!$skipWarmup) { Log "Running 1x warmup restore" - $enabledSwitches = @("cleanGlobalPackagesFolder", "cleanHttpCache", "cleanPluginsCache", "killMSBuildAndDotnetExeProcess") + $enabledSwitches = @("cleanGlobalPackagesFolder", "cleanHttpCache", "cleanPluginsCache", "killMSBuildAndDotnetExeProcess", "cleanRepository") If ($isPackagesConfig) { $enabledSwitches += "isPackagesConfig" @@ -198,7 +198,7 @@ Try If (!$skipCleanRestores) { Log "Running $($iterationCount)x clean restores" - $enabledSwitches = @("cleanGlobalPackagesFolder", "cleanHttpCache", "cleanPluginsCache", "killMSBuildAndDotnetExeProcess") + $enabledSwitches = @("cleanGlobalPackagesFolder", "cleanHttpCache", "cleanPluginsCache", "killMSBuildAndDotnetExeProcess", "cleanRepository") If ($isPackagesConfig) { $enabledSwitches += "isPackagesConfig" @@ -214,7 +214,7 @@ Try If (!$skipColdRestores) { Log "Running $($iterationCount)x without a global packages folder" - $enabledSwitches = @("cleanGlobalPackagesFolder", "killMSBuildAndDotnetExeProcess") + $enabledSwitches = @("cleanGlobalPackagesFolder", "killMSBuildAndDotnetExeProcess", "cleanRepository") If ($isPackagesConfig) { $enabledSwitches += "isPackagesConfig" From 278b9174e29d50903cf375f3d8d86a25296cc2e5 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 16:56:15 -0700 Subject: [PATCH 09/17] Cleanup --- scripts/nuget-debug-helpers.ps1 | 7 ++- scripts/perftests/PerformanceTestRunner.ps1 | 9 ++-- .../perftests/PerformanceTestUtilities.ps1 | 45 ++++++++++++++++--- scripts/perftests/RunPerformanceTests.ps1 | 33 ++++++++++++-- .../perftests/testCases/Test-NuGetClient.ps1 | 8 ++-- .../perftests/testCases/Test-OrchardCore.ps1 | 6 +-- scripts/perftests/testCases/Test-Orleans.ps1 | 43 ------------------ 7 files changed, 86 insertions(+), 65 deletions(-) delete mode 100644 scripts/perftests/testCases/Test-Orleans.ps1 diff --git a/scripts/nuget-debug-helpers.ps1 b/scripts/nuget-debug-helpers.ps1 index d97862d9b62..0c835d7d065 100644 --- a/scripts/nuget-debug-helpers.ps1 +++ b/scripts/nuget-debug-helpers.ps1 @@ -1,6 +1,11 @@ +Param([string] $Config) + $NuGetClientRoot= Resolve-Path $(Join-Path $PSScriptRoot "..\") -$Configuration = "Debug" +if (-not [string]::IsNullOrEmpty($Config)) { + $Configuration = "Debug" +} + $NETFramework = "net472" $NETStandard = "netstandard2.0" $NETCoreApp = "netcoreapp5.0" diff --git a/scripts/perftests/PerformanceTestRunner.ps1 b/scripts/perftests/PerformanceTestRunner.ps1 index fdede79a255..5e9a9b6bc75 100644 --- a/scripts/perftests/PerformanceTestRunner.ps1 +++ b/scripts/perftests/PerformanceTestRunner.ps1 @@ -20,7 +20,10 @@ How many times to run each test. The default is 3 .PARAMETER skipRepoCleanup Whether to delete the checked out repos from the test cases. -.PARAMETER extraArguments +.PARAMETER additionalOptions +Additional options such as ones to skip certain runs like -skipWarmup or maybe run the local version of NuGet, -useLocallyBuiltNuGet. +To get the list of all options check out RunPerformanceTests.ps1 in the same folder. + .EXAMPLE .\PerformanceTestRunner.ps1 -resultsFolderPath resultsFolder -nugetClientFilePaths F:\NuGetExe\NuGet.exe,"C:\Program Files\dotnet\dotnet.exe" #> @@ -34,7 +37,7 @@ Param( [int] $iterationCount = 3, [string] $testCaseDirectory, [switch] $skipRepoCleanup, - [string] $extraArguments + [string] $additionalOptions ) . "$PSScriptRoot\PerformanceTestUtilities.ps1" @@ -110,7 +113,7 @@ Try -logsFolderPath $logsFolderPath ` -nugetFoldersPath $nugetFoldersPath ` -iterationCount $iterationCount ` - -extraArguments $extraArguments + -additionalOptions $additionalOptions } Catch { diff --git a/scripts/perftests/PerformanceTestUtilities.ps1 b/scripts/perftests/PerformanceTestUtilities.ps1 index 58257ba9a6d..81982a02df1 100644 --- a/scripts/perftests/PerformanceTestUtilities.ps1 +++ b/scripts/perftests/PerformanceTestUtilities.ps1 @@ -181,7 +181,7 @@ Function GetClientVersion([string] $nugetClientFilePath) ElseIf($(IsClientMSBuildExe $nugetClientFilePath)) { $clientDir = Split-Path -Path $nugetClientFilePath - $nugetClientPath = Resolve-Path (Join-Path -Path $clientDir -ChildPath "../../../Common7/IDE/CommonExtensions/Microsoft/NuGet/NuGet.Build.Tasks.dll") + $nugetClientPath = Resolve-Path (Join-Path -Path $clientDir -ChildPath "../../../../Common7/IDE/CommonExtensions/Microsoft/NuGet/NuGet.Build.Tasks.dll") $versionInfo = Get-ChildItem $nugetClientPath | % versioninfo | Select-Object FileVersion Return $(($versionInfo -split '\n')[0]).TrimStart("@{").TrimEnd('}').Substring("FileVersion=".Length) } @@ -249,13 +249,12 @@ Function RunPerformanceTestsOnGitRepository( [string] $nugetFoldersPath, [string] $logsFolderPath, [int] $iterationCount, - [switch] $staticGraphRestore, - [string] $extraArguments) + [string] $additionalOptions) { $testCaseName = GenerateNameFromGitUrl $repoUrl $resultsFilePath = [System.IO.Path]::Combine($resultsFolderPath, "$testCaseName.csv") $solutionFilePath = SetupGitRepository -repository $repoUrl -commitHash $commitHash -sourceFolderPath $([System.IO.Path]::Combine($sourceRootFolderPath, $testCaseName)) - $sb = [scriptblock]::Create("$PSScriptRoot\RunPerformanceTests.ps1 -nugetClientFilePath ""$nugetClientFilePath"" -solutionFilePath $solutionFilePath -resultsFilePath $resultsFilePath -logsFolderPath $logsFolderPath -nugetFoldersPath $nugetFoldersPath -iterationCount $iterationCount " + $extraArguments) + $sb = [scriptblock]::Create("$PSScriptRoot\RunPerformanceTests.ps1 -nugetClientFilePath ""$nugetClientFilePath"" -solutionFilePath $solutionFilePath -resultsFilePath $resultsFilePath -logsFolderPath $logsFolderPath -nugetFoldersPath $nugetFoldersPath -iterationCount $iterationCount " + $additionalOptions) SetupNuGetFolders $nugetClientFilePath $nugetFoldersPath & $sb } @@ -348,7 +347,8 @@ Function RunRestore( [switch] $killMsBuildAndDotnetExeProcesses, [switch] $force, [switch] $staticGraphRestore, - [switch] $cleanRepository) + [switch] $cleanRepository, + [switch] $useLocallyBuiltNuGet) { $isClientDotnetExe = IsClientDotnetExe $nugetClientFilePath $isClientMSBuild = IsClientMSBuildExe $nugetClientFilePath @@ -489,9 +489,40 @@ Function RunRestore( $arguments.Add("/p:NuGetAudit=false") } + if($useLocallyBuiltNuGet) + { + if($isClientMSBuild) + { + $NETFramework = "net472" + $NETStandard = "netstandard2.0" + $NETCoreApp = "netcoreapp5.0" + $Configuration = "release" + $packDllPath = Join-Path $NuGetClientRoot "artifacts\NuGet.Build.Tasks.Pack\bin\$Configuration\$NETFramework\NuGet.Build.Tasks.Pack.dll" + $packTargetsPath = Join-Path $NuGetClientRoot "src\NuGet.Core\NuGet.Build.Tasks.Pack\NuGet.Build.Tasks.Pack.targets" + $restoreDllPath = Join-Path $NuGetClientRoot "artifacts\NuGet.Build.Tasks\bin\$Configuration\$NETFramework\NuGet.Build.Tasks.dll" + $nugetRestoreTargetsPath = Join-Path $NuGetClientRoot "src\NuGet.Core\NuGet.Build.Tasks\NuGet.targets" + $nugetPropsPath = Join-Path $NuGetClientRoot "src\NuGet.Core\NuGet.Build.Tasks\NuGet.props" + $consoleExePath = Join-Path $NuGetClientRoot "artifacts\NuGet.Build.Tasks.Console\bin\$Configuration\$NETFramework\NuGet.Build.Tasks.Console.exe" + $arguments.Add("/p:NuGetRestoreTargets=$nugetRestoreTargetsPath"); + $arguments.Add("/p:NuGetPropsFile=$nugetPropsPath"); + $arguments.Add("/p:RestoreTaskAssemblyFile=$restoreDllPath"); + $arguments.Add("/p:NuGetBuildTasksPackTargets=$packTargetsPath"); + $arguments.Add("/p:NuGetConsoleProcessFileName=$consoleExePath"); + $arguments.Add("/p:ImportNuGetBuildTasksPackTargetsFromSdk=true"); + $arguments.Add("/p:NuGetPackTaskAssemblyFile=$packDllPath"); + } + else + { + Log "Locally built NuGet can only be used with msbuild.exe" "red" + } + } + $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() + + # What if I invoke nuget custom here. $logs = . $nugetClientFilePath $arguments | Out-String + if($LASTEXITCODE -ne 0) { throw "The command `"$nugetClientFilePath $arguments`" finished with exit code $LASTEXITCODE.`n" + $logs @@ -526,7 +557,7 @@ Function RunRestore( If (!(Test-Path $resultsFilePath)) { - $columnHeaders = "Client Name,Client Version,Solution Name,Test Run ID,Scenario Name,Total Time (seconds),Core Restore Time (seconds),Force,Static Graph," + ` + $columnHeaders = "Client Name,Client Version,Locally Built NuGet,Solution Name,Test Run ID,Scenario Name,Total Time (seconds),Core Restore Time (seconds),Force,Static Graph," + ` "Global Packages Folder .nupkg Count,Global Packages Folder .nupkg Size (MB),Global Packages Folder File Count,Global Packages Folder File Size (MB),Clean Global Packages Folder," + ` "HTTP Cache File Count,HTTP Cache File Size (MB),Clean HTTP Cache,Plugins Cache File Count,Plugins Cache File Size (MB),Clean Plugins Cache,Kill MSBuild and dotnet Processes,Clean git repo," + ` "Processor Name,Processor Physical Core Count,Processor Logical Core Count" @@ -534,7 +565,7 @@ Function RunRestore( OutFileWithCreateFolders $resultsFilePath $columnHeaders } - $data = "$clientName,$clientVersion,$solutionName,$testRunId,$scenarioName,$totalTime,$restoreCoreTime,$force,$staticGraphOutputValue," + ` + $data = "$clientName,$clientVersion,$useLocallyBuiltNuGet,$solutionName,$testRunId,$scenarioName,$totalTime,$restoreCoreTime,$force,$staticGraphOutputValue," + ` "$($globalPackagesFolderNupkgFilesInfo.Count),$($globalPackagesFolderNupkgFilesInfo.TotalSizeInMB),$($globalPackagesFolderFilesInfo.Count),$($globalPackagesFolderFilesInfo.TotalSizeInMB),$cleanGlobalPackagesFolder," + ` "$($httpCacheFilesInfo.Count),$($httpCacheFilesInfo.TotalSizeInMB),$cleanHttpCache,$($pluginsCacheFilesInfo.Count),$($pluginsCacheFilesInfo.TotalSizeInMB),$cleanPluginsCache,$killMsBuildAndDotnetExeProcesses,$cleanRepository" + ` "$($processorInfo.Name),$($processorInfo.NumberOfCores),$($processorInfo.NumberOfLogicalProcessors)" diff --git a/scripts/perftests/RunPerformanceTests.ps1 b/scripts/perftests/RunPerformanceTests.ps1 index 94f16153337..07cdcc2feee 100644 --- a/scripts/perftests/RunPerformanceTests.ps1 +++ b/scripts/perftests/RunPerformanceTests.ps1 @@ -50,6 +50,9 @@ Skips no-op restore. .PARAMETER staticGraphRestore Uses static graph restore if applicable for the client. +.PARAMETER useLocallyBuiltNuGet +Whether to use locally built NuGet. Only works with msbuild.exe. It simply bootstraps the release configuration pre-built version of NuGet . + .EXAMPLE .\RunPerformanceTests.ps1 -nugetClientFilePath "C:\Program Files\dotnet\dotnet.exe" -solutionFilePath F:\NuGet.Client\NuGet.sln -resultsFilePath results.csv #> @@ -69,7 +72,8 @@ Param( [switch] $skipColdRestores, [switch] $skipForceRestores, [switch] $skipNoOpRestores, - [switch] $staticGraphRestore + [switch] $staticGraphRestore, + [switch] $useLocallyBuiltNuGet ) . "$PSScriptRoot\PerformanceTestUtilities.ps1" @@ -191,6 +195,10 @@ Try { $enabledSwitches += "staticGraphRestore" } + If ($useLocallyBuiltNuGet) + { + $enabledSwitches += "useLocallyBuiltNuGet" + } $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "warmup" -enabledSwitches $enabledSwitches RunRestore @arguments } @@ -207,6 +215,10 @@ Try { $enabledSwitches += "staticGraphRestore" } + If ($useLocallyBuiltNuGet) + { + $enabledSwitches += "useLocallyBuiltNuGet" + } $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "arctic" -enabledSwitches $enabledSwitches 1..$iterationCount | % { RunRestore @arguments } } @@ -223,6 +235,10 @@ Try { $enabledSwitches += "staticGraphRestore" } + If ($useLocallyBuiltNuGet) + { + $enabledSwitches += "useLocallyBuiltNuGet" + } $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "cold" -enabledSwitches $enabledSwitches 1..$iterationCount | % { RunRestore @arguments } } @@ -235,6 +251,10 @@ Try { $enabledSwitches += "staticGraphRestore" } + If ($useLocallyBuiltNuGet) + { + $enabledSwitches += "useLocallyBuiltNuGet" + } $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "force" -enabledSwitches $enabledSwitches 1..$iterationCount | % { RunRestore @arguments } } @@ -242,14 +262,19 @@ Try If (!$skipNoOpRestores) { Log "Running $($iterationCount)x no-op restores" + + $enabledSwitches = @("") If ($staticGraphRestore) { - $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "noop" -enabledSwitches @("staticGraphRestore") + $enabledSwitches += "staticGraphRestore" } - Else + If ($useLocallyBuiltNuGet) { - $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "noop" + $enabledSwitches += "useLocallyBuiltNuGet" } + + $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "noop" -enabledSwitches $enabledSwitches + 1..$iterationCount | % { RunRestore @arguments } } diff --git a/scripts/perftests/testCases/Test-NuGetClient.ps1 b/scripts/perftests/testCases/Test-NuGetClient.ps1 index ce449a5f251..d42eca3229f 100644 --- a/scripts/perftests/testCases/Test-NuGetClient.ps1 +++ b/scripts/perftests/testCases/Test-NuGetClient.ps1 @@ -9,24 +9,24 @@ Param( [string] $logsFolderPath, [string] $nugetFoldersPath, [int] $iterationCount, - [string] $extraArguments + [string] $additionalOptions ) . "$PSScriptRoot\..\PerformanceTestUtilities.ps1" -if(![string]::IsNullOrEmpty($extraArguments)) +if(![string]::IsNullOrEmpty($additionalOptions)) { RunPerformanceTestsOnGitRepository ` -nugetClientFilePath $nugetClientFilePath ` -sourceRootFolderPath $sourceRootFolderPath ` -testCaseName $testCaseName ` -repoUrl "https://github.com/NuGet/NuGet.Client.git" ` - -commitHash "f6279fb833960d9128d16c4e911705167e0bb754" ` + -commitHash "4b906a9bd9dde24da0caaecbaf43c747b17f2668" ` -resultsFolderPath $resultsFolderPath ` -logsFolderPath $logsFolderPath ` -nugetFoldersPath $nugetFoldersPath ` -iterationCount $iterationCount ` - -extraArguments $extraArguments + -additionalOptions $additionalOptions } Else { diff --git a/scripts/perftests/testCases/Test-OrchardCore.ps1 b/scripts/perftests/testCases/Test-OrchardCore.ps1 index acbb0624329..7f0e0fb0fa8 100644 --- a/scripts/perftests/testCases/Test-OrchardCore.ps1 +++ b/scripts/perftests/testCases/Test-OrchardCore.ps1 @@ -9,12 +9,12 @@ Param( [string] $logsFolderPath, [string] $nugetFoldersPath, [int] $iterationCount, - [string] $extraArguments + [string] $additionalOptions ) . "$PSScriptRoot\..\PerformanceTestUtilities.ps1" -if(![string]::IsNullOrEmpty($extraArguments)) +if(![string]::IsNullOrEmpty($additionalOptions)) { RunPerformanceTestsOnGitRepository ` -nugetClientFilePath $nugetClientFilePath ` @@ -26,7 +26,7 @@ RunPerformanceTestsOnGitRepository ` -logsFolderPath $logsFolderPath ` -nugetFoldersPath $nugetFoldersPath ` -iterationCount $iterationCount ` - -extraArguments $extraArguments + -additionalOptions $additionalOptions } Else { diff --git a/scripts/perftests/testCases/Test-Orleans.ps1 b/scripts/perftests/testCases/Test-Orleans.ps1 deleted file mode 100644 index 64e4e83b482..00000000000 --- a/scripts/perftests/testCases/Test-Orleans.ps1 +++ /dev/null @@ -1,43 +0,0 @@ -Param( - [Parameter(Mandatory = $True)] - [string] $nugetClientFilePath, - [Parameter(Mandatory = $True)] - [string] $sourceRootFolderPath, - [Parameter(Mandatory = $True)] - [string] $resultsFolderPath, - [Parameter(Mandatory = $True)] - [string] $logsFolderPath, - [string] $nugetFoldersPath, - [int] $iterationCount, - [string] $extraArguments -) - -. "$PSScriptRoot\..\PerformanceTestUtilities.ps1" - -if(![string]::IsNullOrEmpty($extraArguments)) -{ -RunPerformanceTestsOnGitRepository ` - -nugetClientFilePath $nugetClientFilePath ` - -sourceRootFolderPath $sourceRootFolderPath ` - -testCaseName $testCaseName ` - -repoUrl "https://github.com/dotnet/orleans.git" ` - -commitHash "00fe587cc9d18db3bb238f1e78abf46835b97457" ` - -resultsFolderPath $resultsFolderPath ` - -logsFolderPath $logsFolderPath ` - -nugetFoldersPath $nugetFoldersPath ` - -iterationCount $iterationCount ` - -extraArguments $extraArguments -} -Else -{ -RunPerformanceTestsOnGitRepository ` - -nugetClientFilePath $nugetClientFilePath ` - -sourceRootFolderPath $sourceRootFolderPath ` - -testCaseName $testCaseName ` - -repoUrl "https://github.com/dotnet/orleans.git" ` - -commitHash "00fe587cc9d18db3bb238f1e78abf46835b97457" ` - -resultsFolderPath $resultsFolderPath ` - -logsFolderPath $logsFolderPath ` - -nugetFoldersPath $nugetFoldersPath ` - -iterationCount $iterationCount -} \ No newline at end of file From 87d1e48203fcd05c16d1554338e2e2d96d01e6d4 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 16:58:48 -0700 Subject: [PATCH 10/17] Cleanup --- scripts/perftests/PerformanceTestRunner.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/perftests/PerformanceTestRunner.ps1 b/scripts/perftests/PerformanceTestRunner.ps1 index 5e9a9b6bc75..a203ee5ced5 100644 --- a/scripts/perftests/PerformanceTestRunner.ps1 +++ b/scripts/perftests/PerformanceTestRunner.ps1 @@ -26,6 +26,13 @@ To get the list of all options check out RunPerformanceTests.ps1 in the same fol .EXAMPLE .\PerformanceTestRunner.ps1 -resultsFolderPath resultsFolder -nugetClientFilePaths F:\NuGetExe\NuGet.exe,"C:\Program Files\dotnet\dotnet.exe" + +.EXAMPLE +.\PerformanceTestRunner.ps1 -resultsFolderPath resultsFolder -nugetClientFilePaths "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe" -skipRepoCleanup -additionalOptions "-useLocallyBuiltNuGet -staticGraphRestore" + +.EXAMPLE +.\PerformanceTestRunner.ps1 -resultsFolderPath resultsFolder -nugetClientFilePaths "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe" -skipRepoCleanup -additionalOptions "-useLocallyBuiltNuGet" + #> Param( [Parameter(Mandatory = $true)] From 58c589c222c80cf5562b0764e4cd5fe855d25815 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 17:04:58 -0700 Subject: [PATCH 11/17] Cleanup --- .../perftests/PerformanceTestUtilities.ps1 | 10 +++++-- scripts/perftests/RunPerformanceTests.ps1 | 27 +++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/scripts/perftests/PerformanceTestUtilities.ps1 b/scripts/perftests/PerformanceTestUtilities.ps1 index 81982a02df1..3b9971419c6 100644 --- a/scripts/perftests/PerformanceTestUtilities.ps1 +++ b/scripts/perftests/PerformanceTestUtilities.ps1 @@ -348,7 +348,8 @@ Function RunRestore( [switch] $force, [switch] $staticGraphRestore, [switch] $cleanRepository, - [switch] $useLocallyBuiltNuGet) + [switch] $useLocallyBuiltNuGet, + [switch] $forceLegacyResolverFallback) { $isClientDotnetExe = IsClientDotnetExe $nugetClientFilePath $isClientMSBuild = IsClientMSBuildExe $nugetClientFilePath @@ -485,10 +486,15 @@ Function RunRestore( If($isClientDotnetExe -Or $isClientMSBuild) { - # Always disable NuGetAudit. It's something impacted by the time of execution + # Always disable NuGetAudit. It's something impacted by the time of execution, and not helpful in these type of performance tests. $arguments.Add("/p:NuGetAudit=false") } + if(($isClientDotnetExe -Or $isClientMSBuild) -And $forceLegacyResolverFallback) + { + $arguments.Add("/p:RestoreUseLegacyDependencyResolver=true") + } + if($useLocallyBuiltNuGet) { if($isClientMSBuild) diff --git a/scripts/perftests/RunPerformanceTests.ps1 b/scripts/perftests/RunPerformanceTests.ps1 index 07cdcc2feee..b3aaa65ece5 100644 --- a/scripts/perftests/RunPerformanceTests.ps1 +++ b/scripts/perftests/RunPerformanceTests.ps1 @@ -51,7 +51,9 @@ Skips no-op restore. Uses static graph restore if applicable for the client. .PARAMETER useLocallyBuiltNuGet -Whether to use locally built NuGet. Only works with msbuild.exe. It simply bootstraps the release configuration pre-built version of NuGet . +Whether to use locally built NuGet. Only works with msbuild.exe. It simply bootstraps the release configuration pre-built version of NuGet + +.PARAMETER forceLegacyResolverFallback .EXAMPLE .\RunPerformanceTests.ps1 -nugetClientFilePath "C:\Program Files\dotnet\dotnet.exe" -solutionFilePath F:\NuGet.Client\NuGet.sln -resultsFilePath results.csv @@ -73,7 +75,8 @@ Param( [switch] $skipForceRestores, [switch] $skipNoOpRestores, [switch] $staticGraphRestore, - [switch] $useLocallyBuiltNuGet + [switch] $useLocallyBuiltNuGet, + [switch] $forceLegacyResolverFallback ) . "$PSScriptRoot\PerformanceTestUtilities.ps1" @@ -199,6 +202,10 @@ Try { $enabledSwitches += "useLocallyBuiltNuGet" } + If ($forceLegacyResolverFallback) + { + $enabledSwitches += "forceLegacyResolverFallback" + } $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "warmup" -enabledSwitches $enabledSwitches RunRestore @arguments } @@ -219,6 +226,10 @@ Try { $enabledSwitches += "useLocallyBuiltNuGet" } + If ($forceLegacyResolverFallback) + { + $enabledSwitches += "forceLegacyResolverFallback" + } $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "arctic" -enabledSwitches $enabledSwitches 1..$iterationCount | % { RunRestore @arguments } } @@ -239,6 +250,10 @@ Try { $enabledSwitches += "useLocallyBuiltNuGet" } + If ($forceLegacyResolverFallback) + { + $enabledSwitches += "forceLegacyResolverFallback" + } $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "cold" -enabledSwitches $enabledSwitches 1..$iterationCount | % { RunRestore @arguments } } @@ -255,6 +270,10 @@ Try { $enabledSwitches += "useLocallyBuiltNuGet" } + If ($forceLegacyResolverFallback) + { + $enabledSwitches += "forceLegacyResolverFallback" + } $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "force" -enabledSwitches $enabledSwitches 1..$iterationCount | % { RunRestore @arguments } } @@ -272,6 +291,10 @@ Try { $enabledSwitches += "useLocallyBuiltNuGet" } + If ($forceLegacyResolverFallback) + { + $enabledSwitches += "forceLegacyResolverFallback" + } $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "noop" -enabledSwitches $enabledSwitches From 803dc41e27f9a45cb0ea85fd26a62c2fa2976953 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Wed, 14 Aug 2024 17:50:29 -0700 Subject: [PATCH 12/17] Cleanup --- scripts/nuget-debug-helpers.ps1 | 2 +- scripts/perftests/PerformanceTestUtilities.ps1 | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/nuget-debug-helpers.ps1 b/scripts/nuget-debug-helpers.ps1 index 0c835d7d065..2e75cf2123d 100644 --- a/scripts/nuget-debug-helpers.ps1 +++ b/scripts/nuget-debug-helpers.ps1 @@ -2,7 +2,7 @@ Param([string] $Config) $NuGetClientRoot= Resolve-Path $(Join-Path $PSScriptRoot "..\") -if (-not [string]::IsNullOrEmpty($Config)) { +if ([string]::IsNullOrEmpty($Config)) { $Configuration = "Debug" } diff --git a/scripts/perftests/PerformanceTestUtilities.ps1 b/scripts/perftests/PerformanceTestUtilities.ps1 index 3b9971419c6..7fdc8d1d845 100644 --- a/scripts/perftests/PerformanceTestUtilities.ps1 +++ b/scripts/perftests/PerformanceTestUtilities.ps1 @@ -500,8 +500,6 @@ Function RunRestore( if($isClientMSBuild) { $NETFramework = "net472" - $NETStandard = "netstandard2.0" - $NETCoreApp = "netcoreapp5.0" $Configuration = "release" $packDllPath = Join-Path $NuGetClientRoot "artifacts\NuGet.Build.Tasks.Pack\bin\$Configuration\$NETFramework\NuGet.Build.Tasks.Pack.dll" $packTargetsPath = Join-Path $NuGetClientRoot "src\NuGet.Core\NuGet.Build.Tasks.Pack\NuGet.Build.Tasks.Pack.targets" @@ -565,7 +563,7 @@ Function RunRestore( { $columnHeaders = "Client Name,Client Version,Locally Built NuGet,Solution Name,Test Run ID,Scenario Name,Total Time (seconds),Core Restore Time (seconds),Force,Static Graph," + ` "Global Packages Folder .nupkg Count,Global Packages Folder .nupkg Size (MB),Global Packages Folder File Count,Global Packages Folder File Size (MB),Clean Global Packages Folder," + ` - "HTTP Cache File Count,HTTP Cache File Size (MB),Clean HTTP Cache,Plugins Cache File Count,Plugins Cache File Size (MB),Clean Plugins Cache,Kill MSBuild and dotnet Processes,Clean git repo," + ` + "HTTP Cache File Count,HTTP Cache File Size (MB),Clean HTTP Cache,Plugins Cache File Count,Plugins Cache File Size (MB),Clean Plugins Cache,Kill MSBuild and dotnet Processes,Clean git repo,Force Legacy resolver," + ` "Processor Name,Processor Physical Core Count,Processor Logical Core Count" OutFileWithCreateFolders $resultsFilePath $columnHeaders @@ -573,7 +571,7 @@ Function RunRestore( $data = "$clientName,$clientVersion,$useLocallyBuiltNuGet,$solutionName,$testRunId,$scenarioName,$totalTime,$restoreCoreTime,$force,$staticGraphOutputValue," + ` "$($globalPackagesFolderNupkgFilesInfo.Count),$($globalPackagesFolderNupkgFilesInfo.TotalSizeInMB),$($globalPackagesFolderFilesInfo.Count),$($globalPackagesFolderFilesInfo.TotalSizeInMB),$cleanGlobalPackagesFolder," + ` - "$($httpCacheFilesInfo.Count),$($httpCacheFilesInfo.TotalSizeInMB),$cleanHttpCache,$($pluginsCacheFilesInfo.Count),$($pluginsCacheFilesInfo.TotalSizeInMB),$cleanPluginsCache,$killMsBuildAndDotnetExeProcesses,$cleanRepository" + ` + "$($httpCacheFilesInfo.Count),$($httpCacheFilesInfo.TotalSizeInMB),$cleanHttpCache,$($pluginsCacheFilesInfo.Count),$($pluginsCacheFilesInfo.TotalSizeInMB),$cleanPluginsCache,$killMsBuildAndDotnetExeProcesses,$cleanRepository,$forceLegacyResolverFallback," + ` "$($processorInfo.Name),$($processorInfo.NumberOfCores),$($processorInfo.NumberOfLogicalProcessors)" Add-Content -Path $resultsFilePath -Value $data From c98a36f41c6bfd639d12b99faf145624815160e6 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Thu, 15 Aug 2024 10:09:09 -0700 Subject: [PATCH 13/17] revert debug helpers changes --- scripts/nuget-debug-helpers.ps1 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/nuget-debug-helpers.ps1 b/scripts/nuget-debug-helpers.ps1 index 2e75cf2123d..d97862d9b62 100644 --- a/scripts/nuget-debug-helpers.ps1 +++ b/scripts/nuget-debug-helpers.ps1 @@ -1,11 +1,6 @@ -Param([string] $Config) - $NuGetClientRoot= Resolve-Path $(Join-Path $PSScriptRoot "..\") -if ([string]::IsNullOrEmpty($Config)) { - $Configuration = "Debug" -} - +$Configuration = "Debug" $NETFramework = "net472" $NETStandard = "netstandard2.0" $NETCoreApp = "netcoreapp5.0" From 52670b27b2873971aa3e9ed4bd4e9efe276c7319 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Thu, 15 Aug 2024 10:23:40 -0700 Subject: [PATCH 14/17] Cleanup --- scripts/perftests/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/perftests/README.md b/scripts/perftests/README.md index fc3abb7db78..19c62554211 100644 --- a/scripts/perftests/README.md +++ b/scripts/perftests/README.md @@ -25,3 +25,9 @@ The `PerformanceTestUtilities.ps1` script is a collection of utility functions t Note that it's very important to initialize the script from a location that does not have a global.json in it's directory path. This can skew the results if you are dealing with SDK based projects. To run either the performance tests or the runner, run `Get-Help scriptName.ps1` and/or `Get-Help scriptName.ps1 -examples` + +### Using the scripts to test local builds + +- The way NuGet is integrated within MSBuild, allows us to easily bootstrap the restore code with MSBuild and run the current locally built bits. +To do that, simply pass `-additionalOptions "-useLocallyBuiltNuGet"` in the PerformanceTestRunner as the scripts' example suggests. +Other notable features include toggling between the default and legacy resolver `-forceLegacyResolverFallback` or opting into graph restore `-staticGraphRestore`. From d5f6385f9e57c2ad924eabd86e8c574b64a9b93f Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Thu, 15 Aug 2024 10:36:29 -0700 Subject: [PATCH 15/17] Fix up tests --- scripts/perftests/README.md | 1 + scripts/perftests/RunPerformanceTests.ps1 | 28 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/scripts/perftests/README.md b/scripts/perftests/README.md index 19c62554211..1b6a563ded5 100644 --- a/scripts/perftests/README.md +++ b/scripts/perftests/README.md @@ -13,6 +13,7 @@ The scenarios are sequential as follows: 1. Clean restore - no http cache & other local caches, no files in the global package folder, absolutely everything gets downloaded and extracted. 1. Cold restore - There is only an http cache. This tells us more about the installation/extraction time. Potentially we might see some extra http calls depending on the project graph. +1. Offline restore - no http cache or plugin cache, but there is a global packages folder. This simulates setups where the gpf is shared across different machines. Ideally these restores are offline, and do not make any remote calls. 1. Force restore - The http cache & global packages folder are full. This usually means that there are no package downloads or installations happening. 1. NoOp restore diff --git a/scripts/perftests/RunPerformanceTests.ps1 b/scripts/perftests/RunPerformanceTests.ps1 index b3aaa65ece5..95af0da3c15 100644 --- a/scripts/perftests/RunPerformanceTests.ps1 +++ b/scripts/perftests/RunPerformanceTests.ps1 @@ -41,6 +41,9 @@ Skips clean restores. .PARAMETER skipColdRestores Skips cold restores +.PARAMETER skipOfflineRestores +Skips offline restores + .PARAMETER skipForceRestores Skips force restores @@ -72,6 +75,7 @@ Param( [switch] $skipWarmup, [switch] $skipCleanRestores, [switch] $skipColdRestores, + [switch] $skipOfflineRestores, [switch] $skipForceRestores, [switch] $skipNoOpRestores, [switch] $staticGraphRestore, @@ -258,6 +262,30 @@ Try 1..$iterationCount | % { RunRestore @arguments } } + If (!$skipOfflineRestores) + { + Log "Running $($iterationCount)x without a global packages folder" + $enabledSwitches = @("cleanHttpCache", "cleanPluginsCache", "killMSBuildAndDotnetExeProcess", "cleanRepository") + If ($isPackagesConfig) + { + $enabledSwitches += "isPackagesConfig" + } + If ($staticGraphRestore) + { + $enabledSwitches += "staticGraphRestore" + } + If ($useLocallyBuiltNuGet) + { + $enabledSwitches += "useLocallyBuiltNuGet" + } + If ($forceLegacyResolverFallback) + { + $enabledSwitches += "forceLegacyResolverFallback" + } + $arguments = CreateNugetClientArguments $solutionFilePath $nugetClientFilePath $resultsFilePath $logsFolderPath $solutionName $testRunId "offline" -enabledSwitches $enabledSwitches + 1..$iterationCount | % { RunRestore @arguments } + } + If (!$skipForceRestores) { Log "Running $($iterationCount)x force restores" From d386310d2fb118d1b06631dda33d2c747f00e092 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Thu, 15 Aug 2024 10:52:52 -0700 Subject: [PATCH 16/17] Add offline restores --- scripts/perftests/RunPerformanceTests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/perftests/RunPerformanceTests.ps1 b/scripts/perftests/RunPerformanceTests.ps1 index 95af0da3c15..4b2e5429fec 100644 --- a/scripts/perftests/RunPerformanceTests.ps1 +++ b/scripts/perftests/RunPerformanceTests.ps1 @@ -264,7 +264,7 @@ Try If (!$skipOfflineRestores) { - Log "Running $($iterationCount)x without a global packages folder" + Log "Running $($iterationCount)x offline restores without http cache" $enabledSwitches = @("cleanHttpCache", "cleanPluginsCache", "killMSBuildAndDotnetExeProcess", "cleanRepository") If ($isPackagesConfig) { From 9569abac11eb07021c103ac5f55af542676def32 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Fri, 16 Aug 2024 13:25:59 -0700 Subject: [PATCH 17/17] Address feedback --- scripts/perftests/PerformanceTestUtilities.ps1 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/scripts/perftests/PerformanceTestUtilities.ps1 b/scripts/perftests/PerformanceTestUtilities.ps1 index 7fdc8d1d845..f2390b58b9b 100644 --- a/scripts/perftests/PerformanceTestUtilities.ps1 +++ b/scripts/perftests/PerformanceTestUtilities.ps1 @@ -502,14 +502,12 @@ Function RunRestore( $NETFramework = "net472" $Configuration = "release" $packDllPath = Join-Path $NuGetClientRoot "artifacts\NuGet.Build.Tasks.Pack\bin\$Configuration\$NETFramework\NuGet.Build.Tasks.Pack.dll" - $packTargetsPath = Join-Path $NuGetClientRoot "src\NuGet.Core\NuGet.Build.Tasks.Pack\NuGet.Build.Tasks.Pack.targets" - $restoreDllPath = Join-Path $NuGetClientRoot "artifacts\NuGet.Build.Tasks\bin\$Configuration\$NETFramework\NuGet.Build.Tasks.dll" - $nugetRestoreTargetsPath = Join-Path $NuGetClientRoot "src\NuGet.Core\NuGet.Build.Tasks\NuGet.targets" - $nugetPropsPath = Join-Path $NuGetClientRoot "src\NuGet.Core\NuGet.Build.Tasks\NuGet.props" - $consoleExePath = Join-Path $NuGetClientRoot "artifacts\NuGet.Build.Tasks.Console\bin\$Configuration\$NETFramework\NuGet.Build.Tasks.Console.exe" + $packTargetsPath = Join-Path $NuGetClientRoot "artifacts\NuGet.Build.Tasks.Pack\bin\$Configuration\$NETFramework\NuGet.Build.Tasks.Pack.targets" + $nugetRestoreTargetsPath = Join-Path $NuGetClientRoot "artifacts\NuGet.Build.Tasks\bin\$Configuration\$NETFramework\NuGet.targets" + $nugetPropsPath = Join-Path $NuGetClientRoot "artifacts\NuGet.Build.Tasks\bin\$Configuration\$NETFramework\NuGet.props" + $consoleExePath = Join-Path $NuGetClientRoot "artifacts\NuGet.Build.Tasks.Console\bin\$Configuration\$NETFramework\NuGet.Build.Tasks.Console.exe" $arguments.Add("/p:NuGetRestoreTargets=$nugetRestoreTargetsPath"); $arguments.Add("/p:NuGetPropsFile=$nugetPropsPath"); - $arguments.Add("/p:RestoreTaskAssemblyFile=$restoreDllPath"); $arguments.Add("/p:NuGetBuildTasksPackTargets=$packTargetsPath"); $arguments.Add("/p:NuGetConsoleProcessFileName=$consoleExePath"); $arguments.Add("/p:ImportNuGetBuildTasksPackTargetsFromSdk=true"); @@ -522,9 +520,6 @@ Function RunRestore( } $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() - - # What if I invoke nuget custom here. - $logs = . $nugetClientFilePath $arguments | Out-String if($LASTEXITCODE -ne 0)