From: Owen Smith Date: Tue, 10 Aug 2021 15:40:47 +0000 (+0100) Subject: Fix SDV/CodeQL log generation X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3a842f133ebc282ff9c1755e81f18dd5ab87369b;p=pvdrivers%2Fwin%2Fxenbus.git Fix SDV/CodeQL log generation - sarif files need to be stored with SDV logs when generating the DVL file - Disable PREFast and CodeAnalysis by default - Run a seperate CodeAnalysis build after SDV, but before generating DVL file DVL file should contain multiple summary lines for SDV, at least 1 line for CodeAnalysis and at least 1 line for Semmle (CodeQL) Signed-off-by: Owen Smith --- diff --git a/msbuild.ps1 b/msbuild.ps1 index de7ad52..846abd2 100644 --- a/msbuild.ps1 +++ b/msbuild.ps1 @@ -17,7 +17,8 @@ Function Run-MSBuild { [string]$Configuration, [string]$Platform, [string]$Target = "Build", - [string]$Inputs = "" + [string]$Inputs = "", + [switch]$CodeAnalysis ) $c = "msbuild.exe" @@ -28,6 +29,11 @@ Function Run-MSBuild { if ($Inputs) { $c += [string]::Format(" /p:Inputs=""{0}"" ", $Inputs) } + if ($CodeAnalysis) { + $c += "/p:RunCodeAnalysis=true " + $c += "/p:EnablePREFast=true " + } + $c += Join-Path -Path $SolutionPath -ChildPath $Name Invoke-Expression $c @@ -55,6 +61,7 @@ Function Run-MSBuildSDV { Run-MSBuild $projpath $project $Configuration $Platform "Build" Run-MSBuild $projpath $project $Configuration $Platform "sdv" "/clean" Run-MSBuild $projpath $project $Configuration $Platform "sdv" "/check:default.sdv /debug" + Run-MSBuild $projpath $project $Configuration $Platform "Build" -CodeAnalysis Run-MSBuild $projpath $project $Configuration $Platform "dvl" $refine = Join-Path -Path $projpath -ChildPath "refine.sdv" @@ -73,14 +80,14 @@ Function Run-CodeQL { [string]$Name, [string]$Configuration, [string]$Platform, - [string]$SearchPath, - [string]$OutputPath + [string]$SearchPath ) $projpath = Resolve-Path (Join-Path $SolutionPath $Name) $project = [string]::Format("{0}.vcxproj", $Name) $output = [string]::Format("{0}.sarif", $Name) $database = Join-Path "database" $Name + $sarif = Join-Path $projpath $output # write a bat file to wrap msbuild parameters $bat = [string]::Format("{0}.bat", $Name) @@ -120,7 +127,7 @@ Function Run-CodeQL { $c += " windows_driver_recommended.qls" $c += " --format=sarifv2.1.0" $c += " --output=" - $c += (Join-Path $OutputPath $output) + $c += $sarif $c += " --search-path=" $c += $SearchPath @@ -129,6 +136,8 @@ Function Run-CodeQL { Write-Host -ForegroundColor Red "ERROR: CodeQL failed, code:" $LASTEXITCODE Exit $LASTEXITCODE } + + Copy-Item $sarif -Destination $SolutionPath } # @@ -165,9 +174,11 @@ elseif ($Type -eq "codeql") { } New-Item -ItemType Directory "database" - Run-CodeQL $solutionpath "xen" $configuration["codeql"] $platform[$Arch] $searchpath $archivepath - Run-CodeQL $solutionpath "xenfilt" $configuration["codeql"] $platform[$Arch] $searchpath $archivepath - Run-CodeQL $solutionpath "xenbus" $configuration["codeql"] $platform[$Arch] $searchpath $archivepath + Run-CodeQL $solutionpath "xen" $configuration["codeql"] $platform[$Arch] $searchpath + Run-CodeQL $solutionpath "xenfilt" $configuration["codeql"] $platform[$Arch] $searchpath + Run-CodeQL $solutionpath "xenbus" $configuration["codeql"] $platform[$Arch] $searchpath + + Copy-Item -Path (Join-Path -Path $SolutionPath -ChildPath "*.sarif") -Destination $archivepath } elseif ($Type -eq "sdv") { $archivepath = "xenbus" diff --git a/vs2019/xen/xen.vcxproj b/vs2019/xen/xen.vcxproj index bccef34..2c4579e 100644 --- a/vs2019/xen/xen.vcxproj +++ b/vs2019/xen/xen.vcxproj @@ -13,7 +13,6 @@ - true false ..\$(ProjectName)\$(ConfigurationName)\$(Platform)\ ..\$(ConfigurationName)\$(Platform)\ @@ -26,7 +25,6 @@ EnableAllWarnings 4061;4146;4464;4711;4770;4548;4820;4668;4255;5045;6001;6054;26451;28196;30030;30029;%(DisableSpecificWarnings) true - true ..\..\include;%(AdditionalIncludeDirectories) diff --git a/vs2019/xenbus/xenbus.vcxproj b/vs2019/xenbus/xenbus.vcxproj index eac2f7e..c769599 100644 --- a/vs2019/xenbus/xenbus.vcxproj +++ b/vs2019/xenbus/xenbus.vcxproj @@ -13,7 +13,6 @@ - true false ..\$(ProjectName)\$(ConfigurationName)\$(Platform)\ ..\$(ConfigurationName)\$(Platform)\ @@ -26,7 +25,6 @@ EnableAllWarnings 4061;4146;4464;4711;4770;4548;4820;4668;4255;5045;6001;6054;26451;28196;30030;30029;%(DisableSpecificWarnings) true - true ..\..\include;%(AdditionalIncludeDirectories) diff --git a/vs2019/xenfilt/xenfilt.vcxproj b/vs2019/xenfilt/xenfilt.vcxproj index 620e3a6..a0e54c5 100644 --- a/vs2019/xenfilt/xenfilt.vcxproj +++ b/vs2019/xenfilt/xenfilt.vcxproj @@ -13,7 +13,6 @@ - true false ..\$(ProjectName)\$(ConfigurationName)\$(Platform)\ ..\$(ConfigurationName)\$(Platform)\ @@ -26,7 +25,6 @@ EnableAllWarnings 4061;4464;4711;4770;4548;4820;4668;4255;5045;6001;6054;26451;28196;30030;30029;%(DisableSpecificWarnings) true - true ..\..\include;%(AdditionalIncludeDirectories)