Skip to content

Commit 4e0b5f9

Browse files
parth21999Copilot
andcommitted
Convert all tests to use TIMED_TEST_SUITE_INITIALIZE/CLEANUP
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 886a915 commit 4e0b5f9

114 files changed

Lines changed: 318 additions & 210 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

samples/async_op_samples_int/async_op_samples_int.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "c_pal/sync.h"
1717
#include "c_pal/thandle.h"
1818
#include "c_pal/threadapi.h"
19+
#include "c_pal/timed_test_suite.h"
1920

2021
#include "c_util/async_op.h"
2122

@@ -366,12 +367,12 @@ static void test_ASYNC_OP_MODULE_CALLBACK(void* context, COMMON_ASYNC_OP_MODULE_
366367

367368
BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE)
368369

369-
TEST_SUITE_INITIALIZE(TestClassInit)
370+
TIMED_TEST_SUITE_INITIALIZE(TestClassInit, TIMED_TEST_DEFAULT_TIMEOUT_MS)
370371
{
371372
ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL));
372373
}
373374

374-
TEST_SUITE_CLEANUP(TestClassCleanup)
375+
TIMED_TEST_SUITE_CLEANUP(TestClassCleanup)
375376
{
376377
gballoc_hl_deinit();
377378
}
@@ -1444,4 +1445,4 @@ TEST_FUNCTION(all_modules_can_be_canceled_successfully_with_real_cancel_after_ma
14441445
}
14451446
}
14461447

1447-
END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE)
1448+
END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE)

tests/async_op_int/async_op_int.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "c_pal/gballoc_hl_redirect.h"
1616

1717
#include "c_pal/thandle.h"
18+
#include "c_pal/timed_test_suite.h"
1819

1920
#include "c_util/async_op.h"
2021

@@ -84,12 +85,12 @@ static ASYNC_OP_DISPOSE disposes[] =
8485

8586
BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE)
8687

87-
TEST_SUITE_INITIALIZE(setsBufferTempSize)
88+
TIMED_TEST_SUITE_INITIALIZE(setsBufferTempSize, TIMED_TEST_DEFAULT_TIMEOUT_MS)
8889
{
8990
ASSERT_ARE_EQUAL(int, 0, gballoc_hl_init(NULL, NULL));
9091
}
9192

92-
TEST_SUITE_CLEANUP(TestClassCleanup)
93+
TIMED_TEST_SUITE_CLEANUP(TestClassCleanup)
9394
{
9495
gballoc_hl_deinit();
9596
}
@@ -144,4 +145,4 @@ TEST_FUNCTION(async_op_from_context_with_alignment_1)
144145
}
145146
}
146147

147-
END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE)
148+
END_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE)

tests/async_op_ut/async_op_ut.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code)
2222

2323
BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE)
2424

25-
TEST_SUITE_INITIALIZE(setsBufferTempSize)
25+
TIMED_TEST_SUITE_INITIALIZE(setsBufferTempSize, TIMED_TEST_DEFAULT_TIMEOUT_MS)
2626
{
2727
ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL));
2828

@@ -33,7 +33,7 @@ TEST_SUITE_INITIALIZE(setsBufferTempSize)
3333
REGISTER_GLOBAL_MOCK_FAIL_RETURN(realloc, NULL);
3434
}
3535

36-
TEST_SUITE_CLEANUP(TestClassCleanup)
36+
TIMED_TEST_SUITE_CLEANUP(TestClassCleanup)
3737
{
3838
umock_c_deinit();
3939

tests/async_op_ut/async_op_ut_pch.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "testrunnerswitcher.h"
1414
#include "umock_c/umock_c.h"
1515

16+
#include "c_pal/timed_test_suite.h"
17+
1618
#include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS
1719

1820
#include "c_pal/gballoc_hl.h"
@@ -26,4 +28,4 @@
2628

2729
#include "c_util/async_op.h"
2830

29-
#endif // ASYNC_OP_UT_PCH_H
31+
#endif // ASYNC_OP_UT_PCH_H

tests/async_retry_wrapper_ut/async_retry_wrapper_ut.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code)
205205

206206
BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE)
207207

208-
TEST_SUITE_INITIALIZE(suite_init)
208+
TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS)
209209
{
210210
ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL));
211211

@@ -258,7 +258,7 @@ TEST_SUITE_INITIALIZE(suite_init)
258258
REGISTER_TYPE(TEST_ASYNC_API_SYNC_MULTIPLE_RESULT, TEST_ASYNC_API_SYNC_MULTIPLE_RESULT);
259259
}
260260

261-
TEST_SUITE_CLEANUP(suite_cleanup)
261+
TIMED_TEST_SUITE_CLEANUP(suite_cleanup)
262262
{
263263
THANDLE_ASSIGN(REAL_THREADPOOL)(&g.test_threadpool, NULL);
264264
umock_c_deinit();

tests/async_retry_wrapper_ut/async_retry_wrapper_ut_pch.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "c_pal/interlocked.h" /*included for mocking reasons - it will prohibit creation of mocks belonging to interlocked.h - at the moment verified through int tests - this is porting legacy code, temporary solution*/
2121

22+
#include "c_pal/timed_test_suite.h"
23+
2224
#include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS
2325
#define GBALLOC_HL_REDIRECT_H
2426
#undef GBALLOC_HL_REDIRECT_H
@@ -46,4 +48,4 @@
4648

4749
#include "c_util/async_retry_wrapper.h"
4850

49-
#endif // ASYNC_RETRY_WRAPPER_UT_PCH_H
51+
#endif // ASYNC_RETRY_WRAPPER_UT_PCH_H

tests/async_type_helper_copy_value_handler_ut/async_type_helper_copy_value_handler_ut.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft. All rights reserved.
1+
// Copyright (c) Microsoft. All rights reserved.
22

33

44

@@ -27,7 +27,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code)
2727

2828
BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE)
2929

30-
TEST_SUITE_INITIALIZE(suite_init)
30+
TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS)
3131
{
3232
ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL));
3333

@@ -38,7 +38,7 @@ TEST_SUITE_INITIALIZE(suite_init)
3838

3939
}
4040

41-
TEST_SUITE_CLEANUP(suite_cleanup)
41+
TIMED_TEST_SUITE_CLEANUP(suite_cleanup)
4242
{
4343
umock_c_deinit();
4444

tests/async_type_helper_copy_value_handler_ut/async_type_helper_copy_value_handler_ut_pch.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#include "c_pal/interlocked.h" /*included for mocking reasons - it will prohibit creation of mocks belonging to this interlocked.h, temporary solution*/
1919

20+
#include "c_pal/timed_test_suite.h"
21+
2022
#include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS
2123
#include "c_pal/gballoc_hl.h"
2224
#include "c_pal/gballoc_hl_redirect.h"
@@ -28,4 +30,4 @@
2830

2931
#include "c_util/async_type_helper_copy_value_handler.h"
3032

31-
#endif // ASYNC_TYPE_HELPER_COPY_VALUE_HANDLER_UT_PCH_H
33+
#endif // ASYNC_TYPE_HELPER_COPY_VALUE_HANDLER_UT_PCH_H

tests/async_type_helper_ref_counted_handler_ut/async_type_helper_ref_counted_handler_ut.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code)
2121

2222
BEGIN_TEST_SUITE(TEST_SUITE_NAME_FROM_CMAKE)
2323

24-
TEST_SUITE_INITIALIZE(suite_init)
24+
TIMED_TEST_SUITE_INITIALIZE(suite_init, TIMED_TEST_DEFAULT_TIMEOUT_MS)
2525
{
2626
ASSERT_ARE_EQUAL(int, 0, real_gballoc_hl_init(NULL, NULL));
2727

@@ -38,7 +38,7 @@ TEST_SUITE_INITIALIZE(suite_init)
3838
REGISTER_UMOCK_ALIAS_TYPE(TEST_REFCOUNTED_HANDLE, void*);
3939
}
4040

41-
TEST_SUITE_CLEANUP(suite_cleanup)
41+
TIMED_TEST_SUITE_CLEANUP(suite_cleanup)
4242
{
4343
umock_c_deinit();
4444

tests/async_type_helper_ref_counted_handler_ut/async_type_helper_ref_counted_handler_ut_pch.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#include "c_pal/interlocked.h" /*included for mocking reasons - it will prohibit creation of mocks belonging to this interlocked.h, temporary solution*/
1919

20+
#include "c_pal/timed_test_suite.h"
21+
2022
#include "umock_c/umock_c_ENABLE_MOCKS.h" // ============================== ENABLE_MOCKS
2123
#include "c_pal/gballoc_hl.h"
2224
#include "c_pal/gballoc_hl_redirect.h"
@@ -29,4 +31,4 @@
2931

3032
#include "c_util/async_type_helper_ref_counted_handler.h"
3133

32-
#endif // ASYNC_TYPE_HELPER_REF_COUNTED_HANDLER_UT_PCH_H
34+
#endif // ASYNC_TYPE_HELPER_REF_COUNTED_HANDLER_UT_PCH_H

0 commit comments

Comments
 (0)