[ITC/UTC][capi-system-device][Non-ACR] Fix to correctly test headless profile 50/317850/3
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 6 Jan 2025 04:47:10 +0000 (13:47 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 13 Jan 2025 04:25:15 +0000 (13:25 +0900)
Instead of skipping test on headless profile, do it like headed profile.
This is possible due to change of device API and deviced that has
become working properly on headless profile.

Change-Id: Iee0a301fc43a0656a76cf20ce267d49ed830c92d
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/itc/device/ITs-device_power.c
src/utc/device/utc-system-device-power.c

index 7a91b17fbfaeff890fb3948f73598e2edfb18e03..0825b3cf83268ebcfff06fc09dbdaa9232e770bf 100644 (file)
@@ -91,30 +91,46 @@ int ITc_device_power_request_release_lock_p(void)
 {
        START_TEST;
 
-       power_lock_e power_locks[] = { POWER_LOCK_CPU, POWER_LOCK_DISPLAY, POWER_LOCK_DISPLAY_DIM };
-       int enum_size = sizeof(power_locks) / sizeof(power_locks[0]);
+       struct expect_return_by_profile {
+               power_lock_e lock_type;
+               int headed;
+               int headless;
+       } expect_return[] = {
+               {
+                       .lock_type = POWER_LOCK_CPU,
+                       .headed = DEVICE_ERROR_NONE,
+                       .headless = DEVICE_ERROR_NONE,
+               }, {
+                       .lock_type = POWER_LOCK_DISPLAY,
+                       .headed = DEVICE_ERROR_NONE,
+                       .headless = DEVICE_ERROR_NOT_SUPPORTED,
+               }, {
+                       .lock_type = POWER_LOCK_DISPLAY_DIM,
+                       .headed = DEVICE_ERROR_NONE,
+                       .headless = DEVICE_ERROR_NOT_SUPPORTED,
+               },
+       };
+       int enum_size = sizeof(expect_return) / sizeof(expect_return[0]);
        int enum_counter = 0;
 
-       if ((bIsDisplayFeatureSupported == false) || (bIsDisplayStateFeatureSupported == false))
-               return 0;
-
        for ( enum_counter=0; enum_counter<enum_size; enum_counter++)
        {
                // Target API
-               int nRet = device_power_request_lock(power_locks[enum_counter], 10);
-               if ( nRet != DEVICE_ERROR_NONE )
+               int nRet = device_power_request_lock(expect_return[enum_counter].lock_type, 10);
+               int nExpectedRet = bIsDisplayFeatureSupported ? expect_return[enum_counter].headed : expect_return[enum_counter].headless;
+               if ( nRet != nExpectedRet )
                {
-                       FPRINTF("[Line : %d][%s] device_power_request_lock failed for enum = %s, error returned = %s\\n",
-                               __LINE__, API_NAMESPACE, DeviceGetPowerLock(power_locks[enum_counter]), DeviceGetError(nRet));
+                       FPRINTF("[Line : %d][%s] device_power_request_lock failed for enum = %s, error returned = %s, expected return = %s\\n",
+                                       __LINE__, API_NAMESPACE, DeviceGetPowerLock(expect_return[enum_counter].lock_type), DeviceGetError(nRet), DeviceGetError(nExpectedRet));
                        return 1;
                }
 
                // Target API
-               nRet  = device_power_release_lock(power_locks[enum_counter]);
-               if ( nRet != DEVICE_ERROR_NONE )
+               nRet  = device_power_release_lock(expect_return[enum_counter].lock_type);
+               if ( nRet != nExpectedRet )
                {
-                       FPRINTF("[Line : %d][%s] device_power_release_lock failed for enum = %s, error returned = %s\\n",
-                               __LINE__, API_NAMESPACE, DeviceGetPowerLock(power_locks[enum_counter]), DeviceGetError(nRet));
+                       FPRINTF("[Line : %d][%s] device_power_release_lock failed for enum = %s, error returned = %s, expected return = %s\\n",
+                               __LINE__, API_NAMESPACE, DeviceGetPowerLock(expect_return[enum_counter].lock_type), DeviceGetError(nRet), DeviceGetError(nExpectedRet));
                        return 1;
                }
        }
index c66b3b594deb2766a408146268e17b0ca5d7e7ab..04ef83571fc631ee3ebf209495633ea93c835377 100644 (file)
@@ -145,9 +145,6 @@ int utc_system_device_power_request_lock_n_2(void)
                                (locks[i] == POWER_LOCK_DISPLAY_DIM)) {
                                assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED);
                                return 0;
-                       } else if (locks[i] == POWER_LOCK_CPU) {
-                               assert_eq(error, DEVICE_ERROR_NONE);
-                               return 0;
                        }
                }
                assert_eq(error, DEVICE_ERROR_INVALID_PARAMETER);