il all compiles and some tests run

This commit is contained in:
Andrei Porumb 2024-11-05 18:33:59 -08:00
Родитель ec7d0029fa
Коммит ce8e74f0d4
29 изменённых файлов: 302 добавлений и 31 удалений

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

@ -14,7 +14,7 @@
int main(void)
{
if (!logger_init())
if (logger_init()!=0)
{
return MU_FAILURE;
}

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

@ -1,12 +1,30 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except log_context.c (which we have here mocked )
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/log_context.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
add_executable(log_context_ut
log_context_ut.c
log_context_mocked.c
${c_logging_v2_sources_full_path}
)
include_directories(../../src)
target_link_libraries(log_context_ut c_logging_v2)
target_link_libraries(log_context_ut c_logging_v2_core)
add_test(NAME log_context_ut COMMAND log_context_ut)
set_target_properties(log_context_ut PROPERTIES FOLDER "tests/c_logging_v2")

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

@ -11,3 +11,7 @@ extern void mock_free(void* ptr);
#define log_internal_error_report mock_log_internal_error_report
#include "log_context.c"
#undef malloc
#undef free
#undef log_internal_error_report

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

@ -1,6 +1,23 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except log_sink_etw.c (which we have here mocked )
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/log_errno_win32.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
if(WIN32)
set(log_errno_int_mocked_c_files
log_errno_win32_mocked.c
@ -12,12 +29,16 @@ set(log_errno_int_mocked_c_files
endif()
add_executable(log_errno_int
../../src/logger.c
log_errno_int.c
${log_errno_int_mocked_c_files}
${c_logging_v2_sources_full_path}
)
#due to usage of "errno" (which is a MACRO... or a function)... or a function with the same name as the macro... log_errno_win32_mocked.c has to be compiled separately, not in UNITY
set_source_files_properties(log_sink_etw_mocked.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
include_directories(../../src)
target_link_libraries(log_errno_int c_logging_v2)
target_include_directories(log_errno_int PUBLIC ${c_logging_v2_dir}/inc)
target_link_libraries(log_errno_int macro_utils_c dbghelp)
add_test(NAME log_errno_int COMMAND log_errno_int)
set_target_properties(log_errno_int PROPERTIES FOLDER "tests/c_logging_v2")

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

@ -1,13 +1,33 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except log_errno_win32.c (which we have here mocked )
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/log_errno_win32.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
add_executable(log_errno_ut
../../src/logger.c
log_errno_win32_mocked.c
log_errno_win32_ut.c
${c_logging_v2_sources_full_path}
)
#due to usage of "errno" (which is a MACRO... or a function)... or a function with the same name as the macro... log_errno_win32_mocked.c has to be compiled separately, not in UNITY
set_source_files_properties(log_errno_win32_mocked.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
include_directories(../../src)
target_link_libraries(log_errno_ut c_logging_v2)
target_link_libraries(log_errno_ut c_logging_v2_core)
add_test(NAME log_errno_ut COMMAND log_errno_ut)
set_target_properties(log_errno_ut PROPERTIES FOLDER "tests/c_logging_v2")

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

@ -2,8 +2,6 @@
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
add_executable(log_hresult_int
../../src/logger.c
../../src/log_hresult.c
log_hresult_int.c
)

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

@ -1,13 +1,33 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except logger.c (which we have here mocked ) and logger_sinks_config.c (we use our own sinks) ... we need to get the other sources of c_logging_v2
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/log_hresult.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
add_executable(log_hresult_ut
../../src/logger.c
log_hresult_mocked.c
log_hresult_ut.c
${c_logging_v2_sources_full_path}
)
#due to usage of "errno" (which is a MACRO... or a function)... or a function with the same name as the macro... log_errno_win32_mocked.c has to be compiled separately, not in UNITY
set_source_files_properties(log_hresult_mocked.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
include_directories(../../src)
target_link_libraries(log_hresult_ut c_logging_v2)
target_link_libraries(log_hresult_ut c_logging_v2_core)
add_test(NAME log_hresult_ut COMMAND log_hresult_ut)
set_target_properties(log_hresult_ut PROPERTIES FOLDER "tests/c_logging_v2")

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

@ -1,10 +1,29 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except log_lasterror.c (which we have here mocked... we need to get the sources of c_logging_v2)
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/log_lasterror.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
add_executable(log_lasterror_ut
../../src/logger.c
log_lasterror_mocked.c
log_lasterror_ut.c
${c_logging_v2_sources_full_path}
)
include_directories(../../src)

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

@ -10,3 +10,6 @@ DWORD mock_FormatMessageA_no_newline(DWORD dwFlags, LPCVOID lpSource, DWORD dwMe
#define FormatMessageA_no_newline mock_FormatMessageA_no_newline
#include "log_lasterror.c"
#undef GetLastError
#undef FormatMessageA_no_newline

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

@ -1,12 +1,30 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except log_sink_callback.c (which we have here mocked... we need to get the sources of c_logging_v2)
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/log_sink_callback.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
add_executable(log_sink_callback_ut
log_sink_callback_ut.c
log_sink_callback_mocked.c
${c_logging_v2_sources_full_path}
)
include_directories(../../src)
target_link_libraries(log_sink_callback_ut c_logging_v2)
target_link_libraries(log_sink_callback_ut c_logging_v2_core)
add_test(NAME log_sink_callback_ut COMMAND log_sink_callback_ut)
set_target_properties(log_sink_callback_ut PROPERTIES FOLDER "tests/c_logging_v2")

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

@ -27,3 +27,12 @@ const LOG_CONTEXT_PROPERTY_VALUE_PAIR* mock_log_context_get_property_value_pairs
int mock_log_context_property_to_string(char* buffer, size_t buffer_size, const LOG_CONTEXT_PROPERTY_VALUE_PAIR* property_value_pairs, size_t property_value_pair_count);
#include "log_sink_callback.c"
#undef printf
#undef time
#undef ctime
#undef vsnprintf
#undef snprintf
#undef log_context_get_property_value_pair_count
#undef log_context_get_property_value_pairs
#undef log_context_property_to_string

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

@ -1,12 +1,30 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except log_sink_console.c (which we have here mocked... we need to get the sources of c_logging_v2)
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/log_sink_console.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
add_executable(log_sink_console_ut
log_sink_console_ut.c
log_sink_console_mocked.c
${c_logging_v2_sources_full_path}
)
include_directories(../../src)
target_link_libraries(log_sink_console_ut c_logging_v2)
target_link_libraries(log_sink_console_ut c_logging_v2_core)
add_test(NAME log_sink_console_ut COMMAND log_sink_console_ut)
set_target_properties(log_sink_console_ut PROPERTIES FOLDER "tests/c_logging_v2")

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

@ -27,3 +27,12 @@ const LOG_CONTEXT_PROPERTY_VALUE_PAIR* mock_log_context_get_property_value_pairs
int mock_log_context_property_to_string(char* buffer, size_t buffer_size, const LOG_CONTEXT_PROPERTY_VALUE_PAIR* property_value_pairs, size_t property_value_pair_count);
#include "log_sink_console.c"
#undef printf
#undef time
#undef ctime
#undef vsnprintf
#undef snprintf
#undef log_context_get_property_value_pair_count
#undef log_context_get_property_value_pairs
#undef log_context_property_to_string

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

@ -1,12 +1,33 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except log_sink_etw.c (which we have here mocked )
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/log_sink_etw.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
add_executable(log_sink_etw_2_ut
log_sink_etw_2_ut.c
log_sink_etw_mocked.c
${c_logging_v2_sources_full_path}
)
#due to usage of "errno" (which is a MACRO... or a function)... or a function with the same name as the macro... log_errno_win32_mocked.c has to be compiled separately, not in UNITY
set_source_files_properties(log_sink_etw_mocked.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
include_directories(../../src)
target_link_libraries(log_sink_etw_2_ut c_logging_v2)
target_link_libraries(log_sink_etw_2_ut c_logging_v2_core)
add_test(NAME log_sink_etw_2_ut COMMAND log_sink_etw_2_ut)
set_target_properties(log_sink_etw_2_ut PROPERTIES FOLDER "tests/c_logging_v2")

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

@ -43,8 +43,6 @@
MU_DEFINE_ENUM(MOCK_CALL_TYPE, MOCK_CALL_TYPE_VALUES)
MU_DEFINE_ENUM_STRINGS(LOG_CONTEXT_PROPERTY_TYPE, LOG_CONTEXT_PROPERTY_TYPE_VALUES)
// very poor mans mocks :-(
#define MAX_PRINTF_CAPTURED_OUPUT_SIZE (LOG_MAX_MESSAGE_LENGTH * 2)

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

@ -1,12 +1,33 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except log_sink_etw.c (which we have here mocked ) and logger_sinks_config.c (we use our own sinks) ... we need to get the other sources of c_logging_v2
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/log_sink_etw.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
add_executable(log_sink_etw_custom_provider_id_ut
log_sink_etw_custom_provider_id_ut.c
log_sink_etw_mocked.c
${c_logging_v2_sources_full_path}
)
#due to usage of "errno" (which is a MACRO... or a function)... or a function with the same name as the macro... log_errno_win32_mocked.c has to be compiled separately, not in UNITY
set_source_files_properties(log_sink_etw_mocked.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
include_directories(../../src)
target_link_libraries(log_sink_etw_custom_provider_id_ut c_logging_v2)
target_link_libraries(log_sink_etw_custom_provider_id_ut c_logging_v2_core)
add_test(NAME log_sink_etw_custom_provider_id_ut COMMAND log_sink_etw_custom_provider_id_ut)
set_target_properties(log_sink_etw_custom_provider_id_ut PROPERTIES FOLDER "tests/c_logging_v2")

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

@ -54,8 +54,6 @@
MU_DEFINE_ENUM(MOCK_CALL_TYPE, MOCK_CALL_TYPE_VALUES)
MU_DEFINE_ENUM_STRINGS(LOG_CONTEXT_PROPERTY_TYPE, LOG_CONTEXT_PROPERTY_TYPE_VALUES)
// very poor mans mocks :-(
#define MAX_PRINTF_CAPTURED_OUPUT_SIZE (LOG_MAX_MESSAGE_LENGTH * 2)

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

@ -74,8 +74,6 @@ static void read_bool(const void* source, int32_t* destination)
static GUID provider_guid = { 0xDAD29F36, 0x0A48, 0x4DEF, { 0x9D, 0x50, 0x8E, 0xF9, 0x03, 0x6B, 0x92, 0xB4 } };
MU_DEFINE_ENUM_STRINGS(LOG_CONTEXT_PROPERTY_TYPE, LOG_CONTEXT_PROPERTY_TYPE_VALUES)
#define POOR_MANS_ASSERT(cond) \
if (!(cond)) \
{ \

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

@ -1,11 +1,32 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except log_sink_etw.c (which we have here mocked ) and logger_sinks_config.c (we use our own sinks) ... we need to get the other sources of c_logging_v2
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/log_sink_etw.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
add_executable(log_sink_etw_ut
log_sink_etw_ut.c
log_sink_etw_mocked.c
${c_logging_v2_sources_full_path}
)
#due to usage of "errno" (which is a MACRO... or a function)... or a function with the same name as the macro... log_errno_win32_mocked.c has to be compiled separately, not in UNITY
set_source_files_properties(log_sink_etw_mocked.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
include_directories(../../src)
target_link_libraries(log_sink_etw_ut c_logging_v2)
add_test(NAME log_sink_etw_ut COMMAND log_sink_etw_ut)

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

@ -51,8 +51,6 @@
MU_DEFINE_ENUM(MOCK_CALL_TYPE, MOCK_CALL_TYPE_VALUES)
MU_DEFINE_ENUM_STRINGS(LOG_CONTEXT_PROPERTY_TYPE, LOG_CONTEXT_PROPERTY_TYPE_VALUES)
// very poor mans mocks :-(
#define MAX_PRINTF_CAPTURED_OUPUT_SIZE (LOG_MAX_MESSAGE_LENGTH * 2)

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

@ -1,12 +1,34 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except log_sink_etw.c (which we have here mocked )
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("XXXX ${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/log_sink_etw.c)
message("XXX ${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
message("XXX c_logging_v2_sources_full_path=${c_logging_v2_sources_full_path}")
add_executable(log_sink_etw_without_init_ut
log_sink_etw_without_init_ut.c
log_sink_etw_mocked.c
${c_logging_v2_sources_full_path}
)
#due to usage of "errno" (which is a MACRO... or a function)... or a function with the same name as the macro... log_errno_win32_mocked.c has to be compiled separately, not in UNITY
set_source_files_properties(log_sink_etw_mocked.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
include_directories(../../src)
target_link_libraries(log_sink_etw_without_init_ut c_logging_v2)
target_link_libraries(log_sink_etw_without_init_ut c_logging_v2_core)
add_test(NAME log_sink_etw_without_init_ut COMMAND log_sink_etw_without_init_ut)
set_target_properties(log_sink_etw_without_init_ut PROPERTIES FOLDER "tests/c_logging_v2")

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

@ -43,8 +43,6 @@
MU_DEFINE_ENUM(MOCK_CALL_TYPE, MOCK_CALL_TYPE_VALUES)
MU_DEFINE_ENUM_STRINGS(LOG_CONTEXT_PROPERTY_TYPE, LOG_CONTEXT_PROPERTY_TYPE_VALUES)
// very poor mans mocks :-(
#define MAX_PRINTF_CAPTURED_OUPUT_SIZE (LOG_MAX_MESSAGE_LENGTH * 2)

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

@ -1,12 +1,30 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except logger.c (which we have here mocked )
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/logger.c ./src/logger_sinks_config.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
add_executable(logger_abort_ut
logger_mocked.c
logger_abort_ut.c
${c_logging_v2_sources_full_path}
)
include_directories(../../src)
target_link_libraries(logger_abort_ut c_logging_v2)
target_link_libraries(logger_abort_ut c_logging_v2_core)
add_test(NAME logger_abort_ut COMMAND logger_abort_ut)
set_target_properties(logger_abort_ut PROPERTIES FOLDER "tests/c_logging_v2")

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

@ -31,8 +31,6 @@
MU_DEFINE_ENUM(MOCK_CALL_TYPE, MOCK_CALL_TYPE_VALUES)
MU_DEFINE_ENUM_STRINGS(LOG_CONTEXT_PROPERTY_TYPE, LOG_CONTEXT_PROPERTY_TYPE_VALUES)
// very poor mans mocks :-(
#define MAX_FILE_STRING_LENGTH 256

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

@ -8,3 +8,5 @@
void mock_abort(void);
#include "logger.c"
#undef abort

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

@ -13,5 +13,8 @@ add_executable(logger_perf
timer_win32.c
)
#due to LOGGER_V1_V2_H we skip completely here building with UNITY
set_target_properties(logger_perf PROPERTIES UNITY_BUILD OFF)
target_link_libraries(logger_perf c_logging c_logging_v2 rpcrt4)
add_test(NAME logger_perf COMMAND logger_perf)

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

@ -1,12 +1,30 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#since we want to use all the other sources in c_logging_v2 except logger.c (which we have here mocked ) and logger_sinks_config.c (we use our own sinks) ... we need to get the other sources of c_logging_v2
get_target_property(c_logging_v2_sources c_logging_v2 SOURCES)
message("${c_logging_v2_sources}")
list(REMOVE_ITEM c_logging_v2_sources ./src/logger.c ./src/logger_sinks_config.c)
message("${c_logging_v2_sources}")
get_target_property(c_logging_v2_dir c_logging_v2 SOURCE_DIR)
set(c_logging_v2_sources_full_path)
foreach(source ${c_logging_v2_sources})
if(IS_ABSOLUTE ${source})
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${source})
else()
set(c_logging_v2_sources_full_path ${c_logging_v2_sources_full_path} ${c_logging_v2_dir}/${source})
endif()
endforeach()
add_executable(logger_ut
logger_mocked.c
logger_ut.c
${c_logging_v2_sources_full_path}
)
include_directories(../../src)
target_link_libraries(logger_ut c_logging_v2)
target_link_libraries(logger_ut c_logging_v2_core)
add_test(NAME logger_ut COMMAND logger_ut)
set_target_properties(logger_ut PROPERTIES FOLDER "tests/c_logging_v2")

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

@ -8,3 +8,5 @@
void mock_abort(void);
#include "logger.c"
#undef abort

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

@ -39,8 +39,6 @@
MU_DEFINE_ENUM(MOCK_CALL_TYPE, MOCK_CALL_TYPE_VALUES)
MU_DEFINE_ENUM_STRINGS(LOG_CONTEXT_PROPERTY_TYPE, LOG_CONTEXT_PROPERTY_TYPE_VALUES)
// very poor mans mocks :-(
#define MAX_FILE_STRING_LENGTH 256