Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to set featureflags during integration test runs #10195

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions eng/pipelines/test-integration-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 16 additions & 4 deletions featurflag.ps1 → eng/scripts/featureflag.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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("\")

Expand Down Expand Up @@ -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
}