Skip to content

Commit

Permalink
pass xdp install path to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfriesen committed Feb 13, 2025
1 parent cefc569 commit 394d2a7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
11 changes: 9 additions & 2 deletions test/functional/lib/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,17 @@ SetDeviceSddl(
_In_z_ const CHAR *Sddl
)
{
CHAR XdpBinaryPath[MAX_PATH];
UINT32 XdpBinaryPathLength;
CHAR CmdBuff[256];
RtlZeroMemory(CmdBuff, sizeof(CmdBuff));

sprintf_s(CmdBuff, "xdpcfg.exe SetDeviceSddl \"%s\"", Sddl);
XdpBinaryPathLength =
GetEnvironmentVariableA("_XDP_BINARIES_PATH", XdpBinaryPath, sizeof(XdpBinaryPath));
TEST_NOT_EQUAL(0, XdpBinaryPathLength);
TEST_TRUE(XdpBinaryPathLength <= sizeof(XdpBinaryPath));

RtlZeroMemory(CmdBuff, sizeof(CmdBuff));
sprintf_s(CmdBuff, "%s\\xdpcfg.exe SetDeviceSddl \"%s\"", XdpBinaryPath, Sddl);
TEST_EQUAL(0, InvokeSystem(CmdBuff));
}

Expand Down
11 changes: 10 additions & 1 deletion tools/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ $XdpFileVersion = (Get-Item $XdpSys).VersionInfo.FileVersion
# format is "A.B.C.D", but XDP (and semver) use only the "A.B.C".
$XdpFileVersion = $XdpFileVersion.substring(0, $XdpFileVersion.LastIndexOf('.'))
$XdpMsiFullPath = "$ArtifactsDir\xdp-for-windows.$Platform.$XdpFileVersion.msi"
$XdpRuntimeNupkgSetupPath = "runtime/native/xdp-setup.ps1"
$XdpRuntimeNupkgNativePath = "runtime/native"
$XdpRuntimeNupkgSetupPath = "$XdpRuntimeNupkgNativePath/xdp-setup.ps1"
$FndisSys = "$ArtifactsDir\test\fndis\fndis.sys"
$XdpMpSys = "$ArtifactsDir\test\xdpmp\xdpmp.sys"
$XdpMpInf = "$ArtifactsDir\test\xdpmp\xdpmp.inf"
Expand Down Expand Up @@ -285,6 +286,7 @@ function Install-Xdp {

if ($XdpInstaller -eq "MSI") {
$XdpPath = Get-XdpInstallPath
$XdpBinariesPath = $XdpPath

$AddLocal = @()

Expand All @@ -306,6 +308,7 @@ function Install-Xdp {
}
} elseif ($XdpInstaller -eq "NuGet") {
$XdpPath = Get-XdpInstallPath
$XdpBinariesPath = "$XdpPath/$XdpRuntimeNupkgNativePath"
$XdpSetupPath = "$XdpPath/$XdpRuntimeNupkgSetupPath"
$XdpRuntimeNupkgFullPath = Find-Nupkg "$ArtifactsDir\XDP-for-Windows-Runtime.$Platform.$XdpFileVersion*.nupkg"

Expand All @@ -322,6 +325,8 @@ function Install-Xdp {
& $XdpSetupPath -Install xdpebpf | Write-Verbose
}
} elseif ($XdpInstaller -eq "INF") {
$XdpBinariesPath = $ArtifactsDir

Write-Verbose "netcfg.exe -v -l $XdpInf -c s -i ms_xdp"
netcfg.exe -v -l $XdpInf -c s -i ms_xdp | Write-Verbose
if ($LastExitCode) {
Expand All @@ -344,6 +349,8 @@ function Install-Xdp {
Start-Service-With-Retry xdp

Refresh-Path
$env:_XDP_BINARIES_PATH = $XdpBinariesPath
[System.Environment]::SetEnvironmentVariable("_XDP_BINARIES_PATH", $env:_XDP_BINARIES_PATH, "Machine")

Write-Verbose "xdp.sys install complete!"
}
Expand Down Expand Up @@ -444,6 +451,8 @@ function Uninstall-Xdp {
Cleanup-Service xdp
}

[System.Environment]::SetEnvironmentVariable("_XDP_BINARIES_PATH", $null, "Machine")
$env:_XDP_BINARIES_PATH = $null
Refresh-Path

Write-Verbose "xdp.sys uninstall complete!"
Expand Down

0 comments on commit 394d2a7

Please sign in to comment.