Skip to content

Commit 9f5b654

Browse files
committed
Round out ExtraTestMacros
Signed-off-by: Michael Carroll <michael@openrobotics.org>
1 parent 41189fd commit 9f5b654

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

include/gz/utils/ExtraTestMacros.hh

+25-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020

2121
#include <gz/utils/detail/ExtraTestMacros.hh>
2222

23+
/// \brief Restrict the execution of the test to just the Windows platform
24+
/// Other platforms will get the test compiled but it won't be run
25+
/// as part of the test suite execution.
26+
/// The macro uses the Disabled_ prefix provided by googletest. See
27+
/// https://chromium.googlesource.com/external/github.com/google/googletest/+/HEAD/googletest/docs/advanced.md
28+
#define GZ_UTILS_TEST_ENABLED_ONLY_ON_WINDOWS(TestName) \
29+
DETAIL_GZ_UTILS_TEST_ENABLED_ONLY_ON_WINDOWS(TestName)
30+
2331
/// \brief Restrict the execution of the test for the Windows platform.
2432
/// The test will be compiled on Windows too but will never be run as
2533
/// part of the test suite. The macro uses the Disabled_ prefix provided
@@ -28,8 +36,16 @@
2836
#define GZ_UTILS_TEST_DISABLED_ON_WIN32(TestName) \
2937
DETAIL_GZ_UTILS_TEST_DISABLED_ON_WIN32(TestName)
3038

39+
/// \brief Restrict the execution of the test to just the MacOS platform
40+
/// Other platforms will get the test compiled but it won't be run
41+
/// as part of the test suite execution.
42+
/// The macro uses the Disabled_ prefix provided by googletest. See
43+
/// https://chromium.googlesource.com/external/github.com/google/googletest/+/HEAD/googletest/docs/advanced.md
44+
#define GZ_UTILS_TEST_ENABLED_ONLY_ON_MAC(TestName) \
45+
DETAIL_GZ_UTILS_TEST_ENABLED_ONLY_ON_MAC(TestName)
46+
3147
/// \brief Restrict the execution of the test for the Mac platform.
32-
/// The test will be compiled on Windows too but will never be run as
48+
/// The test will be compiled on Mac too but will never be run as
3349
/// part of the test suite. The macro uses the Disabled_ prefix provided
3450
/// by googletest. See
3551
/// https://chromium.googlesource.com/external/github.com/google/googletest/+/HEAD/googletest/docs/advanced.md
@@ -44,4 +60,12 @@
4460
#define GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(TestName) \
4561
DETAIL_GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(TestName)
4662

63+
/// \brief Restrict the execution of the test for the Linux platform
64+
/// The test will be compiled on Linux too but will never be run as
65+
/// part of the test suite. The macro uses the Disabled_ prefix provided
66+
/// by googletest. See
67+
/// https://chromium.googlesource.com/external/github.com/google/googletest/+/HEAD/googletest/docs/advanced.md
68+
#define GZ_UTILS_TEST_DISABLED_ON_LINUX(TestName) \
69+
DETAIL_GZ_UTILS_TEST_DISABLED_ON_LINUX(TestName)
70+
4771
#endif // GZ_UTILS_EXTRATESTMACROS_HH

include/gz/utils/detail/ExtraTestMacros.hh

+12
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,45 @@
2626

2727
#define DETAIL_GZ_UTILS_TEST_DISABLED_ON_WIN32(TestName) \
2828
DETAIL_GZ_UTILS_ADD_DISABLED_PREFIX(TestName)
29+
#define DETAIL_GZ_UTILS_TEST_ENABLED_ONLY_ON_WIN32(TestName) \
30+
TestName
2931

3032
#else
3133

3234
#define DETAIL_GZ_UTILS_TEST_DISABLED_ON_WIN32(TestName) \
3335
TestName
36+
#define DETAIL_GZ_UTILS_TEST_ENABLED_ONLY_ON_WIN32(TestName) \
37+
DETAIL_GZ_UTILS_ADD_DISABLED_PREFIX(TestName)
3438

3539
#endif // defined _WIN32
3640

3741
#if defined __APPLE__
3842

3943
#define DETAIL_GZ_UTILS_TEST_DISABLED_ON_MAC(TestName) \
4044
DETAIL_GZ_UTILS_ADD_DISABLED_PREFIX(TestName)
45+
#define DETAIL_GZ_UTILS_TEST_ENABLED_ONLY_ON_MAC(TestName) \
46+
TestName
4147

4248
#else
4349

4450
#define DETAIL_GZ_UTILS_TEST_DISABLED_ON_MAC(TestName) \
4551
TestName
52+
#define DETAIL_GZ_UTILS_TEST_ENABLED_ONLY_ON_MAC(TestName) \
53+
DETAIL_GZ_UTILS_ADD_DISABLED_PREFIX(TestName)
4654

4755
#endif // defined __APPLE__
4856

4957
#if defined __linux__
5058

59+
#define DETAIL_GZ_UTILS_TEST_DISABLED_ON_LINUX(TestName) \
60+
DETAIL_GZ_UTILS_ADD_DISABLED_PREFIX(TestName)
5161
#define DETAIL_GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(TestName) \
5262
TestName
5363

5464
#else
5565

66+
#define DETAIL_GZ_UTILS_TEST_DISABLED_ON_LINUX(TestName) \
67+
TestName
5668
#define DETAIL_GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(TestName) \
5769
DETAIL_GZ_UTILS_ADD_DISABLED_PREFIX(TestName)
5870

0 commit comments

Comments
 (0)