]> xenbits.xensource.com Git - pvdrivers/win/xenvbd.git/commitdiff
Fix SDV/CodeQL log generation
authorOwen Smith <owen.smith@citrix.com>
Thu, 12 Aug 2021 12:41:36 +0000 (13:41 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 20 Sep 2021 09:29:26 +0000 (10:29 +0100)
- 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 <owen.smith@citrix.com>
msbuild.ps1
vs2019/xencrsh/xencrsh.vcxproj
vs2019/xendisk/xendisk.vcxproj
vs2019/xenvbd/xenvbd.vcxproj

index 4cb408accf5181d12c9f7461f0b3e844569dadba..8279d931b00bf7c778cb8f890591a903e24d7a3b 100644 (file)
@@ -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
 }
 
 #
@@ -167,8 +176,10 @@ elseif ($Type -eq "codeql") {
        New-Item -ItemType Directory "database" | Out-Null
 
        $projectlist | ForEach {
-               Run-CodeQL $solutionpath $_ $configuration["codeql"] $platform[$Arch] $searchpath $archivepath
+               Run-CodeQL $solutionpath $_ $configuration["codeql"] $platform[$Arch] $searchpath
        }
+
+       Copy-Item -Path (Join-Path -Path $SolutionPath -ChildPath "*.sarif") -Destination $archivepath
 }
 elseif ($Type -eq "sdv") {
        if (-Not (Test-Path -Path $archivepath)) {
index 7aae718b520616e969672b8dba90abfe80270eb5..04bd9bfb895a1f86cf16af737b2ca4eb2b736202 100644 (file)
@@ -13,7 +13,6 @@
   <Import Project="..\targets.props" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <PropertyGroup>
-    <RunCodeAnalysis>true</RunCodeAnalysis>
     <EnableInf2cat>false</EnableInf2cat>
     <IntDir>..\$(ProjectName)\$(ConfigurationName)\$(Platform)\</IntDir>
     <OutDir>..\$(ConfigurationName)\$(Platform)\</OutDir>
@@ -26,7 +25,6 @@
       <WarningLevel>EnableAllWarnings</WarningLevel>
       <DisableSpecificWarnings>4061;4464;4548;4770;4711;4820;4668;4255;5045;6001;6054;26451;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <EnablePREfast>true</EnablePREfast>
     </ClCompile>
     <ResourceCompile>
       <AdditionalIncludeDirectories>..\..\include;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
index 799b86a07eaeaa837dc1c10aad4798e2528912d6..1417eef93c32e1c1bbe838de763c42c6e6cd4300 100644 (file)
@@ -13,7 +13,6 @@
   <Import Project="..\targets.props" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <PropertyGroup>
-    <RunCodeAnalysis>true</RunCodeAnalysis>
     <EnableInf2cat>false</EnableInf2cat>
     <IntDir>..\$(ProjectName)\$(ConfigurationName)\$(Platform)\</IntDir>
     <OutDir>..\$(ConfigurationName)\$(Platform)\</OutDir>
@@ -27,7 +26,6 @@
       <WarningLevel>EnableAllWarnings</WarningLevel>
       <DisableSpecificWarnings>4061;4464;4548;4770;4711;4820;4668;4255;5045;6001;6054;26451;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <EnablePREfast>true</EnablePREfast>
     </ClCompile>
     <ResourceCompile>
       <AdditionalIncludeDirectories>..\..\include;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
index dcdd6d8405e110a1df61d24f335ab8467509e2a6..720c7bb2d355ff488931d8f57a3344225bae9032 100644 (file)
@@ -13,7 +13,6 @@
   <Import Project="..\targets.props" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <PropertyGroup>
-    <RunCodeAnalysis>true</RunCodeAnalysis>
     <EnableInf2cat>false</EnableInf2cat>
     <IntDir>..\$(ProjectName)\$(ConfigurationName)\$(Platform)\</IntDir>
     <OutDir>..\$(ConfigurationName)\$(Platform)\</OutDir>
@@ -26,7 +25,6 @@
       <WarningLevel>EnableAllWarnings</WarningLevel>
       <DisableSpecificWarnings>4061;4464;4548;4770;4711;4820;4668;4255;5045;6001;6054;26451;28160;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <EnablePREfast>true</EnablePREfast>
     </ClCompile>
     <ResourceCompile>
       <AdditionalIncludeDirectories>..\..\include;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>