summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaemin.yeom <taemin.yeom@samsung.com>2021-09-29 13:22:42 +0900
committertaemin.yeom <taemin.yeom@samsung.com>2021-09-29 13:27:47 +0900
commitddb260cd112300bb0be27f0b7e1e857afaae719b (patch)
treea4029f08cc3ac6ba0b80cae4e7317c777e061964
parentf22456cf0cf1e054d62b4847d28610c03a28c997 (diff)
downloadsensor-ddb260cd112300bb0be27f0b7e1e857afaae719b.tar.gz
sensor-ddb260cd112300bb0be27f0b7e1e857afaae719b.tar.bz2
sensor-ddb260cd112300bb0be27f0b7e1e857afaae719b.zip
Support lower gtest versionsubmit/tizen/20210929.044826
"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>
-rw-r--r--haltest/main.cpp4
-rw-r--r--haltest/sensor-device.cpp10
-rw-r--r--haltest/sensor-haltest.h6
3 files changed, 20 insertions, 0 deletions
diff --git a/haltest/main.cpp b/haltest/main.cpp
index 1a20fef..a142e3e 100644
--- a/haltest/main.cpp
+++ b/haltest/main.cpp
@@ -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);
diff --git a/haltest/sensor-device.cpp b/haltest/sensor-device.cpp
index 3b87482..ed28660 100644
--- a/haltest/sensor-device.cpp
+++ b/haltest/sensor-device.cpp
@@ -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) {
diff --git a/haltest/sensor-haltest.h b/haltest/sensor-haltest.h
index 88ef284..bd4ec43 100644
--- a/haltest/sensor-haltest.h
+++ b/haltest/sensor-haltest.h
@@ -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