Configure defender process exceptions when running tests (#13470)
* Configure defender process exceptions when running tests * Use explicit %ls * Save state * Save state * Add exceptions before the package is installed * Remove extra call
Blue committed
Sep 10, 2025 at 19:36 UTC
2eac1dafeca0d88320ff2260c5d5fe5dbb09cd33
2 files changed
+6
-12
test/windows/Common.cpp
+1
-11
@@ -2071,16 +2071,6 @@ Return Value:
2071
THROW_HR_MSG(E_FAIL, "Test setup returned non-zero exit code %lu", ExitCode);
2072
}
2073
2074
- if (!g_pipelineBuildId.empty())
2075
- {
2076
- LxsstuRunCommand(std::format(
2077
- L"Powershell -NoProfile -Command \"Add-MpPreference -ExclusionPath '{}'\"",
2078
- wsl::windows::common::wslutil::GetMsiPackagePath().value())
2079
- .data());
2080
-
2081
- LxsstuRunCommand(std::format(L"Powershell -NoProfile -Command \"Add-MpPreference -ExclusionPath '.'\"").data());
2082
- }
2083
-
2074
return true;
2075
}
2076
@@ -2128,7 +2118,7 @@ Return Value:
2118
commandLine = std::format(L"Get-MpThreat > \"{}\\Get-MpThreat.txt\"", g_dumpFolder);
2119
LxsstuLaunchPowershellAndCaptureOutput(commandLine.data());
2120
2131
- commandLine = std::format(L"Get-MpPreference > \"{}\\Get-MpPreference\"", g_dumpFolder);
2121
+ commandLine = std::format(L"Get-MpPreference > \"{}\\Get-MpPreference.txt\"", g_dumpFolder);
2122
LxsstuLaunchPowershellAndCaptureOutput(commandLine.data());
2123
}
2124
tools/test/CloudTest-Setup.bat
+5
-1
@@ -4,4 +4,8 @@ rem Required to make cloudtest use our version of taef
4
setx /M CloudTestWorkerCustomTaefExe "%1\taef\te.exe"
5
6
mkdir %2\WexLogFileOutput
7
-mklink /D %1\WexLogFileOutput %2\WexLogFileOutput
\ No newline at end of file
7
+mklink /D %1\WexLogFileOutput %2\WexLogFileOutput
8
+
9
+rem These need to run before the package is installed
10
+powershell -NoProfile -Command "Add-MpPreference -ExclusionPath 'C:\Program Files\WSL'"
11
+powershell -NoProfile -Command "Add-MpPreference -ExclusionProcess @('wsl.exe', 'wslg.exe', 'wslconfig.exe', 'wslrelay.exe', 'wslhost.exe', 'msrdc.exe', 'wslservice.exe', 'msal.wsl.proxy.exe', 'te.processhost.exe')"
\ No newline at end of file