To fix gtest errors 10/187310/2 submit/tizen/20180822.022033
authorlokilee73 <changjoo.lee@samsung.com>
Wed, 22 Aug 2018 02:01:42 +0000 (11:01 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Wed, 22 Aug 2018 02:07:17 +0000 (11:07 +0900)
There were errors by unsupported devices.
  ex) thermal and cpu in wearable target
Old value of h/w info remained and it caused errors.
So, initialize h/w info at the beggining of gtest.

Change-Id: I95edc88ff7020346f0a9d1bf5c0edff6dea28bc0
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
unittest/device_haltests.cpp

index 9d0cb37..e45533b 100755 (executable)
@@ -209,6 +209,7 @@ TEST_F(BATTERYHalTest, InitP)
        if (!supported)
                return;
 
+       info = NULL;
        ret = hw_get_info(BATTERY_HARDWARE_DEVICE_ID,
                        (const struct hw_info **)&info);
        EXPECT_EQ(ret, 0) << "Fail to load battery hal (" << ret << ")";
@@ -290,6 +291,7 @@ TEST_F(CPUHalTest, InitP)
 {
        int ret;
 
+       info = NULL;
        ret = hw_get_info(CPU_HARDWARE_DEVICE_ID,
                        (const struct hw_info **)&info);
        if (ret < 0) {
@@ -354,6 +356,7 @@ TEST_F(DISPLAYHalTest, InitP)
 {
        int ret;
 
+       info = NULL;
        ret = hw_get_info(DISPLAY_HARDWARE_DEVICE_ID,
                        (const struct hw_info **)&info);
        if (ret < 0) {
@@ -533,6 +536,7 @@ TEST_F(EXTCONHalTest, InitP)
 {
        int ret;
 
+       info = NULL;
        ret = hw_get_info(EXTERNAL_CONNECTION_HARDWARE_DEVICE_ID,
                        (const struct hw_info **)&info);
        if (ret < 0) {
@@ -610,6 +614,7 @@ TEST_F(IRHalTest, InitP)
        if (!supported)
                return;
 
+       info = NULL;
        ret = hw_get_info(IR_HARDWARE_DEVICE_ID,
                        (const struct hw_info **)&info);
        EXPECT_EQ(ret, 0) << "Fail to get hal for ir (" << ret << ")";
@@ -679,6 +684,7 @@ TEST_F(RGBHalTest, InitP)
        if (!supported)
                return;
 
+       info = NULL;
        ret = hw_get_info(LED_HARDWARE_DEVICE_ID,
                        (const struct hw_info **)&info);
        EXPECT_EQ(ret, 0) << "Fail to get hal for rgb (" << ret << ")";
@@ -734,6 +740,7 @@ TEST_F(THERMALHalTest, InitP)
 {
        int ret;
 
+       info = NULL;
        ret = hw_get_info(THERMAL_HARDWARE_DEVICE_ID,
                                (const struct hw_info **)&info);
        if (ret < 0) {
@@ -809,6 +816,7 @@ TEST_F(TOUCHSCREENHalTest, InitP)
 {
        int ret;
 
+       info = NULL;
        ret = hw_get_info(TOUCHSCREEN_HARDWARE_DEVICE_ID,
                        (const struct hw_info **)&info);
        if (ret < 0) {
@@ -861,6 +869,7 @@ TEST_F(USBCLIENTHalTest, InitP)
        if (!supported)
                return;
 
+       info = NULL;
        ret = hw_get_info(USB_CLIENT_HARDWARE_DEVICE_ID,
                        (const struct hw_info **)&info);
        if (ret < 0) {
@@ -1037,6 +1046,7 @@ TEST_F(USBGADGETHalTest, InitP)
 {
        int ret;
 
+       info = NULL;
        ret = hw_get_info(USB_GADGET_DEVICE_ID,
                        (const struct hw_info **)&info);
        if (ret < 0) {