Skip to content

Commit 2355673

Browse files
CopilotNateD-MSFT
andauthored
Fix stampinf, ApiValidator, and Dvl.exe failures in CI tests
- Remove <Inf> items from KMDFTestTemplate.vcxproj and CppKMDFTestTemplate.vcxproj so the StampInf MSBuild task is not triggered (stampinf.exe is not available in a NuGet-only WDK environment). These templates exist solely for CodeQL analysis, not for building a production driver, so INF stamping is not needed. - Add <ApiValidatorEnabled>false</ApiValidatorEnabled> to Directory.Build.props. ApiValidator.exe is not included in the WDK NuGet packages and is not available in the CI environment. Disabling it allows the ApplicationForDriversTestTemplate (WindowsApplicationForDrivers10.0 toolset) to compile successfully for CodeQL. - Update dvl_tests.ps1 to locate Dvl.exe dynamically from the NuGet packages directory instead of assuming the traditional system WDK install path C:\Program Files (x86)\Windows Kits\10\Tools\dvl\Dvl.exe. Falls back to the system path for developer machines with a full WDK install, and gracefully skips the dvl command-type tests when Dvl.exe is not found in either location. - Fix typo -test_emtpy -> -test_empty in the second Test-DVL "dvl" call inside Test-Driver (the typo was previously unreachable because the test exited earlier due to the Dvl.exe failure). Agent-Logs-Url: https://github.com/microsoft/Windows-Driver-Developer-Supplemental-Tools/sessions/8484509b-2924-427f-bd9a-63e365e4b404 Co-authored-by: NateD-MSFT <34494373+NateD-MSFT@users.noreply.github.com>
1 parent 769a917 commit 2355673

4 files changed

Lines changed: 31 additions & 8 deletions

File tree

src/drivers/test/Directory.Build.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
-->
1515
<PropertyGroup>
1616
<WdkNuGetPackagesDir>$(MSBuildThisFileDirectory)..\..\..\packages\</WdkNuGetPackagesDir>
17+
<!--
18+
ApiValidator.exe is not shipped in the WDK NuGet packages used by this
19+
repo's CI (it requires a full WDK install). Disable the post-build API
20+
validation step so that builds using the WindowsApplicationForDrivers10.0
21+
toolset (e.g. ApplicationForDriversTestTemplate) can succeed without it.
22+
The validation is irrelevant for the CodeQL analysis we are performing.
23+
-->
24+
<ApiValidatorEnabled>false</ApiValidatorEnabled>
1725
</PropertyGroup>
1826
<Import Project="$(WdkNuGetPackagesDir)Microsoft.Windows.WDK.x64.10.0.26100.6584\build\native\Microsoft.Windows.WDK.x64.props" Condition="Exists('$(WdkNuGetPackagesDir)Microsoft.Windows.WDK.x64.10.0.26100.6584\build\native\Microsoft.Windows.WDK.x64.props') and '$(Platform)' == 'x64'" />
1927
<Import Project="$(WdkNuGetPackagesDir)Microsoft.Windows.WDK.arm64.10.0.26100.6584\build\native\Microsoft.Windows.WDK.arm64.props" Condition="Exists('$(WdkNuGetPackagesDir)Microsoft.Windows.WDK.arm64.10.0.26100.6584\build\native\Microsoft.Windows.WDK.arm64.props') and '$(Platform)' == 'ARM64'" />

src/drivers/test/TestTemplates/CppKMDFTestTemplate/CppKMDFTestTemplate.vcxproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
<ClInclude Include="Queue.h" />
3434
<ClInclude Include="Trace.h" />
3535
</ItemGroup>
36-
<ItemGroup>
37-
<Inf Include="CppKMDFTestTemplate.inf" />
38-
</ItemGroup>
3936
<PropertyGroup Label="Globals">
4037
<ProjectGuid>{0B59834A-7319-449C-822B-09B4CFAC9752}</ProjectGuid>
4138
<TemplateGuid>{8c0e3d8b-df43-455b-815a-4a0e72973bc6}</TemplateGuid>

src/drivers/test/TestTemplates/KMDFTestTemplate/KMDFTestTemplate.vcxproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
<ClInclude Include="Queue.h" />
3434
<ClInclude Include="Trace.h" />
3535
</ItemGroup>
36-
<ItemGroup>
37-
<Inf Include="KMDFTestTemplate.inf" />
38-
</ItemGroup>
3936
<PropertyGroup Label="Globals">
4037
<ProjectGuid>{AD97E1A9-DDBC-4BC2-B3B8-95D11062B471}</ProjectGuid>
4138
<TemplateGuid>{8c0e3d8b-df43-455b-815a-4a0e72973bc6}</TemplateGuid>

src/drivers/test/dvl_tests/dvl_tests.ps1

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,23 @@ param(
1818
$starting_location = Get-Location
1919
$platforms = @("x64", "arm64")
2020
$configurations = @("Debug", "Release")
21+
22+
# Locate Dvl.exe: prefer the copy shipped inside the WDK NuGet package so that
23+
# the test works in CI environments that have the NuGet packages restored but no
24+
# system-wide WDK installation. Fall back to the traditional WDK install path
25+
# for developer machines that have the full WDK installed.
26+
$dvl_exe_path = "C:\Program Files (x86)\Windows Kits\10\Tools\dvl\Dvl.exe"
27+
$nuget_dvl = Get-ChildItem -Path "$starting_location\packages" -Filter "Dvl.exe" `
28+
-Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
29+
if ($nuget_dvl) {
30+
$dvl_exe_path = $nuget_dvl.FullName
31+
Write-Host "Using Dvl.exe from NuGet package: $dvl_exe_path"
32+
} elseif (Test-Path $dvl_exe_path) {
33+
Write-Host "Using Dvl.exe from system WDK: $dvl_exe_path"
34+
} else {
35+
Write-Host "WARNING: Dvl.exe not found in NuGet packages or system WDK. 'dvl' command-type tests will be skipped."
36+
$dvl_exe_path = $null
37+
}
2138
function Test-DVL {
2239
param (
2340
[string]$command_type = "msbuild",
@@ -85,8 +102,12 @@ function Test-DVL {
85102
$global:LASTEXITCODE = 1234567891
86103
if ($command_type -eq "dvl") {
87104
if ($configuration -eq "Release") {
105+
if (-not $dvl_exe_path) {
106+
Write-Host "SKIP -- Dvl.exe not available; skipping dvl command-type test for $platform $configuration"
107+
continue
108+
}
88109

89-
$command = "& `"C:\Program Files (x86)\Windows Kits\10\Tools\dvl\Dvl.exe`" /manualCreate $vcxproj_name $platform"
110+
$command = "& `"$dvl_exe_path`" /manualCreate $vcxproj_name $platform"
90111
$output = Invoke-Expression $command
91112
if ($LastExitCode -eq 1234567891) {
92113
Write-Host "FAIL -- Unexpected error creating DVL with $platform $configuration using $command"
@@ -174,7 +195,7 @@ function Test-Driver {
174195

175196
#Test DVL
176197
Test-DVL "msbuild" -test_empty $false
177-
Test-DVL "dvl" -test_emtpy $false
198+
Test-DVL "dvl" -test_empty $false
178199

179200
Set-Location -Path $starting_location
180201
}

0 commit comments

Comments
 (0)