Major refactoring: testing

This commit is contained in:
Bill Zissimopoulos 2015-12-28 18:41:26 -08:00
parent fee52f4397
commit 28ab5aa3e4
4 changed files with 17 additions and 13 deletions

View File

@ -177,6 +177,7 @@
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">TurnOffAllWarnings</WarningLevel> <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">TurnOffAllWarnings</WarningLevel>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\tst\winfsp-tests\mount-test.c" /> <ClCompile Include="..\..\..\tst\winfsp-tests\mount-test.c" />
<ClCompile Include="..\..\..\tst\winfsp-tests\timeout-test.c" />
<ClCompile Include="..\..\..\tst\winfsp-tests\winfsp-tests.c" /> <ClCompile Include="..\..\..\tst\winfsp-tests\winfsp-tests.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -19,6 +19,9 @@
<ClCompile Include="..\..\..\tst\winfsp-tests\mount-test.c"> <ClCompile Include="..\..\..\tst\winfsp-tests\mount-test.c">
<Filter>Source</Filter> <Filter>Source</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\tst\winfsp-tests\timeout-test.c">
<Filter>Source</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\..\ext\tlib\testsuite.h"> <ClInclude Include="..\..\..\ext\tlib\testsuite.h">

View File

@ -23,18 +23,22 @@ void timeout_pending_dotest(PWSTR DeviceName)
{ {
NTSTATUS Result; NTSTATUS Result;
BOOL Success; BOOL Success;
FSP_FSCTL_VOLUME_PARAMS Params = { 0 }; FSP_FSCTL_VOLUME_PARAMS VolumeParams = { 0 };
WCHAR VolumePath[MAX_PATH]; WCHAR VolumePath[MAX_PATH];
WCHAR FilePath[MAX_PATH]; WCHAR FilePath[MAX_PATH];
HANDLE VolumeHandle; HANDLE VolumeHandle;
HANDLE Thread; HANDLE Thread;
DWORD ExitCode; DWORD ExitCode;
Params.SectorSize = 16384; VolumeParams.IrpTimeout = FspFsctlIrpTimeoutDebug;
Params.SerialNumber = 0x12345678; VolumeParams.SectorSize = 16384;
Params.IrpTimeout = FspFsctlIrpTimeoutDebug; VolumeParams.SerialNumber = 0x12345678;
Result = FspFsctlCreateVolume(DeviceName, &Params, 0, VolumePath, sizeof VolumePath); wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), L"\\\\winfsp-tests");
Result = FspFsctlCreateVolume(DeviceName, &VolumeParams,
VolumePath, sizeof VolumePath, &VolumeHandle);
ASSERT(STATUS_SUCCESS == Result); ASSERT(STATUS_SUCCESS == Result);
ASSERT(0 == wcsncmp(L"\\Device\\Volume{", VolumePath, 15));
ASSERT(INVALID_HANDLE_VALUE != VolumeHandle);
StringCbPrintfW(FilePath, sizeof FilePath, L"\\\\?\\GLOBALROOT%s\\file0", VolumePath); StringCbPrintfW(FilePath, sizeof FilePath, L"\\\\?\\GLOBALROOT%s\\file0", VolumePath);
Thread = (HANDLE)_beginthreadex(0, 0, timeout_pending_dotest_thread, FilePath, 0, 0); Thread = (HANDLE)_beginthreadex(0, 0, timeout_pending_dotest_thread, FilePath, 0, 0);
@ -46,12 +50,6 @@ void timeout_pending_dotest(PWSTR DeviceName)
ASSERT(ERROR_OPERATION_ABORTED == ExitCode); ASSERT(ERROR_OPERATION_ABORTED == ExitCode);
Result = FspFsctlOpenVolume(VolumePath, &VolumeHandle);
ASSERT(STATUS_SUCCESS == Result);
Result = FspFsctlDeleteVolume(VolumeHandle);
ASSERT(STATUS_SUCCESS == Result);
Success = CloseHandle(VolumeHandle); Success = CloseHandle(VolumeHandle);
ASSERT(Success); ASSERT(Success);
} }
@ -64,6 +62,7 @@ void timeout_pending_test(void)
timeout_pending_dotest(L"WinFsp.Net"); timeout_pending_dotest(L"WinFsp.Net");
} }
#if 0
static unsigned __stdcall timeout_transact_dotest_thread(void *FilePath) static unsigned __stdcall timeout_transact_dotest_thread(void *FilePath)
{ {
FspDebugLog(__FUNCTION__ ": \"%S\"\n", FilePath); FspDebugLog(__FUNCTION__ ": \"%S\"\n", FilePath);
@ -161,9 +160,10 @@ void timeout_transact_test(void)
if (WinFspNetTests) if (WinFspNetTests)
timeout_transact_dotest(L"WinFsp.Net"); timeout_transact_dotest(L"WinFsp.Net");
} }
#endif
void timeout_tests(void) void timeout_tests(void)
{ {
TEST(timeout_pending_test); TEST(timeout_pending_test);
TEST(timeout_transact_test); //TEST(timeout_transact_test);
} }

View File

@ -6,7 +6,7 @@ int WinFspNetTests = 1;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
TESTSUITE(mount_tests); TESTSUITE(mount_tests);
//TESTSUITE(timeout_tests); TESTSUITE(timeout_tests);
tlib_run_tests(argc, argv); tlib_run_tests(argc, argv);
return 0; return 0;