This commit is contained in:
parth21999 2020-06-11 11:29:41 -04:00
Родитель 4935ecffc4
Коммит b4a7d89b9c
41 изменённых файлов: 736 добавлений и 1 удалений

Просмотреть файл

@ -25,6 +25,5 @@ include_directories(${CMAKE_CURRENT_LIST_DIR}/inc)
include_directories(${MACRO_UTILS_INC_FOLDER})
add_library(pal_interfaces INTERFACE)
#target_sources(pal_interfaces INTERFACE ${pal_interfaces_md_files} ${pal_interfaces_h_files})
target_include_directories(pal_interfaces INTERFACE ${CMAKE_CURRENT_LIST_DIR}/inc)
add_subdirectory(tests)

Просмотреть файл

@ -0,0 +1,39 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
cmake_minimum_required(VERSION 2.8.11)
set(azure_c_pal_reals_h_files
real_threadapi.h
real_threadapi_renames.h
)
if(WIN32)
set(azure_c_pal_reals_c_files ${azure_c_pal_reals_c_files}
../../../win32/src/reals_win32/real_interlocked_hl_win32.c
../../../win32/src/reals_win32/real_srw_lock_win32.c
../../../win32/src/reals_win32/real_string_utils_win32.c
../../../win32/src/reals_win32/real_timer_win32.c
)
set(azure_c_pal_reals_h_files ${azure_c_pal_reals_h_files}
real_interlocked_hl.h
real_interlocked_hl_renames.h
real_srw_lock.h
real_srw_lock_renames.h
real_string_utils.h
real_string_utils_renames.h
real_timer.h
real_timer_renames.h
)
set(REALS_SRC_DIR ../../../win32/src/reals_win32)
else()
set(REALS_SRC_DIR ../../../linux/src/reals_linux)
endif()
include_directories(${REALS_SRC_DIR})
add_library(azure_c_pal_reals ${azure_c_pal_reals_c_files} ${azure_c_pal_reals_h_files})
target_include_directories(azure_c_pal_reals PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/tests/reals>)
target_link_libraries(azure_c_pal_reals azure_c_logging)

Просмотреть файл

@ -0,0 +1,39 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#ifndef REAL_INTERLOCKED_HL_H
#define REAL_INTERLOCKED_HL_H
#include "azure_macro_utils/macro_utils.h"
#include "windows.h"
#define R2(X) REGISTER_GLOBAL_MOCK_HOOK(X, real_##X);
#define REGISTER_INTERLOCKED_HL_GLOBAL_MOCK_HOOK() \
MU_FOR_EACH_1(R2, \
InterlockedHL_Add64WithCeiling, \
InterlockedHL_WaitForValue, \
InterlockedHL_WaitForNotValue, \
InterlockedHL_SetAndWake, \
InterlockedHL_CompareExchange64If \
)
#include "interlocked_hl.h"
#ifdef __cplusplus
extern "C" {
#endif
INTERLOCKED_HL_RESULT real_InterlockedHL_Add64WithCeiling(LONGLONG volatile * Addend, LONGLONG Ceiling, LONGLONG Value, LONGLONG* originalAddend);
INTERLOCKED_HL_RESULT real_InterlockedHL_WaitForValue(LONG volatile* address, LONG value, DWORD milliseconds);
INTERLOCKED_HL_RESULT real_InterlockedHL_WaitForValue64(LONG64 volatile* address, LONG64 value, DWORD milliseconds);
INTERLOCKED_HL_RESULT real_InterlockedHL_WaitForNotValue(LONG volatile* address, LONG value, DWORD milliseconds);
INTERLOCKED_HL_RESULT real_InterlockedHL_SetAndWake(LONG volatile* address, LONG value);
INTERLOCKED_HL_RESULT real_InterlockedHL_CompareExchange64If(LONG64 volatile* target, LONG64 exchange, INTERLOCKED_COMPARE_EXCHANGE_64_IF compare, LONG64* original_target);
#ifdef __cplusplus
}
#endif
#endif //REAL_INTERLOCKED_HL_H

Просмотреть файл

@ -0,0 +1,11 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define InterlockedHL_Add64WithCeiling real_InterlockedHL_Add64WithCeiling
#define InterlockedHL_WaitForValue real_InterlockedHL_WaitForValue
#define InterlockedHL_WaitForValue64 real_InterlockedHL_WaitForValue64
#define InterlockedHL_WaitForNotValue real_InterlockedHL_WaitForNotValue
#define InterlockedHL_SetAndWake real_InterlockedHL_SetAndWake
#define InterlockedHL_CompareExchange64If real_InterlockedHL_CompareExchange64If
#define INTERLOCKED_HL_RESULT real_INTERLOCKED_HL_RESULT

Просмотреть файл

@ -0,0 +1,50 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#ifndef REAL_SRW_LOCK_H
#define REAL_SRW_LOCK_H
#ifdef __cplusplus
#include <cstdbool>
#else
#include <stdbool.h>
#endif
#include "azure_macro_utils/macro_utils.h"
#include "srw_lock.h"
#define R2(X) REGISTER_GLOBAL_MOCK_HOOK(X, real_##X);
#define REGISTER_SRW_LOCK_GLOBAL_MOCK_HOOK() \
MU_FOR_EACH_1(R2, \
srw_lock_create, \
srw_lock_destroy, \
srw_lock_acquire_exclusive, \
srw_lock_release_exclusive, \
srw_lock_acquire_shared, \
srw_lock_release_shared \
)
#ifdef __cplusplus
extern "C" {
#endif
SRW_LOCK_HANDLE real_srw_lock_create(bool do_statistics, const char* lock_name);
void real_srw_lock_destroy(SRW_LOCK_HANDLE handle);
void real_srw_lock_acquire_exclusive(SRW_LOCK_HANDLE handle);
void real_srw_lock_release_exclusive(SRW_LOCK_HANDLE handle);
void real_srw_lock_acquire_shared(SRW_LOCK_HANDLE handle);
void real_srw_lock_release_shared(SRW_LOCK_HANDLE handle);
#ifdef __cplusplus
}
#endif
#endif // REAL_SRW_LOCK_H

Просмотреть файл

@ -0,0 +1,9 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define srw_lock_create real_srw_lock_create
#define srw_lock_destroy real_srw_lock_destroy
#define srw_lock_acquire_exclusive real_srw_lock_acquire_exclusive
#define srw_lock_release_exclusive real_srw_lock_release_exclusive
#define srw_lock_acquire_shared real_srw_lock_acquire_shared
#define srw_lock_release_shared real_srw_lock_release_shared

Просмотреть файл

@ -0,0 +1,54 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#ifndef REAL_STRING_UTILS_H
#define REAL_STRING_UTILS_H
#ifdef __cplusplus
#include <cstdbool>
#else
#include <stdbool.h>
#endif
#include "azure_macro_utils/macro_utils.h"
#include "srw_lock.h"
#define R2(X) REGISTER_GLOBAL_MOCK_HOOK(X, real_##X);
#define REGISTER_STRING_UTILS_GLOBAL_MOCK_HOOK() \
MU_FOR_EACH_1(R2, \
sprintf_char_function, \
sprintf_wchar_function, \
vsprintf_char, \
vsprintf_wchar, \
FILETIME_toAsciiArray, \
mbs_to_wcs, \
wcs_to_mbs \
)
#ifdef __cplusplus
extern "C" {
#endif
#include "windows.h"
char* real_sprintf_char_function(const char* format, ...);
wchar_t* real_sprintf_wchar_function(const wchar_t* format, ...);
char* real_vsprintf_char(const char* format, va_list va);
wchar_t* real_vsprintf_wchar(const wchar_t* format, va_list va);
char* real_FILETIME_toAsciiArray(const FILETIME* fileTime);
wchar_t* real_mbs_to_wcs(const char* source);
char* real_wcs_to_mbs(const wchar_t* source);
#ifdef __cplusplus
}
#endif
#endif // REAL_STRING_UTILS_H

Просмотреть файл

@ -0,0 +1,10 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define sprintf_char_function real_sprintf_char_function
#define sprintf_wchar_function real_sprintf_wchar_function
#define vsprintf_char real_vsprintf_char
#define vsprintf_wchar real_vsprintf_wchar
#define FILETIME_toAsciiArray real_FILETIME_toAsciiArray
#define mbs_to_wcs real_mbs_to_wcs
#define wcs_to_mbs real_wcs_to_mbs

Просмотреть файл

@ -0,0 +1,37 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#ifndef REAL_THREADAPI_H
#define REAL_THREADAPI_H
#include "azure_macro_utils/macro_utils.h"
#include "threadapi.h"
#define R2(X) REGISTER_GLOBAL_MOCK_HOOK(X, real_##X);
#define REGISTER_THREADAPI_GLOBAL_MOCK_HOOK() \
MU_FOR_EACH_1(R2, \
ThreadAPI_Create, \
ThreadAPI_Join, \
ThreadAPI_Exit, \
ThreadAPI_Sleep \
)
#ifdef __cplusplus
extern "C" {
#endif
THREADAPI_RESULT real_ThreadAPI_Create(THREAD_HANDLE* threadHandle, THREAD_START_FUNC func, void* arg);
THREADAPI_RESULT real_ThreadAPI_Join(THREAD_HANDLE threadHandle, int* res);
void real_ThreadAPI_Exit(int res);
void real_ThreadAPI_Sleep(unsigned int milliseconds);
#ifdef __cplusplus
}
#endif
#endif // REAL_THREADAPI_H

Просмотреть файл

@ -0,0 +1,9 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define ThreadAPI_Create real_ThreadAPI_Create
#define ThreadAPI_Join real_ThreadAPI_Join
#define ThreadAPI_Exit real_ThreadAPI_Exit
#define ThreadAPI_Sleep real_ThreadAPI_Sleep
#define THREADAPI_RESULT real_THREADAPI_RESULT

Просмотреть файл

@ -0,0 +1,45 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#ifndef REAL_TIMER_H
#define REAL_TIMER_H
#include "azure_macro_utils/macro_utils.h"
#include "timer.h"
#define R2(X) REGISTER_GLOBAL_MOCK_HOOK(X, real_##X);
#define REGISTER_TIMER_GLOBAL_MOCK_HOOK() \
MU_FOR_EACH_1(R2, \
timer_create, \
timer_start, \
timer_get_elapsed, \
timer_global_get_elapsed_ms, \
timer_destroy \
)
#ifdef __cplusplus
extern "C" {
#endif
TIMER_HANDLE real_timer_create(void);
void real_timer_start(TIMER_HANDLE handle);
double real_timer_get_elapsed(TIMER_HANDLE handle);
double real_timer_get_elapsed_ms(TIMER_HANDLE handle);
double real_timer_global_get_elapsed_ms(void);
double real_timer_global_get_elapsed_us(void);
void real_timer_destroy(TIMER_HANDLE handle);
#ifdef __cplusplus
}
#endif
#endif // REAL_TIMER_H

Просмотреть файл

@ -0,0 +1,10 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define timer_create real_timer_create
#define timer_start real_timer_start
#define timer_get_elapsed real_timer_get_elapsed
#define timer_get_elapsed_ms real_timer_get_elapsed_ms
#define timer_destroy real_timer_destroy
#define timer_global_get_elapsed_ms real_timer_global_get_elapsed_ms
#define timer_global_get_elapsed_us real_timer_global_get_elapsed_us

Просмотреть файл

@ -0,0 +1,65 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
cmake_minimum_required(VERSION 2.8.11)
set(azure_c_util_reals_c_files
real_constbuffer.c
real_constbuffer_array.c
real_constbuffer_array_batcher_nv.c
real_crt_abstractions.c
real_doublylinkedlist.c
real_memory_data.c
real_singlylinkedlist.c
real_threadapi.c
real_uuid.c
)
set(azure_c_util_reals_h_files
real_constbuffer.h
real_constbuffer_renames.h
real_constbuffer_array.h
real_constbuffer_array_renames.h
real_constbuffer_array_batcher_nv.h
real_constbuffer_array_batcher_nv_renames.h
real_crt_abstractions.h
real_crt_abstractions_renames.h
real_doublylinkedlist.h
real_doublylinkedlist_renames.h
real_memory_data.h
real_memory_data_renames.h
real_singlylinkedlist.h
real_uuid.h
real_uuid_renames.h
real_threadapi.h
real_threadapi_renames.h
)
if(WIN32)
set(azure_c_util_reals_c_files ${azure_c_util_reals_c_files}
real_interlocked_hl.c
real_srw_lock.c
real_string_utils.c
real_timer.c
real_sm.c
)
set(azure_c_util_reals_h_files ${azure_c_util_reals_h_files}
real_interlocked_hl.h
real_interlocked_hl_renames.h
real_srw_lock.h
real_srw_lock_renames.h
real_string_utils.h
real_string_utils_renames.h
real_timer.h
real_timer_renames.h
real_sm.h
real_sm_renames.h
)
endif()
include_directories(${CMAKE_CURRENT_LIST_DIR}/../../src)
add_library(azure_c_util_reals ${azure_c_util_reals_c_files} ${azure_c_util_reals_h_files})
target_include_directories(azure_c_util_reals PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/tests/reals>)
target_link_libraries(azure_c_util_reals azure_c_logging)

Просмотреть файл

@ -0,0 +1,11 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_constbuffer_array_batcher_nv_renames.h"
#include "real_constbuffer_array_renames.h"
#include "real_constbuffer_renames.h"
#include "real_memory_data_renames.h"
#include "constbuffer_array_batcher_nv.c"

Просмотреть файл

@ -0,0 +1,9 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_constbuffer_array_renames.h"
#include "real_constbuffer_renames.h"
#include "../src/constbuffer_array.c"

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "real_constbuffer_renames.h"
#define GBALLOC_H
#include "../src/constbuffer.c"

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "real_crt_abstractions_renames.h"
#define GBALLOC_H
#include "crt_abstractions.c"

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "real_doublylinkedlist_renames.h"
#define GBALLOC_H
#include "doublylinkedlist.c"

Просмотреть файл

@ -0,0 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
#define GBALLOC_H
#include "real_interlocked_hl_renames.h"
#include "../../adapters/interlocked_hl_win32.c"

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_memory_data_renames.h"
#include "../../src/memory_data.c"

Просмотреть файл

@ -0,0 +1,18 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#define singlylinkedlist_create real_singlylinkedlist_create
#define singlylinkedlist_destroy real_singlylinkedlist_destroy
#define singlylinkedlist_add real_singlylinkedlist_add
#define singlylinkedlist_add_head real_singlylinkedlist_add_head
#define singlylinkedlist_remove real_singlylinkedlist_remove
#define singlylinkedlist_get_head_item real_singlylinkedlist_get_head_item
#define singlylinkedlist_get_next_item real_singlylinkedlist_get_next_item
#define singlylinkedlist_find real_singlylinkedlist_find
#define singlylinkedlist_item_get_value real_singlylinkedlist_item_get_value
#define singlylinkedlist_remove_if real_singlylinkedlist_remove_if
#define singlylinkedlist_foreach real_singlylinkedlist_foreach
#include "singlylinkedlist.c"

Просмотреть файл

@ -0,0 +1,10 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_interlocked_hl_renames.h"
#include "real_sm_renames.h"
#include "../../src/sm.c"

Просмотреть файл

@ -0,0 +1,11 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_string_utils_renames.h"
#include "real_timer_renames.h"
#include "real_srw_lock_renames.h"
#include "../../adapters/srw_lock.c"

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_string_utils_renames.h"
#include "../../adapters/string_utils.c"

Просмотреть файл

@ -0,0 +1,12 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_threadapi_renames.h"
#if _MSC_VER
#include "../../adapters/threadapi_win32.c"
#else
#include "../../adapters/threadapi_pthreads.c"
#endif

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_timer_renames.h"
#include "../../adapters/timer.c"

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_uuid_renames.h"
#include "uuid.c"

Просмотреть файл

@ -0,0 +1,65 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
cmake_minimum_required(VERSION 2.8.11)
set(azure_c_util_reals_c_files
real_constbuffer.c
real_constbuffer_array.c
real_constbuffer_array_batcher_nv.c
real_crt_abstractions.c
real_doublylinkedlist.c
real_memory_data.c
real_singlylinkedlist.c
real_threadapi.c
real_uuid.c
)
set(azure_c_util_reals_h_files
real_constbuffer.h
real_constbuffer_renames.h
real_constbuffer_array.h
real_constbuffer_array_renames.h
real_constbuffer_array_batcher_nv.h
real_constbuffer_array_batcher_nv_renames.h
real_crt_abstractions.h
real_crt_abstractions_renames.h
real_doublylinkedlist.h
real_doublylinkedlist_renames.h
real_memory_data.h
real_memory_data_renames.h
real_singlylinkedlist.h
real_uuid.h
real_uuid_renames.h
real_threadapi.h
real_threadapi_renames.h
)
if(WIN32)
set(azure_c_util_reals_c_files ${azure_c_util_reals_c_files}
real_interlocked_hl.c
real_srw_lock.c
real_string_utils.c
real_timer.c
real_sm.c
)
set(azure_c_util_reals_h_files ${azure_c_util_reals_h_files}
real_interlocked_hl.h
real_interlocked_hl_renames.h
real_srw_lock.h
real_srw_lock_renames.h
real_string_utils.h
real_string_utils_renames.h
real_timer.h
real_timer_renames.h
real_sm.h
real_sm_renames.h
)
endif()
include_directories(${CMAKE_CURRENT_LIST_DIR}/../../src)
add_library(azure_c_util_reals ${azure_c_util_reals_c_files} ${azure_c_util_reals_h_files})
target_include_directories(azure_c_util_reals PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/tests/reals>)
target_link_libraries(azure_c_util_reals azure_c_logging)

Просмотреть файл

@ -0,0 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
#define GBALLOC_H
#include "real_interlocked_hl_renames.h"
#include "../../adapters/interlocked_hl_win32.c"

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_memory_data_renames.h"
#include "../../src/memory_data.c"

Просмотреть файл

@ -0,0 +1,18 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#define singlylinkedlist_create real_singlylinkedlist_create
#define singlylinkedlist_destroy real_singlylinkedlist_destroy
#define singlylinkedlist_add real_singlylinkedlist_add
#define singlylinkedlist_add_head real_singlylinkedlist_add_head
#define singlylinkedlist_remove real_singlylinkedlist_remove
#define singlylinkedlist_get_head_item real_singlylinkedlist_get_head_item
#define singlylinkedlist_get_next_item real_singlylinkedlist_get_next_item
#define singlylinkedlist_find real_singlylinkedlist_find
#define singlylinkedlist_item_get_value real_singlylinkedlist_item_get_value
#define singlylinkedlist_remove_if real_singlylinkedlist_remove_if
#define singlylinkedlist_foreach real_singlylinkedlist_foreach
#include "singlylinkedlist.c"

Просмотреть файл

@ -0,0 +1,10 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_interlocked_hl_renames.h"
#include "real_sm_renames.h"
#include "../../src/sm.c"

Просмотреть файл

@ -0,0 +1,11 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_string_utils_renames.h"
#include "real_timer_renames.h"
#include "real_srw_lock_renames.h"
#include "../../adapters/srw_lock.c"

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_string_utils_renames.h"
#include "../../adapters/string_utils.c"

Просмотреть файл

@ -0,0 +1,12 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_threadapi_renames.h"
#if _MSC_VER
#include "../../adapters/threadapi_win32.c"
#else
#include "../../adapters/threadapi_pthreads.c"
#endif

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_timer_renames.h"
#include "../../adapters/timer.c"

Просмотреть файл

@ -0,0 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#define GBALLOC_H
#include "real_uuid_renames.h"
#include "uuid.c"

Просмотреть файл

@ -12,6 +12,7 @@ if(${run_unittests})
add_subdirectory(uniqueid_win32_ut)
add_subdirectory(timer_win32_ut)
add_subdirectory(srw_lock_win32_ut)
add_subdirectory(reals_ut)
endif()
if(${run_int_tests})

Просмотреть файл

@ -0,0 +1,10 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
set(theseTestsName azure_c_pal_reals_ut)
set(${theseTestsName}_test_files
${theseTestsName}.c
)
build_c_tests(${theseTestsName} ON "tests/azure_c_pal/win32" ADDITIONAL_LIBS azure_c_pal azure_c_pal_reals)

Просмотреть файл

@ -0,0 +1,46 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "testrunnerswitcher.h"
#define REGISTER_GLOBAL_MOCK_HOOK(original, real) \
(original == real) ? (void)0 : (void)1;
#include "real_threadapi.h"
#include "threadapi.h"
#if defined _MSC_VER
#include "../../../interfaces/tests/reals/real_srw_lock.h"
#include "../../../interfaces/tests/reals/real_string_utils.h"
#include "../../../interfaces/tests/reals/real_timer.h"
#include "../../../interfaces/tests/reals/real_interlocked_hl.h"
#include "srw_lock.h"
#include "string_utils.h"
#include "timer.h"
#include "interlocked_hl.h"
#endif
BEGIN_TEST_SUITE(azure_c_pal_reals_ut)
// this test makes sure that the mappings work
// (there is a real_ function corresponding to the original)
TEST_FUNCTION(check_all_c_pal_reals)
{
// arrange
// act
REGISTER_THREADAPI_GLOBAL_MOCK_HOOK();
#if defined _MSC_VER
REGISTER_SRW_LOCK_GLOBAL_MOCK_HOOK();
REGISTER_STRING_UTILS_GLOBAL_MOCK_HOOK();
REGISTER_TIMER_GLOBAL_MOCK_HOOK();
REGISTER_INTERLOCKED_HL_GLOBAL_MOCK_HOOK();
#endif
// assert
// no explicit assert, if it builds it works
}
END_TEST_SUITE(azure_c_pal_reals_ut)

Просмотреть файл

@ -0,0 +1,12 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include <stddef.h>
#include "testrunnerswitcher.h"
int main(void)
{
size_t failedTestCount = 0;
RUN_TEST_SUITE(azure_c_util_reals_ut, failedTestCount);
return failedTestCount;
}