tst: winfsp-tests: silo testing

This commit is contained in:
Bill Zissimopoulos 2022-09-28 18:46:17 +01:00
parent a3765d6360
commit 53b44dcb5c
5 changed files with 30 additions and 4 deletions

View File

@ -17,7 +17,7 @@ if not X%2==X set Chkpnt=%2
) > %~dp0..\build\VStudio\build\%Config%\deploy-setup.bat
(
echo docker run -it --rm --isolation=process -v%Deploy%:%Deploy%:RO %CImage% cmd.exe
echo docker run -it --rm --isolation=process -v%Deploy%:%Deploy%:RW %CImage% cmd.exe /k cd %Deploy%
) > %~dp0..\build\VStudio\build\%Config%\docker-run.bat
set Files=

View File

@ -158,7 +158,10 @@ static void posix_map_sid_test(void)
CloseHandle(Token);
for (size_t i = 0; sizeof map / sizeof map[0] > i; i++)
size_t n = sizeof map / sizeof map[0];
if (RunningInContainer)
n -= 2; /* container: disable tests for "user manager\containeradministrator" */
for (size_t i = 0; n > i; i++)
{
Success = ConvertStringSidToSidW(map[i].SidStr, &Sid0);
ASSERT(Success);

View File

@ -254,8 +254,13 @@ static void volpath_mount_test(void)
/*
* This test does FspFileSystemSetMountPoint and therefore
* cannot be used with --external or --mountpoint.
*
* Also the MountMgr appears to be buggy and fail with spurious
* STATUS_NOT_SUPPORTED and STATUS_INVALID_PARAMETER error codes
* under Windows Containers (at least with ServerCore 1909). So
* disable if RunningInContainer.
*/
if (NtfsTests || OptMountPoint)
if (NtfsTests || OptMountPoint || RunningInContainer)
return;
if (WinFspDiskTests)
@ -322,7 +327,12 @@ void volpath_tests(void)
/*
* This test does FspFileSystemSetMountPoint and therefore
* cannot be used with --external or --mountpoint.
*
* Also the MountMgr appears to be buggy and fail with spurious
* STATUS_NOT_SUPPORTED and STATUS_INVALID_PARAMETER error codes
* under Windows Containers (at least with ServerCore 1909). So
* disable if RunningInContainer.
*/
if (!NtfsTests && !OptMountPoint)
if (!NtfsTests && !OptMountPoint && !RunningInContainer)
TEST(volpath_mount_test);
}

View File

@ -32,6 +32,7 @@
int NtfsTests = 0;
int WinFspDiskTests = 1;
int WinFspNetTests = 1;
int RunningInContainer = 0;
BOOLEAN OptExternal = FALSE;
BOOLEAN OptFuseExternal = FALSE;
@ -258,6 +259,12 @@ int main(int argc, char *argv[])
if (0 == getenv("WINFSP_TESTS_EXCEPTION_FILTER_DISABLE"))
SetUnhandledExceptionFilter(UnhandledExceptionHandler);
RunningInContainer = ERROR_SUCCESS == RegGetValueW(
HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control",
L"ContainerType",
RRF_RT_REG_DWORD, 0,
0, 0);
for (int argi = 1; argc > argi; argi++)
{
const char *a = argv[argi];
@ -266,6 +273,7 @@ int main(int argc, char *argv[])
if (0 == strcmp("--ntfs", a) || 0 == strcmp("--external", a))
{
OptExternal = TRUE;
OptFuseExternal = FALSE;
NtfsTests = 1;
WinFspDiskTests = 0;
WinFspNetTests = 0;
@ -404,6 +412,10 @@ int main(int argc, char *argv[])
if (!NtfsTests && OptShareName)
ABORT("option --share requires --ntfs/--external");
if (RunningInContainer)
/* container: disable network file system tests */
WinFspNetTests = 0;
DisableBackupRestorePrivileges();
AddNetShareIfNeeded();

View File

@ -213,6 +213,7 @@ VOID GetTestDirectoryEx(PWSTR DirBuf, ULONG DirBufSize, PWSTR DriveBuf);
extern int NtfsTests;
extern int WinFspDiskTests;
extern int WinFspNetTests;
extern int RunningInContainer;
extern BOOLEAN OptExternal;
extern BOOLEAN OptFuseExternal;