Skip to content

Commit 10c3d66

Browse files
committed
wrk
1 parent 7e82241 commit 10c3d66

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

scripts/matrix_testing/CreateMatrixTestReport.ps1

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,7 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel
297297
"RULE" = $CurrentRuleName;
298298
"QUERY" = $CurrentQueryName;
299299
"COMPILE_PASS" = $false;
300-
"EXTRACTOR_PASS" = $false;
301-
"EXTRACTOR_ERRORS" = "";
300+
"COMPILE_ERROR_OUTPUT" = "";
302301
"TEST_PASS" = $false ;
303302
"TEST_DIFFERENCE" = "";
304303
}
@@ -323,32 +322,19 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel
323322
}
324323
catch {
325324
Write-Host -ForegroundColor ([ConsoleColor]4) "FAILED"
325+
$row["COMPILE_ERROR_OUTPUT"] = $_
326326

327327
return $row # although it is unlikely to succeed with the next rule skipping to the next rule
328328
# ensures all of the rules will be reported in the
329329
# output.
330330
}
331331

332332
$row["COMPILE_PASS"] = $true
333-
Write-Host "Validating extractor results..." -NoNewline
334-
335-
try {
336-
$diagnostics = Execute-QueryAndDecodeAsJson -DatabasePath $db -QueryPath $diagnostic_query
337-
}catch {
338-
Write-Host -ForegroundColor ([ConsoleColor]4) $_Exception.Message
339-
return $row
340-
}
341-
342-
if ( $diagnostics.'#select'.tuples.Length -eq 0 ) {
343-
$row["EXTRACTOR_PASS"] = $true
344-
Write-Host -ForegroundColor ([ConsoleColor]2) "OK"
345-
} else {
346-
Write-Host -ForegroundColor ([ConsoleColor]4) "FAILED"
347-
$row["EXTRACTOR_ERRORS"] = $diagnostics | ConvertTo-Json -Depth 100
348-
}
349-
333+
350334
Write-Host "Checking expected output..."
351335

336+
# Dragons below 🐉🐉🐉
337+
#
352338
# Note this technique uses so-called "wizard" settings to make it possible
353339
# to compare hand compiled databases using qltest. The relative paths and
354340
# other options are required to be set as below (especially the detail about
@@ -388,7 +374,6 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel
388374
Write-Host "Standard Out Buffered to: $stdOut"
389375
Write-Host "Standard Error Buffered to: $stdErr"
390376

391-
392377
$procDetails = Start-Process -FilePath "codeql" -PassThru -NoNewWindow -Wait -ArgumentList "test run $qlRefFile --dataset=`"$datasetRelPath`"" -RedirectStandardOutput $stdOut -RedirectStandardError $stdErr
393378

394379
if (-Not $procDetails.ExitCode -eq 0) {

scripts/matrix_testing/NewDatabaseForRule.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,14 @@ function New-Database-For-Rule {
3939

4040
Write-Host "codeql database create -l cpp -s $RuleTestDir --command='$BUILD_COMMAND' $DB_PATH"
4141

42-
$procDetails = Start-Process -FilePath "codeql" -PassThru -NoNewWindow -Wait -ArgumentList "database create -l cpp -s $RuleTestDir --command=`"$BUILD_COMMAND`" $DB_PATH"
42+
$stdOut = Join-Path ([System.IO.Path]::GetTempPath()) ([System.Guid]::NewGuid())
43+
44+
$procDetails = Start-Process -FilePath "codeql" -RedirectStandardOutput $stdOut -PassThru -NoNewWindow -Wait -ArgumentList "database create -l cpp -s $RuleTestDir --command=`"$BUILD_COMMAND`" $DB_PATH"
45+
46+
Get-Content $stdOut | Out-String | Write-Host
4347

4448
if (-Not $procDetails.ExitCode -eq 0) {
45-
throw "Database creation failed."
49+
throw Get-Content $stdOut | Out-String
4650
}
4751

4852
return $DB_PATH

0 commit comments

Comments
 (0)