Skip to content

Commit

Permalink
Make it possible to set featureflags during integration test runs (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzngard committed Apr 1, 2024
1 parent 2489cb3 commit 416d1fd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
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
}

0 comments on commit 416d1fd

Please sign in to comment.