[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/4] Fix SDV/CodeQL log generation


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Thu, 12 Aug 2021 13:41:36 +0100
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Thu, 12 Aug 2021 12:42:21 +0000
  • Ironport-hdrordr: A9a23:PJMRla7NargefQLMsgPXwPDXdLJyesId70hD6qhwISY6TiX+rb HJoB17726NtN9/YhEdcLy7VJVoBEmskKKdgrNhWotKPjOW21dARbsKheCJrgEIWReOktK1vZ 0QCpSWY+eQMbEVt6nHCXGDYrQd/OU=
  • Ironport-sdr: oG9GGQUz1DhgkH/ISwVYi6LmDdysf1OvtYa0mTaYDVzjbE8gR/CzuwfjwXn3euKJiL3gUurtbc Y5w/7FcesN2bR/dsQkGcdn5BXnG/Wu/RpdTbXOD8VXYaTAdjQGxOWDgebUplLJTiaHmTIxL0nR 0F1qQQ0K3qOZAkEr2oiTYZ2abtzDFmKFhx1ZCE0EhxEfTVcDsQRmd3E2ERLR/jNTjb7Y3imyA3 rQMGjts5D/dZRgrHrXZbP4D2cpKG5mBvA67am3JHLhb++PuFu5NmGaeu+0lmMlYVhnR0MPiSsD 7e2sO6a2ioxUZmef8QM20yYE
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

- 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@xxxxxxxxxx>
---
 msbuild.ps1                    | 21 ++++++++++++++++-----
 vs2019/xencrsh/xencrsh.vcxproj |  2 --
 vs2019/xendisk/xendisk.vcxproj |  2 --
 vs2019/xenvbd/xenvbd.vcxproj   |  2 --
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/msbuild.ps1 b/msbuild.ps1
index 4cb408a..8279d93 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
 }
 
 #
@@ -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)) {
diff --git a/vs2019/xencrsh/xencrsh.vcxproj b/vs2019/xencrsh/xencrsh.vcxproj
index 7aae718..04bd9bf 100644
--- a/vs2019/xencrsh/xencrsh.vcxproj
+++ b/vs2019/xencrsh/xencrsh.vcxproj
@@ -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>
diff --git a/vs2019/xendisk/xendisk.vcxproj b/vs2019/xendisk/xendisk.vcxproj
index 799b86a..1417eef 100644
--- a/vs2019/xendisk/xendisk.vcxproj
+++ b/vs2019/xendisk/xendisk.vcxproj
@@ -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>
diff --git a/vs2019/xenvbd/xenvbd.vcxproj b/vs2019/xenvbd/xenvbd.vcxproj
index dcdd6d8..720c7bb 100644
--- a/vs2019/xenvbd/xenvbd.vcxproj
+++ b/vs2019/xenvbd/xenvbd.vcxproj
@@ -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>
-- 
2.31.1.windows.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.