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>
</ClCompile>
<ClCompile Include="..\..\..\tst\winfsp-tests\mount-test.c" />
<ClCompile Include="..\..\..\tst\winfsp-tests\timeout-test.c" />
<ClCompile Include="..\..\..\tst\winfsp-tests\winfsp-tests.c" />
</ItemGroup>
<ItemGroup>

View File

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

View File

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