ctest: change default output test path
This commit is contained in:
parent
e97f76a031
commit
dd23dd1aee
@ -95,6 +95,12 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||||||
if(Wno-deprecated-declarations)
|
if(Wno-deprecated-declarations)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
|
||||||
endif()
|
endif()
|
||||||
|
if(BUILD_TESTING)
|
||||||
|
CHECK_C_COMPILER_FLAG(-Wno-format Wno-format)
|
||||||
|
if(Wno-format)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG")
|
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
||||||
@ -231,6 +237,7 @@ INCLUDE(CTest)
|
|||||||
|
|
||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
set(TESTING_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Testing")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# WinPR
|
# WinPR
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
|
#ifndef MAX_PATH
|
||||||
|
#define MAX_PATH 260
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FILE_READ_DATA 0x0001
|
#define FILE_READ_DATA 0x0001
|
||||||
#define FILE_LIST_DIRECTORY 0x0001
|
#define FILE_LIST_DIRECTORY 0x0001
|
||||||
#define FILE_WRITE_DATA 0x0002
|
#define FILE_WRITE_DATA 0x0002
|
||||||
@ -121,14 +125,69 @@
|
|||||||
#define OPEN_ALWAYS 4
|
#define OPEN_ALWAYS 4
|
||||||
#define TRUNCATE_EXISTING 5
|
#define TRUNCATE_EXISTING 5
|
||||||
|
|
||||||
|
#define FIND_FIRST_EX_CASE_SENSITIVE 0x1
|
||||||
|
#define FIND_FIRST_EX_LARGE_FETCH 0x2
|
||||||
|
|
||||||
typedef union _FILE_SEGMENT_ELEMENT
|
typedef union _FILE_SEGMENT_ELEMENT
|
||||||
{
|
{
|
||||||
PVOID64 Buffer;
|
PVOID64 Buffer;
|
||||||
ULONGLONG Alignment;
|
ULONGLONG Alignment;
|
||||||
} FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
|
} FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
|
||||||
|
|
||||||
|
typedef struct _WIN32_FIND_DATAA
|
||||||
|
{
|
||||||
|
DWORD dwFileAttributes;
|
||||||
|
FILETIME ftCreationTime;
|
||||||
|
FILETIME ftLastAccessTime;
|
||||||
|
FILETIME ftLastWriteTime;
|
||||||
|
DWORD nFileSizeHigh;
|
||||||
|
DWORD nFileSizeLow;
|
||||||
|
DWORD dwReserved0;
|
||||||
|
DWORD dwReserved1;
|
||||||
|
CHAR cFileName[MAX_PATH];
|
||||||
|
CHAR cAlternateFileName[14];
|
||||||
|
} WIN32_FIND_DATAA, *PWIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
|
||||||
|
|
||||||
|
typedef struct _WIN32_FIND_DATAW
|
||||||
|
{
|
||||||
|
DWORD dwFileAttributes;
|
||||||
|
FILETIME ftCreationTime;
|
||||||
|
FILETIME ftLastAccessTime;
|
||||||
|
FILETIME ftLastWriteTime;
|
||||||
|
DWORD nFileSizeHigh;
|
||||||
|
DWORD nFileSizeLow;
|
||||||
|
DWORD dwReserved0;
|
||||||
|
DWORD dwReserved1;
|
||||||
|
WCHAR cFileName[MAX_PATH];
|
||||||
|
WCHAR cAlternateFileName[14];
|
||||||
|
} WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW;
|
||||||
|
|
||||||
|
typedef enum _FINDEX_INFO_LEVELS
|
||||||
|
{
|
||||||
|
FindExInfoStandard,
|
||||||
|
FindExInfoMaxInfoLevel
|
||||||
|
} FINDEX_INFO_LEVELS;
|
||||||
|
|
||||||
|
typedef enum _FINDEX_SEARCH_OPS
|
||||||
|
{
|
||||||
|
FindExSearchNameMatch,
|
||||||
|
FindExSearchLimitToDirectories,
|
||||||
|
FindExSearchLimitToDevices,
|
||||||
|
FindExSearchMaxSearchOp
|
||||||
|
} FINDEX_SEARCH_OPS;
|
||||||
|
|
||||||
typedef VOID (*LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped);
|
typedef VOID (*LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped);
|
||||||
|
|
||||||
|
#ifdef UNICODE
|
||||||
|
#define WIN32_FIND_DATA WIN32_FIND_DATAW
|
||||||
|
#define PWIN32_FIND_DATA PWIN32_FIND_DATAW
|
||||||
|
#define LPWIN32_FIND_DATA LPWIN32_FIND_DATAW
|
||||||
|
#else
|
||||||
|
#define WIN32_FIND_DATA WIN32_FIND_DATAA
|
||||||
|
#define PWIN32_FIND_DATA PWIN32_FIND_DATAA
|
||||||
|
#define LPWIN32_FIND_DATA LPWIN32_FIND_DATAA
|
||||||
|
#endif
|
||||||
|
|
||||||
WINPR_API HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
WINPR_API HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||||
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
|
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
|
||||||
|
|
||||||
@ -179,12 +238,31 @@ WINPR_API BOOL UnlockFile(HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffse
|
|||||||
WINPR_API BOOL UnlockFileEx(HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow,
|
WINPR_API BOOL UnlockFileEx(HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow,
|
||||||
DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped);
|
DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped);
|
||||||
|
|
||||||
|
HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
|
||||||
|
HANDLE FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData);
|
||||||
|
|
||||||
|
HANDLE FindFirstFileExA(LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData,
|
||||||
|
FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags);
|
||||||
|
HANDLE FindFirstFileExW(LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData,
|
||||||
|
FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags);
|
||||||
|
|
||||||
|
BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData);
|
||||||
|
BOOL FindNextFileW(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData);
|
||||||
|
|
||||||
|
BOOL FindClose(HANDLE hFindFile);
|
||||||
|
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
#define CreateFile CreateFileW
|
#define CreateFile CreateFileW
|
||||||
#define DeleteFile DeleteFileW
|
#define DeleteFile DeleteFileW
|
||||||
|
#define FindFirstFile FindFirstFileW
|
||||||
|
#define FindFirstFileEx FindFirstFileExW
|
||||||
|
#define FindNextFile FindNextFileW
|
||||||
#else
|
#else
|
||||||
#define CreateFile CreateFileA
|
#define CreateFile CreateFileA
|
||||||
#define DeleteFile DeleteFileA
|
#define DeleteFile DeleteFileA
|
||||||
|
#define FindFirstFile FindFirstFileA
|
||||||
|
#define FindFirstFileEx FindFirstFileExA
|
||||||
|
#define FindNextFile FindNextFileA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <winpr/file.h>
|
#include <winpr/file.h>
|
||||||
#include <winpr/winpr.h>
|
#include <winpr/winpr.h>
|
||||||
#include <winpr/error.h>
|
#include <winpr/error.h>
|
||||||
|
#include <winpr/handle.h>
|
||||||
#include <winpr/wtypes.h>
|
#include <winpr/wtypes.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -148,10 +148,12 @@ typedef struct _LUID
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
|
typedef LPWSTR PTSTR;
|
||||||
typedef LPWSTR LPTCH;
|
typedef LPWSTR LPTCH;
|
||||||
typedef LPWSTR LPTSTR;
|
typedef LPWSTR LPTSTR;
|
||||||
typedef LPCWSTR LPCTSTR;
|
typedef LPCWSTR LPCTSTR;
|
||||||
#else
|
#else
|
||||||
|
typedef LPSTR PTSTR;
|
||||||
typedef LPSTR LPTCH;
|
typedef LPSTR LPTCH;
|
||||||
typedef LPSTR LPTSTR;
|
typedef LPSTR LPTSTR;
|
||||||
typedef LPCSTR LPCTSTR;
|
typedef LPCSTR LPCTSTR;
|
||||||
|
@ -31,6 +31,8 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
|||||||
|
|
||||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||||
|
|
||||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||||
get_filename_component(TestName ${test} NAME_WE)
|
get_filename_component(TestName ${test} NAME_WE)
|
||||||
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
||||||
|
@ -20,6 +20,8 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
|||||||
|
|
||||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||||
|
|
||||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||||
get_filename_component(TestName ${test} NAME_WE)
|
get_filename_component(TestName ${test} NAME_WE)
|
||||||
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
||||||
|
@ -113,6 +113,11 @@
|
|||||||
* UnlockFileEx
|
* UnlockFileEx
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File System Behavior in the Microsoft Windows Environment:
|
||||||
|
* http://download.microsoft.com/download/4/3/8/43889780-8d45-4b2e-9d3a-c696a890309f/File%20System%20Behavior%20Overview.pdf
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||||
@ -259,5 +264,42 @@ BOOL UnlockFileEx(HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLo
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HANDLE FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HANDLE FindFirstFileExA(LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData,
|
||||||
|
FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HANDLE FindFirstFileExW(LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData,
|
||||||
|
FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FindNextFileW(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FindClose(HANDLE hFindFile)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
|||||||
|
|
||||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||||
|
|
||||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||||
get_filename_component(TestName ${test} NAME_WE)
|
get_filename_component(TestName ${test} NAME_WE)
|
||||||
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
||||||
|
@ -22,6 +22,8 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
|||||||
|
|
||||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||||
|
|
||||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||||
get_filename_component(TestName ${test} NAME_WE)
|
get_filename_component(TestName ${test} NAME_WE)
|
||||||
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
||||||
|
@ -20,6 +20,8 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
|||||||
|
|
||||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||||
|
|
||||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||||
get_filename_component(TestName ${test} NAME_WE)
|
get_filename_component(TestName ${test} NAME_WE)
|
||||||
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
||||||
|
@ -25,9 +25,14 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
|||||||
|
|
||||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||||
|
|
||||||
|
set(TEST_AREA "${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME}Area")
|
||||||
|
file(MAKE_DIRECTORY ${TEST_AREA})
|
||||||
|
|
||||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||||
get_filename_component(TestName ${test} NAME_WE)
|
get_filename_component(TestName ${test} NAME_WE)
|
||||||
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName} ${EXECUTABLE_OUTPUT_PATH})
|
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName} ${TEST_AREA})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")
|
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")
|
||||||
|
@ -21,4 +21,7 @@ add_library(${MODULE_NAME} TestLibraryA.c)
|
|||||||
|
|
||||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${TEST_AREA}/${MODULE_NAME}")
|
||||||
|
file(MAKE_DIRECTORY "${TEST_AREA}/${MODULE_NAME}")
|
||||||
|
|
||||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test/Extra")
|
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test/Extra")
|
||||||
|
@ -21,4 +21,7 @@ add_library(${MODULE_NAME} TestLibraryB.c)
|
|||||||
|
|
||||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${TEST_AREA}/${MODULE_NAME}")
|
||||||
|
file(MAKE_DIRECTORY "${TEST_AREA}/${MODULE_NAME}")
|
||||||
|
|
||||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test/Extra")
|
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test/Extra")
|
||||||
|
@ -1,26 +1,52 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
#include <winpr/file.h>
|
#include <winpr/path.h>
|
||||||
#include <winpr/tchar.h>
|
#include <winpr/tchar.h>
|
||||||
#include <winpr/windows.h>
|
#include <winpr/windows.h>
|
||||||
#include <winpr/library.h>
|
#include <winpr/library.h>
|
||||||
|
|
||||||
int TestLibraryFreeLibrary(int argc, char* argv[])
|
int TestLibraryFreeLibrary(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
char* str;
|
||||||
|
int length;
|
||||||
|
LPTSTR BasePath;
|
||||||
HINSTANCE library;
|
HINSTANCE library;
|
||||||
|
LPCTSTR SharedLibraryExtension;
|
||||||
|
TCHAR LibraryPath[PATHCCH_MAX_CCH];
|
||||||
|
|
||||||
library = LoadLibrary(_T("kernel32.dll"));
|
str = argv[1];
|
||||||
|
|
||||||
|
#ifdef UNICODE
|
||||||
|
length = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0);
|
||||||
|
BasePath = (WCHAR*) malloc((length + 1) * sizeof(WCHAR));
|
||||||
|
MultiByteToWideChar(CP_UTF8, 0, str, length, (LPWSTR) BasePath, length * sizeof(WCHAR));
|
||||||
|
BasePath[length] = 0;
|
||||||
|
#else
|
||||||
|
BasePath = _strdup(str);
|
||||||
|
length = strlen(BasePath);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CopyMemory(LibraryPath, BasePath, length * sizeof(TCHAR));
|
||||||
|
NativePathCchAppend(LibraryPath, PATHCCH_MAX_CCH, _T("TestLibraryA")); /* subdirectory */
|
||||||
|
NativePathCchAppend(LibraryPath, PATHCCH_MAX_CCH, _T("TestLibraryA")); /* file name without extension */
|
||||||
|
|
||||||
|
SharedLibraryExtension = PathGetSharedLibraryExtension(PATH_SHARED_LIB_EXT_WITH_DOT);
|
||||||
|
NativePathCchAddExtension(LibraryPath, PATHCCH_MAX_CCH, SharedLibraryExtension); /* add shared library extension */
|
||||||
|
|
||||||
|
_tprintf(_T("Loading Library: %s\n"), LibraryPath);
|
||||||
|
|
||||||
|
library = LoadLibrary(LibraryPath);
|
||||||
|
|
||||||
if (!library)
|
if (!library)
|
||||||
{
|
{
|
||||||
printf("LoadLibrary failure\n");
|
_tprintf(_T("LoadLibrary failure\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FreeLibrary(library))
|
if (!FreeLibrary(library))
|
||||||
{
|
{
|
||||||
printf("FreeLibrary failure\n");
|
_tprintf(_T("FreeLibrary failure\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,9 @@ int TestLibraryGetProcAddress(int argc, char* argv[])
|
|||||||
char* str;
|
char* str;
|
||||||
int length;
|
int length;
|
||||||
LPTSTR BasePath;
|
LPTSTR BasePath;
|
||||||
//HINSTANCE library;
|
HINSTANCE library;
|
||||||
LPTSTR LibraryPath;
|
LPCTSTR SharedLibraryExtension;
|
||||||
|
TCHAR LibraryPath[PATHCCH_MAX_CCH];
|
||||||
|
|
||||||
str = argv[1];
|
str = argv[1];
|
||||||
|
|
||||||
@ -23,28 +24,31 @@ int TestLibraryGetProcAddress(int argc, char* argv[])
|
|||||||
BasePath[length] = 0;
|
BasePath[length] = 0;
|
||||||
#else
|
#else
|
||||||
BasePath = _strdup(str);
|
BasePath = _strdup(str);
|
||||||
|
length = strlen(BasePath);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_tprintf(_T("Base Path: %s\n"), BasePath);
|
CopyMemory(LibraryPath, BasePath, length * sizeof(TCHAR));
|
||||||
|
NativePathCchAppend(LibraryPath, PATHCCH_MAX_CCH, _T("TestLibraryA")); /* subdirectory */
|
||||||
|
NativePathCchAppend(LibraryPath, PATHCCH_MAX_CCH, _T("TestLibraryA")); /* file name without extension */
|
||||||
|
|
||||||
PathAllocCombine(BasePath, _T("TestLibraryA\\TestLibraryA.dll"), 0, &LibraryPath);
|
SharedLibraryExtension = PathGetSharedLibraryExtension(PATH_SHARED_LIB_EXT_WITH_DOT);
|
||||||
|
NativePathCchAddExtension(LibraryPath, PATHCCH_MAX_CCH, SharedLibraryExtension); /* add shared library extension */
|
||||||
|
|
||||||
//_tprintf(_T("Loading Library: %s\n"), LibraryPath);
|
_tprintf(_T("Loading Library: %s\n"), LibraryPath);
|
||||||
|
|
||||||
/*
|
|
||||||
library = LoadLibrary(LibraryPath);
|
library = LoadLibrary(LibraryPath);
|
||||||
|
|
||||||
if (!library)
|
if (!library)
|
||||||
{
|
{
|
||||||
printf("LoadLibrary failure\n");
|
_tprintf(_T("LoadLibrary failure\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FreeLibrary(library))
|
if (!FreeLibrary(library))
|
||||||
{
|
{
|
||||||
printf("FreeLibrary failure\n");
|
_tprintf(_T("FreeLibrary failure\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,52 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
#include <winpr/file.h>
|
#include <winpr/path.h>
|
||||||
#include <winpr/tchar.h>
|
#include <winpr/tchar.h>
|
||||||
#include <winpr/windows.h>
|
#include <winpr/windows.h>
|
||||||
#include <winpr/library.h>
|
#include <winpr/library.h>
|
||||||
|
|
||||||
int TestLibraryLoadLibrary(int argc, char* argv[])
|
int TestLibraryLoadLibrary(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
char* str;
|
||||||
|
int length;
|
||||||
|
LPTSTR BasePath;
|
||||||
HINSTANCE library;
|
HINSTANCE library;
|
||||||
|
LPCTSTR SharedLibraryExtension;
|
||||||
|
TCHAR LibraryPath[PATHCCH_MAX_CCH];
|
||||||
|
|
||||||
library = LoadLibrary(_T("kernel32.dll"));
|
str = argv[1];
|
||||||
|
|
||||||
|
#ifdef UNICODE
|
||||||
|
length = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0);
|
||||||
|
BasePath = (WCHAR*) malloc((length + 1) * sizeof(WCHAR));
|
||||||
|
MultiByteToWideChar(CP_UTF8, 0, str, length, (LPWSTR) BasePath, length * sizeof(WCHAR));
|
||||||
|
BasePath[length] = 0;
|
||||||
|
#else
|
||||||
|
BasePath = _strdup(str);
|
||||||
|
length = strlen(BasePath);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CopyMemory(LibraryPath, BasePath, length * sizeof(TCHAR));
|
||||||
|
NativePathCchAppend(LibraryPath, PATHCCH_MAX_CCH, _T("TestLibraryA")); /* subdirectory */
|
||||||
|
NativePathCchAppend(LibraryPath, PATHCCH_MAX_CCH, _T("TestLibraryA")); /* file name without extension */
|
||||||
|
|
||||||
|
SharedLibraryExtension = PathGetSharedLibraryExtension(PATH_SHARED_LIB_EXT_WITH_DOT);
|
||||||
|
NativePathCchAddExtension(LibraryPath, PATHCCH_MAX_CCH, SharedLibraryExtension); /* add shared library extension */
|
||||||
|
|
||||||
|
_tprintf(_T("Loading Library: %s\n"), LibraryPath);
|
||||||
|
|
||||||
|
library = LoadLibrary(LibraryPath);
|
||||||
|
|
||||||
if (!library)
|
if (!library)
|
||||||
{
|
{
|
||||||
printf("LoadLibrary failure\n");
|
_tprintf(_T("LoadLibrary failure\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FreeLibrary(library))
|
if (!FreeLibrary(library))
|
||||||
{
|
{
|
||||||
printf("FreeLibrary failure\n");
|
_tprintf(_T("FreeLibrary failure\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,6 +287,50 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||||||
#undef _PATH_SEPARATOR_STR
|
#undef _PATH_SEPARATOR_STR
|
||||||
#undef PATH_CCH_APPEND
|
#undef PATH_CCH_APPEND
|
||||||
|
|
||||||
|
/* Unix-style Paths */
|
||||||
|
|
||||||
|
#define DEFINE_UNICODE FALSE
|
||||||
|
#define _PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||||
|
#define _PATH_SEPARATOR_STR PATH_SLASH_STR
|
||||||
|
#define PATH_CCH_APPEND UnixPathCchAppendA
|
||||||
|
#include "include/PathCchAppend.c"
|
||||||
|
#undef DEFINE_UNICODE
|
||||||
|
#undef _PATH_SEPARATOR_CHR
|
||||||
|
#undef _PATH_SEPARATOR_STR
|
||||||
|
#undef PATH_CCH_APPEND
|
||||||
|
|
||||||
|
#define DEFINE_UNICODE TRUE
|
||||||
|
#define _PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||||
|
#define _PATH_SEPARATOR_STR PATH_SLASH_STR_W
|
||||||
|
#define PATH_CCH_APPEND UnixPathCchAppendW
|
||||||
|
#include "include/PathCchAppend.c"
|
||||||
|
#undef DEFINE_UNICODE
|
||||||
|
#undef _PATH_SEPARATOR_CHR
|
||||||
|
#undef _PATH_SEPARATOR_STR
|
||||||
|
#undef PATH_CCH_APPEND
|
||||||
|
|
||||||
|
/* Native-style Paths */
|
||||||
|
|
||||||
|
#define DEFINE_UNICODE FALSE
|
||||||
|
#define _PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||||
|
#define _PATH_SEPARATOR_STR PATH_SEPARATOR_STR
|
||||||
|
#define PATH_CCH_APPEND NativePathCchAppendA
|
||||||
|
#include "include/PathCchAppend.c"
|
||||||
|
#undef DEFINE_UNICODE
|
||||||
|
#undef _PATH_SEPARATOR_CHR
|
||||||
|
#undef _PATH_SEPARATOR_STR
|
||||||
|
#undef PATH_CCH_APPEND
|
||||||
|
|
||||||
|
#define DEFINE_UNICODE TRUE
|
||||||
|
#define _PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||||
|
#define _PATH_SEPARATOR_STR PATH_SEPARATOR_STR_W
|
||||||
|
#define PATH_CCH_APPEND NativePathCchAppendW
|
||||||
|
#include "include/PathCchAppend.c"
|
||||||
|
#undef DEFINE_UNICODE
|
||||||
|
#undef _PATH_SEPARATOR_CHR
|
||||||
|
#undef _PATH_SEPARATOR_STR
|
||||||
|
#undef PATH_CCH_APPEND
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PathCchAppendEx
|
* PathCchAppendEx
|
||||||
*/
|
*/
|
||||||
|
@ -41,6 +41,8 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
|||||||
|
|
||||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||||
|
|
||||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||||
get_filename_component(TestName ${test} NAME_WE)
|
get_filename_component(TestName ${test} NAME_WE)
|
||||||
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
||||||
|
@ -19,7 +19,7 @@ int TestPathIsUNCEx(int argc, char* argv[])
|
|||||||
|
|
||||||
_tcscpy(Path, testPathUNC);
|
_tcscpy(Path, testPathUNC);
|
||||||
|
|
||||||
status = PathIsUNCEx(Path, &Server);
|
status = PathIsUNCEx(Path, (LPCTSTR*) &Server);
|
||||||
|
|
||||||
if (!status)
|
if (!status)
|
||||||
{
|
{
|
||||||
@ -37,7 +37,7 @@ int TestPathIsUNCEx(int argc, char* argv[])
|
|||||||
|
|
||||||
_tcscpy(Path, testPathNotUNC);
|
_tcscpy(Path, testPathNotUNC);
|
||||||
|
|
||||||
status = PathIsUNCEx(Path, &Server);
|
status = PathIsUNCEx(Path, (LPCTSTR*) &Server);
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,8 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
|||||||
|
|
||||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||||
|
|
||||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||||
get_filename_component(TestName ${test} NAME_WE)
|
get_filename_component(TestName ${test} NAME_WE)
|
||||||
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
||||||
|
@ -27,6 +27,8 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
|||||||
|
|
||||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||||
|
|
||||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||||
get_filename_component(TestName ${test} NAME_WE)
|
get_filename_component(TestName ${test} NAME_WE)
|
||||||
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName})
|
||||||
|
Loading…
Reference in New Issue
Block a user