Skip to content

Commit e34f382

Browse files
authored
matrix testing mutex
1 parent 14f0f35 commit e34f382

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/matrix_testing/CreateMatrixTestReport.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel
299299

300300
foreach($testDirectory in $testDirs){
301301

302+
Write-Host "Acquiring lock for $testDirectory"
303+
$Mutex = New-Object -TypeName System.Threading.Mutex -ArgumentList $false, ("__Matrix_" + $testDirectory.Replace([IO.Path]::DirectorySeparatorChar,"_"));
304+
$Mutex.WaitOne() | Out-Null;
305+
Write-Host "Locked $testDirectory"
306+
302307
# for the report
303308
$row = @{
304309
"SUITE" = $CurrentSuiteName;
@@ -412,6 +417,8 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel
412417
# output current row state
413418
$row
414419

420+
# release any held mutexes
421+
$Mutex.ReleaseMutex();
415422

416423
###########################################################
417424
###########################################################
@@ -449,4 +456,4 @@ if (-not $SkipSummaryReport){
449456
# write out a summary
450457
Write-Host "Writing summary report to $summaryReportOutputFile"
451458
Create-Summary-Report -DataFile $reportOutputFile -OutputFile $summaryReportOutputFile
452-
}
459+
}

0 commit comments

Comments
 (0)