winfsp-tests: getinfo_test

This commit is contained in:
Bill Zissimopoulos 2016-01-24 11:27:38 -08:00
parent 83329c8e71
commit 1db9f2b677
4 changed files with 56 additions and 0 deletions

View File

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

View File

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

View File

@ -0,0 +1,51 @@
#include <winfsp/winfsp.h>
#include <tlib/testsuite.h>
#include <sddl.h>
#include <strsafe.h>
#include "memfs.h"
void *memfs_start(ULONG Flags);
void memfs_stop(void *data);
PWSTR memfs_volumename(void *data);
extern int NtfsTests;
extern int WinFspDiskTests;
extern int WinFspNetTests;
void getinfo_dotest(ULONG Flags, PWSTR Prefix)
{
void *memfs = memfs_start(Flags);
HANDLE Handle;
WCHAR FilePath[MAX_PATH];
StringCbPrintfW(FilePath, sizeof FilePath, L"%s%s\\file0",
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
Handle = CreateFileW(FilePath,
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
CREATE_NEW, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, 0);
ASSERT(INVALID_HANDLE_VALUE != Handle);
CloseHandle(Handle);
memfs_stop(memfs);
}
void getinfo_test(void)
{
if (NtfsTests)
{
WCHAR DirBuf[MAX_PATH] = L"\\\\?\\";
GetCurrentDirectoryW(MAX_PATH - 4, DirBuf + 4);
getinfo_dotest(-1, DirBuf);
}
if (WinFspDiskTests)
getinfo_dotest(MemfsDisk, 0);
if (WinFspNetTests)
getinfo_dotest(MemfsNet, L"\\\\memfs\\share");
}
void getinfo_tests(void)
{
TEST(getinfo_test);
}

View File

@ -11,6 +11,7 @@ int main(int argc, char *argv[])
TESTSUITE(timeout_tests);
TESTSUITE(memfs_tests);
TESTSUITE(create_tests);
TESTSUITE(getinfo_tests);
tlib_run_tests(argc, argv);
return 0;