diff --git a/c_pal_ll/interfaces/tests/interlocked_int/interlocked_int.c b/c_pal_ll/interfaces/tests/interlocked_int/interlocked_int.c index b3468bad..0364fae4 100644 --- a/c_pal_ll/interfaces/tests/interlocked_int/interlocked_int.c +++ b/c_pal_ll/interfaces/tests/interlocked_int/interlocked_int.c @@ -9,14 +9,15 @@ #include "testrunnerswitcher.h" #include "c_pal/interlocked.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(a) +TIMED_TEST_SUITE_INITIALIZE(a) { } -TEST_SUITE_CLEANUP(b) +TIMED_TEST_SUITE_CLEANUP(b) { } @@ -1033,4 +1034,4 @@ TEST_FUNCTION(interlocked_xor_8_does_bitwise_xor) ASSERT_ARE_EQUAL(uint8_t, 0xFF, return_val, "Return value is incorrect"); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/c_pal_ll/interfaces/tests/interlocked_macros_ut/interlocked_macros_ut.c b/c_pal_ll/interfaces/tests/interlocked_macros_ut/interlocked_macros_ut.c index d84a4637..da44dbc8 100644 --- a/c_pal_ll/interfaces/tests/interlocked_macros_ut/interlocked_macros_ut.c +++ b/c_pal_ll/interfaces/tests/interlocked_macros_ut/interlocked_macros_ut.c @@ -5,11 +5,11 @@ BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(a) +TIMED_TEST_SUITE_INITIALIZE(a) { } -TEST_SUITE_CLEANUP(b) +TIMED_TEST_SUITE_CLEANUP(b) { } diff --git a/c_pal_ll/interfaces/tests/interlocked_macros_ut/interlocked_macros_ut_pch.h b/c_pal_ll/interfaces/tests/interlocked_macros_ut/interlocked_macros_ut_pch.h index 70f5397a..e27c3e2e 100644 --- a/c_pal_ll/interfaces/tests/interlocked_macros_ut/interlocked_macros_ut_pch.h +++ b/c_pal_ll/interfaces/tests/interlocked_macros_ut/interlocked_macros_ut_pch.h @@ -14,5 +14,6 @@ #include "macro_utils/macro_utils.h" // IWYU pragma: keep #include "c_pal/interlocked.h" +#include "c_pal/timed_test_suite.h" -#endif // INTERLOCKED_MACROS_UT_PCH_H +#endif // INTERLOCKED_MACROS_UT_PCH_H \ No newline at end of file diff --git a/c_pal_ll/interfaces/tests/sync_int/sync_int.c b/c_pal_ll/interfaces/tests/sync_int/sync_int.c index 411d26e4..5eb7554f 100644 --- a/c_pal_ll/interfaces/tests/sync_int/sync_int.c +++ b/c_pal_ll/interfaces/tests/sync_int/sync_int.c @@ -15,6 +15,7 @@ #include "c_pal/threadapi.h" #include "c_pal/sync.h" #include "c_pal/timer.h" +#include "c_pal/timed_test_suite.h" TEST_DEFINE_ENUM_TYPE(THREADAPI_RESULT, THREADAPI_RESULT_VALUES) TEST_DEFINE_ENUM_TYPE(WAIT_ON_ADDRESS_RESULT, WAIT_ON_ADDRESS_RESULT_VALUES); @@ -123,12 +124,12 @@ static int increment_on_wake_up_64(void* address) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(a) +TIMED_TEST_SUITE_INITIALIZE(a) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); } -TEST_SUITE_CLEANUP(b) +TIMED_TEST_SUITE_CLEANUP(b) { gballoc_hl_deinit(); } @@ -351,4 +352,4 @@ TEST_FUNCTION(wait_on_address_64_returns_after_timeout_elapses) ASSERT_ARE_EQUAL(WAIT_ON_ADDRESS_RESULT, WAIT_ON_ADDRESS_TIMEOUT, return_val, "wait_on_address_64 should have returned timeout"); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/c_pal_ll/linux/tests/interlocked_linux_ut/interlocked_linux_ut.c b/c_pal_ll/linux/tests/interlocked_linux_ut/interlocked_linux_ut.c index 81c556df..b0aa842a 100644 --- a/c_pal_ll/linux/tests/interlocked_linux_ut/interlocked_linux_ut.c +++ b/c_pal_ll/linux/tests/interlocked_linux_ut/interlocked_linux_ut.c @@ -45,7 +45,7 @@ static bool hook_mock_atomic_compare_exchange_pointer(void* volatile_atomic* obj BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types()); @@ -55,7 +55,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_HOOK(mock_atomic_compare_exchange_pointer, hook_mock_atomic_compare_exchange_pointer); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } diff --git a/c_pal_ll/linux/tests/interlocked_linux_ut/interlocked_linux_ut_pch.h b/c_pal_ll/linux/tests/interlocked_linux_ut/interlocked_linux_ut_pch.h index bf9c7692..2f616d7b 100644 --- a/c_pal_ll/linux/tests/interlocked_linux_ut/interlocked_linux_ut_pch.h +++ b/c_pal_ll/linux/tests/interlocked_linux_ut/interlocked_linux_ut_pch.h @@ -18,5 +18,6 @@ #include "umock_c/umocktypes_stdint.h" #include "c_pal/interlocked.h" +#include "c_pal/timed_test_suite.h" -#endif // INTERLOCKED_LINUX_UT_PCH_H +#endif // INTERLOCKED_LINUX_UT_PCH_H \ No newline at end of file diff --git a/c_pal_ll/linux/tests/sync_linux_ut/sync_linux_ut.c b/c_pal_ll/linux/tests/sync_linux_ut/sync_linux_ut.c index 08f17536..6ab5521c 100644 --- a/c_pal_ll/linux/tests/sync_linux_ut/sync_linux_ut.c +++ b/c_pal_ll/linux/tests/sync_linux_ut/sync_linux_ut.c @@ -36,13 +36,13 @@ IMPLEMENT_UMOCK_C_ENUM_TYPE(WAIT_ON_ADDRESS_RESULT, WAIT_ON_ADDRESS_RESULT_VALUE BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); REGISTER_GLOBAL_MOCK_HOOK(mock_syscall, hook_mock_syscall) } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } diff --git a/c_pal_ll/linux/tests/sync_linux_ut/sync_linux_ut_pch.h b/c_pal_ll/linux/tests/sync_linux_ut/sync_linux_ut_pch.h index 7d824318..75d4b75e 100644 --- a/c_pal_ll/linux/tests/sync_linux_ut/sync_linux_ut_pch.h +++ b/c_pal_ll/linux/tests/sync_linux_ut/sync_linux_ut_pch.h @@ -24,8 +24,9 @@ #include "c_pal/interlocked.h" #include "c_pal/sync.h" +#include "c_pal/timed_test_suite.h" // No idea why iwyu warns about this since we include time.h but... // IWYU pragma: no_forward_declare timespec -#endif // SYNC_LINUX_UT_PCH_H +#endif // SYNC_LINUX_UT_PCH_H \ No newline at end of file diff --git a/c_pal_ll/win32/tests/interlocked_win32_ut/interlocked_win32_ut.c b/c_pal_ll/win32/tests/interlocked_win32_ut/interlocked_win32_ut.c index 14e24ec8..2a5562c6 100644 --- a/c_pal_ll/win32/tests/interlocked_win32_ut/interlocked_win32_ut.c +++ b/c_pal_ll/win32/tests/interlocked_win32_ut/interlocked_win32_ut.c @@ -17,14 +17,14 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); ASSERT_ARE_EQUAL(int, 0, umocktypes_windows_register_types()); REGISTER_UMOCK_ALIAS_TYPE(SHORT, int16_t); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } diff --git a/c_pal_ll/win32/tests/interlocked_win32_ut/interlocked_win32_ut_pch.h b/c_pal_ll/win32/tests/interlocked_win32_ut/interlocked_win32_ut_pch.h index 53ac1619..09cb9186 100644 --- a/c_pal_ll/win32/tests/interlocked_win32_ut/interlocked_win32_ut_pch.h +++ b/c_pal_ll/win32/tests/interlocked_win32_ut/interlocked_win32_ut_pch.h @@ -18,5 +18,6 @@ #include "umock_c/umocktypes_windows.h" #include "c_pal/interlocked.h" +#include "c_pal/timed_test_suite.h" -#endif // INTERLOCKED_WIN32_UT_PCH_H +#endif // INTERLOCKED_WIN32_UT_PCH_H \ No newline at end of file diff --git a/c_pal_ll/win32/tests/sync_win32_ut/sync_win32_ut.c b/c_pal_ll/win32/tests/sync_win32_ut/sync_win32_ut.c index aeb20178..74fd93e5 100644 --- a/c_pal_ll/win32/tests/sync_win32_ut/sync_win32_ut.c +++ b/c_pal_ll/win32/tests/sync_win32_ut/sync_win32_ut.c @@ -20,7 +20,7 @@ IMPLEMENT_UMOCK_C_ENUM_TYPE(WAIT_ON_ADDRESS_RESULT, WAIT_ON_ADDRESS_RESULT_VALUE BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -29,7 +29,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_UMOCK_ALIAS_TYPE(SIZE_T, size_t); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); diff --git a/c_pal_ll/win32/tests/sync_win32_ut/sync_win32_ut_pch.h b/c_pal_ll/win32/tests/sync_win32_ut/sync_win32_ut_pch.h index 0cc8b03e..f534e789 100644 --- a/c_pal_ll/win32/tests/sync_win32_ut/sync_win32_ut_pch.h +++ b/c_pal_ll/win32/tests/sync_win32_ut/sync_win32_ut_pch.h @@ -17,6 +17,8 @@ #include "umock_c/umock_c.h" #include "umock_c/umocktypes_windows.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" @@ -26,4 +28,4 @@ #include "c_pal/sync.h" -#endif // SYNC_WIN32_UT_PCH_H +#endif // SYNC_WIN32_UT_PCH_H \ No newline at end of file diff --git a/common/inc/c_pal/timed_test_suite.h b/common/inc/c_pal/timed_test_suite.h index 7dcbb538..75de6a9b 100644 --- a/common/inc/c_pal/timed_test_suite.h +++ b/common/inc/c_pal/timed_test_suite.h @@ -3,7 +3,11 @@ #ifndef TIMED_TEST_SUITE_H #define TIMED_TEST_SUITE_H +// Enable TEST_SUITE_INITIALIZE_INTERNAL/CLEANUP_INTERNAL for use by TIMED_ macros +#define DEFINE_TEST_SUITE_INITIALIZE +#define DEFINE_TEST_SUITE_CLEANUP #include "testrunnerswitcher.h" + #include "c_pal/process_watchdog.h" // Default timeout: 10 minutes @@ -16,7 +20,7 @@ /*Codes_SRS_TIMED_TEST_SUITE_43_004: [ The watchdog init fixture shall execute before the user's initialization code. ]*/ #define TIMED_TEST_SUITE_INITIALIZE(name, timeout_ms, ...) \ static void MU_C2(timed_test_watchdog_init_, name)(void) { ASSERT_ARE_EQUAL(int, 0, process_watchdog_init(timeout_ms), "process_watchdog_init failed"); } \ - TEST_SUITE_INITIALIZE(name, MU_C2(timed_test_watchdog_init_, name), ##__VA_ARGS__) + TEST_SUITE_INITIALIZE_INTERNAL(name, MU_C2(timed_test_watchdog_init_, name), ##__VA_ARGS__) // Cleanup - stops the watchdog after user cleanup code runs // Watchdog deinit fixture runs AFTER user cleanup code (last in fixture list) @@ -25,6 +29,7 @@ /*Codes_SRS_TIMED_TEST_SUITE_43_007: [ The watchdog deinit fixture shall execute after the user's cleanup code. ]*/ #define TIMED_TEST_SUITE_CLEANUP(name, ...) \ static void MU_C2(timed_test_watchdog_deinit_, name)(void) { process_watchdog_deinit(); } \ - TEST_SUITE_CLEANUP(name, ##__VA_ARGS__, MU_C2(timed_test_watchdog_deinit_, name)) + TEST_SUITE_CLEANUP_INTERNAL(name, ##__VA_ARGS__, MU_C2(timed_test_watchdog_deinit_, name)) + #endif // TIMED_TEST_SUITE_H diff --git a/common/tests/arithmetic_int/arithmetic_int.c b/common/tests/arithmetic_int/arithmetic_int.c index 1d45fa9a..8e103637 100644 --- a/common/tests/arithmetic_int/arithmetic_int.c +++ b/common/tests/arithmetic_int/arithmetic_int.c @@ -7,14 +7,15 @@ #include "testrunnerswitcher.h" #include "c_pal/arithmetic.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { } @@ -1098,4 +1099,4 @@ printf("{.left = %" ALIGN PRIu64 "ULL, .right = %" ALIGN PRIu64 "ULL, .high = % } */ -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/common/tests/call_once_int/call_once_int.c b/common/tests/call_once_int/call_once_int.c index 05edf96a..9a7558ae 100644 --- a/common/tests/call_once_int/call_once_int.c +++ b/common/tests/call_once_int/call_once_int.c @@ -17,6 +17,7 @@ #include "c_pal/threadapi.h" #include "c_pal/call_once.h" +#include "c_pal/timed_test_suite.h" TEST_DEFINE_ENUM_TYPE(THREADAPI_RESULT, THREADAPI_RESULT_VALUES) @@ -79,11 +80,11 @@ static int chaosThread( BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -151,4 +152,4 @@ TEST_FUNCTION(call_once_chaos_knight) } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/common/tests/call_once_ut/call_once_ut.c b/common/tests/call_once_ut/call_once_ut.c index 4c16a7dd..c47a27f5 100644 --- a/common/tests/call_once_ut/call_once_ut.c +++ b/common/tests/call_once_ut/call_once_ut.c @@ -18,7 +18,7 @@ static call_once_t g_state = CALL_ONCE_NOT_CALLED; BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init"); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types()); @@ -29,7 +29,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_SYNC_GLOBAL_MOCK_HOOK(); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/common/tests/call_once_ut/call_once_ut_pch.h b/common/tests/call_once_ut/call_once_ut_pch.h index bdbec32a..bd002718 100644 --- a/common/tests/call_once_ut/call_once_ut_pch.h +++ b/common/tests/call_once_ut/call_once_ut_pch.h @@ -17,6 +17,8 @@ #include "umock_c/umocktypes.h" #include "umock_c/umocktypes_stdint.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/interlocked.h" #include "c_pal/sync.h" @@ -26,4 +28,4 @@ #include "real_sync.h" #include "c_pal/call_once.h" -#endif // CALL_ONCE_UT_PCH_H +#endif // CALL_ONCE_UT_PCH_H \ No newline at end of file diff --git a/common/tests/interlocked_hl_ut/interlocked_hl_ut.c b/common/tests/interlocked_hl_ut/interlocked_hl_ut.c index 86f2dca3..01635a02 100644 --- a/common/tests/interlocked_hl_ut/interlocked_hl_ut.c +++ b/common/tests/interlocked_hl_ut/interlocked_hl_ut.c @@ -70,7 +70,7 @@ IMPLEMENT_UMOCK_C_ENUM_TYPE(WAIT_ON_ADDRESS_RESULT, WAIT_ON_ADDRESS_RESULT_VALUE BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(a) +TIMED_TEST_SUITE_INITIALIZE(a, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types()); @@ -86,7 +86,7 @@ TEST_SUITE_INITIALIZE(a) REGISTER_GLOBAL_MOCK_HOOK(wait_on_address_64, hook_wait_on_address_64); } -TEST_SUITE_CLEANUP(b) +TIMED_TEST_SUITE_CLEANUP(b) { umock_c_deinit(); } diff --git a/common/tests/interlocked_hl_ut/interlocked_hl_ut_pch.h b/common/tests/interlocked_hl_ut/interlocked_hl_ut_pch.h index f669c921..682c237a 100644 --- a/common/tests/interlocked_hl_ut/interlocked_hl_ut_pch.h +++ b/common/tests/interlocked_hl_ut/interlocked_hl_ut_pch.h @@ -19,6 +19,8 @@ #include "umock_c/umocktypes_stdint.h" #include "umock_c/umocktypes_bool.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/interlocked.h" #include "c_pal/sync.h" @@ -29,4 +31,4 @@ #include "real_gballoc_hl.h" #include "c_pal/interlocked_hl.h" -#endif // INTERLOCKED_HL_UT_PCH_H +#endif // INTERLOCKED_HL_UT_PCH_H \ No newline at end of file diff --git a/common/tests/lazy_init_int/lazy_init_int.c b/common/tests/lazy_init_int/lazy_init_int.c index 523812c9..5a85fb56 100644 --- a/common/tests/lazy_init_int/lazy_init_int.c +++ b/common/tests/lazy_init_int/lazy_init_int.c @@ -18,6 +18,7 @@ #include "c_pal/gballoc_hl.h" // IWYU pragma: keep #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep +#include "c_pal/timed_test_suite.h" TEST_DEFINE_ENUM_TYPE(LAZY_INIT_RESULT, LAZY_INIT_RESULT_VALUES); TEST_DEFINE_ENUM_TYPE(THREADAPI_RESULT, THREADAPI_RESULT_VALUES); @@ -91,12 +92,12 @@ static int chaosThread( BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { nThreadsForChaos = sysinfo_get_processor_count(); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -139,10 +140,10 @@ TEST_FUNCTION(lazy_init_chaos_knight) } ///assert - all done in the threads themselves - + ///clean free(threads); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/common/tests/lazy_init_ut/lazy_init_ut.c b/common/tests/lazy_init_ut/lazy_init_ut.c index b0dd4094..cddb1f9c 100644 --- a/common/tests/lazy_init_ut/lazy_init_ut.c +++ b/common/tests/lazy_init_ut/lazy_init_ut.c @@ -26,7 +26,7 @@ IMPLEMENT_UMOCK_C_ENUM_TYPE(CALL_ONCE_RESULT, CALL_ONCE_RESULT_VALUES); BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init"); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types()); @@ -37,7 +37,7 @@ TEST_SUITE_INITIALIZE(suite_init) } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/common/tests/lazy_init_ut/lazy_init_ut_pch.h b/common/tests/lazy_init_ut/lazy_init_ut_pch.h index 7d1f15af..efd3ecdb 100644 --- a/common/tests/lazy_init_ut/lazy_init_ut_pch.h +++ b/common/tests/lazy_init_ut/lazy_init_ut_pch.h @@ -20,6 +20,8 @@ #include "umock_c/umocktypes_stdint.h" #include "umock_c/umocktypes_bool.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/call_once.h" #include "c_pal/interlocked.h" // for volatile_atomic @@ -27,4 +29,4 @@ #include "c_pal/lazy_init.h" -#endif // LAZY_INIT_UT_PCH_H +#endif // LAZY_INIT_UT_PCH_H \ No newline at end of file diff --git a/common/tests/log_critical_and_terminate_ut/log_critical_and_terminate_ut.c b/common/tests/log_critical_and_terminate_ut/log_critical_and_terminate_ut.c index 74ba921d..33508415 100644 --- a/common/tests/log_critical_and_terminate_ut/log_critical_and_terminate_ut.c +++ b/common/tests/log_critical_and_terminate_ut/log_critical_and_terminate_ut.c @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "log_critical_and_terminate_ut_pch.h" @@ -12,12 +12,12 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) - TEST_SUITE_INITIALIZE(TestClassInitialize) + TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); } - TEST_SUITE_CLEANUP(TestClassCleanup) + TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } diff --git a/common/tests/log_critical_and_terminate_ut/log_critical_and_terminate_ut_pch.h b/common/tests/log_critical_and_terminate_ut/log_critical_and_terminate_ut_pch.h index 33d57c5b..f06ce4d7 100644 --- a/common/tests/log_critical_and_terminate_ut/log_critical_and_terminate_ut_pch.h +++ b/common/tests/log_critical_and_terminate_ut/log_critical_and_terminate_ut_pch.h @@ -11,6 +11,8 @@ #include "testrunnerswitcher.h" #include "umock_c/umock_c.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/ps_util.h" @@ -19,4 +21,4 @@ #include "c_pal/log_critical_and_terminate.h" -#endif // LOG_CRITICAL_AND_TERMINATE_UT_PCH_H +#endif // LOG_CRITICAL_AND_TERMINATE_UT_PCH_H \ No newline at end of file diff --git a/common/tests/ps_util_ut/ps_util_ut.c b/common/tests/ps_util_ut/ps_util_ut.c index 17366037..5a9e676e 100644 --- a/common/tests/ps_util_ut/ps_util_ut.c +++ b/common/tests/ps_util_ut/ps_util_ut.c @@ -22,12 +22,12 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) - TEST_SUITE_INITIALIZE(TestClassInitialize) + TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); } - TEST_SUITE_CLEANUP(TestClassCleanup) + TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } diff --git a/common/tests/ps_util_ut/ps_util_ut_pch.h b/common/tests/ps_util_ut/ps_util_ut_pch.h index 94efb819..f56b9425 100644 --- a/common/tests/ps_util_ut/ps_util_ut_pch.h +++ b/common/tests/ps_util_ut/ps_util_ut_pch.h @@ -10,5 +10,6 @@ #include "umock_c/umock_c.h" #include "c_pal/ps_util.h" +#include "c_pal/timed_test_suite.h" -#endif // PS_UTIL_UT_PCH_H +#endif // PS_UTIL_UT_PCH_H \ No newline at end of file diff --git a/common/tests/real_thandle_helper_ut/real_thandle_helper_ut.c b/common/tests/real_thandle_helper_ut/real_thandle_helper_ut.c index e8a8067e..4139b272 100644 --- a/common/tests/real_thandle_helper_ut/real_thandle_helper_ut.c +++ b/common/tests/real_thandle_helper_ut/real_thandle_helper_ut.c @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "real_thandle_helper_ut_pch.h" @@ -51,7 +51,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -69,7 +69,7 @@ TEST_SUITE_INITIALIZE(TestClassInitialize) THANDLE_MOVE(REAL_MOCKED_STRUCT)(&g.test_mocked_struct, &temp); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { THANDLE_ASSIGN(REAL_MOCKED_STRUCT)(&g.test_mocked_struct, NULL); diff --git a/common/tests/real_thandle_helper_ut/real_thandle_helper_ut_pch.h b/common/tests/real_thandle_helper_ut/real_thandle_helper_ut_pch.h index c090ef7a..c0f9909a 100644 --- a/common/tests/real_thandle_helper_ut/real_thandle_helper_ut_pch.h +++ b/common/tests/real_thandle_helper_ut/real_thandle_helper_ut_pch.h @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // Precompiled header for real_thandle_helper_ut @@ -15,6 +15,8 @@ #include "umock_c/umocktypes_stdint.h" #include "testrunnerswitcher.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" @@ -37,4 +39,4 @@ THANDLE_TYPE_DECLARE(MOCKED_STRUCT); #include "real_thandle_helper.h" -#endif // REAL_THANDLE_HELPER_UT_PCH_H +#endif // REAL_THANDLE_HELPER_UT_PCH_H \ No newline at end of file diff --git a/common/tests/real_thandle_log_context_handle_ut/real_thandle_log_context_handle_ut.c b/common/tests/real_thandle_log_context_handle_ut/real_thandle_log_context_handle_ut.c index d874d27d..f8b25071 100644 --- a/common/tests/real_thandle_log_context_handle_ut/real_thandle_log_context_handle_ut.c +++ b/common/tests/real_thandle_log_context_handle_ut/real_thandle_log_context_handle_ut.c @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "real_thandle_log_context_handle_ut_pch.h" @@ -12,7 +12,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -31,7 +31,7 @@ TEST_SUITE_INITIALIZE(TestClassInitialize) } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); real_gballoc_hl_deinit(); diff --git a/common/tests/real_thandle_log_context_handle_ut/real_thandle_log_context_handle_ut_pch.h b/common/tests/real_thandle_log_context_handle_ut/real_thandle_log_context_handle_ut_pch.h index 074de169..12dc5f85 100644 --- a/common/tests/real_thandle_log_context_handle_ut/real_thandle_log_context_handle_ut_pch.h +++ b/common/tests/real_thandle_log_context_handle_ut/real_thandle_log_context_handle_ut_pch.h @@ -18,6 +18,8 @@ #include "c_logging/log_context.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" // IWYU pragma: keep #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep @@ -30,4 +32,4 @@ #include "module.h" -#endif // REAL_THANDLE_LOG_CONTEXT_HANDLE_UT_PCH_H +#endif // REAL_THANDLE_LOG_CONTEXT_HANDLE_UT_PCH_H \ No newline at end of file diff --git a/common/tests/refcount_ut/refcount_ut.c b/common/tests/refcount_ut/refcount_ut.c index 47c79f5e..49a6b01a 100644 --- a/common/tests/refcount_ut/refcount_ut.c +++ b/common/tests/refcount_ut/refcount_ut.c @@ -28,7 +28,7 @@ DEFINE_REFCOUNT_TYPE_WITH_CUSTOM_ALLOC(TEST_STRUCT, test_malloc, test_malloc_fle BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) - TEST_SUITE_INITIALIZE(TestClassInitialize) + TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -42,7 +42,7 @@ BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) REGISTER_INTERLOCKED_GLOBAL_MOCK_HOOK(); } - TEST_SUITE_CLEANUP(TestClassCleanup) + TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); diff --git a/common/tests/refcount_ut/refcount_ut_pch.h b/common/tests/refcount_ut/refcount_ut_pch.h index c8637a4a..9256d8e0 100644 --- a/common/tests/refcount_ut/refcount_ut_pch.h +++ b/common/tests/refcount_ut/refcount_ut_pch.h @@ -17,6 +17,8 @@ #include "umock_c/umock_c.h" #include "umock_c/umocktypes_stdint.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/interlocked.h" #include "c_pal/gballoc_hl.h" @@ -27,4 +29,4 @@ #include "real_gballoc_hl.h" #include "real_interlocked.h" -#endif // REFCOUNT_UT_PCH_H +#endif // REFCOUNT_UT_PCH_H \ No newline at end of file diff --git a/common/tests/s_list_ut/s_list_ut.c b/common/tests/s_list_ut/s_list_ut.c index 64ee8b89..d35ee3d3 100644 --- a/common/tests/s_list_ut/s_list_ut.c +++ b/common/tests/s_list_ut/s_list_ut.c @@ -52,7 +52,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { umock_c_init(on_umock_c_error); @@ -61,7 +61,7 @@ TEST_SUITE_INITIALIZE(TestClassInitialize) REGISTER_UMOCK_ALIAS_TYPE(PS_LIST_ENTRY, void*); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } diff --git a/common/tests/s_list_ut/s_list_ut_pch.h b/common/tests/s_list_ut/s_list_ut_pch.h index 8e3e32a3..6890abc2 100644 --- a/common/tests/s_list_ut/s_list_ut_pch.h +++ b/common/tests/s_list_ut/s_list_ut_pch.h @@ -16,7 +16,8 @@ #include "c_pal/s_list.h" #include "c_pal/containing_record.h" +#include "c_pal/timed_test_suite.h" #include "testrunnerswitcher.h" -#endif // S_LIST_UT_PCH_H +#endif // S_LIST_UT_PCH_H \ No newline at end of file diff --git a/common/tests/sm_int/sm_int.c b/common/tests/sm_int/sm_int.c index 0045ea6c..f58a9397 100644 --- a/common/tests/sm_int/sm_int.c +++ b/common/tests/sm_int/sm_int.c @@ -14,6 +14,7 @@ #include "c_logging/log_level.h" #include "c_logging/logger.h" +#include "c_pal/timed_test_suite.h" #include "c_pal/timer.h" #include "c_pal/gballoc_hl.h" #include "c_pal/threadapi.h" @@ -839,7 +840,7 @@ MU_DEFINE_ENUM_STRINGS(SM_STATES, SM_STATES_VALUES) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); #if _MSC_VER @@ -854,7 +855,7 @@ TEST_SUITE_INITIALIZE(suite_init) LogInfo("numberOfProcessors was detected as %" PRIu32 "", numberOfProcessors); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { gballoc_hl_deinit(); } diff --git a/common/tests/sm_ut/sm_ut.c b/common/tests/sm_ut/sm_ut.c index c7f996c8..4e6f2511 100644 --- a/common/tests/sm_ut/sm_ut.c +++ b/common/tests/sm_ut/sm_ut.c @@ -36,7 +36,7 @@ static SM_HANDLE TEST_sm_create(void) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(setsBufferTempSize) +TIMED_TEST_SUITE_INITIALIZE(setsBufferTempSize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -51,7 +51,7 @@ TEST_SUITE_INITIALIZE(setsBufferTempSize) REGISTER_TYPE(SM_RESULT, SM_RESULT); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); diff --git a/common/tests/sm_ut/sm_ut_pch.h b/common/tests/sm_ut/sm_ut_pch.h index 95b72a71..e052382b 100644 --- a/common/tests/sm_ut/sm_ut_pch.h +++ b/common/tests/sm_ut/sm_ut_pch.h @@ -22,6 +22,8 @@ // IWYU pragma: no_include "c_pal/ps_util.h" #include "c_pal/interlocked.h"// IWYU pragma: keep +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" @@ -34,4 +36,4 @@ #include "c_pal/sm.h" -#endif // SM_UT_PCH_H +#endif // SM_UT_PCH_H \ No newline at end of file diff --git a/common/tests/thandle_2_ut/thandle_2_ut.c b/common/tests/thandle_2_ut/thandle_2_ut.c index 67c7c906..6cc0b234 100644 --- a/common/tests/thandle_2_ut/thandle_2_ut.c +++ b/common/tests/thandle_2_ut/thandle_2_ut.c @@ -12,7 +12,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(it_does_something) +TIMED_TEST_SUITE_INITIALIZE(it_does_something, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -29,7 +29,7 @@ TEST_SUITE_INITIALIZE(it_does_something) umock_c_init(on_umock_c_error); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); diff --git a/common/tests/thandle_2_ut/thandle_2_ut_pch.h b/common/tests/thandle_2_ut/thandle_2_ut_pch.h index 36506f1a..84d277c9 100644 --- a/common/tests/thandle_2_ut/thandle_2_ut_pch.h +++ b/common/tests/thandle_2_ut/thandle_2_ut_pch.h @@ -15,6 +15,8 @@ #include "testrunnerswitcher.h" #include "umock_c/umock_c.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" /*THANDLE needs malloc/malloc_flex/free to exist*/ @@ -28,4 +30,4 @@ #include "c_pal/thandle_ll.h" -#endif // THANDLE_2_UT_PCH_H +#endif // THANDLE_2_UT_PCH_H \ No newline at end of file diff --git a/common/tests/thandle_ptr_int/thandle_ptr_int.c b/common/tests/thandle_ptr_int/thandle_ptr_int.c index d788325a..8b7c5aa6 100644 --- a/common/tests/thandle_ptr_int/thandle_ptr_int.c +++ b/common/tests/thandle_ptr_int/thandle_ptr_int.c @@ -17,6 +17,7 @@ #include "c_pal/thandle_ll.h" #include "c_pal/thandle.h" // IWYU pragma: keep #include "c_pal/thandle_ptr.h" +#include "c_pal/timed_test_suite.h" #include "example.h" #include "example_incomplete_type.h" @@ -58,12 +59,12 @@ THANDLE_PTR_DEFINE(A_S_CONST_PTR); BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(it_does_something) +TIMED_TEST_SUITE_INITIALIZE(it_does_something, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { gballoc_hl_deinit(); } @@ -200,4 +201,3 @@ TEST_FUNCTION(thandle_int_works_with_incomplete_types) } END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) - diff --git a/common/tests/thandle_ptr_ut/thandle_ptr_ut.c b/common/tests/thandle_ptr_ut/thandle_ptr_ut.c index efb2c2d5..0d06963c 100644 --- a/common/tests/thandle_ptr_ut/thandle_ptr_ut.c +++ b/common/tests/thandle_ptr_ut/thandle_ptr_ut.c @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "thandle_ptr_ut_pch.h" @@ -23,7 +23,7 @@ THANDLE_PTR_DEFINE(UNDER_TEST_PTR); BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(it_does_something) +TIMED_TEST_SUITE_INITIALIZE(it_does_something, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -32,7 +32,7 @@ TEST_SUITE_INITIALIZE(it_does_something) REGISTER_GBALLOC_HL_GLOBAL_MOCK_HOOK(); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); diff --git a/common/tests/thandle_ptr_ut/thandle_ptr_ut_pch.h b/common/tests/thandle_ptr_ut/thandle_ptr_ut_pch.h index aa9a9cd4..5cfe26e4 100644 --- a/common/tests/thandle_ptr_ut/thandle_ptr_ut_pch.h +++ b/common/tests/thandle_ptr_ut/thandle_ptr_ut_pch.h @@ -14,6 +14,8 @@ #include "c_pal/thandle_ll.h" // for THANDLE, THANDLE_ASSIGN +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "umock_c/umock_c.h" #include "c_pal/gballoc_hl.h" @@ -25,4 +27,4 @@ #include "c_pal/thandle_ptr.h" -#endif // THANDLE_PTR_UT_PCH_H +#endif // THANDLE_PTR_UT_PCH_H \ No newline at end of file diff --git a/common/tests/thandle_ut/thandle_ut.c b/common/tests/thandle_ut/thandle_ut.c index 7f2f8b5f..e40db7e5 100644 --- a/common/tests/thandle_ut/thandle_ut.c +++ b/common/tests/thandle_ut/thandle_ut.c @@ -121,7 +121,7 @@ static size_t get_sizeof_A_S_FLEX(const A_S_FLEX* source) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(it_does_something) +TIMED_TEST_SUITE_INITIALIZE(it_does_something, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -130,7 +130,7 @@ TEST_SUITE_INITIALIZE(it_does_something) REGISTER_GBALLOC_HL_GLOBAL_MOCK_HOOK(); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); diff --git a/common/tests/thandle_ut/thandle_ut_pch.h b/common/tests/thandle_ut/thandle_ut_pch.h index 30e2b281..df070f7e 100644 --- a/common/tests/thandle_ut/thandle_ut_pch.h +++ b/common/tests/thandle_ut/thandle_ut_pch.h @@ -13,6 +13,8 @@ #include "testrunnerswitcher.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "umock_c/umock_c.h" #include "c_pal/gballoc_hl.h" @@ -31,4 +33,4 @@ #define TEST_A_DEFINE 1 -#endif // THANDLE_UT_PCH_H +#endif // THANDLE_UT_PCH_H \ No newline at end of file diff --git a/common/tests/threadpool_int/threadpool_int.c b/common/tests/threadpool_int/threadpool_int.c index 631d01c8..7b112353 100644 --- a/common/tests/threadpool_int/threadpool_int.c +++ b/common/tests/threadpool_int/threadpool_int.c @@ -26,6 +26,7 @@ #include "c_pal/execution_engine.h" #include "c_pal/thandle.h" // IWYU pragma: keep #include "c_pal/thandle_ll.h" +#include "c_pal/timed_test_suite.h" static volatile_atomic int64_t g_call_count; @@ -48,7 +49,7 @@ TEST_DEFINE_ENUM_TYPE(THREADAPI_RESULT, THREADAPI_RESULT_VALUES); BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); @@ -57,7 +58,7 @@ TEST_SUITE_INITIALIZE(suite_init) srand((unsigned int)seed); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { gballoc_hl_deinit(); } @@ -1142,7 +1143,7 @@ static int chaos_thread_with_timers_no_lock_func(void* context) } break; } - + case TEST_ACTION_START_THREADPOOL_TIMER: // Start a timer { @@ -1604,4 +1605,4 @@ TEST_FUNCTION(threadpool_timer_then_workers_does_not_race) execution_engine_dec_ref(engine); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/common/tests/tqueue_int/tqueue_int.c b/common/tests/tqueue_int/tqueue_int.c index cc57b8bd..6097f7f9 100644 --- a/common/tests/tqueue_int/tqueue_int.c +++ b/common/tests/tqueue_int/tqueue_int.c @@ -20,6 +20,7 @@ #include "c_pal/timer.h" #include "c_pal/tqueue.h" +#include "c_pal/timed_test_suite.h" #include "tqueue_foo.h" // TQUEUE(FOO) is used for most int tests @@ -48,7 +49,7 @@ TEST_DEFINE_ENUM_TYPE(INTERLOCKED_HL_RESULT, INTERLOCKED_HL_RESULT_VALUES); BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); // Print out the random seed to recreate issues if any arise @@ -57,7 +58,7 @@ TEST_SUITE_INITIALIZE(suite_init) srand((unsigned int)seed); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { gballoc_hl_deinit(); } @@ -726,4 +727,4 @@ TEST_FUNCTION(MU_C3(TQUEUE_chaos_knight_test_with_THANDLE_queue_size_16_and_, N_ TQUEUE_test_with_N_pushers_and_N_poppers_with_queue_size(16, 1024 * 1024, N_THREADS, 1); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/common/tests/tqueue_ut/tqueue_ut.c b/common/tests/tqueue_ut/tqueue_ut.c index d658f7f3..16691f54 100644 --- a/common/tests/tqueue_ut/tqueue_ut.c +++ b/common/tests/tqueue_ut/tqueue_ut.c @@ -35,7 +35,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -52,7 +52,7 @@ TEST_SUITE_INITIALIZE(suite_init) ASSERT_ARE_EQUAL(int, 0, umock_c_negative_tests_init()); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_negative_tests_deinit(); umock_c_deinit(); @@ -1000,10 +1000,10 @@ TEST_FUNCTION(TQUEUE_PUSH_resizes_but_obeys_max_size) STRICT_EXPECTED_CALL(interlocked_exchange_64(IGNORED_ARG, 4)); // set head STRICT_EXPECTED_CALL(srw_lock_ll_release_exclusive(IGNORED_ARG)); STRICT_EXPECTED_CALL(srw_lock_ll_acquire_shared(IGNORED_ARG)); - + STRICT_EXPECTED_CALL(interlocked_add_64(IGNORED_ARG, 0)); // head STRICT_EXPECTED_CALL(interlocked_add_64(IGNORED_ARG, 0)); // tail - + STRICT_EXPECTED_CALL(interlocked_compare_exchange(IGNORED_ARG, QUEUE_ENTRY_STATE_PUSHING, QUEUE_ENTRY_STATE_NOT_USED)); // entry state STRICT_EXPECTED_CALL(interlocked_compare_exchange_64(IGNORED_ARG, 5, 4)); // head change STRICT_EXPECTED_CALL(interlocked_exchange(IGNORED_ARG, QUEUE_ENTRY_STATE_USED)); // entry state diff --git a/common/tests/tqueue_ut/tqueue_ut_pch.h b/common/tests/tqueue_ut/tqueue_ut_pch.h index 2dca75b2..fd152d80 100644 --- a/common/tests/tqueue_ut/tqueue_ut_pch.h +++ b/common/tests/tqueue_ut/tqueue_ut_pch.h @@ -18,6 +18,8 @@ #include "umock_c/umocktypes_bool.h" #include "umock_c/umocktypes_stdint.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/interlocked.h" #include "c_pal/srw_lock_ll.h" @@ -40,4 +42,4 @@ #include "c_pal/tqueue.h" -#endif // TQUEUE_UT_PCH_H +#endif // TQUEUE_UT_PCH_H \ No newline at end of file diff --git a/deps/c-build-tools b/deps/c-build-tools index 44914dd2..cd1696ed 160000 --- a/deps/c-build-tools +++ b/deps/c-build-tools @@ -1 +1 @@ -Subproject commit 44914dd2655b0f366e204003c80f59dea8fbb26a +Subproject commit cd1696ed03b222da664385a58c4d10862a05d21a diff --git a/deps/c-testrunnerswitcher b/deps/c-testrunnerswitcher index 095648ce..05a4b7c8 160000 --- a/deps/c-testrunnerswitcher +++ b/deps/c-testrunnerswitcher @@ -1 +1 @@ -Subproject commit 095648cece8d0a20ba24032145924da21dc7f473 +Subproject commit 05a4b7c8cd2043f68fd3dc588415d8db5b90274f diff --git a/interfaces/tests/file_int/file_int.c b/interfaces/tests/file_int/file_int.c index 24c2d04d..5a860846 100644 --- a/interfaces/tests/file_int/file_int.c +++ b/interfaces/tests/file_int/file_int.c @@ -16,6 +16,7 @@ #include "file_int_helpers.h" #include "c_pal/file.h" +#include "c_pal/timed_test_suite.h" TEST_DEFINE_ENUM_TYPE(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_RESULT) TEST_DEFINE_ENUM_TYPE(FILE_READ_ASYNC_RESULT, FILE_READ_ASYNC_RESULT) @@ -81,12 +82,12 @@ static FILE_HANDLE file_create_helper(const char* filename) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(a) +TIMED_TEST_SUITE_INITIALIZE(a, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); } -TEST_SUITE_CLEANUP(b) +TIMED_TEST_SUITE_CLEANUP(b) { gballoc_hl_deinit(); } @@ -158,7 +159,7 @@ TEST_FUNCTION(write_to_a_file_and_read_from_it) ///act ASSERT_ARE_EQUAL(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_OK, file_write_async(file_handle, source, size, 0, write_callback, &write_context)); - + ///assert wait_on_address_helper(&write_context.value, write_context.pre_callback_value, UINT32_MAX); ASSERT_ARE_EQUAL(int32_t, write_context.post_callback_value, interlocked_or(&write_context.value, 0), "value should be post_callback_value"); @@ -217,7 +218,7 @@ TEST_FUNCTION(write_twice_to_a_file_contiguously_and_read_from_it) ///act ASSERT_ARE_EQUAL(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_OK, file_write_async(file_handle, source1, sizeof(source1) - 1 , 0, write_callback, &write_context1)); ASSERT_ARE_EQUAL(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_OK, file_write_async(file_handle, source2, sizeof(source2), sizeof(source1) - 1, write_callback, &write_context2)); - + ///assert wait_on_address_helper(&write_context1.value, write_context1.pre_callback_value, UINT32_MAX); ASSERT_ARE_EQUAL(int32_t, write_context1.post_callback_value, interlocked_or(&write_context1.value, 0), "value should be post_callback_value"); @@ -292,7 +293,7 @@ TEST_FUNCTION(write_twice_to_a_file_non_contiguously_and_read_from_it) ///act ASSERT_ARE_EQUAL(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_OK, file_write_async(file_handle, source1, size, 0, write_callback, &write_context1)); ASSERT_ARE_EQUAL(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_OK, file_write_async(file_handle, source2, size, second_write_position, write_callback, &write_context2)); - + ///assert wait_on_address_helper(&write_context1.value, write_context1.pre_callback_value, UINT32_MAX); ASSERT_ARE_EQUAL(int32_t, write_context1.post_callback_value, interlocked_or(&write_context1.value, 0), "value should be post_callback_value"); @@ -365,7 +366,7 @@ TEST_FUNCTION(perform_operations_open_write_close_open_read_close) ASSERT_ARE_EQUAL(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_OK, file_write_async(file_handle1, source, size, 0, write_callback, &write_context)); wait_on_address_helper(&write_context.value, write_context.pre_callback_value, UINT32_MAX); file_destroy(file_handle1); - + ///assert ASSERT_ARE_EQUAL(int32_t, write_context.post_callback_value, interlocked_or(&write_context.value, 0), "value should be post_callback_value"); ASSERT_IS_TRUE(write_context.did_write_succeed); @@ -456,7 +457,7 @@ TEST_FUNCTION(read_beyond_eof_fails) FILE_HANDLE file_handle = file_create_helper(filename); ASSERT_ARE_EQUAL(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_OK, file_write_async(file_handle, source, size, 0, write_callback, &write_context)); - + wait_on_address_helper(&write_context.value, write_context.pre_callback_value, UINT32_MAX); ASSERT_ARE_EQUAL(int32_t, write_context.post_callback_value, interlocked_or(&write_context.value, 0), "value should be post_callback_value"); @@ -508,7 +509,7 @@ TEST_FUNCTION(large_simultaneous_writes_succeed) contexts[i].post_callback_value = i; ASSERT_ARE_EQUAL(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_OK, file_write_async(file_handle, sources[i], block_size, block_size * i, write_callback, &contexts[i])); - + } for (int i = 0; i < num_blocks; ++i) @@ -545,7 +546,7 @@ TEST_FUNCTION(large_simultaneous_writes_succeed) } file_destroy(file_handle); (void)delete_file(filename); -} +} /*Tests_SRS_FILE_43_003: [If a file with name full_file_name does not exist, file_create shall create a file with that name.]*/ @@ -623,4 +624,4 @@ TEST_FUNCTION(large_simultaneous_reads_succeed) file_destroy(file_handle); (void)delete_file(filename); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/interfaces/tests/gballoc_hl_perf/gballoc_hl_perf.c b/interfaces/tests/gballoc_hl_perf/gballoc_hl_perf.c index bb5b6b2c..d8532c6c 100644 --- a/interfaces/tests/gballoc_hl_perf/gballoc_hl_perf.c +++ b/interfaces/tests/gballoc_hl_perf/gballoc_hl_perf.c @@ -9,6 +9,7 @@ #include "c_pal/timer.h" #include "c_pal/gballoc_hl.h" +#include "c_pal/timed_test_suite.h" #define malloc gballoc_hl_malloc #define malloc_2 gballoc_hl_malloc_2 @@ -18,12 +19,12 @@ BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { gballoc_hl_deinit(); } @@ -176,4 +177,4 @@ TEST_FUNCTION(free_performance) free(blocks); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/interfaces/tests/pipe_int/pipe_int.c b/interfaces/tests/pipe_int/pipe_int.c index e30b12d0..6bfcfbdc 100644 --- a/interfaces/tests/pipe_int/pipe_int.c +++ b/interfaces/tests/pipe_int/pipe_int.c @@ -9,15 +9,16 @@ #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep #include "c_pal/pipe.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(a) +TIMED_TEST_SUITE_INITIALIZE(a, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); } -TEST_SUITE_CLEANUP(b) +TIMED_TEST_SUITE_CLEANUP(b) { gballoc_hl_deinit(); } @@ -74,4 +75,4 @@ TEST_FUNCTION(pipe_open_close_succeeds_returns_non_zero_exit_code) ASSERT_ARE_EQUAL(int, 42, exit_code); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/interfaces/tests/socket_transport_int/socket_transport_int.c b/interfaces/tests/socket_transport_int/socket_transport_int.c index 04924596..eb377bc9 100644 --- a/interfaces/tests/socket_transport_int/socket_transport_int.c +++ b/interfaces/tests/socket_transport_int/socket_transport_int.c @@ -17,6 +17,7 @@ #include "c_pal/interlocked.h" #include "c_pal/socket_transport.h" #include "c_pal/timer.h" // IWYU pragma: keep +#include "c_pal/timed_test_suite.h" #ifdef WIN32 #define SOCKET_SEND_FLAG 0 @@ -52,14 +53,14 @@ TEST_DEFINE_ENUM_TYPE(ADDRESS_TYPE, ADDRESS_TYPE_VALUES); BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); ASSERT_ARE_EQUAL(int, 0, platform_init()); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { (void)platform_deinit(); gballoc_hl_deinit(); @@ -473,4 +474,4 @@ TEST_FUNCTION(get_local_socket_address_test) free(client_local_address_list); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/interfaces/tests/srw_lock_int/srw_lock_int.c b/interfaces/tests/srw_lock_int/srw_lock_int.c index cfacb7a7..e3d30e03 100644 --- a/interfaces/tests/srw_lock_int/srw_lock_int.c +++ b/interfaces/tests/srw_lock_int/srw_lock_int.c @@ -9,16 +9,17 @@ #include "umock_c/umock_c.h" // IWYU pragma: keep #include "c_pal/srw_lock.h" +#include "c_pal/timed_test_suite.h" static const char* TEST_LOCK_NAME = "test_lock"; BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -75,4 +76,4 @@ TEST_FUNCTION(srw_lock_shared_lock) srw_lock_destroy(lock_handle); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/interfaces/tests/srw_lock_ll_int/srw_lock_ll_int.c b/interfaces/tests/srw_lock_ll_int/srw_lock_ll_int.c index 738b145c..4aa5117e 100644 --- a/interfaces/tests/srw_lock_ll_int/srw_lock_ll_int.c +++ b/interfaces/tests/srw_lock_ll_int/srw_lock_ll_int.c @@ -8,14 +8,15 @@ #include "umock_c/umock_c.h" // IWYU pragma: keep #include "c_pal/srw_lock_ll.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -76,4 +77,4 @@ TEST_FUNCTION(srw_lock_ll_shared_lock_succeeds) srw_lock_ll_deinit(&lock); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/interfaces/tests/sysinfo_int/sysinfo_int.c b/interfaces/tests/sysinfo_int/sysinfo_int.c index 86c7b352..68cc1035 100644 --- a/interfaces/tests/sysinfo_int/sysinfo_int.c +++ b/interfaces/tests/sysinfo_int/sysinfo_int.c @@ -11,15 +11,16 @@ #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep #include "c_pal/sysinfo.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(a) +TIMED_TEST_SUITE_INITIALIZE(a, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); } -TEST_SUITE_CLEANUP(b) +TIMED_TEST_SUITE_CLEANUP(b) { gballoc_hl_deinit(); } @@ -49,4 +50,4 @@ TEST_FUNCTION(sysinfo_get_processor_count_returns_processor_count) /* Tests_SRS_SYSINFO_01_002: [ If any error occurs, sysinfo_get_processor_count shall return 0. ]*/ /* Can't really be induced on "any" platform, tested independently for each psupported platform */ -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/interfaces/tests/timer_int/timer_int.c b/interfaces/tests/timer_int/timer_int.c index 59df2728..c2d042f0 100644 --- a/interfaces/tests/timer_int/timer_int.c +++ b/interfaces/tests/timer_int/timer_int.c @@ -11,15 +11,16 @@ #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep #include "c_pal/threadapi.h" #include "c_pal/timer.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(a) +TIMED_TEST_SUITE_INITIALIZE(a, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); } -TEST_SUITE_CLEANUP(b) +TIMED_TEST_SUITE_CLEANUP(b) { gballoc_hl_deinit(); } @@ -311,4 +312,4 @@ TEST_FUNCTION(timer_global_get_elapsed_us_measures_a_seconds) ASSERT_IS_TRUE((end - start) < 1500000); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/interfaces/tests/uuid_int/uuid_int.c b/interfaces/tests/uuid_int/uuid_int.c index 6e37e373..f4ddcbd3 100644 --- a/interfaces/tests/uuid_int/uuid_int.c +++ b/interfaces/tests/uuid_int/uuid_int.c @@ -9,14 +9,15 @@ #include "c_logging/logger.h" #include "c_pal/uuid.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -237,4 +238,4 @@ TEST_FUNCTION(UUID_T_VALUES_OR_NULL_compiles) ///assert - none } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/linux/tests/async_socket_linux_int/async_socket_linux_int.c b/linux/tests/async_socket_linux_int/async_socket_linux_int.c index 8da10f84..a00b695c 100644 --- a/linux/tests/async_socket_linux_int/async_socket_linux_int.c +++ b/linux/tests/async_socket_linux_int/async_socket_linux_int.c @@ -21,6 +21,7 @@ #include "c_pal/sync.h" #include "c_pal/socket_handle.h" #include "c_pal/platform.h" +#include "c_pal/timed_test_suite.h" static int g_port_num; @@ -173,14 +174,14 @@ static void dump_bytes(const char* msg, uint8_t data_payload[], uint32_t length) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); ASSERT_ARE_EQUAL(int, 0, platform_init()); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { platform_deinit(); @@ -538,4 +539,4 @@ TEST_FUNCTION(MU_C3(scheduling_, N_WORK_ITEMS, _sockets_items)) execution_engine_dec_ref(execution_engine); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/linux/tests/async_socket_linux_ut/async_socket_linux_ut.c b/linux/tests/async_socket_linux_ut/async_socket_linux_ut.c index 752a1d4f..aee37616 100644 --- a/linux/tests/async_socket_linux_ut/async_socket_linux_ut.c +++ b/linux/tests/async_socket_linux_ut/async_socket_linux_ut.c @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. #include "async_socket_linux_ut_pch.h" @@ -135,7 +135,7 @@ static void setup_async_socket_notify_io_async_mocks(ASYNC_SOCKET_NOTIFY_IO_TYPE BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { int result; @@ -172,7 +172,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_TYPE(ASYNC_SOCKET_NOTIFY_IO_RESULT, ASYNC_SOCKET_NOTIFY_IO_RESULT); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); diff --git a/linux/tests/async_socket_linux_ut/async_socket_linux_ut_pch.h b/linux/tests/async_socket_linux_ut/async_socket_linux_ut_pch.h index df9f2753..ef069939 100644 --- a/linux/tests/async_socket_linux_ut/async_socket_linux_ut_pch.h +++ b/linux/tests/async_socket_linux_ut/async_socket_linux_ut_pch.h @@ -23,6 +23,8 @@ #include "umock_c/umocktypes_charptr.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/completion_port_linux.h" @@ -43,4 +45,4 @@ #define TEST_MAX_EVENTS_NUM 64 -#endif // ASYNC_SOCKET_LINUX_UT_PCH_H +#endif // ASYNC_SOCKET_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/completion_port_linux_ut/completion_port_linux_ut.c b/linux/tests/completion_port_linux_ut/completion_port_linux_ut.c index 6e963aec..4434188c 100644 --- a/linux/tests/completion_port_linux_ut/completion_port_linux_ut.c +++ b/linux/tests/completion_port_linux_ut/completion_port_linux_ut.c @@ -107,7 +107,7 @@ static void setup_remove_thread_data(void) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -141,7 +141,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_TYPE(COMPLETION_PORT_EPOLL_ACTION, COMPLETION_PORT_EPOLL_ACTION); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); real_gballoc_hl_deinit(); diff --git a/linux/tests/completion_port_linux_ut/completion_port_linux_ut_pch.h b/linux/tests/completion_port_linux_ut/completion_port_linux_ut_pch.h index 65f1ee22..71c344c7 100644 --- a/linux/tests/completion_port_linux_ut/completion_port_linux_ut_pch.h +++ b/linux/tests/completion_port_linux_ut/completion_port_linux_ut_pch.h @@ -22,6 +22,8 @@ #include "umock_c/umocktypes_charptr.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" // IWYU pragma: keep @@ -50,4 +52,4 @@ #define TEST_COMPLETION_PORT_CALLBACK_EXECUTING 2 #define TEST_COMPLETION_PORT_CALLBACK_EXECUTED 3 -#endif // COMPLETION_PORT_LINUX_UT_PCH_H +#endif // COMPLETION_PORT_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/error_handling_linux_ut/error_handling_linux_ut.c b/linux/tests/error_handling_linux_ut/error_handling_linux_ut.c index ecf838bc..e47260ad 100644 --- a/linux/tests/error_handling_linux_ut/error_handling_linux_ut.c +++ b/linux/tests/error_handling_linux_ut/error_handling_linux_ut.c @@ -11,7 +11,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types()); @@ -23,7 +23,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_FAIL_RETURN(malloc_2, NULL); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); umock_c_negative_tests_deinit(); @@ -65,7 +65,7 @@ TEST_FUNCTION(get_last_error_SUCCEEDS) umock_c_reset_all_calls(); STRICT_EXPECTED_CALL(interlocked_add(IGNORED_ARG, 0)); - + ///act uint32_t result = 0; result = error_handling_linux_get_last_error(); diff --git a/linux/tests/error_handling_linux_ut/error_handling_linux_ut_pch.h b/linux/tests/error_handling_linux_ut/error_handling_linux_ut_pch.h index 7e7aea1a..f342c8f9 100644 --- a/linux/tests/error_handling_linux_ut/error_handling_linux_ut_pch.h +++ b/linux/tests/error_handling_linux_ut/error_handling_linux_ut_pch.h @@ -19,6 +19,8 @@ #include "real_gballoc_ll.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" @@ -34,4 +36,4 @@ #include "c_pal/error_handling.h" -#endif // ERROR_HANDLING_LINUX_UT_PCH_H +#endif // ERROR_HANDLING_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/execution_engine_linux_ut/execution_engine_linux_ut.c b/linux/tests/execution_engine_linux_ut/execution_engine_linux_ut.c index 61453f89..e7df2d47 100644 --- a/linux/tests/execution_engine_linux_ut/execution_engine_linux_ut.c +++ b/linux/tests/execution_engine_linux_ut/execution_engine_linux_ut.c @@ -18,7 +18,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types()); @@ -32,7 +32,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_INTERLOCKED_HL_GLOBAL_MOCK_HOOK(); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); umock_c_negative_tests_deinit(); diff --git a/linux/tests/execution_engine_linux_ut/execution_engine_linux_ut_pch.h b/linux/tests/execution_engine_linux_ut/execution_engine_linux_ut_pch.h index c0161b62..0271c0fe 100644 --- a/linux/tests/execution_engine_linux_ut/execution_engine_linux_ut_pch.h +++ b/linux/tests/execution_engine_linux_ut/execution_engine_linux_ut_pch.h @@ -18,6 +18,8 @@ #include "real_gballoc_ll.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" @@ -38,4 +40,4 @@ #define MIN_THREAD_COUNT 5 #define MAX_THREAD_COUNT 10 -#endif // EXECUTION_ENGINE_LINUX_UT_PCH_H +#endif // EXECUTION_ENGINE_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/file_util_linux_ut/file_util_linux_ut.c b/linux/tests/file_util_linux_ut/file_util_linux_ut.c index 370cb504..d5ac5164 100644 --- a/linux/tests/file_util_linux_ut/file_util_linux_ut.c +++ b/linux/tests/file_util_linux_ut/file_util_linux_ut.c @@ -18,7 +18,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types()); @@ -32,7 +32,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_UMOCK_ALIAS_TYPE(LPSECURITY_ATTRIBUTES, void*); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); umock_c_negative_tests_deinit(); @@ -96,7 +96,7 @@ TEST_FUNCTION(file_util_open_file_open_Fail) HANDLE result; STRICT_EXPECTED_CALL(malloc(IGNORED_ARG)); - STRICT_EXPECTED_CALL(mocked_open(G_FILE_NAME, O_RDONLY|O_CREAT)) + STRICT_EXPECTED_CALL(mocked_open(G_FILE_NAME, O_RDONLY|O_CREAT)) .SetReturn(-1); STRICT_EXPECTED_CALL(free(IGNORED_ARG)); @@ -118,7 +118,7 @@ static const struct CREATION_DISPOSITION_INPUTS_TAG int creation_disposition; int flags; -} TEST_VEC_CREATION_DISPOSITION_INPUTS[] = +} TEST_VEC_CREATION_DISPOSITION_INPUTS[] = { {CREATE_ALWAYS, O_CREAT}, {CREATE_NEW, O_CREAT|O_EXCL}, @@ -191,7 +191,7 @@ static const struct DESIRED_ACCESS_INPUTS { int in_desired_access; int user_access; -} DESIRED_ACCESS_INPUTS[] = +} DESIRED_ACCESS_INPUTS[] = { {GENERIC_READ, O_RDONLY}, {GENERIC_WRITE, O_WRONLY}, @@ -280,7 +280,7 @@ TEST_FUNCTION(file_util_close_file_Succeeds) ///act result = file_util_close_file(handle_input); - + //assert ASSERT_IS_TRUE(result); ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); @@ -307,7 +307,7 @@ TEST_FUNCTION(file_util_close_file_FAILS) ///act result = file_util_close_file(handle_input); - + //assert ASSERT_IS_FALSE(result); ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); @@ -326,6 +326,6 @@ TEST_FUNCTION(file_util_close_file_input_NULL) ///assert ASSERT_IS_FALSE(result); ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); -} +} END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) diff --git a/linux/tests/file_util_linux_ut/file_util_linux_ut_pch.h b/linux/tests/file_util_linux_ut/file_util_linux_ut_pch.h index bf31a43d..393c8e46 100644 --- a/linux/tests/file_util_linux_ut/file_util_linux_ut_pch.h +++ b/linux/tests/file_util_linux_ut/file_util_linux_ut_pch.h @@ -24,6 +24,8 @@ #include "real_gballoc_ll.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" @@ -37,4 +39,4 @@ #include "c_pal/file_util.h" -#endif // FILE_UTIL_LINUX_UT_PCH_H +#endif // FILE_UTIL_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut.c b/linux/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut.c index 71cb6068..b6c3c8d9 100644 --- a/linux/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut.c +++ b/linux/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut.c @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "gballoc_hl_passthrough_ut_pch.h" @@ -37,7 +37,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(init_suite) +TIMED_TEST_SUITE_INITIALIZE(init_suite, TIMED_TEST_DEFAULT_TIMEOUT_MS) { umock_c_init(on_umock_c_error); @@ -48,7 +48,7 @@ TEST_SUITE_INITIALIZE(init_suite) REGISTER_GLOBAL_MOCK_HOOK(gballoc_ll_size, stdlib_size); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } diff --git a/linux/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut_pch.h b/linux/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut_pch.h index ed5e2d42..ba04c38e 100644 --- a/linux/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut_pch.h +++ b/linux/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut_pch.h @@ -16,10 +16,12 @@ #include "umock_c/umock_c.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_ll.h" #include "umock_c/umock_c_DISABLE_MOCKS.h" // ============================== DISABLE_MOCKS #include "c_pal/gballoc_hl.h" -#endif // GBALLOC_HL_PASSTHROUGH_UT_PCH_H +#endif // GBALLOC_HL_PASSTHROUGH_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/gballoc_ll_passthrough_int/gballoc_ll_passthrough_int.c b/linux/tests/gballoc_ll_passthrough_int/gballoc_ll_passthrough_int.c index 5d07134d..bb45e96b 100644 --- a/linux/tests/gballoc_ll_passthrough_int/gballoc_ll_passthrough_int.c +++ b/linux/tests/gballoc_ll_passthrough_int/gballoc_ll_passthrough_int.c @@ -8,15 +8,16 @@ #include "testrunnerswitcher.h" #include "c_pal/gballoc_ll.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_ll_init(NULL)); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { gballoc_ll_deinit(); } @@ -153,7 +154,7 @@ TEST_FUNCTION(gballoc_ll_free_works) unsigned char* ptr = (unsigned char*)gballoc_ll_malloc(1); ASSERT_IS_NOT_NULL(ptr); - ///act + ///act gballoc_ll_free(ptr); ///assert - doesn't crash @@ -166,7 +167,7 @@ TEST_FUNCTION(gballoc_ll_realloc_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = (unsigned char*)gballoc_ll_realloc(ptr1, 2); ///assert - doesn't crash @@ -183,7 +184,7 @@ TEST_FUNCTION(gballoc_ll_realloc_2_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = (unsigned char*)gballoc_ll_realloc_2(ptr1, 1, 2); ///assert - doesn't crash @@ -200,7 +201,7 @@ TEST_FUNCTION(gballoc_ll_realloc_flex_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = (unsigned char*)gballoc_ll_realloc_flex(ptr1, 4, 20, 8); ///assert - doesn't crash @@ -216,7 +217,7 @@ TEST_FUNCTION(gballoc_ll_calloc_works) ///arrange unsigned char* ptr; - ///act + ///act ptr = (unsigned char*)gballoc_ll_calloc(1, 1); ///assert - doesn't crash @@ -246,4 +247,4 @@ TEST_FUNCTION(gballoc_ll_size_works) } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/linux/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut.c b/linux/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut.c index 78b15113..47bf9801 100644 --- a/linux/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut.c +++ b/linux/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut.c @@ -27,7 +27,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { umock_c_init(on_umock_c_error); @@ -36,7 +36,7 @@ TEST_SUITE_INITIALIZE(TestClassInitialize) REGISTER_GLOBAL_MOCK_RETURN(mock_calloc, TEST_CALLOC_RESULT); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } @@ -55,7 +55,7 @@ TEST_FUNCTION(gballoc_ll_init_returns_0) { ///arrange int result; - + ///act result = gballoc_ll_init(NULL); diff --git a/linux/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut_pch.h b/linux/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut_pch.h index a16b55eb..cba8ee67 100644 --- a/linux/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut_pch.h +++ b/linux/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut_pch.h @@ -15,5 +15,6 @@ #include "umock_c/umock_c.h" #include "c_pal/gballoc_ll.h" +#include "c_pal/timed_test_suite.h" -#endif // GBALLOC_LL_PASSTHROUGH_UT_PCH_H +#endif // GBALLOC_LL_PASSTHROUGH_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/linux_reals_ut/reals_linux_ut_pch.h b/linux/tests/linux_reals_ut/reals_linux_ut_pch.h index fc51cbec..911d6282 100644 --- a/linux/tests/linux_reals_ut/reals_linux_ut_pch.h +++ b/linux/tests/linux_reals_ut/reals_linux_ut_pch.h @@ -18,6 +18,7 @@ #include "c_pal/thandle_log_context_handle.h" // IWYU pragma: keep #include "c_pal/socket_transport.h" // IWYU pragma: keep #include "c_pal/async_socket.h" // IWYU pragma: keep +#include "c_pal/timed_test_suite.h" #define REGISTER_GLOBAL_MOCK_HOOK(original, real) \ (original == real) ? (void)0 : (void)1; @@ -35,4 +36,4 @@ #include "real_socket_transport.h" #include "real_async_socket.h" -#endif // REALS_LINUX_UT_PCH_H +#endif // REALS_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/pipe_linux_ut/pipe_linux_ut.c b/linux/tests/pipe_linux_ut/pipe_linux_ut.c index a28a2f0f..e71bc3e0 100644 --- a/linux/tests/pipe_linux_ut/pipe_linux_ut.c +++ b/linux/tests/pipe_linux_ut/pipe_linux_ut.c @@ -21,13 +21,13 @@ static FILE* test_file_handle = (FILE*)0x1001; BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); ASSERT_ARE_EQUAL(int, 0, umocktypes_charptr_register_types()); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } diff --git a/linux/tests/pipe_linux_ut/pipe_linux_ut_pch.h b/linux/tests/pipe_linux_ut/pipe_linux_ut_pch.h index abf3ab58..c6dbdfcf 100644 --- a/linux/tests/pipe_linux_ut/pipe_linux_ut_pch.h +++ b/linux/tests/pipe_linux_ut/pipe_linux_ut_pch.h @@ -11,8 +11,9 @@ #include "macro_utils/macro_utils.h" // IWYU pragma: keep #include "testrunnerswitcher.h" +#include "c_pal/timed_test_suite.h" #include "umock_c/umock_c.h" #include "umock_c/umocktypes_charptr.h" -#endif // PIPE_LINUX_UT_PCH_H +#endif // PIPE_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/platform_linux_ut/platform_linux_ut.c b/linux/tests/platform_linux_ut/platform_linux_ut.c index a3738320..f4cdc011 100644 --- a/linux/tests/platform_linux_ut/platform_linux_ut.c +++ b/linux/tests/platform_linux_ut/platform_linux_ut.c @@ -1,4 +1,4 @@ -// Copyright(C) Microsoft Corporation.All rights reserved. +// Copyright(C) Microsoft Corporation.All rights reserved. #include "platform_linux_ut_pch.h" @@ -25,7 +25,7 @@ static int my_getaddrinfo(const char* pNodeName, const char* pServiceName, const BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init"); ASSERT_ARE_EQUAL(int, 0, umocktypes_charptr_register_types()); @@ -36,7 +36,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_UMOCK_ALIAS_TYPE(COMPLETION_PORT_HANDLE, void*); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/linux/tests/platform_linux_ut/platform_linux_ut_pch.h b/linux/tests/platform_linux_ut/platform_linux_ut_pch.h index 8eca6932..92cff614 100644 --- a/linux/tests/platform_linux_ut/platform_linux_ut_pch.h +++ b/linux/tests/platform_linux_ut/platform_linux_ut_pch.h @@ -17,6 +17,8 @@ #include "umock_c/umock_c.h" #include "umock_c/umocktypes_charptr.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/completion_port_linux.h" @@ -27,4 +29,4 @@ #include "c_pal/platform.h" #include "c_pal/platform_linux.h" -#endif // PLATFORM_LINUX_UT_PCH_H +#endif // PLATFORM_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/process_watchdog_int/process_watchdog_int.c b/linux/tests/process_watchdog_int/process_watchdog_int.c index 11173793..965c5295 100644 --- a/linux/tests/process_watchdog_int/process_watchdog_int.c +++ b/linux/tests/process_watchdog_int/process_watchdog_int.c @@ -23,6 +23,7 @@ #include "c_logging/logger.h" #include "c_pal/timer.h" +#include "c_pal/timed_test_suite.h" // Shared exit codes between parent and child #include "process_watchdog_int_common.h" @@ -144,11 +145,11 @@ static void get_child_exe_path(char* buffer, size_t buffer_size) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -229,4 +230,4 @@ TEST_FUNCTION(process_watchdog_does_not_terminate_before_timeout) "Child process did not complete successfully, exit_code=%d", exit_code); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/linux/tests/process_watchdog_linux_ut/process_watchdog_linux_ut.c b/linux/tests/process_watchdog_linux_ut/process_watchdog_linux_ut.c index 9405af65..ba2f34e3 100644 --- a/linux/tests/process_watchdog_linux_ut/process_watchdog_linux_ut.c +++ b/linux/tests/process_watchdog_linux_ut/process_watchdog_linux_ut.c @@ -30,7 +30,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types()); @@ -40,7 +40,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_HOOK(mocked_timer_create, hook_timer_create); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/linux/tests/process_watchdog_linux_ut/process_watchdog_linux_ut_pch.h b/linux/tests/process_watchdog_linux_ut/process_watchdog_linux_ut_pch.h index 4c96d7ac..92e217fb 100644 --- a/linux/tests/process_watchdog_linux_ut/process_watchdog_linux_ut_pch.h +++ b/linux/tests/process_watchdog_linux_ut/process_watchdog_linux_ut_pch.h @@ -18,6 +18,8 @@ #include "umock_c/umocktypes_stdint.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/interlocked.h" @@ -31,4 +33,4 @@ #include "c_pal/process_watchdog.h" -#endif // PROCESS_WATCHDOG_LINUX_UT_PCH_H +#endif // PROCESS_WATCHDOG_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/socket_transport_linux_ut/socket_transport_linux_ut.c b/linux/tests/socket_transport_linux_ut/socket_transport_linux_ut.c index f7853341..b2556197 100644 --- a/linux/tests/socket_transport_linux_ut/socket_transport_linux_ut.c +++ b/linux/tests/socket_transport_linux_ut/socket_transport_linux_ut.c @@ -110,7 +110,7 @@ static int my_gethostname(char* name, size_t namelen) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init failed"); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types(), "umocktypes_stdint_register_types failed"); @@ -160,7 +160,7 @@ TEST_SUITE_INITIALIZE(suite_init) } } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); umock_c_negative_tests_deinit(); diff --git a/linux/tests/socket_transport_linux_ut/socket_transport_linux_ut_pch.h b/linux/tests/socket_transport_linux_ut/socket_transport_linux_ut_pch.h index 7cfac2ab..03ad26ac 100644 --- a/linux/tests/socket_transport_linux_ut/socket_transport_linux_ut_pch.h +++ b/linux/tests/socket_transport_linux_ut/socket_transport_linux_ut_pch.h @@ -30,6 +30,8 @@ #include "umock_c/umocktypes.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "socket_mocked.h" @@ -47,4 +49,4 @@ #define MAX_SOCKET_ARRAY 10 -#endif // SOCKET_TRANSPORT_LINUX_UT_PCH_H +#endif // SOCKET_TRANSPORT_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/srw_lock_linux_ut/srw_lock_linux_ut.c b/linux/tests/srw_lock_linux_ut/srw_lock_linux_ut.c index 74aa3d7e..e7c3307b 100644 --- a/linux/tests/srw_lock_linux_ut/srw_lock_linux_ut.c +++ b/linux/tests/srw_lock_linux_ut/srw_lock_linux_ut.c @@ -102,7 +102,7 @@ static void test_srw_lock_acquire_shared(SRW_LOCK_HANDLE handle) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types()); @@ -121,7 +121,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_FAIL_RETURN(mocked_pthread_rwlock_init, 1); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); umock_c_negative_tests_deinit(); diff --git a/linux/tests/srw_lock_linux_ut/srw_lock_linux_ut_pch.h b/linux/tests/srw_lock_linux_ut/srw_lock_linux_ut_pch.h index 0c6b44a6..85d228a5 100644 --- a/linux/tests/srw_lock_linux_ut/srw_lock_linux_ut_pch.h +++ b/linux/tests/srw_lock_linux_ut/srw_lock_linux_ut_pch.h @@ -19,6 +19,8 @@ #include "umock_c/umocktypes_stdint.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep @@ -32,4 +34,4 @@ #include "c_pal/srw_lock.h" -#endif // SRW_LOCK_LINUX_UT_PCH_H +#endif // SRW_LOCK_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/srw_lock_ll_linux_ut/srw_lock_ll_linux_ut.c b/linux/tests/srw_lock_ll_linux_ut/srw_lock_ll_linux_ut.c index 43c5f9ec..1842bfb0 100644 --- a/linux/tests/srw_lock_ll_linux_ut/srw_lock_ll_linux_ut.c +++ b/linux/tests/srw_lock_ll_linux_ut/srw_lock_ll_linux_ut.c @@ -31,7 +31,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init"); @@ -43,7 +43,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_RETURNS(mocked_pthread_rwlock_trywrlock, 0, 10); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/linux/tests/srw_lock_ll_linux_ut/srw_lock_ll_linux_ut_pch.h b/linux/tests/srw_lock_ll_linux_ut/srw_lock_ll_linux_ut_pch.h index 2d510ba1..cf0a353b 100644 --- a/linux/tests/srw_lock_ll_linux_ut/srw_lock_ll_linux_ut_pch.h +++ b/linux/tests/srw_lock_ll_linux_ut/srw_lock_ll_linux_ut_pch.h @@ -17,5 +17,6 @@ #include "umock_c/umock_c.h" #include "c_pal/srw_lock_ll.h" +#include "c_pal/timed_test_suite.h" -#endif // SRW_LOCK_LL_LINUX_UT_PCH_H +#endif // SRW_LOCK_LL_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/string_utils_int/string_utils_int.c b/linux/tests/string_utils_int/string_utils_int.c index e8570346..4712936f 100644 --- a/linux/tests/string_utils_int/string_utils_int.c +++ b/linux/tests/string_utils_int/string_utils_int.c @@ -13,16 +13,17 @@ #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep #include "c_pal/string_utils.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { gballoc_hl_deinit(); } @@ -195,4 +196,4 @@ TEST_FUNCTION(vsprintf_char_with_a_non_empty_string_succeeds) } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/linux/tests/sysinfo_linux_ut/sysinfo_linux_ut.c b/linux/tests/sysinfo_linux_ut/sysinfo_linux_ut.c index 1ee97abd..4d69b098 100644 --- a/linux/tests/sysinfo_linux_ut/sysinfo_linux_ut.c +++ b/linux/tests/sysinfo_linux_ut/sysinfo_linux_ut.c @@ -20,13 +20,13 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init failed"); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types(), "umocktypes_stdint_register_types failed"); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/linux/tests/sysinfo_linux_ut/sysinfo_linux_ut_pch.h b/linux/tests/sysinfo_linux_ut/sysinfo_linux_ut_pch.h index 34b36601..d9bf29c1 100644 --- a/linux/tests/sysinfo_linux_ut/sysinfo_linux_ut_pch.h +++ b/linux/tests/sysinfo_linux_ut/sysinfo_linux_ut_pch.h @@ -16,5 +16,6 @@ #include "umock_c/umocktypes_stdint.h" #include "c_pal/sysinfo.h" +#include "c_pal/timed_test_suite.h" -#endif // SYSINFO_LINUX_UT_PCH_H +#endif // SYSINFO_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/threadpool_linux_ut/threadpool_linux_ut.c b/linux/tests/threadpool_linux_ut/threadpool_linux_ut.c index e162e079..11d24d5f 100644 --- a/linux/tests/threadpool_linux_ut/threadpool_linux_ut.c +++ b/linux/tests/threadpool_linux_ut/threadpool_linux_ut.c @@ -131,7 +131,7 @@ static THANDLE(THREADPOOL) test_create_threadpool(void) static void setup_lazy_init(void) { THANDLE(THREADPOOL) threadpool = test_create_threadpool(); - // create one timer + // create one timer STRICT_EXPECTED_CALL(malloc(IGNORED_ARG)); STRICT_EXPECTED_CALL(interlocked_exchange(IGNORED_ARG, 1)); STRICT_EXPECTED_CALL(lazy_init(IGNORED_ARG, IGNORED_ARG, IGNORED_ARG)); @@ -174,7 +174,7 @@ static THANDLE(THREADPOOL_TIMER) test_create_threadpool_and_start_timer(uint32_t BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types()); @@ -217,7 +217,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_TYPE(TQUEUE_POP_RESULT, TQUEUE_POP_RESULT); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); umock_c_negative_tests_deinit(); diff --git a/linux/tests/threadpool_linux_ut/threadpool_linux_ut_pch.h b/linux/tests/threadpool_linux_ut/threadpool_linux_ut_pch.h index 80ba1081..d9d001d0 100644 --- a/linux/tests/threadpool_linux_ut/threadpool_linux_ut_pch.h +++ b/linux/tests/threadpool_linux_ut/threadpool_linux_ut_pch.h @@ -23,6 +23,8 @@ #include "real_gballoc_ll.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" @@ -57,4 +59,4 @@ #define MAX_THREADPOOL_TIMER_COUNT 64 #define MAX_TIMERS 1024 -#endif // THREADPOOL_LINUX_UT_PCH_H +#endif // THREADPOOL_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/timer_linux_ut/timer_linux_ut.c b/linux/tests/timer_linux_ut/timer_linux_ut.c index 17f6b442..74606ddf 100644 --- a/linux/tests/timer_linux_ut/timer_linux_ut.c +++ b/linux/tests/timer_linux_ut/timer_linux_ut.c @@ -18,7 +18,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -32,7 +32,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_UMOCK_ALIAS_TYPE(clockid_t, int); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); umock_c_negative_tests_deinit(); @@ -222,7 +222,7 @@ TEST_FUNCTION(timer_get_elapsed_success) umock_c_reset_all_calls(); STRICT_EXPECTED_CALL(mocked_clock_gettime(CLOCK_MONOTONIC, IGNORED_ARG)) .CopyOutArgumentBuffer_tp(&stop_time, sizeof(stop_time)); - + //act double elapsed_time = timer_get_elapsed(timer); @@ -246,7 +246,7 @@ TEST_FUNCTION(timer_get_elapsed_success_0_1) umock_c_reset_all_calls(); STRICT_EXPECTED_CALL(mocked_clock_gettime(CLOCK_MONOTONIC, IGNORED_ARG)) .CopyOutArgumentBuffer_tp(&stop_time, sizeof(stop_time)); - + //act double elapsed_time = timer_get_elapsed(timer); @@ -273,7 +273,7 @@ TEST_FUNCTION(timer_get_elapsed_success_0_2_crossing_second) stop_time.tv_nsec = 100000000; STRICT_EXPECTED_CALL(mocked_clock_gettime(CLOCK_MONOTONIC, IGNORED_ARG)) .CopyOutArgumentBuffer_tp(&stop_time, sizeof(stop_time)); - + //act double elapsed_time = timer_get_elapsed(timer); @@ -297,7 +297,7 @@ TEST_FUNCTION(when_clock_gettime_fails_timer_get_elapsed_also_fails) STRICT_EXPECTED_CALL(mocked_clock_gettime(CLOCK_MONOTONIC, IGNORED_ARG)) .CopyOutArgumentBuffer_tp(&stop_time, sizeof(stop_time)) .SetReturn(-1); - + //act double elapsed_time = timer_get_elapsed(timer); @@ -334,7 +334,7 @@ TEST_FUNCTION(timer_get_elapsed_ms_success) umock_c_reset_all_calls(); STRICT_EXPECTED_CALL(mocked_clock_gettime(CLOCK_MONOTONIC, IGNORED_ARG)) .CopyOutArgumentBuffer_tp(&stop_time, sizeof(stop_time)); - + //act double elapsed_time = timer_get_elapsed_ms(timer); @@ -358,7 +358,7 @@ TEST_FUNCTION(timer_get_elapsed_ms_success_100_ms) umock_c_reset_all_calls(); STRICT_EXPECTED_CALL(mocked_clock_gettime(CLOCK_MONOTONIC, IGNORED_ARG)) .CopyOutArgumentBuffer_tp(&stop_time, sizeof(stop_time)); - + //act double elapsed_time = timer_get_elapsed_ms(timer); @@ -385,7 +385,7 @@ TEST_FUNCTION(timer_get_elapsed_ms_success_200_ms_crossing_second) stop_time.tv_nsec = 100000000; STRICT_EXPECTED_CALL(mocked_clock_gettime(CLOCK_MONOTONIC, IGNORED_ARG)) .CopyOutArgumentBuffer_tp(&stop_time, sizeof(stop_time)); - + //act double elapsed_time = timer_get_elapsed_ms(timer); @@ -409,7 +409,7 @@ TEST_FUNCTION(when_clock_gettime_fails_timer_get_elapsed_ms_also_fails) STRICT_EXPECTED_CALL(mocked_clock_gettime(CLOCK_MONOTONIC, IGNORED_ARG)) .CopyOutArgumentBuffer_tp(&stop_time, sizeof(stop_time)) .SetReturn(-1); - + //act double elapsed_time = timer_get_elapsed_ms(timer); diff --git a/linux/tests/timer_linux_ut/timer_linux_ut_pch.h b/linux/tests/timer_linux_ut/timer_linux_ut_pch.h index ea63e0a3..7f8b7d98 100644 --- a/linux/tests/timer_linux_ut/timer_linux_ut_pch.h +++ b/linux/tests/timer_linux_ut/timer_linux_ut_pch.h @@ -14,6 +14,8 @@ #include "umock_c/umock_c.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep @@ -27,4 +29,4 @@ // No idea why iwyu warns about this since we include time.h but... // IWYU pragma: no_forward_declare timespec -#endif // TIMER_LINUX_UT_PCH_H +#endif // TIMER_LINUX_UT_PCH_H \ No newline at end of file diff --git a/linux/tests/uuid_linux_ut/uuid_linux_ut.c b/linux/tests/uuid_linux_ut/uuid_linux_ut.c index 11690833..da349be4 100644 --- a/linux/tests/uuid_linux_ut/uuid_linux_ut.c +++ b/linux/tests/uuid_linux_ut/uuid_linux_ut.c @@ -76,7 +76,7 @@ static int umock_are_equal_uuid_t(const uuid_t* left, const uuid_t* right) static int umock_copy_uuid_t(uuid_t* destination, const uuid_t* source) { if ( - (destination == NULL) || + (destination == NULL) || (source == NULL) ) { @@ -95,7 +95,7 @@ static void umock_free_uuid_t(uuid_t* value) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); @@ -104,7 +104,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_HOOK(mocked_uuid_generate, hook_uuid_generate); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/linux/tests/uuid_linux_ut/uuid_linux_ut_pch.h b/linux/tests/uuid_linux_ut/uuid_linux_ut_pch.h index e513cf52..1328dd34 100644 --- a/linux/tests/uuid_linux_ut/uuid_linux_ut_pch.h +++ b/linux/tests/uuid_linux_ut/uuid_linux_ut_pch.h @@ -20,6 +20,7 @@ #include "umock_c/umock_c_negative_tests.h" #include "c_pal/uuid.h" +#include "c_pal/timed_test_suite.h" #define TEST_DATA_0 0x01 #define TEST_DATA_1 0x12 @@ -38,4 +39,4 @@ #define TEST_DATA_14 0xEF #define TEST_DATA_15 0xF0 -#endif // UUID_LINUX_UT_PCH_H +#endif // UUID_LINUX_UT_PCH_H \ No newline at end of file diff --git a/umocktypes/tests/umocktypes_uuid_t_int/umocktypes_uuid_t_int.c b/umocktypes/tests/umocktypes_uuid_t_int/umocktypes_uuid_t_int.c index bcd6a7b1..4e150343 100644 --- a/umocktypes/tests/umocktypes_uuid_t_int/umocktypes_uuid_t_int.c +++ b/umocktypes/tests/umocktypes_uuid_t_int/umocktypes_uuid_t_int.c @@ -12,6 +12,7 @@ #include "c_pal/uuid.h" #include "c_pal/umocktypes_uuid_t.h" +#include "c_pal/timed_test_suite.h" #include "module.h" @@ -24,14 +25,14 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize) { umock_c_init(on_umock_c_error); ASSERT_ARE_EQUAL(int, 0, umocktypes_UUID_T_register_types()); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } @@ -161,4 +162,4 @@ TEST_FUNCTION(module_calls_const_submodule_2) /*wants to see that the const UUID ASSERT_ARE_NOT_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/async_socket_win32_int/async_socket_win32_int.c b/win32/tests/async_socket_win32_int/async_socket_win32_int.c index 614cff03..50ff5081 100644 --- a/win32/tests/async_socket_win32_int/async_socket_win32_int.c +++ b/win32/tests/async_socket_win32_int/async_socket_win32_int.c @@ -14,6 +14,7 @@ #include "c_pal/execution_engine.h" #include "c_pal/gballoc_hl.h" #include "c_pal/execution_engine_win32.h" +#include "c_pal/timed_test_suite.h" #define TEST_PORT 4266 @@ -114,7 +115,7 @@ static void setup_sockets(SOCKET* client_socket, SOCKET* server_socket, SOCKET* BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); @@ -122,7 +123,7 @@ TEST_SUITE_INITIALIZE(suite_init) ASSERT_ARE_EQUAL(int, 0, WSAStartup(MAKEWORD(2, 2), &wsaData)); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { (void)WSACleanup(); @@ -328,4 +329,4 @@ TEST_FUNCTION(when_server_socket_is_closed_receive_errors_on_client_side) execution_engine_dec_ref(execution_engine); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/async_socket_win32_ut/async_socket_win32_ut.c b/win32/tests/async_socket_win32_ut/async_socket_win32_ut.c index 9900c6da..d5c568c7 100644 --- a/win32/tests/async_socket_win32_ut/async_socket_win32_ut.c +++ b/win32/tests/async_socket_win32_ut/async_socket_win32_ut.c @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. @@ -76,7 +76,7 @@ MOCK_FUNCTION_END() BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { int result; @@ -127,7 +127,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_TYPE(ASYNC_SOCKET_RECEIVE_RESULT, ASYNC_SOCKET_RECEIVE_RESULT); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); diff --git a/win32/tests/async_socket_win32_ut/async_socket_win32_ut_pch.h b/win32/tests/async_socket_win32_ut/async_socket_win32_ut_pch.h index f313d767..b4457baf 100644 --- a/win32/tests/async_socket_win32_ut/async_socket_win32_ut_pch.h +++ b/win32/tests/async_socket_win32_ut/async_socket_win32_ut_pch.h @@ -21,6 +21,8 @@ #include "umock_c/umocktypes_charptr.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" @@ -34,4 +36,4 @@ #include "c_pal/async_socket.h" -#endif // ASYNC_SOCKET_WIN32_UT_PCH_H +#endif // ASYNC_SOCKET_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/execution_engine_win32_ut/execution_engine_win32_ut.c b/win32/tests/execution_engine_win32_ut/execution_engine_win32_ut.c index a2d8342d..73f3c74c 100644 --- a/win32/tests/execution_engine_win32_ut/execution_engine_win32_ut.c +++ b/win32/tests/execution_engine_win32_ut/execution_engine_win32_ut.c @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. @@ -23,7 +23,7 @@ MOCK_FUNCTION_END() BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { int result; @@ -45,7 +45,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_UMOCK_ALIAS_TYPE(BOOL, int); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); diff --git a/win32/tests/execution_engine_win32_ut/execution_engine_win32_ut_pch.h b/win32/tests/execution_engine_win32_ut/execution_engine_win32_ut_pch.h index d0a9ccbf..b5d4039c 100644 --- a/win32/tests/execution_engine_win32_ut/execution_engine_win32_ut_pch.h +++ b/win32/tests/execution_engine_win32_ut/execution_engine_win32_ut_pch.h @@ -19,6 +19,8 @@ #include "umock_c/umock_c_negative_tests.h" #include "c_pal/execution_engine.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" @@ -30,4 +32,4 @@ #include "c_pal/execution_engine_win32.h" -#endif // EXECUTION_ENGINE_WIN32_UT_PCH_H +#endif // EXECUTION_ENGINE_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/file_win32_ut/file_win32_ut.c b/win32/tests/file_win32_ut/file_win32_ut.c index d60e0889..23699e64 100644 --- a/win32/tests/file_win32_ut/file_win32_ut.c +++ b/win32/tests/file_win32_ut/file_win32_ut.c @@ -107,7 +107,7 @@ static FILE_HANDLE start_file_io_async(FILE_IO_ASYNC_TYPE type, unsigned char* b } ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); - + umock_c_reset_all_calls(); return file_handle; @@ -115,7 +115,7 @@ static FILE_HANDLE start_file_io_async(FILE_IO_ASYNC_TYPE type, unsigned char* b BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -143,7 +143,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_RETURNS(mock_CreateEvent, fake_h_event, NULL); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); @@ -225,7 +225,7 @@ TEST_FUNCTION(file_create_succeeds) ///assert ASSERT_IS_NOT_NULL(file_handle); ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); - + ///cleanup file_destroy(file_handle); } @@ -428,7 +428,7 @@ TEST_FUNCTION(file_write_async_succeeds_asynchronously) ///assert ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); ASSERT_ARE_EQUAL(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_OK, result); - + ///cleanup captured_callback(NULL, NULL, captured_ov, NO_ERROR, sizeof(source), NULL); file_destroy(file_handle); @@ -468,7 +468,7 @@ TEST_FUNCTION(file_write_async_fails_synchronously) ///assert ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); ASSERT_ARE_EQUAL(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_WRITE_ERROR, result); - + ///cleanup file_destroy(file_handle); } @@ -500,14 +500,14 @@ TEST_FUNCTION(file_write_async_succeeds_synchronously) STRICT_EXPECTED_CALL(mock_CloseHandle(fake_h_event)); STRICT_EXPECTED_CALL(free(IGNORED_ARG)) .ValidateArgumentValue_ptr(&io); - + ///act FILE_WRITE_ASYNC_RESULT result = file_write_async(file_handle, source, size, position, mock_user_callback, user_context); ///assert ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); ASSERT_ARE_EQUAL(FILE_WRITE_ASYNC_RESULT, FILE_WRITE_ASYNC_OK, result); - + ///cleanup file_destroy(file_handle); } @@ -586,7 +586,7 @@ TEST_FUNCTION(file_read_async_fails_with_null_destination) ///assert ASSERT_ARE_EQUAL(FILE_READ_ASYNC_RESULT, FILE_READ_ASYNC_INVALID_ARGS, result); ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); - + ///cleanup file_destroy(file_handle); } @@ -605,7 +605,7 @@ TEST_FUNCTION(file_read_async_fails_with_null_user_callback) ///assert ASSERT_ARE_EQUAL(FILE_READ_ASYNC_RESULT, FILE_READ_ASYNC_INVALID_ARGS, result); ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); - + ///cleanup file_destroy(file_handle); } @@ -624,7 +624,7 @@ TEST_FUNCTION(file_read_async_fails_if_size_is_zero) ///assert ASSERT_ARE_EQUAL(FILE_READ_ASYNC_RESULT, FILE_READ_ASYNC_INVALID_ARGS, result); ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); - + ///cleanup file_destroy(file_handle); } @@ -660,7 +660,7 @@ TEST_FUNCTION(file_read_async_succeeds_asynchronously) ///assert ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); ASSERT_ARE_EQUAL(FILE_READ_ASYNC_RESULT, FILE_READ_ASYNC_OK, result); - + ///cleanup captured_callback(NULL, NULL, captured_ov, NO_ERROR, sizeof(source), NULL); file_destroy(file_handle); @@ -700,7 +700,7 @@ TEST_FUNCTION(file_read_async_fails_synchronously) ///assert ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); ASSERT_ARE_EQUAL(FILE_READ_ASYNC_RESULT, FILE_READ_ASYNC_READ_ERROR, result); - + ///cleanup file_destroy(file_handle); } diff --git a/win32/tests/file_win32_ut/file_win32_ut_pch.h b/win32/tests/file_win32_ut/file_win32_ut_pch.h index c5db3a7c..aa0e053f 100644 --- a/win32/tests/file_win32_ut/file_win32_ut_pch.h +++ b/win32/tests/file_win32_ut/file_win32_ut_pch.h @@ -21,6 +21,8 @@ #include "umock_c/umocktypes_bool.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/execution_engine.h" @@ -34,4 +36,4 @@ #include "c_pal/file.h" -#endif // FILE_WIN32_UT_PCH_H +#endif // FILE_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/gballoc_hl_int/gballoc_hl_int.c b/win32/tests/gballoc_hl_int/gballoc_hl_int.c index 8c3400ce..7103e00e 100644 --- a/win32/tests/gballoc_hl_int/gballoc_hl_int.c +++ b/win32/tests/gballoc_hl_int/gballoc_hl_int.c @@ -9,15 +9,16 @@ #include "testrunnerswitcher.h" #include "c_pal/gballoc_hl.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { gballoc_hl_deinit(); } @@ -163,7 +164,7 @@ TEST_FUNCTION(gballoc_hl_free_works) unsigned char* ptr = gballoc_hl_malloc(1); ASSERT_IS_NOT_NULL(ptr); - ///act + ///act gballoc_hl_free(ptr); ///assert - doesn't crash @@ -176,7 +177,7 @@ TEST_FUNCTION(gballoc_hl_realloc_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_hl_realloc(ptr1, 2); ///assert - doesn't crash @@ -193,7 +194,7 @@ TEST_FUNCTION(gballoc_hl_realloc_2_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_hl_realloc_2(ptr1, 2, 3); ///assert - doesn't crash @@ -210,7 +211,7 @@ TEST_FUNCTION(gballoc_hl_realloc_flex_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_hl_realloc_flex(ptr1, 2, 3, 5); ///assert - doesn't crash @@ -225,7 +226,7 @@ TEST_FUNCTION(gballoc_hl_calloc_works) ///arrange unsigned char* ptr; - ///act + ///act ptr = gballoc_hl_calloc(1, 1); ///assert @@ -242,7 +243,7 @@ TEST_FUNCTION(gballoc_hl_size_returns_the_size_of_the_allocated_block) unsigned char* ptr = gballoc_hl_malloc(1); ASSERT_IS_NOT_NULL(ptr); - ///act + ///act size_t size = gballoc_hl_size(ptr); ///assert @@ -252,4 +253,4 @@ TEST_FUNCTION(gballoc_hl_size_returns_the_size_of_the_allocated_block) gballoc_hl_free(ptr); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/gballoc_hl_metrics_ut/gballoc_hl_metrics_ut.c b/win32/tests/gballoc_hl_metrics_ut/gballoc_hl_metrics_ut.c index 4cad2bb8..773b26dd 100644 --- a/win32/tests/gballoc_hl_metrics_ut/gballoc_hl_metrics_ut.c +++ b/win32/tests/gballoc_hl_metrics_ut/gballoc_hl_metrics_ut.c @@ -18,14 +18,14 @@ IMPLEMENT_UMOCK_C_ENUM_TYPE(LAZY_INIT_RESULT, LAZY_INIT_RESULT_VALUES); BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init"); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types(), "umocktypes_stdint_register_types"); REGISTER_UMOCK_ALIAS_TYPE(LAZY_INIT_FUNCTION, void*); - + REGISTER_TYPE(LAZY_INIT_RESULT, LAZY_INIT_RESULT); REGISTER_GLOBAL_MOCK_RETURN(gballoc_ll_malloc, pretend_to_be_allocated); @@ -40,7 +40,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_INTERLOCKED_GLOBAL_MOCK_HOOK(); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } @@ -603,7 +603,7 @@ TEST_FUNCTION(gballoc_hl_calloc_calls_gballoc_ll_calloc_clears_and_returns_the_r { ASSERT_ARE_EQUAL(uint8_t, 0, ((uint8_t*)result)[i]); } - + ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls()); // cleanup @@ -2219,7 +2219,7 @@ TEST_FUNCTION(gballoc_hl_get_free_latency_buckets_with_2_calls_returns_the_avera .SetReturn(43.0); gballoc_hl_free(ptr1); umock_c_reset_all_calls(); - + STRICT_EXPECTED_CALL(interlocked_add(IGNORED_ARG, 0)); STRICT_EXPECTED_CALL(timer_global_get_elapsed_us()) .SetReturn(3.0); diff --git a/win32/tests/gballoc_hl_metrics_ut/gballoc_hl_metrics_ut_pch.h b/win32/tests/gballoc_hl_metrics_ut/gballoc_hl_metrics_ut_pch.h index e41b282d..dd2b821a 100644 --- a/win32/tests/gballoc_hl_metrics_ut/gballoc_hl_metrics_ut_pch.h +++ b/win32/tests/gballoc_hl_metrics_ut/gballoc_hl_metrics_ut_pch.h @@ -15,6 +15,8 @@ #include "umock_c/umocktypes_stdint.h" #include "umock_c/umocktypes.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/timer.h" #include "c_pal/gballoc_ll.h" @@ -27,4 +29,4 @@ #include "c_pal/gballoc_hl.h" -#endif // GBALLOC_HL_METRICS_UT_PCH_H +#endif // GBALLOC_HL_METRICS_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/gballoc_hl_metrics_wout_init_ut/gballoc_hl_metrics_wout_init_ut.c b/win32/tests/gballoc_hl_metrics_wout_init_ut/gballoc_hl_metrics_wout_init_ut.c index 7d95be99..45cffb9f 100644 --- a/win32/tests/gballoc_hl_metrics_wout_init_ut/gballoc_hl_metrics_wout_init_ut.c +++ b/win32/tests/gballoc_hl_metrics_wout_init_ut/gballoc_hl_metrics_wout_init_ut.c @@ -16,7 +16,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init"); @@ -30,7 +30,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_INTERLOCKED_GLOBAL_MOCK_HOOK(); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/win32/tests/gballoc_hl_metrics_wout_init_ut/gballoc_hl_metrics_wout_init_ut_pch.h b/win32/tests/gballoc_hl_metrics_wout_init_ut/gballoc_hl_metrics_wout_init_ut_pch.h index 45064900..a76291ee 100644 --- a/win32/tests/gballoc_hl_metrics_wout_init_ut/gballoc_hl_metrics_wout_init_ut_pch.h +++ b/win32/tests/gballoc_hl_metrics_wout_init_ut/gballoc_hl_metrics_wout_init_ut_pch.h @@ -15,6 +15,8 @@ #include "umock_c/umocktypes_stdint.h" #include "umock_c/umocktypes.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_ll.h" #include "c_pal/lazy_init.h" @@ -26,4 +28,4 @@ #include "c_pal/gballoc_hl.h" -#endif // GBALLOC_HL_METRICS_WOUT_INIT_UT_PCH_H +#endif // GBALLOC_HL_METRICS_WOUT_INIT_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut.c b/win32/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut.c index 1ce2c76c..2301934b 100644 --- a/win32/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut.c +++ b/win32/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut.c @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "gballoc_hl_passthrough_ut_pch.h" @@ -25,7 +25,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(init_suite) +TIMED_TEST_SUITE_INITIALIZE(init_suite, TIMED_TEST_DEFAULT_TIMEOUT_MS) { umock_c_init(on_umock_c_error); @@ -34,7 +34,7 @@ TEST_SUITE_INITIALIZE(init_suite) REGISTER_GBALLOC_LL_GLOBAL_MOCK_HOOK(); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } diff --git a/win32/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut_pch.h b/win32/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut_pch.h index 77fa7297..2f15b07d 100644 --- a/win32/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut_pch.h +++ b/win32/tests/gballoc_hl_passthrough_ut/gballoc_hl_passthrough_ut_pch.h @@ -14,6 +14,8 @@ #include "umock_c/umock_c.h" #include "umock_c/umocktypes_stdint.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_ll.h" #include "umock_c/umock_c_DISABLE_MOCKS.h" // ============================== DISABLE_MOCKS @@ -22,4 +24,4 @@ #include "c_pal/gballoc_hl.h" -#endif // GBALLOC_HL_PASSTHROUGH_UT_PCH_H +#endif // GBALLOC_HL_PASSTHROUGH_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/gballoc_ll_jemalloc_int/gballoc_ll_jemalloc_int.c b/win32/tests/gballoc_ll_jemalloc_int/gballoc_ll_jemalloc_int.c index 008c6b18..f0f80846 100644 --- a/win32/tests/gballoc_ll_jemalloc_int/gballoc_ll_jemalloc_int.c +++ b/win32/tests/gballoc_ll_jemalloc_int/gballoc_ll_jemalloc_int.c @@ -12,6 +12,7 @@ #include "c_pal/gballoc_ll.h" #include "c_pal/threadapi.h" +#include "c_pal/timed_test_suite.h" #include "jemalloc/jemalloc.h" @@ -23,7 +24,7 @@ static int64_t default_muzzy_decay_ms; BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { // Configure jemalloc to have 4 arenas(hence total max limit for number of arenas = 5, 4 normal + 1 huge) je_malloc_conf = "narenas:4"; @@ -33,7 +34,7 @@ TEST_SUITE_INITIALIZE(TestClassInitialize) ASSERT_ARE_EQUAL(int, 0, je_mallctl("arenas.muzzy_decay_ms", &default_muzzy_decay_ms, &decay_size, NULL, 0)); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { } @@ -169,7 +170,7 @@ TEST_FUNCTION(gballoc_ll_free_works) unsigned char* ptr = gballoc_ll_malloc(1); ASSERT_IS_NOT_NULL(ptr); - ///act + ///act gballoc_ll_free(ptr); ///assert - doesn't crash @@ -182,7 +183,7 @@ TEST_FUNCTION(gballoc_ll_realloc_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc(ptr1, 2); ///assert - doesn't crash @@ -199,7 +200,7 @@ TEST_FUNCTION(gballoc_ll_realloc_2_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc_2(ptr1, 1, 2); ///assert - doesn't crash @@ -216,7 +217,7 @@ TEST_FUNCTION(gballoc_ll_realloc_flex_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc_flex(ptr1, 4, 20, 8); ///assert - doesn't crash @@ -232,7 +233,7 @@ TEST_FUNCTION(gballoc_ll_calloc_works) ///arrange unsigned char* ptr; - ///act + ///act ptr = gballoc_ll_calloc(1, 1); ///assert - doesn't crash @@ -491,7 +492,7 @@ static void gballoc_ll_set_option_decay_check_working_set_size(uint32_t num_allo result = get_working_set_size(&working_set_after); ASSERT_ARE_EQUAL(int, 0, result); LogInfo("Working set size after freeing allocations and decay: %zu bytes\n", working_set_after); - + if (is_percent_max) { // If the decay time is high, then the working set size after decay should also remain high @@ -649,4 +650,4 @@ TEST_FUNCTION(gballoc_ll_set_option_check_wss_with_muzzy_decay_minus_one) ASSERT_ARE_EQUAL(int, 0, gballoc_ll_set_option("muzzy_decay", &default_muzzy_decay_ms)); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut.c b/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut.c index 9733b70d..b5f9c0dc 100644 --- a/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut.c +++ b/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut.c @@ -49,7 +49,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { umock_c_init(on_umock_c_error); @@ -60,7 +60,7 @@ TEST_SUITE_INITIALIZE(TestClassInitialize) REGISTER_UMOCK_ALIAS_TYPE(JEMALLOC_WRITE_CB, void*) } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } @@ -971,7 +971,7 @@ TEST_FUNCTION(gballoc_ll_set_option_fails_for_dirty_decay_if_setting_dirty_decay (void)sprintf(fourth_command, "arena.1.dirty_decay_ms"); char* fifth_command; - setup_failure_expectations_when_setting_decay_for_second_arenas_fails(&first_command, &second_command, (char**)&third_command, (char**)&fourth_command, &fifth_command, &decay_milliseconds, &num_arenas); + setup_failure_expectations_when_setting_decay_for_second_arenas_fails(&first_command, &second_command, (char**)&third_command, (char**)&fourth_command, &fifth_command, &decay_milliseconds, &num_arenas); ///act int result = gballoc_ll_set_option("dirty_decay", &decay_milliseconds); @@ -1001,7 +1001,7 @@ TEST_FUNCTION(gballoc_ll_set_option_fails_for_muzzy_decay_if_setting_muzzy_decay (void)sprintf(fourth_command, "arena.1.muzzy_decay_ms"); char* fifth_command; - setup_failure_expectations_when_setting_decay_for_second_arenas_fails(&first_command, &second_command, (char**)&third_command, (char**)&fourth_command, &fifth_command, &decay_milliseconds, &num_arenas); + setup_failure_expectations_when_setting_decay_for_second_arenas_fails(&first_command, &second_command, (char**)&third_command, (char**)&fourth_command, &fifth_command, &decay_milliseconds, &num_arenas); ///act int result = gballoc_ll_set_option("muzzy_decay", &decay_milliseconds); diff --git a/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut_pch.h b/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut_pch.h index 2970d219..c48b0771 100644 --- a/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut_pch.h +++ b/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut_pch.h @@ -16,5 +16,6 @@ #include "umock_c/umock_c_negative_tests.h" #include "c_pal/gballoc_ll.h" +#include "c_pal/timed_test_suite.h" -#endif // GBALLOC_LL_JEMALLOC_UT_PCH_H +#endif // GBALLOC_LL_JEMALLOC_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/gballoc_ll_mimalloc_int/gballoc_ll_mimalloc_int.c b/win32/tests/gballoc_ll_mimalloc_int/gballoc_ll_mimalloc_int.c index 94143fb9..234f8f91 100644 --- a/win32/tests/gballoc_ll_mimalloc_int/gballoc_ll_mimalloc_int.c +++ b/win32/tests/gballoc_ll_mimalloc_int/gballoc_ll_mimalloc_int.c @@ -8,16 +8,17 @@ #include "testrunnerswitcher.h" #include "c_pal/gballoc_ll.h" +#include "c_pal/timed_test_suite.h" #include "mimalloc.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { } @@ -119,7 +120,7 @@ TEST_FUNCTION(gballoc_ll_free_works) unsigned char* ptr = gballoc_ll_malloc(1); ASSERT_IS_NOT_NULL(ptr); - ///act + ///act gballoc_ll_free(ptr); ///assert - doesn't crash @@ -132,7 +133,7 @@ TEST_FUNCTION(gballoc_ll_realloc_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc(ptr1, 2); ///assert - doesn't crash @@ -151,7 +152,7 @@ TEST_FUNCTION(gballoc_ll_realloc_2_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc_2(ptr1, 1024, 1024); ///assert - doesn't crash @@ -170,7 +171,7 @@ TEST_FUNCTION(gballoc_ll_realloc_flex_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc_flex(ptr1, 4, 20, 4); ///assert - doesn't crash @@ -187,7 +188,7 @@ TEST_FUNCTION(gballoc_ll_calloc_works) ///arrange unsigned char* ptr; - ///act + ///act ptr = gballoc_ll_calloc(1, 1); ///assert - doesn't crash @@ -219,4 +220,4 @@ TEST_FUNCTION(gballoc_ll_size_works) gballoc_ll_free(ptr); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/gballoc_ll_mimalloc_ut/gballoc_ll_mimalloc_ut.c b/win32/tests/gballoc_ll_mimalloc_ut/gballoc_ll_mimalloc_ut.c index 77facca9..ff36079c 100644 --- a/win32/tests/gballoc_ll_mimalloc_ut/gballoc_ll_mimalloc_ut.c +++ b/win32/tests/gballoc_ll_mimalloc_ut/gballoc_ll_mimalloc_ut.c @@ -30,7 +30,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { umock_c_init(on_umock_c_error); @@ -39,7 +39,7 @@ TEST_SUITE_INITIALIZE(TestClassInitialize) REGISTER_GLOBAL_MOCK_RETURN(mock_mi_realloc, TEST_REALLOC_RESULT); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } @@ -218,7 +218,7 @@ TEST_FUNCTION(gballoc_ll_malloc_flex_with_overflow_fails_2) TEST_FUNCTION(gballoc_ll_malloc_flex_with_SIZE_MAX_succeeds) { ///arrange - + STRICT_EXPECTED_CALL(mock_mi_malloc(SIZE_MAX)); ///act diff --git a/win32/tests/gballoc_ll_mimalloc_ut/gballoc_ll_mimalloc_ut_pch.h b/win32/tests/gballoc_ll_mimalloc_ut/gballoc_ll_mimalloc_ut_pch.h index 5a63f9e6..ead4d431 100644 --- a/win32/tests/gballoc_ll_mimalloc_ut/gballoc_ll_mimalloc_ut_pch.h +++ b/win32/tests/gballoc_ll_mimalloc_ut/gballoc_ll_mimalloc_ut_pch.h @@ -15,5 +15,6 @@ #include "umock_c/umock_c.h" #include "c_pal/gballoc_ll.h" +#include "c_pal/timed_test_suite.h" -#endif // GBALLOC_LL_MIMALLOC_UT_PCH_H +#endif // GBALLOC_LL_MIMALLOC_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/gballoc_ll_passthrough_int/gballoc_ll_passthrough_int.c b/win32/tests/gballoc_ll_passthrough_int/gballoc_ll_passthrough_int.c index fae13b74..3789d9f6 100644 --- a/win32/tests/gballoc_ll_passthrough_int/gballoc_ll_passthrough_int.c +++ b/win32/tests/gballoc_ll_passthrough_int/gballoc_ll_passthrough_int.c @@ -8,15 +8,16 @@ #include "testrunnerswitcher.h" #include "c_pal/gballoc_ll.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_ll_init(NULL)); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { gballoc_ll_deinit(); } @@ -153,7 +154,7 @@ TEST_FUNCTION(gballoc_ll_free_works) unsigned char* ptr = gballoc_ll_malloc(1); ASSERT_IS_NOT_NULL(ptr); - ///act + ///act gballoc_ll_free(ptr); ///assert - doesn't crash @@ -166,7 +167,7 @@ TEST_FUNCTION(gballoc_ll_realloc_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc(ptr1, 2); ///assert - doesn't crash @@ -183,7 +184,7 @@ TEST_FUNCTION(gballoc_ll_realloc_2_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc_2(ptr1, 1, 2); ///assert - doesn't crash @@ -200,7 +201,7 @@ TEST_FUNCTION(gballoc_ll_realloc_flex_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc_flex(ptr1, 4, 20, 8); ///assert - doesn't crash @@ -216,7 +217,7 @@ TEST_FUNCTION(gballoc_ll_calloc_works) ///arrange unsigned char* ptr; - ///act + ///act ptr = gballoc_ll_calloc(1, 1); ///assert - doesn't crash @@ -256,4 +257,4 @@ TEST_FUNCTION(gballoc_ll_print_stats_can_be_called_but_does_nothing) ///assert } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut.c b/win32/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut.c index e89945bb..bbf055c5 100644 --- a/win32/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut.c +++ b/win32/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut.c @@ -33,7 +33,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { umock_c_init(on_umock_c_error); @@ -42,7 +42,7 @@ TEST_SUITE_INITIALIZE(TestClassInitialize) REGISTER_GLOBAL_MOCK_RETURN(mock_calloc, TEST_CALLOC_RESULT); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } @@ -61,7 +61,7 @@ TEST_FUNCTION(gballoc_ll_init_returns_0) { ///arrange int result; - + ///act result = gballoc_ll_init(NULL); @@ -108,7 +108,7 @@ TEST_FUNCTION(gballoc_ll_malloc_returns_what_malloc_returns_1) { ///arrange void* ptr; - + STRICT_EXPECTED_CALL(mock_malloc(1)); ///act @@ -252,7 +252,7 @@ TEST_FUNCTION(gballoc_ll_malloc_flex_with_SIZE_MAX_succeeds) void* ptr; STRICT_EXPECTED_CALL(mock_malloc(SIZE_MAX)); - + ///act ptr = gballoc_ll_malloc_flex(1, 2, (SIZE_MAX - 3) / 2 + 1); /*no longer overflow, just SIZE_MAX*/ diff --git a/win32/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut_pch.h b/win32/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut_pch.h index 10df459d..14ceba03 100644 --- a/win32/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut_pch.h +++ b/win32/tests/gballoc_ll_passthrough_ut/gballoc_ll_passthrough_ut_pch.h @@ -10,5 +10,6 @@ #include "macro_utils/macro_utils.h" #include "testrunnerswitcher.h" +#include "c_pal/timed_test_suite.h" -#endif // GBALLOC_LL_PASSTHROUGH_UT_PCH_H +#endif // GBALLOC_LL_PASSTHROUGH_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/gballoc_ll_win32heap_int/gballoc_ll_win32heap_int.c b/win32/tests/gballoc_ll_win32heap_int/gballoc_ll_win32heap_int.c index 596a46d8..93f928df 100644 --- a/win32/tests/gballoc_ll_win32heap_int/gballoc_ll_win32heap_int.c +++ b/win32/tests/gballoc_ll_win32heap_int/gballoc_ll_win32heap_int.c @@ -8,15 +8,16 @@ #include "testrunnerswitcher.h" #include "c_pal/gballoc_ll.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_ll_init(NULL)); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { gballoc_ll_deinit(); } @@ -42,7 +43,7 @@ TEST_FUNCTION(gballoc_ll_init_works) TEST_FUNCTION(gballoc_ll_deinit_works) { - ///arrange + ///arrange ///act gballoc_ll_deinit(); @@ -161,7 +162,7 @@ TEST_FUNCTION(gballoc_ll_free_works) unsigned char* ptr = gballoc_ll_malloc(1); ASSERT_IS_NOT_NULL(ptr); - ///act + ///act gballoc_ll_free(ptr); ///assert - doesn't crash @@ -174,7 +175,7 @@ TEST_FUNCTION(gballoc_ll_realloc_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc(ptr1, 2); ///assert - doesn't crash @@ -191,7 +192,7 @@ TEST_FUNCTION(gballoc_ll_realloc_2_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc_2(ptr1, 2, 1); ///assert - doesn't crash @@ -208,7 +209,7 @@ TEST_FUNCTION(gballoc_ll_realloc_flex_works) ASSERT_IS_NOT_NULL(ptr1); unsigned char* ptr2; - ///act + ///act ptr2 = gballoc_ll_realloc_flex(ptr1, 4, 13, 45); ///assert - doesn't crash @@ -223,7 +224,7 @@ TEST_FUNCTION(gballoc_ll_calloc_works) ///arrange unsigned char* ptr; - ///act + ///act ptr = gballoc_ll_calloc(1, 1); ///assert - doesn't crash @@ -263,4 +264,4 @@ TEST_FUNCTION(gballoc_ll_print_stats_can_be_called_but_does_nothing) ///assert } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/gballoc_ll_win32heap_ut/gballoc_ll_win32heap_ut.c b/win32/tests/gballoc_ll_win32heap_ut/gballoc_ll_win32heap_ut.c index 8edfeffe..29f2eac3 100644 --- a/win32/tests/gballoc_ll_win32heap_ut/gballoc_ll_win32heap_ut.c +++ b/win32/tests/gballoc_ll_win32heap_ut/gballoc_ll_win32heap_ut.c @@ -61,7 +61,7 @@ static void TEST_gballoc_ll_init(void) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { umock_c_init(on_umock_c_error); @@ -81,7 +81,7 @@ TEST_SUITE_INITIALIZE(TestClassInitialize) } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); } @@ -103,7 +103,7 @@ TEST_FUNCTION(gballoc_ll_init_succeeds) { ///arrange LAZY_INIT_FUNCTION do_init; - + STRICT_EXPECTED_CALL(lazy_init(IGNORED_ARG, IGNORED_ARG, IGNORED_ARG)) .CaptureArgumentValue_do_init(&do_init); diff --git a/win32/tests/gballoc_ll_win32heap_ut/gballoc_ll_win32heap_ut_pch.h b/win32/tests/gballoc_ll_win32heap_ut/gballoc_ll_win32heap_ut_pch.h index 4b19b365..33edf706 100644 --- a/win32/tests/gballoc_ll_win32heap_ut/gballoc_ll_win32heap_ut_pch.h +++ b/win32/tests/gballoc_ll_win32heap_ut/gballoc_ll_win32heap_ut_pch.h @@ -16,6 +16,8 @@ #include "umock_c/umock_c.h" #include "umock_c/umocktypes_windows.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/lazy_init.h" #include "umock_c/umock_c_DISABLE_MOCKS.h" // ============================== DISABLE_MOCKS @@ -24,4 +26,4 @@ #include "c_pal/gballoc_ll.h" -#endif // GBALLOC_LL_WIN32HEAP_UT_PCH_H +#endif // GBALLOC_LL_WIN32HEAP_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/job_object_helper_int/job_object_helper_create_int.c b/win32/tests/job_object_helper_int/job_object_helper_create_int.c index 396107fb..44c506da 100644 --- a/win32/tests/job_object_helper_int/job_object_helper_create_int.c +++ b/win32/tests/job_object_helper_int/job_object_helper_create_int.c @@ -14,6 +14,7 @@ #include "c_pal/gballoc_hl_redirect.h" #include "c_pal/job_object_helper.h" #include "c_pal/uuid.h" +#include "c_pal/timed_test_suite.h" #define MEGABYTE ((size_t)1024 * 1024) @@ -21,11 +22,11 @@ BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -116,4 +117,4 @@ TEST_FUNCTION(test_job_object_helper_set_job_limits_to_current_process) THANDLE_ASSIGN(JOB_OBJECT_HELPER)(&result_1, NULL); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/job_object_helper_int/job_object_helper_memory_int.c b/win32/tests/job_object_helper_int/job_object_helper_memory_int.c index 60ca467d..67c359e8 100644 --- a/win32/tests/job_object_helper_int/job_object_helper_memory_int.c +++ b/win32/tests/job_object_helper_int/job_object_helper_memory_int.c @@ -14,6 +14,7 @@ #include "c_pal/gballoc_hl_redirect.h" #include "c_pal/job_object_helper.h" #include "c_pal/uuid.h" +#include "c_pal/timed_test_suite.h" #define MEGABYTE ((size_t)1024 * 1024) @@ -22,11 +23,11 @@ BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -90,4 +91,4 @@ TEST_FUNCTION(test_job_object_helper_set_job_limits_to_current_process_check_mem THANDLE_ASSIGN(JOB_OBJECT_HELPER)(&job_object_helper, NULL); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/job_object_helper_int/job_object_helper_multi_process_int.c b/win32/tests/job_object_helper_int/job_object_helper_multi_process_int.c index 71c8b15e..09d3d6bc 100644 --- a/win32/tests/job_object_helper_int/job_object_helper_multi_process_int.c +++ b/win32/tests/job_object_helper_int/job_object_helper_multi_process_int.c @@ -14,6 +14,7 @@ #include "c_pal/gballoc_hl_redirect.h" #include "c_pal/job_object_helper.h" #include "c_pal/uuid.h" +#include "c_pal/timed_test_suite.h" #define MEGABYTE ((size_t)1024 * 1024) @@ -51,11 +52,11 @@ static void get_job_object_helper_tester_excutable_path(char* full_path, size_t BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -253,4 +254,4 @@ TEST_FUNCTION(test_job_object_helper_set_job_limits_to_current_process_from_mult ASSERT_ARE_NOT_EQUAL(int, NUM_TEST_PROCESSES, allocation_failed_process_count, "Not all processes should have failed to allocate memory"); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/job_object_helper_int/job_object_helper_negative_int.c b/win32/tests/job_object_helper_int/job_object_helper_negative_int.c index ee34db9c..77ef9d95 100644 --- a/win32/tests/job_object_helper_int/job_object_helper_negative_int.c +++ b/win32/tests/job_object_helper_int/job_object_helper_negative_int.c @@ -14,6 +14,7 @@ #include "c_pal/gballoc_hl_redirect.h" #include "c_pal/job_object_helper.h" #include "c_pal/uuid.h" +#include "c_pal/timed_test_suite.h" #define MAX_CPU_PERCENT 100 @@ -22,11 +23,11 @@ BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -78,4 +79,4 @@ TEST_FUNCTION(job_object_helper_set_job_limits_to_current_process_with_100_perce ASSERT_IS_NULL(job_object, "No job object should have been created for 100%% CPU and 100%% memory"); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/job_object_helper_int/job_object_helper_singleton_int.c b/win32/tests/job_object_helper_int/job_object_helper_singleton_int.c index dd5f0938..a8853728 100644 --- a/win32/tests/job_object_helper_int/job_object_helper_singleton_int.c +++ b/win32/tests/job_object_helper_int/job_object_helper_singleton_int.c @@ -14,6 +14,7 @@ #include "c_pal/gballoc_hl_redirect.h" #include "c_pal/job_object_helper.h" #include "c_pal/timer.h" +#include "c_pal/timed_test_suite.h" #define MAX_REPEATED_CALLS 10 @@ -109,11 +110,11 @@ static double measure_cpu_percent_under_saturation(DWORD burn_duration_ms) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -188,4 +189,4 @@ TEST_FUNCTION(test_job_object_helper_repeated_calls_return_same_singleton_and_no } } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/job_object_helper_ut/job_object_helper_ut.c b/win32/tests/job_object_helper_ut/job_object_helper_ut.c index 70a886c9..ea8daa91 100644 --- a/win32/tests/job_object_helper_ut/job_object_helper_ut.c +++ b/win32/tests/job_object_helper_ut/job_object_helper_ut.c @@ -109,7 +109,7 @@ static void setup_job_object_helper_set_job_limits_to_current_process_expectatio BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL), "real_gballoc_hl_init failed"); ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init failed"); @@ -125,7 +125,7 @@ TEST_SUITE_INITIALIZE(suite_init) } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_negative_tests_deinit(); umock_c_deinit(); diff --git a/win32/tests/job_object_helper_ut/job_object_helper_ut_pch.h b/win32/tests/job_object_helper_ut/job_object_helper_ut_pch.h index 5268a9eb..a1d0d353 100644 --- a/win32/tests/job_object_helper_ut/job_object_helper_ut_pch.h +++ b/win32/tests/job_object_helper_ut/job_object_helper_ut_pch.h @@ -21,6 +21,8 @@ #include "c_pal/interlocked.h" #include "c_pal/interlocked_hl.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" @@ -30,4 +32,4 @@ #include "real_gballoc_hl.h" #include "c_pal/job_object_helper.h" -#endif // JOB_OBJECT_HELPER_UT_PCH_H +#endif // JOB_OBJECT_HELPER_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/malloc_multi_flex_int/malloc_multi_flex_int.c b/win32/tests/malloc_multi_flex_int/malloc_multi_flex_int.c index 660e4498..cbb6107c 100644 --- a/win32/tests/malloc_multi_flex_int/malloc_multi_flex_int.c +++ b/win32/tests/malloc_multi_flex_int/malloc_multi_flex_int.c @@ -10,14 +10,15 @@ #include "c_pal/gballoc_hl_redirect.h" #include "c_pal/malloc_multi_flex.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(TestClassInitialize) +TIMED_TEST_SUITE_INITIALIZE(TestClassInitialize, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { } @@ -186,4 +187,4 @@ TEST_FUNCTION(test_malloc_multi_flex_allocates_memory_and_assigns_address_ptr_fo free(test_struct_handle); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/malloc_multi_flex_ut/malloc_multi_flex_ut.c b/win32/tests/malloc_multi_flex_ut/malloc_multi_flex_ut.c index 22523ba9..1427aedd 100644 --- a/win32/tests/malloc_multi_flex_ut/malloc_multi_flex_ut.c +++ b/win32/tests/malloc_multi_flex_ut/malloc_multi_flex_ut.c @@ -14,7 +14,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init failed"); @@ -24,7 +24,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_FAIL_RETURN(malloc, NULL); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); real_gballoc_hl_deinit(); diff --git a/win32/tests/malloc_multi_flex_ut/malloc_multi_flex_ut_pch.h b/win32/tests/malloc_multi_flex_ut/malloc_multi_flex_ut_pch.h index 5876de9f..156aad45 100644 --- a/win32/tests/malloc_multi_flex_ut/malloc_multi_flex_ut_pch.h +++ b/win32/tests/malloc_multi_flex_ut/malloc_multi_flex_ut_pch.h @@ -19,6 +19,8 @@ #include "umock_c/umocktypes_charptr.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" @@ -29,4 +31,4 @@ #include "test_module.h" -#endif // MALLOC_MULTI_FLEX_UT_PCH_H +#endif // MALLOC_MULTI_FLEX_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/pipe_win32_ut/pipe_win32_ut.c b/win32/tests/pipe_win32_ut/pipe_win32_ut.c index 8b66cf55..c8ac518f 100644 --- a/win32/tests/pipe_win32_ut/pipe_win32_ut.c +++ b/win32/tests/pipe_win32_ut/pipe_win32_ut.c @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "pipe_win32_ut_pch.h" @@ -14,7 +14,7 @@ static FILE* test_file_handle = (FILE*)0x1001; BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -22,7 +22,7 @@ TEST_SUITE_INITIALIZE(suite_init) ASSERT_ARE_EQUAL(int, 0, umocktypes_charptr_register_types()); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); diff --git a/win32/tests/pipe_win32_ut/pipe_win32_ut_pch.h b/win32/tests/pipe_win32_ut/pipe_win32_ut_pch.h index 579be249..fdb81bbd 100644 --- a/win32/tests/pipe_win32_ut/pipe_win32_ut_pch.h +++ b/win32/tests/pipe_win32_ut/pipe_win32_ut_pch.h @@ -18,6 +18,8 @@ #include "umock_c/umock_c.h" #include "umock_c/umocktypes_charptr.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "mock_pipe.h" #include "umock_c/umock_c_DISABLE_MOCKS.h" // ============================== DISABLE_MOCKS @@ -26,4 +28,4 @@ #include "c_pal/pipe.h" -#endif // PIPE_WIN32_UT_PCH_H +#endif // PIPE_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/platform_win32_ut/platform_win32_ut.c b/win32/tests/platform_win32_ut/platform_win32_ut.c index ae239025..8319030b 100644 --- a/win32/tests/platform_win32_ut/platform_win32_ut.c +++ b/win32/tests/platform_win32_ut/platform_win32_ut.c @@ -22,7 +22,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { int result; @@ -37,7 +37,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_UMOCK_ALIAS_TYPE(LPWSADATA, void*); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/win32/tests/platform_win32_ut/platform_win32_ut_pch.h b/win32/tests/platform_win32_ut/platform_win32_ut_pch.h index fccca1d4..0b095f94 100644 --- a/win32/tests/platform_win32_ut/platform_win32_ut_pch.h +++ b/win32/tests/platform_win32_ut/platform_win32_ut_pch.h @@ -18,5 +18,6 @@ #include "macro_utils/macro_utils.h" #include "c_pal/platform.h" +#include "c_pal/timed_test_suite.h" -#endif // PLATFORM_WIN32_UT_PCH_H +#endif // PLATFORM_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/process_watchdog_int/process_watchdog_int.c b/win32/tests/process_watchdog_int/process_watchdog_int.c index fd3366a2..ee360d0f 100644 --- a/win32/tests/process_watchdog_int/process_watchdog_int.c +++ b/win32/tests/process_watchdog_int/process_watchdog_int.c @@ -15,6 +15,7 @@ #include "c_logging/logger.h" #include "c_pal/timer.h" +#include "c_pal/timed_test_suite.h" // Shared exit codes between parent and child #include "process_watchdog_int_common.h" @@ -123,11 +124,11 @@ static void get_child_exe_path(char* buffer, size_t buffer_size) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { } @@ -208,4 +209,4 @@ TEST_FUNCTION(process_watchdog_does_not_terminate_before_timeout) "Child process did not complete successfully, exit_code=%d", exit_code); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/process_watchdog_win32_ut/process_watchdog_win32_ut.c b/win32/tests/process_watchdog_win32_ut/process_watchdog_win32_ut.c index 7fda80bb..f8ce97a1 100644 --- a/win32/tests/process_watchdog_win32_ut/process_watchdog_win32_ut.c +++ b/win32/tests/process_watchdog_win32_ut/process_watchdog_win32_ut.c @@ -23,7 +23,7 @@ static PTP_TIMER hook_CreateThreadpoolTimer(PTP_TIMER_CALLBACK pfnti, PVOID pv, BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types()); @@ -41,7 +41,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_HOOK(mocked_CreateThreadpoolTimer, hook_CreateThreadpoolTimer); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/win32/tests/process_watchdog_win32_ut/process_watchdog_win32_ut_pch.h b/win32/tests/process_watchdog_win32_ut/process_watchdog_win32_ut_pch.h index e17fec25..21d5b961 100644 --- a/win32/tests/process_watchdog_win32_ut/process_watchdog_win32_ut_pch.h +++ b/win32/tests/process_watchdog_win32_ut/process_watchdog_win32_ut_pch.h @@ -17,6 +17,8 @@ #include "umock_c/umocktypes_stdint.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/interlocked.h" @@ -30,4 +32,4 @@ #include "c_pal/process_watchdog.h" -#endif // PROCESS_WATCHDOG_WIN32_UT_PCH_H +#endif // PROCESS_WATCHDOG_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/reals_win32_ut/reals_win32_ut_pch.h b/win32/tests/reals_win32_ut/reals_win32_ut_pch.h index d0a9a748..5601b751 100644 --- a/win32/tests/reals_win32_ut/reals_win32_ut_pch.h +++ b/win32/tests/reals_win32_ut/reals_win32_ut_pch.h @@ -26,6 +26,7 @@ #include "c_pal/socket_transport.h" #include "c_pal/async_socket.h" #include "c_pal/job_object_helper.h" +#include "c_pal/timed_test_suite.h" #include "macro_utils/macro_utils.h" @@ -55,4 +56,4 @@ #include "real_async_socket.h" #include "real_job_object_helper.h" -#endif // REALS_WIN32_UT_PCH_H +#endif // REALS_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/single_performance_counter_win32_ut/single_performance_counter_win32_ut.c b/win32/tests/single_performance_counter_win32_ut/single_performance_counter_win32_ut.c index 21fc0e26..e9c474a9 100644 --- a/win32/tests/single_performance_counter_win32_ut/single_performance_counter_win32_ut.c +++ b/win32/tests/single_performance_counter_win32_ut/single_performance_counter_win32_ut.c @@ -126,7 +126,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -167,7 +167,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_HOOK(mocked_PdhGetFormattedCounterValue, hook_mocked_PdhGetFormattedCounterValue); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); real_gballoc_hl_deinit(); @@ -285,7 +285,7 @@ TEST_FUNCTION(single_performance_counter_create_module_name_too_large) { // arrange char new_mocked_name[MAX_PATH + 2]; - memset(new_mocked_name, 'a', MAX_PATH + 2); + memset(new_mocked_name, 'a', MAX_PATH + 2); new_mocked_name[0] = '\\'; // slash to make it a full path new_mocked_name[MAX_PATH + 1] = '\0'; // null terminate mocked_mocked_GetModuleFileNameA_filename = new_mocked_name; diff --git a/win32/tests/single_performance_counter_win32_ut/single_performance_counter_win32_ut_pch.h b/win32/tests/single_performance_counter_win32_ut/single_performance_counter_win32_ut_pch.h index 08ecf0ae..c20b3a42 100644 --- a/win32/tests/single_performance_counter_win32_ut/single_performance_counter_win32_ut_pch.h +++ b/win32/tests/single_performance_counter_win32_ut/single_performance_counter_win32_ut_pch.h @@ -23,6 +23,8 @@ #include "umock_c/umocktypes_struct.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" @@ -46,4 +48,4 @@ #include "c_pal/single_performance_counter.h" -#endif // SINGLE_PERFORMANCE_COUNTER_WIN32_UT_PCH_H +#endif // SINGLE_PERFORMANCE_COUNTER_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/socket_transport_win32_ut/socket_transport_win32_ut.c b/win32/tests/socket_transport_win32_ut/socket_transport_win32_ut.c index 56fb04f8..d104f4c4 100644 --- a/win32/tests/socket_transport_win32_ut/socket_transport_win32_ut.c +++ b/win32/tests/socket_transport_win32_ut/socket_transport_win32_ut.c @@ -94,7 +94,7 @@ static int my_gethostname(char* name, int namelen) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init failed"); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types(), "umocktypes_stdint_register_types failed"); @@ -158,7 +158,7 @@ TEST_SUITE_INITIALIZE(suite_init) g_addrInfo.ai_canonname = "ai_canonname"; } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); umock_c_negative_tests_deinit(); diff --git a/win32/tests/socket_transport_win32_ut/socket_transport_win32_ut_pch.h b/win32/tests/socket_transport_win32_ut/socket_transport_win32_ut_pch.h index 77cf1994..92db21a5 100644 --- a/win32/tests/socket_transport_win32_ut/socket_transport_win32_ut_pch.h +++ b/win32/tests/socket_transport_win32_ut/socket_transport_win32_ut_pch.h @@ -22,6 +22,8 @@ #include "umock_c/umock_c_negative_tests.h" #include "umock_c/umocktypes_windows.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "winsock_mocked.h" @@ -40,4 +42,4 @@ #include "c_pal/socket_transport.h" -#endif // SOCKET_TRANSPORT_WIN32_UT_PCH_H +#endif // SOCKET_TRANSPORT_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/srw_lock_ll_win32_ut/srw_lock_ll_win32_ut.c b/win32/tests/srw_lock_ll_win32_ut/srw_lock_ll_win32_ut.c index b8296014..fe50a7d1 100644 --- a/win32/tests/srw_lock_ll_win32_ut/srw_lock_ll_win32_ut.c +++ b/win32/tests/srw_lock_ll_win32_ut/srw_lock_ll_win32_ut.c @@ -32,7 +32,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init"); ASSERT_ARE_EQUAL(int, 0, umocktypes_windows_register_types(), "umocktypes_windows_register_types"); @@ -41,10 +41,10 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_RETURNS(mocked_TryAcquireSRWLockShared, TRUE, FALSE); REGISTER_UMOCK_ALIAS_TYPE(PSRWLOCK, void*); - + } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/win32/tests/srw_lock_ll_win32_ut/srw_lock_ll_win32_ut_pch.h b/win32/tests/srw_lock_ll_win32_ut/srw_lock_ll_win32_ut_pch.h index 3f364dc9..cfa5052f 100644 --- a/win32/tests/srw_lock_ll_win32_ut/srw_lock_ll_win32_ut_pch.h +++ b/win32/tests/srw_lock_ll_win32_ut/srw_lock_ll_win32_ut_pch.h @@ -19,5 +19,6 @@ #include "umock_c/umocktypes_windows.h" #include "c_pal/srw_lock_ll.h" +#include "c_pal/timed_test_suite.h" -#endif // SRW_LOCK_LL_WIN32_UT_PCH_H +#endif // SRW_LOCK_LL_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/srw_lock_win32_ut/srw_lock_win32_ut.c b/win32/tests/srw_lock_win32_ut/srw_lock_win32_ut.c index 7e73d651..180cff0e 100644 --- a/win32/tests/srw_lock_win32_ut/srw_lock_win32_ut.c +++ b/win32/tests/srw_lock_win32_ut/srw_lock_win32_ut.c @@ -84,7 +84,7 @@ static void TEST_srw_lock_acquire_exclusive(SRW_LOCK_HANDLE handle, double prete BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -103,7 +103,7 @@ TEST_SUITE_INITIALIZE(suite_init) } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); diff --git a/win32/tests/srw_lock_win32_ut/srw_lock_win32_ut_pch.h b/win32/tests/srw_lock_win32_ut/srw_lock_win32_ut_pch.h index 750f79b5..ddbda7ec 100644 --- a/win32/tests/srw_lock_win32_ut/srw_lock_win32_ut_pch.h +++ b/win32/tests/srw_lock_win32_ut/srw_lock_win32_ut_pch.h @@ -17,6 +17,8 @@ #include "umock_c/umocktypes.h" #include "umock_c/umocktypes_windows.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" @@ -27,4 +29,4 @@ #include "real_gballoc_hl.h" #include "c_pal/srw_lock.h" -#endif // SRW_LOCK_WIN32_UT_PCH_H +#endif // SRW_LOCK_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/string_utils_int/string_utils_int.c b/win32/tests/string_utils_int/string_utils_int.c index 7a3618b3..26dabbf5 100644 --- a/win32/tests/string_utils_int/string_utils_int.c +++ b/win32/tests/string_utils_int/string_utils_int.c @@ -13,16 +13,17 @@ #include "c_pal/gballoc_hl_redirect.h" #include "c_pal/string_utils.h" +#include "c_pal/timed_test_suite.h" BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL)); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { gballoc_hl_deinit(); } @@ -341,7 +342,7 @@ TEST_FUNCTION(vsprintf_char_fails_with_invalid_sequence_characters) char* result; /*original string is */ - wchar_t s[] = { + wchar_t s[] = { 0x54+ (0x00<<8), /*T*/ 0x65+ (0x00<<8), /*e*/ 0x73+ (0x00<<8), /*s*/ @@ -365,4 +366,4 @@ TEST_FUNCTION(vsprintf_char_fails_with_invalid_sequence_characters) setlocale(LC_CTYPE, t); } -END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) +END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) \ No newline at end of file diff --git a/win32/tests/string_utils_win32_ut/string_utils_win32_ut.c b/win32/tests/string_utils_win32_ut/string_utils_win32_ut.c index 128efb5b..9f4de724 100644 --- a/win32/tests/string_utils_win32_ut/string_utils_win32_ut.c +++ b/win32/tests/string_utils_win32_ut/string_utils_win32_ut.c @@ -49,7 +49,7 @@ static int hook_vsnprintf(char* buffer, size_t buffer_size, const char* format, BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -62,7 +62,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GLOBAL_MOCK_FAIL_RETURN(malloc, NULL); REGISTER_GLOBAL_MOCK_HOOK(mocked_FileTimeToSystemTime, hook_FileTimeToSystemTime); - + REGISTER_GLOBAL_MOCK_HOOK(mocked_vsnprintf, hook_vsnprintf); REGISTER_GLOBAL_MOCK_FAIL_RETURN(mocked_vsnprintf, -1); @@ -71,7 +71,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_UMOCK_ALIAS_TYPE(va_list, void*); } -TEST_SUITE_CLEANUP(TestClassCleanup) +TIMED_TEST_SUITE_CLEANUP(TestClassCleanup) { umock_c_deinit(); @@ -113,7 +113,7 @@ TEST_FUNCTION(FILETIME_to_string_UTC_with_123_milliseconds_succeeds) { ///arrange char* result; - FILETIME mock = { .dwLowDateTime = 1, .dwHighDateTime = 1 }; + FILETIME mock = { .dwLowDateTime = 1, .dwHighDateTime = 1 }; STRICT_EXPECTED_CALL(mocked_FileTimeToSystemTime(&mock, IGNORED_ARG)); STRICT_EXPECTED_CALL(mocked_vsnprintf(NULL, 0, IGNORED_ARG, IGNORED_ARG)); /*this is sprintf_char*/ diff --git a/win32/tests/string_utils_win32_ut/string_utils_win32_ut_pch.h b/win32/tests/string_utils_win32_ut/string_utils_win32_ut_pch.h index 5abadc2d..94aa63f7 100644 --- a/win32/tests/string_utils_win32_ut/string_utils_win32_ut_pch.h +++ b/win32/tests/string_utils_win32_ut/string_utils_win32_ut_pch.h @@ -22,6 +22,8 @@ #include "umock_c/umocktypes_bool.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" @@ -34,4 +36,4 @@ #include "c_pal/string_utils.h" -#endif // STRING_UTILS_WIN32_UT_PCH_H +#endif // STRING_UTILS_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/sysinfo_win32_ut/sysinfo_win32_ut.c b/win32/tests/sysinfo_win32_ut/sysinfo_win32_ut.c index 53fabae7..332b43d5 100644 --- a/win32/tests/sysinfo_win32_ut/sysinfo_win32_ut.c +++ b/win32/tests/sysinfo_win32_ut/sysinfo_win32_ut.c @@ -21,7 +21,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error), "umock_c_init failed"); ASSERT_ARE_EQUAL(int, 0, umocktypes_stdint_register_types(), "umocktypes_stdint_register_types failed"); @@ -30,7 +30,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_UMOCK_ALIAS_TYPE(DWORD, uint32_t); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); umock_c_negative_tests_deinit(); diff --git a/win32/tests/sysinfo_win32_ut/sysinfo_win32_ut_pch.h b/win32/tests/sysinfo_win32_ut/sysinfo_win32_ut_pch.h index f9375b0d..ccc293f3 100644 --- a/win32/tests/sysinfo_win32_ut/sysinfo_win32_ut_pch.h +++ b/win32/tests/sysinfo_win32_ut/sysinfo_win32_ut_pch.h @@ -18,5 +18,6 @@ #include "umock_c/umock_c_negative_tests.h" #include "c_pal/sysinfo.h" +#include "c_pal/timed_test_suite.h" -#endif // SYSINFO_WIN32_UT_PCH_H +#endif // SYSINFO_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/threadpool_win32_ut/threadpool_win32_ut.c b/win32/tests/threadpool_win32_ut/threadpool_win32_ut.c index f2766a02..5f490fce 100644 --- a/win32/tests/threadpool_win32_ut/threadpool_win32_ut.c +++ b/win32/tests/threadpool_win32_ut/threadpool_win32_ut.c @@ -214,7 +214,7 @@ static THANDLE(THREADPOOL_TIMER) test_create_threadpool_and_start_timer(uint32_t BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL)); @@ -236,7 +236,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_UMOCK_ALIAS_TYPE(PTP_TIMER_CALLBACK, void*); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); diff --git a/win32/tests/threadpool_win32_ut/threadpool_win32_ut_pch.h b/win32/tests/threadpool_win32_ut/threadpool_win32_ut_pch.h index 139ae83b..9890e30b 100644 --- a/win32/tests/threadpool_win32_ut/threadpool_win32_ut_pch.h +++ b/win32/tests/threadpool_win32_ut/threadpool_win32_ut_pch.h @@ -20,6 +20,8 @@ #include "umock_c/umocktypes_windows.h" #include "umock_c/umock_c_negative_tests.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" @@ -40,4 +42,4 @@ #include "c_pal/string_utils.h" #include "c_pal/threadpool.h" -#endif // THREADPOOL_WIN32_UT_PCH_H +#endif // THREADPOOL_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/timer_win32_ut/timer_win32_ut.c b/win32/tests/timer_win32_ut/timer_win32_ut.c index c816a486..24e54854 100644 --- a/win32/tests/timer_win32_ut/timer_win32_ut.c +++ b/win32/tests/timer_win32_ut/timer_win32_ut.c @@ -21,7 +21,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { int result; @@ -42,7 +42,7 @@ TEST_SUITE_INITIALIZE(suite_init) REGISTER_GBALLOC_HL_GLOBAL_MOCK_HOOK(); } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); umock_c_negative_tests_deinit(); diff --git a/win32/tests/timer_win32_ut/timer_win32_ut_pch.h b/win32/tests/timer_win32_ut/timer_win32_ut_pch.h index c115514e..f65d1e81 100644 --- a/win32/tests/timer_win32_ut/timer_win32_ut_pch.h +++ b/win32/tests/timer_win32_ut/timer_win32_ut_pch.h @@ -18,6 +18,8 @@ #include "umock_c/umock_c_negative_tests.h" #include "umock_c/umocktypes_bool.h" +#include "c_pal/timed_test_suite.h" + #include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" @@ -28,4 +30,4 @@ #include "c_pal/timer.h" -#endif // TIMER_WIN32_UT_PCH_H +#endif // TIMER_WIN32_UT_PCH_H \ No newline at end of file diff --git a/win32/tests/uuid_win32_ut/uuid_win32_ut.c b/win32/tests/uuid_win32_ut/uuid_win32_ut.c index 952ed983..54f412f7 100644 --- a/win32/tests/uuid_win32_ut/uuid_win32_ut.c +++ b/win32/tests/uuid_win32_ut/uuid_win32_ut.c @@ -35,7 +35,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code) BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE) -TEST_SUITE_INITIALIZE(suite_init) +TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS) { ASSERT_ARE_EQUAL(int, 0, umock_c_init(on_umock_c_error)); @@ -46,7 +46,7 @@ TEST_SUITE_INITIALIZE(suite_init) g_hook_UuidCreate_return = RPC_S_OK; } -TEST_SUITE_CLEANUP(suite_cleanup) +TIMED_TEST_SUITE_CLEANUP(suite_cleanup) { umock_c_deinit(); } diff --git a/win32/tests/uuid_win32_ut/uuid_win32_ut_pch.h b/win32/tests/uuid_win32_ut/uuid_win32_ut_pch.h index 27480e22..8f8342a3 100644 --- a/win32/tests/uuid_win32_ut/uuid_win32_ut_pch.h +++ b/win32/tests/uuid_win32_ut/uuid_win32_ut_pch.h @@ -19,6 +19,7 @@ #include "umock_c/umock_c_negative_tests.h" #include "c_pal/uuid.h" +#include "c_pal/timed_test_suite.h" #define TEST_DATA_1 0x12233445 #define TEST_DATA_2 0x5667 @@ -32,4 +33,4 @@ #define TEST_DATA_4_6 0xF0 #define TEST_DATA_4_7 0x01 -#endif // UUID_WIN32_UT_PCH_H +#endif // UUID_WIN32_UT_PCH_H \ No newline at end of file