Support lower gtest version 33/264733/2 submit/tizen/20210929.044826
authortaemin.yeom <taemin.yeom@samsung.com>
Wed, 29 Sep 2021 04:22:42 +0000 (13:22 +0900)
committertaemin.yeom <taemin.yeom@samsung.com>
Wed, 29 Sep 2021 04:27:47 +0000 (13:27 +0900)
"GTEST_SKIP()" is supported from gtest 1.10
so in lower version, it has to been ignored.

Change-Id: Ic2a64eb5005ec177dfb6bc04d2dbf55133cfd453
Signed-off-by: taemin.yeom <taemin.yeom@samsung.com>
haltest/main.cpp
haltest/sensor-device.cpp
haltest/sensor-haltest.h

index 1a20fef..a142e3e 100644 (file)
@@ -25,6 +25,8 @@ protected:
 
 TEST_F(SENSOR_API, GetBackendP)
 {
+       SKIP_NO_FEATURE();
+
        int ret_val;
        ret_val = hal_sensor_get_backend();
        EXPECT_EQ(ret_val, 0) << strerr("Failed to get sensor device", ret_val);
@@ -32,6 +34,8 @@ TEST_F(SENSOR_API, GetBackendP)
 
 TEST_F(SENSOR_API, CreateP)
 {
+       SKIP_NO_FEATURE();
+
        int ret_val;
        void **devices;
        ret_val = hal_sensor_create(&devices);
index 3b87482..ed28660 100644 (file)
@@ -36,6 +36,11 @@ public:
 int SENSOR_DEV::device_count = 0;
 device_registry_t SENSOR_DEV::devices;
 
+#define SKIP_NO_FEATURE() \
+       if (!check_feature_all()) { \
+                       return; \
+       }
+
 #define SKIP_NO_DEV() \
        if (device_count <= 0) { \
                SKIP_MESSAGE("There is no sensor devices."); \
@@ -44,6 +49,7 @@ device_registry_t SENSOR_DEV::devices;
 
 TEST_F(SENSOR_DEV, get_poll_fdP)
 {
+       SKIP_NO_FEATURE()
        SKIP_NO_DEV()
 
        for (auto it = devices.begin(); it != devices.end(); ++it) {
@@ -56,6 +62,7 @@ TEST_F(SENSOR_DEV, get_sensorsP)
        const sensor_info_t *sensors = nullptr;
        int ret_func;
 
+       SKIP_NO_FEATURE()
        SKIP_NO_DEV()
 
        for (auto it = devices.begin(); it != devices.end(); ++it) {
@@ -67,6 +74,7 @@ TEST_F(SENSOR_DEV, get_sensorsP)
 
 TEST_F(SENSOR_DEV, get_sensorsN)
 {
+       SKIP_NO_FEATURE()
        SKIP_NO_DEV()
 
        for (auto it = devices.begin(); it != devices.end(); ++it) {
@@ -154,6 +162,7 @@ TEST_F(SENSOR_DEV, get_dataP)
        sensor_data_t *data = NULL;
        const sensor_info_t *sensors = nullptr;
 
+       SKIP_NO_FEATURE()
        SKIP_NO_DEV()
 
        for (auto it = devices.begin(); it != devices.end(); ++it) {
@@ -169,6 +178,7 @@ TEST_F(SENSOR_DEV, get_dataN)
        int length = 0;
        sensor_data_t *data = NULL;
 
+       SKIP_NO_FEATURE()
        SKIP_NO_DEV()
 
        for (auto it = devices.begin(); it != devices.end(); ++it) {
index 88ef284..bd4ec43 100644 (file)
@@ -21,6 +21,7 @@
 #include <string.h>
 
 #if (GTEST_VERSION_MAJOR < 1 || (GTEST_VERSION_MAJOR == 1 && GTEST_VERSION_MINOR < 10))
+#define GTEST_SKIP() ;
 // hack gtest internal for print message
 namespace testing
 {
@@ -52,6 +53,11 @@ do { \
     testing::internal::ColoredPrintf(testing::internal::COLOR_DEFAULT, "\n"); \
 } while (0)
 
+#define SKIP_NO_FEATURE() \
+       if (!check_feature_all()) { \
+                       return; \
+       }
+
 // SetUp/TearDown function for a testsuite differ by gtest version
 #if (GTEST_VERSION_MAJOR >= 2 || (GTEST_VERSION_MAJOR == 1 && GTEST_VERSION_MINOR >= 10))
 #define SetUpHalTestSuite    SetUpTestSuite