mirror of
				https://github.com/winfsp/winfsp.git
				synced 2025-10-30 19:48:38 -05:00 
			
		
		
		
	winfsp-tests: getinfo_test
This commit is contained in:
		| @@ -181,6 +181,7 @@ | |||||||
|       <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">TurnOffAllWarnings</WarningLevel> |       <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">TurnOffAllWarnings</WarningLevel> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|     <ClCompile Include="..\..\..\tst\winfsp-tests\create-test.c" /> |     <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-test.c" /> | ||||||
|     <ClCompile Include="..\..\..\tst\winfsp-tests\memfs.cpp" /> |     <ClCompile Include="..\..\..\tst\winfsp-tests\memfs.cpp" /> | ||||||
|     <ClCompile Include="..\..\..\tst\winfsp-tests\mount-test.c" /> |     <ClCompile Include="..\..\..\tst\winfsp-tests\mount-test.c" /> | ||||||
|   | |||||||
| @@ -34,6 +34,9 @@ | |||||||
|     <ClCompile Include="..\..\..\tst\winfsp-tests\memfs-test.c"> |     <ClCompile Include="..\..\..\tst\winfsp-tests\memfs-test.c"> | ||||||
|       <Filter>Source</Filter> |       <Filter>Source</Filter> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|  |     <ClCompile Include="..\..\..\tst\winfsp-tests\fileinfo-test.c"> | ||||||
|  |       <Filter>Source</Filter> | ||||||
|  |     </ClCompile> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <ClInclude Include="..\..\..\ext\tlib\testsuite.h"> |     <ClInclude Include="..\..\..\ext\tlib\testsuite.h"> | ||||||
|   | |||||||
							
								
								
									
										51
									
								
								tst/winfsp-tests/fileinfo-test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								tst/winfsp-tests/fileinfo-test.c
									
									
									
									
									
										Normal 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); | ||||||
|  | } | ||||||
| @@ -11,6 +11,7 @@ int main(int argc, char *argv[]) | |||||||
|     TESTSUITE(timeout_tests); |     TESTSUITE(timeout_tests); | ||||||
|     TESTSUITE(memfs_tests); |     TESTSUITE(memfs_tests); | ||||||
|     TESTSUITE(create_tests); |     TESTSUITE(create_tests); | ||||||
|  |     TESTSUITE(getinfo_tests); | ||||||
|  |  | ||||||
|     tlib_run_tests(argc, argv); |     tlib_run_tests(argc, argv); | ||||||
|     return 0; |     return 0; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user