From: Rafal Harabien Date: Thu, 28 Apr 2011 22:10:51 +0000 (+0000) Subject: [APITESTS] X-Git-Tag: backups/ros-amd64-bringup@60669^2~855 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=ee795b8b1e13e8f2b3aa26026f3197c67e670181 [APITESTS] * Add GetDriveType tests. Some fails in ReactOS * Fix few rbuild files svn path=/trunk/; revision=51484 --- diff --git a/rostests/apitests/CMakeLists.txt b/rostests/apitests/CMakeLists.txt index 4ac4b3027d2..1251a06a6ee 100644 --- a/rostests/apitests/CMakeLists.txt +++ b/rostests/apitests/CMakeLists.txt @@ -5,6 +5,7 @@ add_subdirectory(dciman32) add_subdirectory(gdi32) add_subdirectory(ntdll) add_subdirectory(user32) +add_subdirectory(kernel32) if(NOT MSVC) if(ARCH MATCHES i386) diff --git a/rostests/apitests/directory.rbuild b/rostests/apitests/directory.rbuild index 14446375bef..37c01c338be 100644 --- a/rostests/apitests/directory.rbuild +++ b/rostests/apitests/directory.rbuild @@ -21,6 +21,10 @@ + + + + diff --git a/rostests/apitests/kernel32/CMakeLists.txt b/rostests/apitests/kernel32/CMakeLists.txt new file mode 100644 index 00000000000..3fc8c865e62 --- /dev/null +++ b/rostests/apitests/kernel32/CMakeLists.txt @@ -0,0 +1,12 @@ + +add_definitions(-D_DLL -D__USE_CRTIMP) + +list(APPEND SOURCE + GetDriveType.c + testlist.c) + +add_executable(kernel32_apitest ${SOURCE}) +target_link_libraries(kernel32_apitest wine ${PSEH_LIB}) +set_module_type(kernel32_apitest win32cui) +add_importlibs(kernel32_apitest gdi32 user32 msvcrt kernel32 ntdll) +add_cab_target(kernel32_apitest 7) diff --git a/rostests/apitests/kernel32/GetDriveType.c b/rostests/apitests/kernel32/GetDriveType.c new file mode 100644 index 00000000000..010eb362de7 --- /dev/null +++ b/rostests/apitests/kernel32/GetDriveType.c @@ -0,0 +1,71 @@ +#include +#include +#include + +#define IS_DRIVE_TYPE_VALID(type) ((type) != DRIVE_UNKNOWN && (type) != DRIVE_NO_ROOT_DIR) + +START_TEST(GetDriveType) +{ + UINT Type, Type2, i; + WCHAR Path[MAX_PATH]; + + /* Note: Successful calls can set last error to at least ERROR_NOT_A_REPARSE_POINT, we don't test it here */ + SetLastError(0xdeadbeaf); + + Type = GetDriveTypeW(L""); + ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type); + + Type = GetDriveTypeW(L"\nC:\\"); + ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type); + + Type = GetDriveTypeW(L"Z:\\"); + ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type); + + ok(GetLastError() == 0xdeadbeaf, "Expected no errors, got %lu\n", GetLastError()); + + /* Drive root is accepted without ending slash */ + Type = GetDriveTypeW(L"C:"); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + + Type = GetDriveTypeW(L"C:\\"); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + + Type = GetDriveTypeW(NULL); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + + i = GetCurrentDirectoryW(sizeof(Path)/sizeof(Path[0]), Path); + if (i) + { + /* Note: there is no backslash at the end of Path */ + SetLastError(0xdeadbeaf); + Type2 = GetDriveTypeW(Path); + ok(Type2 == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type2); + ok(GetLastError() == 0xdeadbeaf, "Expected ERROR_NOT_A_REPARSE_POINT, got %lu\n", GetLastError()); + + wcscpy(Path+i, L"\\"); + Type2 = GetDriveTypeW(Path); + ok(Type == Type2, "Types are not equal: %u != %u\n", Type, Type2); + } + + i = GetSystemDirectoryW(Path, sizeof(Path)/sizeof(Path[0])); + if (i) + { + /* Note: there is no backslash at the end of Path */ + SetLastError(0xdeadbeaf); + Type = GetDriveTypeW(Path); + ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type); + ok(GetLastError() == 0xdeadbeaf, "Expected no errors, got %lu\n", GetLastError()); + + wcscpy(Path+i, L"\\"); + Type = GetDriveTypeW(Path); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + + wcscpy(Path+i, L"/"); + Type = GetDriveTypeW(Path); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + + wcscpy(Path+i, L"\\\\"); + Type = GetDriveTypeW(Path); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + } +} diff --git a/rostests/apitests/kernel32/kernel32_apitest.rbuild b/rostests/apitests/kernel32/kernel32_apitest.rbuild new file mode 100644 index 00000000000..81766be6722 --- /dev/null +++ b/rostests/apitests/kernel32/kernel32_apitest.rbuild @@ -0,0 +1,13 @@ + + + + + . + wine + ntdll + pseh + testlist.c + + GetDriveType.c + + diff --git a/rostests/apitests/kernel32/testlist.c b/rostests/apitests/kernel32/testlist.c new file mode 100644 index 00000000000..123e1ce2ea5 --- /dev/null +++ b/rostests/apitests/kernel32/testlist.c @@ -0,0 +1,16 @@ +#define WIN32_LEAN_AND_MEAN +#define __ROS_LONG64__ +#include + +#define STANDALONE +#include "wine/test.h" + +extern void func_GetDriveType(void); + +const struct test winetest_testlist[] = +{ + { "GetDriveType", func_GetDriveType }, + + { 0, 0 } +}; + diff --git a/rostests/dibtests/bltrop/bltrop.rbuild b/rostests/dibtests/bltrop/bltrop.rbuild index f19491c61bb..82b0a098e2b 100644 --- a/rostests/dibtests/bltrop/bltrop.rbuild +++ b/rostests/dibtests/bltrop/bltrop.rbuild @@ -4,3 +4,4 @@ user32 bltrop.c bltrop.rc + diff --git a/rostests/dibtests/vbltest/vbltest.rbuild b/rostests/dibtests/vbltest/vbltest.rbuild index d715469ba68..c49b905f530 100644 --- a/rostests/dibtests/vbltest/vbltest.rbuild +++ b/rostests/dibtests/vbltest/vbltest.rbuild @@ -4,3 +4,4 @@ gdi32 vbltest.c vbltest.rc + \ No newline at end of file diff --git a/rostests/dxtest/win32kdxtest/win32kdxtest.rbuild b/rostests/dxtest/win32kdxtest/win32kdxtest.rbuild index ad0499a5d05..90122ac0b6f 100644 --- a/rostests/dxtest/win32kdxtest/win32kdxtest.rbuild +++ b/rostests/dxtest/win32kdxtest/win32kdxtest.rbuild @@ -11,3 +11,4 @@ NtGdiDdWaitForVerticalBlank.c NtGdiDdCanCreateSurface.c dump.c + \ No newline at end of file diff --git a/rostests/win32/smss/movefile/movefile.rbuild b/rostests/win32/smss/movefile/movefile.rbuild index 21033a1930f..9fe8a054cab 100644 --- a/rostests/win32/smss/movefile/movefile.rbuild +++ b/rostests/win32/smss/movefile/movefile.rbuild @@ -4,3 +4,4 @@ user32 movefile.cpp movefile.rc + \ No newline at end of file diff --git a/rostests/win32/user32/drawcaption/drawcaption.rbuild b/rostests/win32/user32/drawcaption/drawcaption.rbuild index 351250ec530..026b2410bd8 100644 --- a/rostests/win32/user32/drawcaption/drawcaption.rbuild +++ b/rostests/win32/user32/drawcaption/drawcaption.rbuild @@ -16,3 +16,4 @@ capicon.c capicon.rc + diff --git a/rostests/winetests/cryptui/cryptui.rbuild b/rostests/winetests/cryptui/cryptui.rbuild index 2c6daf31b46..13b7702ce10 100644 --- a/rostests/winetests/cryptui/cryptui.rbuild +++ b/rostests/winetests/cryptui/cryptui.rbuild @@ -8,3 +8,4 @@ crypt32 user32 ntdll +