From 416d1fd6585fdeb850a29c2ca2dc300298f1fcac Mon Sep 17 00:00:00 2001 From: Andrew Hall Date: Mon, 1 Apr 2024 16:56:29 -0700 Subject: [PATCH] Make it possible to set featureflags during integration test runs (#10195) --- eng/pipelines/test-integration-job.yml | 7 +++++++ featurflag.ps1 => eng/scripts/featureflag.ps1 | 20 +++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) rename featurflag.ps1 => eng/scripts/featureflag.ps1 (80%) diff --git a/eng/pipelines/test-integration-job.yml b/eng/pipelines/test-integration-job.yml index 4c87a9fce12..6f59f3ef12c 100644 --- a/eng/pipelines/test-integration-job.yml +++ b/eng/pipelines/test-integration-job.yml @@ -22,6 +22,13 @@ steps: -devenvExepath C:\\Test\\VisualStudio\\Common7\\IDE\\devenv.exe displayName: Create and Verify hive + - powershell: eng\scripts\featureflag.ps1 + -set + -enable + -flag "$(FeatureFlag)" + displayName: Set Feature Flags + condition: and(succeeded(), ne(variables['FeatureFlag'], '')) + - script: eng\cibuild.cmd -configuration ${{ parameters.configuration }} -msbuildEngine vs diff --git a/featurflag.ps1 b/eng/scripts/featureflag.ps1 similarity index 80% rename from featurflag.ps1 rename to eng/scripts/featureflag.ps1 index 2672ec6efe9..9ce2532efec 100644 --- a/featurflag.ps1 +++ b/eng/scripts/featureflag.ps1 @@ -16,6 +16,15 @@ if ($flag.EndsWith("\")) { throw "Provided flag '$flag' ends with '\', which is not valid" } +$value = 0 + +if ($enable) +{ + $value = 1 +} + +Write-Host "Attempting to modify '$flag' to '$value'" + $flagBase = "FeatureFlags\Razor\LSP" $slashIndex = $flag.LastIndexOf("\") @@ -43,22 +52,25 @@ if ($set) } } -. (Join-Path $PSScriptRoot "eng" "common" "tools.ps1") +$engPath = Join-Path $PSScriptRoot ".." +$commonPath = Join-Path $engPath "common" +$toolScript = Join-Path $commonPath "tools.ps1" + +Write-Host "Executing '$toolScript'" +. $toolScript $vsInfo = LocateVisualStudio if ($null -eq $vsInfo) { throw "Unable to locate required Visual Studio installation" } +Write-Host "Running VsRegEdit" $vsDir = $vsInfo.installationPath.TrimEnd("\") $vsRegEdit = Join-Path (Join-Path (Join-Path $vsDir 'Common7') 'IDE') 'VsRegEdit.exe' -$value = $enable ? 1 : 0 - if ($set) { &$vsRegEdit set "$vsDir" $hive HKCU $flagBase $flag dword $value } else { &$vsRegEdit read "$vsDir" $hive HKCU $flagBase $flag dword } - \ No newline at end of file