Skip to content

Commit

Permalink
Fix test log path sanitation (#4352)
Browse files Browse the repository at this point in the history
  • Loading branch information
anrossi authored Jun 15, 2024
1 parent b7b2021 commit 776a10e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/run-gtest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,11 @@ function Start-TestExecutable([String]$Arguments, [String]$OutputDir) {
# Asynchronously starts a single msquictest test case running.
function Start-TestCase([String]$Name, [int]$Trial = 1) {

$InstanceName = $Name.Replace("/", "_")
# Get a string of invalid chars for filenames
$InvalidChars = [System.IO.Path]::GetInvalidFileNameChars() -join ''
# Escape those chars for use in a regex and put them inside a regex set (the square brackets)
$InvalidCharsToReplace = "[{0}]" -f [RegEx]::Escape($InvalidChars)
$InstanceName = $Name -replace $InvalidCharsToReplace, "_"
$LocalLogDir = Join-Path $LogDir ($InstanceName + "_$Trial")
mkdir $LocalLogDir | Out-Null

Expand Down

0 comments on commit 776a10e

Please sign in to comment.