From cf8918be2801f13492cf118c41b1a9c8f3c3adbb Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Fri, 22 Jan 2016 10:00:22 -0800 Subject: [PATCH] winfsp-tests: create_test: test the tests(!) by trying them against NTFS --- tst/winfsp-tests/create-test.c | 27 ++++++++++++++++++++++++++- tst/winfsp-tests/memfs-test.c | 6 ++++++ tst/winfsp-tests/winfsp-tests.c | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/tst/winfsp-tests/create-test.c b/tst/winfsp-tests/create-test.c index 767aa05b..fee2bd60 100644 --- a/tst/winfsp-tests/create-test.c +++ b/tst/winfsp-tests/create-test.c @@ -8,6 +8,7 @@ void *memfs_start(ULONG Flags); void memfs_stop(void *data); PWSTR memfs_volumename(void *data); +extern int NtfsTests; extern int WinFspDiskTests; extern int WinFspNetTests; @@ -126,7 +127,7 @@ void create_dotest(ULONG Flags, PWSTR Prefix) ASSERT(INVALID_HANDLE_VALUE == Handle); ASSERT(ERROR_FILE_NOT_FOUND == GetLastError()); - if (0 == Prefix) + if (-1 == Flags || 0 == Prefix) { /* backslash at path end */ @@ -166,6 +167,12 @@ void create_dotest(ULONG Flags, PWSTR Prefix) void create_test(void) { + if (NtfsTests) + { + WCHAR DirBuf[MAX_PATH] = L"\\\\?\\"; + GetCurrentDirectoryW(MAX_PATH - 4, DirBuf + 4); + create_dotest(-1, DirBuf); + } if (WinFspDiskTests) create_dotest(MemfsDisk, 0); if (WinFspNetTests) @@ -221,6 +228,12 @@ void create_related_dotest(ULONG Flags, PWSTR Prefix) void create_related_test(void) { + if (NtfsTests) + { + WCHAR DirBuf[MAX_PATH] = L"\\\\?\\"; + GetCurrentDirectoryW(MAX_PATH - 4, DirBuf + 4); + create_related_dotest(-1, DirBuf); + } if (WinFspDiskTests) create_related_dotest(MemfsDisk, 0); if (WinFspNetTests) @@ -325,6 +338,12 @@ void create_sd_dotest(ULONG Flags, PWSTR Prefix) void create_sd_test(void) { + if (NtfsTests) + { + WCHAR DirBuf[MAX_PATH] = L"\\\\?\\"; + GetCurrentDirectoryW(MAX_PATH - 4, DirBuf + 4); + create_sd_dotest(-1, DirBuf); + } if (WinFspDiskTests) create_sd_dotest(MemfsDisk, 0); if (WinFspNetTests) @@ -393,6 +412,12 @@ void create_share_dotest(ULONG Flags, PWSTR Prefix) void create_share_test(void) { + if (NtfsTests) + { + WCHAR DirBuf[MAX_PATH] = L"\\\\?\\"; + GetCurrentDirectoryW(MAX_PATH - 4, DirBuf + 4); + create_share_dotest(-1, DirBuf); + } if (WinFspDiskTests) create_share_dotest(MemfsDisk, 0); if (WinFspNetTests) diff --git a/tst/winfsp-tests/memfs-test.c b/tst/winfsp-tests/memfs-test.c index e80b4acb..451f2ee7 100644 --- a/tst/winfsp-tests/memfs-test.c +++ b/tst/winfsp-tests/memfs-test.c @@ -20,6 +20,9 @@ static unsigned __stdcall memfs_thread(void *Memfs0) void *memfs_start(ULONG Flags) { + if (-1 == Flags) + return 0; + struct memfs_data *data; MEMFS *Memfs; HANDLE Thread; @@ -43,6 +46,9 @@ void *memfs_start(ULONG Flags) void memfs_stop(void *data) { + if (0 == data) + return; + MEMFS *Memfs = ((struct memfs_data *)data)->Memfs; HANDLE Thread = ((struct memfs_data *)data)->Thread; DWORD ExitCode; diff --git a/tst/winfsp-tests/winfsp-tests.c b/tst/winfsp-tests/winfsp-tests.c index 1c74147a..53271cc5 100644 --- a/tst/winfsp-tests/winfsp-tests.c +++ b/tst/winfsp-tests/winfsp-tests.c @@ -1,5 +1,6 @@ #include +int NtfsTests = 1; int WinFspDiskTests = 1; int WinFspNetTests = 1;