@@ -123,6 +123,12 @@ param(
123
123
[string ]
124
124
$ReportDir = (Get-Location ),
125
125
126
+ # Skip summary report -- used for Linux hosts that don't support
127
+ # the OLE database stuff.
128
+ [Parameter (Mandatory = $false )]
129
+ [switch ]
130
+ $SkipSummaryReport ,
131
+
126
132
# Tells the script to use the sytem tmp directory instead of the rule
127
133
# directory.
128
134
[Parameter (Mandatory = $false )]
@@ -245,6 +251,7 @@ else {
245
251
Write-Host " Loaded $ ( $queriesToCheck.Count ) Queries."
246
252
}
247
253
254
+
248
255
#
249
256
# Step 2: Verify All the Required CLI Tools are Installed
250
257
#
@@ -290,8 +297,7 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel
290
297
" RULE" = $CurrentRuleName ;
291
298
" QUERY" = $CurrentQueryName ;
292
299
" COMPILE_PASS" = $false ;
293
- " EXTRACTOR_PASS" = $false ;
294
- " EXTRACTOR_ERRORS" = " " ;
300
+ " COMPILE_ERROR_OUTPUT" = " " ;
295
301
" TEST_PASS" = $false ;
296
302
" TEST_DIFFERENCE" = " " ;
297
303
}
@@ -316,32 +322,19 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel
316
322
}
317
323
catch {
318
324
Write-Host - ForegroundColor ([ConsoleColor ]4 ) " FAILED"
325
+ $row [" COMPILE_ERROR_OUTPUT" ] = $_
319
326
320
327
return $row # although it is unlikely to succeed with the next rule skipping to the next rule
321
328
# ensures all of the rules will be reported in the
322
329
# output.
323
330
}
324
331
325
332
$row [" COMPILE_PASS" ] = $true
326
- Write-Host " Validating extractor results..." - NoNewline
327
-
328
- try {
329
- $diagnostics = Execute- QueryAndDecodeAsJson - DatabasePath $db - QueryPath $diagnostic_query
330
- }catch {
331
- Write-Host - ForegroundColor ([ConsoleColor ]4 ) $_Exception.Message
332
- return $row
333
- }
334
-
335
- if ( $diagnostics .' #select' .tuples.Length -eq 0 ) {
336
- $row [" EXTRACTOR_PASS" ] = $true
337
- Write-Host - ForegroundColor ([ConsoleColor ]2 ) " OK"
338
- } else {
339
- Write-Host - ForegroundColor ([ConsoleColor ]4 ) " FAILED"
340
- $row [" EXTRACTOR_ERRORS" ] = $diagnostics | ConvertTo-Json - Depth 100
341
- }
342
-
333
+
343
334
Write-Host " Checking expected output..."
344
335
336
+ # Dragons below 🐉🐉🐉
337
+ #
345
338
# Note this technique uses so-called "wizard" settings to make it possible
346
339
# to compare hand compiled databases using qltest. The relative paths and
347
340
# other options are required to be set as below (especially the detail about
@@ -381,7 +374,6 @@ $jobRows = $queriesToCheck | ForEach-Object -ThrottleLimit $NumThreads -Parallel
381
374
Write-Host " Standard Out Buffered to: $stdOut "
382
375
Write-Host " Standard Error Buffered to: $stdErr "
383
376
384
-
385
377
$procDetails = Start-Process - FilePath " codeql" - PassThru - NoNewWindow - Wait - ArgumentList " test run $qlRefFile --dataset=`" $datasetRelPath `" " - RedirectStandardOutput $stdOut - RedirectStandardError $stdErr
386
378
387
379
if (-Not $procDetails.ExitCode -eq 0 ) {
@@ -420,6 +412,8 @@ foreach ($r in $REPORT) {
420
412
[PSCustomObject ]$r | Export-CSV - Path $reportOutputFile - Append - NoTypeInformation
421
413
}
422
414
423
- # write out a summary
424
- Write-Host " Writing summary report to $summaryReportOutputFile "
425
- Create- Summary- Report - DataFile $reportOutputFile - OutputFile $summaryReportOutputFile
415
+ if (-not $SkipSummaryReport ){
416
+ # write out a summary
417
+ Write-Host " Writing summary report to $summaryReportOutputFile "
418
+ Create- Summary- Report - DataFile $reportOutputFile - OutputFile $summaryReportOutputFile
419
+ }
0 commit comments