static void SetUpHalTestSuite() {
}
- void SetUp() override {}
+ void SetUp() override {
+ int ret_val = check_feature_all();
+ if (!ret_val) {
+ SKIP_MESSAGE("All sensor features are false");
+ GTEST_SKIP();
+ return;
+ }
+ }
void TearDown() override {}
};
TEST_F(SENSOR_API, GetBackendP)
{
int ret_val;
-
ret_val = hal_sensor_get_backend();
EXPECT_EQ(ret_val, 0) << strerr("Failed to get sensor device", ret_val);
}
TEST_F(SENSOR_API, CreateP)
{
int ret_val;
-
void **devices;
ret_val = hal_sensor_create(&devices);
if (ret_val == -ENODEV) {
SKIP_MESSAGE("Not supported HAL");
- return ;
+ return;
}
ASSERT_GT(ret_val, 0) << strerr("Failed to call create", ret_val);
ASSERT_NE(devices[0], nullptr) << "Opened devices are invalid.";
#ifndef __SENSOR_HALTEST_H__
#define __SENSOR_HALTEST_H__
+#include <system_info.h>
#include <gtest/gtest.h>
#include <string.h>
#define BUFMAX 256
static char errbuf1[BUFMAX];
+#define FEATURE_NUM 37
+static const char *feature[FEATURE_NUM] = {
+ "http://tizen.org/feature/sensor.accelerometer",
+ "http://tizen.org/feature/sensor.accelerometer.wakeup",
+ "http://tizen.org/feature/sensor.activity_recognition",
+ "http://tizen.org/feature/sensor.barometer",
+ "http://tizen.org/feature/sensor.barometer.wakeup",
+ "http://tizen.org/feature/sensor.geomagnetic_rotation_vector",
+ "http://tizen.org/feature/sensor.gesture_recognition",
+ "http://tizen.org/feature/sensor.gravity",
+ "http://tizen.org/feature/sensor.gyroscope",
+ "http://tizen.org/feature/sensor.gyroscope_rotation_vector",
+ "http://tizen.org/feature/sensor.gyroscope.uncalibrated",
+ "http://tizen.org/feature/sensor.gyroscope.wakeup",
+ "http://tizen.org/feature/sensor.heart_rate_monitor",
+ "http://tizen.org/feature/sensor.heart_rate_monitor.batch",
+ "http://tizen.org/feature/sensor.heart_rate_monitor.led_green",
+ "http://tizen.org/feature/sensor.heart_rate_monitor.led_green.batch",
+ "http://tizen.org/feature/sensor.heart_rate_monitor.led_ir",
+ "http://tizen.org/feature/sensor.heart_rate_monitor.led_red",
+ "http://tizen.org/feature/sensor.humidity",
+ "http://tizen.org/feature/sensor.linear_acceleration",
+ "http://tizen.org/feature/sensor.magnetometer",
+ "http://tizen.org/feature/sensor.magnetometer.uncalibrated",
+ "http://tizen.org/feature/sensor.magnetometer.wakeup",
+ "http://tizen.org/feature/sensor.pedometer",
+ "http://tizen.org/feature/sensor.photometer",
+ "http://tizen.org/feature/sensor.photometer.wakeup",
+ "http://tizen.org/feature/sensor.proximity",
+ "http://tizen.org/feature/sensor.proximity.wakeup",
+ "http://tizen.org/feature/sensor.rotation_vector",
+ "http://tizen.org/feature/sensor.significant_motion",
+ "http://tizen.org/feature/sensor.sleep_monitor",
+ "http://tizen.org/feature/sensor.stress_monitor",
+ "http://tizen.org/feature/sensor.temperature",
+ "http://tizen.org/feature/sensor.tiltmeter",
+ "http://tizen.org/feature/sensor.tiltmeter.wakeup",
+ "http://tizen.org/feature/sensor.ultraviolet",
+ "http://tizen.org/feature/sensor.wrist_up"
+};
+
+static bool check_feature_all() {
+ bool ret, val;
+ for (int i = 0; i < FEATURE_NUM; ++i) {
+ ret = system_info_get_platform_bool(feature[i], &val);
+ if (!ret && val)
+ return true;
+ }
+ return false;
+}
+
static inline const char* strerr(const char* message, int eno)
{
if (eno == 0)