From b79455e14cceee956f9ac107e37827fe5ee8673c Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Tue, 18 Jun 2024 05:44:28 +0000 Subject: [PATCH 01/20] gh#30 Source or Sink Profile Variable * Adding new parameter to YAML file to check if device is source or sink * updating code to read this parameter and register tests accordingly. --- .../hdmiCECExtendedEnumsNotSupported.yaml | 1 + src/test_l1_hdmi_cec_driver.c | 50 ++++++++++--------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/profiles/hdmiCECExtendedEnumsNotSupported.yaml b/profiles/hdmiCECExtendedEnumsNotSupported.yaml index 8d85638..5466f9b 100644 --- a/profiles/hdmiCECExtendedEnumsNotSupported.yaml +++ b/profiles/hdmiCECExtendedEnumsNotSupported.yaml @@ -1,4 +1,5 @@ --- hdmicec: + sourceDevice: false features: extendedEnumsSupported: false \ No newline at end of file diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index c6f5538..ecd9cc3 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -87,6 +87,7 @@ static int gTestGroup = 1; static int gTestID = 1; static bool extendedEnumsSupported=false; +static bool sourceDevice=false; #define CEC_GET_CEC_VERSION (0x9F) #define CEC_DEVICE_VENDOR_ID (0x87) @@ -2240,6 +2241,8 @@ int test_hdmicec_hal_l1_register( void ) { return -1; } + extendedEnumsSupported = ut_kvp_getBoolField( ut_kvp_profile_getInstance(), "hdmicec/features/extendedEnumsSupported" ); + sourceDevice = ut_kvp_getBoolField( ut_kvp_profile_getInstance(), "hdmicec/sourceDevice" ); UT_add_test( pSuiteCommon, "open_Positive", test_hdmicec_hal_l1_open_positive); UT_add_test( pSuiteCommon, "open_negative", test_hdmicec_hal_l1_open_negative); @@ -2251,29 +2254,30 @@ int test_hdmicec_hal_l1_register( void ) UT_add_test( pSuiteCommon, "setRxCallback_negative", test_hdmicec_hal_l1_setRxCallback_negative); UT_add_test( pSuiteCommon, "setTxCallback_Positive", test_hdmicec_hal_l1_setTxCallback_positive); UT_add_test( pSuiteCommon, "setTxCallback_negative", test_hdmicec_hal_l1_setTxCallback_negative); - - UT_add_test( pSuite_panel, "addLogicalAddressSink_Positive", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_positive); - UT_add_test( pSuite_panel, "addLogicalAddressSink_negative", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_negative); - UT_add_test( pSuite_panel, "removeLogicalAddressSink_Positive", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_positive); - UT_add_test( pSuite_panel, "removeLogicalAddressSink_negative", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_negative); - UT_add_test( pSuite_panel, "getLogicalAddressSink_Positive", test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_positive); - UT_add_test( pSuite_panel, "getLogicalAddressSink_negative", test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_negative); - UT_add_test( pSuite_panel, "TxSink_Positive", test_hdmicec_hal_l1_hdmiCecTx_sinkDevice_positive); - UT_add_test( pSuite_panel, "TxSink_negative", test_hdmicec_hal_l1_hdmiCecTx_sinkDevice_negative); - UT_add_test( pSuite_panel, "TxAsyncSink_Positive", test_hdmicec_hal_l1_hdmiCecTxAsync_sinkDevice_positive); - UT_add_test( pSuite_panel, "TxAsyncSink_negative", test_hdmicec_hal_l1_hdmiCecTxAsync_sinkDevice_negative); - //UT_add_test( pSuite_panel, "addLogicalAddressWithAddressInUseSink", test_hdmicec_hal_l1_addLogicalAddressWithAddressInUse_sinkDevice); - //UT_add_test( pSuiteHdmiDisConnected, "portDisconnectedSink", test_hdmicec_hal_l1_portDisconnected_sink); - - UT_add_test( pSuite_stb, "getLogicalAddressSource_Positive", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_positive); - UT_add_test( pSuite_stb, "getLogicalAddressSource_negative", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_negative); - UT_add_test( pSuite_stb, "TxSource_Positive", test_hdmicec_hal_l1_hdmiCecTx_sourceDevice_positive); - UT_add_test( pSuite_stb, "TxSource_negative", test_hdmicec_hal_l1_hdmiCecTx_sourceDevice_negative); - UT_add_test( pSuite_stb, "TxAsyncSource_Positive", test_hdmicec_hal_l1_hdmiCecTxAsync_sourceDevice_positive); - UT_add_test( pSuite_stb, "TxAsyncSource_negative", test_hdmicec_hal_l1_hdmiCecTxAsync_sourceDevice_negative); - //UT_add_test( pSuite_stb, "open_logical_address_unavailable_source", test_hdmicec_hal_l1_open_logical_address_unavailable_source); - //UT_add_test( pSuiteHdmiDisConnected, "portDisconnectedSource", test_hdmicec_hal_l1_portDisconnected_source); - extendedEnumsSupported = ut_kvp_getBoolField( ut_kvp_profile_getInstance(), "hdmicec/features/extendedEnumsSupported" ); + if(sourceDevice) + { + UT_add_test( pSuite_stb, "getLogicalAddressSource_Positive", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_positive); + UT_add_test( pSuite_stb, "getLogicalAddressSource_negative", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_negative); + UT_add_test( pSuite_stb, "TxAsyncSource_Positive", test_hdmicec_hal_l1_hdmiCecTxAsync_sourceDevice_positive); + UT_add_test( pSuite_stb, "TxAsyncSource_negative", test_hdmicec_hal_l1_hdmiCecTxAsync_sourceDevice_negative); + UT_add_test( pSuite_stb, "TxSource_Positive", test_hdmicec_hal_l1_hdmiCecTx_sourceDevice_positive); + UT_add_test( pSuite_stb, "TxSource_negative", test_hdmicec_hal_l1_hdmiCecTx_sourceDevice_negative); + //UT_add_test( pSuite_stb, "open_logical_address_unavailable_source", test_hdmicec_hal_l1_open_logical_address_unavailable_source); + //UT_add_test( pSuiteHdmiDisConnected, "portDisconnectedSource", test_hdmicec_hal_l1_portDisconnected_source); + }else{ + UT_add_test( pSuite_panel, "addLogicalAddressSink_Positive", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_positive); + UT_add_test( pSuite_panel, "addLogicalAddressSink_negative", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_negative); + UT_add_test( pSuite_panel, "removeLogicalAddressSink_Positive", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_positive); + UT_add_test( pSuite_panel, "removeLogicalAddressSink_negative", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_negative); + UT_add_test( pSuite_panel, "getLogicalAddressSink_Positive", test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_positive); + UT_add_test( pSuite_panel, "getLogicalAddressSink_negative", test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_negative); + UT_add_test( pSuite_panel, "TxSink_Positive", test_hdmicec_hal_l1_hdmiCecTx_sinkDevice_positive); + UT_add_test( pSuite_panel, "TxSink_negative", test_hdmicec_hal_l1_hdmiCecTx_sinkDevice_negative); + UT_add_test( pSuite_panel, "TxAsyncSink_Positive", test_hdmicec_hal_l1_hdmiCecTxAsync_sinkDevice_positive); + UT_add_test( pSuite_panel, "TxAsyncSink_negative", test_hdmicec_hal_l1_hdmiCecTxAsync_sinkDevice_negative); + //UT_add_test( pSuite_panel, "addLogicalAddressWithAddressInUseSink", test_hdmicec_hal_l1_addLogicalAddressWithAddressInUse_sinkDevice); + //UT_add_test( pSuiteHdmiDisConnected, "portDisconnectedSink", test_hdmicec_hal_l1_portDisconnected_sink); + } return 0; } From 34b9d78ed7a03241f341312b38562cd4538f7af1 Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Wed, 19 Jun 2024 04:52:18 +0000 Subject: [PATCH 02/20] gh #30 Source or Sink Profile Variable *Seperate YAML fiel for source and sink devices *Updated KVP variable name --- .../Sink_HdmiCec.yaml} | 2 +- profiles/Source/Source_HdmiCec.yaml | 5 +++++ src/test_l1_hdmi_cec_driver.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) rename profiles/{hdmiCECExtendedEnumsNotSupported.yaml => Sink/Sink_HdmiCec.yaml} (70%) create mode 100644 profiles/Source/Source_HdmiCec.yaml diff --git a/profiles/hdmiCECExtendedEnumsNotSupported.yaml b/profiles/Sink/Sink_HdmiCec.yaml similarity index 70% rename from profiles/hdmiCECExtendedEnumsNotSupported.yaml rename to profiles/Sink/Sink_HdmiCec.yaml index 5466f9b..9c50229 100644 --- a/profiles/hdmiCECExtendedEnumsNotSupported.yaml +++ b/profiles/Sink/Sink_HdmiCec.yaml @@ -1,5 +1,5 @@ --- hdmicec: - sourceDevice: false + cecSourceDevice: true features: extendedEnumsSupported: false \ No newline at end of file diff --git a/profiles/Source/Source_HdmiCec.yaml b/profiles/Source/Source_HdmiCec.yaml new file mode 100644 index 0000000..a83c387 --- /dev/null +++ b/profiles/Source/Source_HdmiCec.yaml @@ -0,0 +1,5 @@ +--- +hdmicec: + cecSourceDevice: false + features: + extendedEnumsSupported: false \ No newline at end of file diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index ecd9cc3..92d7bce 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -2242,7 +2242,7 @@ int test_hdmicec_hal_l1_register( void ) return -1; } extendedEnumsSupported = ut_kvp_getBoolField( ut_kvp_profile_getInstance(), "hdmicec/features/extendedEnumsSupported" ); - sourceDevice = ut_kvp_getBoolField( ut_kvp_profile_getInstance(), "hdmicec/sourceDevice" ); + sourceDevice = ut_kvp_getBoolField( ut_kvp_profile_getInstance(), "hdmicec/cecSourceDevice" ); UT_add_test( pSuiteCommon, "open_Positive", test_hdmicec_hal_l1_open_positive); UT_add_test( pSuiteCommon, "open_negative", test_hdmicec_hal_l1_open_negative); From 31ce93e6c7311e6fdf7d6b44ed582205970b056c Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Wed, 19 Jun 2024 09:39:31 +0000 Subject: [PATCH 03/20] gh #30 Test Profile Changes * Moving parsing logic to test_utils files * Creating Global variables for profile parameter. --- profiles/Sink/Sink_HdmiCec.yaml | 14 ++- profiles/Source/Source_HdmiCec.yaml | 14 ++- src/main.c | 8 ++ src/test_l1_hdmi_cec_driver.c | 11 ++- src/test_utils.c | 145 ++++++++++++++++++++++++++++ src/test_utils.h | 98 +++++++++++++++++++ 6 files changed, 275 insertions(+), 15 deletions(-) create mode 100644 src/test_utils.c create mode 100644 src/test_utils.h diff --git a/profiles/Sink/Sink_HdmiCec.yaml b/profiles/Sink/Sink_HdmiCec.yaml index 9c50229..49b1f06 100644 --- a/profiles/Sink/Sink_HdmiCec.yaml +++ b/profiles/Sink/Sink_HdmiCec.yaml @@ -1,5 +1,9 @@ ---- -hdmicec: - cecSourceDevice: true - features: - extendedEnumsSupported: false \ No newline at end of file +Device: + Type: sink + Name: element + +# cec Device Type 0- None, 1 - Sink, 2 - Source +cecDeviceType: 2 + +# Extended Error code enum suppot for the platform +extendedEnumsSupported: false \ No newline at end of file diff --git a/profiles/Source/Source_HdmiCec.yaml b/profiles/Source/Source_HdmiCec.yaml index a83c387..85daa2e 100644 --- a/profiles/Source/Source_HdmiCec.yaml +++ b/profiles/Source/Source_HdmiCec.yaml @@ -1,5 +1,9 @@ ---- -hdmicec: - cecSourceDevice: false - features: - extendedEnumsSupported: false \ No newline at end of file +Device: + Type: source + Name: xione + +# cec Device Type 0- None, 1 - Sink, 2 - Source +cecDeviceType: 1 + +# Extended Error code enum suppot for the platform +extendedEnumsSupported: false \ No newline at end of file diff --git a/src/main.c b/src/main.c index 765faa9..15f6b6d 100644 --- a/src/main.c +++ b/src/main.c @@ -62,6 +62,7 @@ #include #include #include +#include "test_utils.h" extern int register_hdmicec_hal_l1_tests( void ); extern int register_vcomponent_tests ( char* profile, unsigned short cpPort, char* cpPath ); @@ -106,6 +107,13 @@ int main(int argc, char** argv) /* Register tests as required, then call the UT-main to support switches and triggering */ UT_init( argc, argv ); + if ( test_utils_parseconfig() == -1 ) + { + printf("\n Failed to parse the configuration file"); + test_utils_parseconfig_term(); + return -1; + } + register_hdmicec_hal_l1_tests (); register_vcomponent_tests(pProfilePath, cpPort, pUrl); diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index 92d7bce..a140374 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -68,8 +68,8 @@ #include #include -#include #include "hdmi_cec_driver.h" +#include "test_utils.h" /** * Set CEC play back logical address here @@ -86,7 +86,6 @@ static int gTestGroup = 1; static int gTestID = 1; -static bool extendedEnumsSupported=false; static bool sourceDevice=false; #define CEC_GET_CEC_VERSION (0x9F) @@ -111,7 +110,7 @@ static bool sourceDevice=false; #define CHECK_FOR_EXTENDED_ERROR_CODE( result, enhanced, old )\ {\ - if ( extendedEnumsSupported == true )\ + if ( gExtendedEnumSupported == true )\ {\ UT_ASSERT_EQUAL( enhanced, result );\ }\ @@ -2254,7 +2253,7 @@ int test_hdmicec_hal_l1_register( void ) UT_add_test( pSuiteCommon, "setRxCallback_negative", test_hdmicec_hal_l1_setRxCallback_negative); UT_add_test( pSuiteCommon, "setTxCallback_Positive", test_hdmicec_hal_l1_setTxCallback_positive); UT_add_test( pSuiteCommon, "setTxCallback_negative", test_hdmicec_hal_l1_setTxCallback_negative); - if(sourceDevice) + if(gCecDeviceType == cecDevicesSource) { UT_add_test( pSuite_stb, "getLogicalAddressSource_Positive", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_positive); UT_add_test( pSuite_stb, "getLogicalAddressSource_negative", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_negative); @@ -2264,7 +2263,9 @@ int test_hdmicec_hal_l1_register( void ) UT_add_test( pSuite_stb, "TxSource_negative", test_hdmicec_hal_l1_hdmiCecTx_sourceDevice_negative); //UT_add_test( pSuite_stb, "open_logical_address_unavailable_source", test_hdmicec_hal_l1_open_logical_address_unavailable_source); //UT_add_test( pSuiteHdmiDisConnected, "portDisconnectedSource", test_hdmicec_hal_l1_portDisconnected_source); - }else{ + } + else if (gCecDeviceType == cecDeviceSink) + { UT_add_test( pSuite_panel, "addLogicalAddressSink_Positive", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_positive); UT_add_test( pSuite_panel, "addLogicalAddressSink_negative", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_negative); UT_add_test( pSuite_panel, "removeLogicalAddressSink_Positive", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_positive); diff --git a/src/test_utils.c b/src/test_utils.c new file mode 100644 index 0000000..b98830a --- /dev/null +++ b/src/test_utils.c @@ -0,0 +1,145 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/** + * @addtogroup HPK Hardware Porting Kit + * @{ + * @par The Hardware Porting Kit + * HPK is the next evolution of the well-defined Hardware Abstraction Layer + * (HAL), but augmented with more comprehensive documentation and test suites + * that OEM or SOC vendors can use to self-certify their ports before taking + * them to RDKM for validation or to an operator for final integration and + * deployment. The Hardware Porting Kit effectively enables an OEM and/or SOC + * vendor to self-certify their own Video Accelerator devices, with minimal RDKM + * assistance. + * + */ + +/** + * @addtogroup Hdmi_Cec Hdmi Cec Module + * @{ + */ + +/** + * @addtogroup Hdmi_Cec_HALTEST Hdmi Cec HAL Tests + * @{ + */ + +/** + * @defgroup Hdmi_Cec_UTILS Hdmi Cec HAL Tests Utility File + * @{ + * @parblock + * + * ### Utility functions for Device Settings HAL : + * + * Utility functions required for the module across all vendors. + * + * **Pre-Conditions:** None @n + * **Dependencies:** None @n + * + * @endparblock + * + */ + +/** +* @file test_utils.c +* +*/ +#include +#include +#include +#include + +#include "hdmi_cec_driver.h" +#include "test_utils.h" + +/* Global Variables */ +char gDeviceType[TEST_UTIL_DEVICE_TYPE_SIZE]; +char gDeviceName[TEST_UTIL_DEVICE_NAME_SIZE]; +int32_t gSourceType; +int32_t gCecDeviceType; +bool gExtendedEnumSupported; + + +static int test_utils_parse_hdmi_cec() +{ + char key_string[TEST_UTIL_KVP_SIZE]; + ut_kvp_status_t status; + + gExtendedEnumSupported = ut_kvp_getBool( ut_kvp_profile_getInstance(), "extendedEnumsSupported" ); + gCecDeviceType = ut_kvp_getUInt32Field(ut_kvp_profile_getInstance(), "cecDeviceType"); + + return 0; +} + + +/* Parse configuration file */ +int test_utils_parseconfig() +{ + ut_kvp_status_t status; + + status = ut_kvp_getStringField(ut_kvp_profile_getInstance(), "Device/Type", gDeviceType, TEST_UTIL_DEVICE_TYPE_SIZE); + + if (status == UT_KVP_STATUS_SUCCESS ) { + if (!strncmp(gDeviceType, TEST_UTIL_TYPE_SOURCE_VALUE, TEST_UTIL_DEVICE_TYPE_SIZE)) { + gSourceType = 1; + } + else if(!strncmp(gDeviceType, TEST_UTIL_TYPE_SINK_VALUE, TEST_UTIL_DEVICE_TYPE_SIZE)) { + gSourceType = 0; + } + else { + UT_LOG_ERROR("Invalid platform type: %s", gDeviceType); + return -1; + } + } + else { + UT_LOG_ERROR("Failed to get the platform type"); + return -1; + } + + status = ut_kvp_getStringField(ut_kvp_profile_getInstance(), "Device/Name", gDeviceName, TEST_UTIL_DEVICE_NAME_SIZE); + + UT_LOG_DEBUG("Device Type: %s, Device Name: %s", gDeviceType, gDeviceName); + + status = test_utils_parse_hdmi_cec(); + if (status != UT_KVP_STATUS_SUCCESS ) { + UT_LOG_ERROR("Failed to parse hdmi cec configurations"); + return -1; + } + /* Note: Add for other modules*/ + //if(gDSModule & dsVideoPort) { + + return 0; +} + +void test_utils_parseconfig_term() +{ + if(gDSAudioPortConfiguration) { + free(gDSAudioPortConfiguration); + } + + if(gDSVideoPortConfiguration) { + free(gDSVideoPortConfiguration); + } +} + +/** @} */ // End of Hdmi_Cec_UTILS +/** @} */ // End of Hdmi_cec_HALTEST +/** @} */ // End of Hdmi_Cec +/** @} */ // End of HPK \ No newline at end of file diff --git a/src/test_utils.h b/src/test_utils.h new file mode 100644 index 0000000..ddef68e --- /dev/null +++ b/src/test_utils.h @@ -0,0 +1,98 @@ +/** +* If not stated otherwise in this file or this component's LICENSE +* file the following copyright and licenses apply: +* +* Copyright 2024 RDK Management +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/** + * @addtogroup HPK Hardware Porting Kit + * @{ + * @par The Hardware Porting Kit + * HPK is the next evolution of the well-defined Hardware Abstraction Layer + * (HAL), but augmented with more comprehensive documentation and test suites + * that OEM or SOC vendors can use to self-certify their ports before taking + * them to RDKM for validation or to an operator for final integration and + * deployment. The Hardware Porting Kit effectively enables an OEM and/or SOC + * vendor to self-certify their own Video Accelerator devices, with minimal RDKM + * assistance. + * + */ + +/** + * @addtogroup Device_Settings Device Settings Module + * @{ + */ + +/** + * @addtogroup Device_Settings_HALTEST Device Settings HAL Tests + * @{ + */ + +/** + * @defgroup Device_Settings_UTILS Device Settings HAL Tests Utility File + * @{ + * @parblock + * + * ### Utility functions for Device Settings HAL : + * + * Utility functions required for the module across all vendors. + * + * **Pre-Conditions:** None @n + * **Dependencies:** None @n + * + * @endparblock + * + */ + +/** +* @file test_utils.h +* +*/ +#ifndef __TEST_UTILS_H__ +#define __TEST_UTILS_H__ + +#include "hdmi_cec_driver.h" + +#define TEST_UTIL_KVP_SIZE 256 +#define TEST_UTIL_DEVICE_TYPE_SIZE 8 +#define TEST_UTIL_DEVICE_NAME_SIZE 64 +#define TEST_UTIL_DS_MODULE_NAME_SIZE 32 + + + +typedef enum _eCecDeviceType { + cecDeviceNone = 0, + cecDeviceSink = 1, + cecDevicesSource = 2, +}eCecDeviceType_t; + +/* Global variables */ +extern char gDeviceType[TEST_UTIL_DEVICE_TYPE_SIZE]; +extern char gDeviceName[TEST_UTIL_DEVICE_NAME_SIZE]; +extern int32_t gSourceType; +extern int32_t gCecDeviceType; +extern bool gExtendedEnumSupported; + + +/*Function prototypes */ +int test_utils_parseconfig(); +void test_utils_parseconfig_term(); + +#endif //__TEST_UTILS_H__ +/** @} */ // End of Device_Settings_UTILS +/** @} */ // End of Device_Settings_HALTEST +/** @} */ // End of Device_Settings +/** @} */ // End of HPK \ No newline at end of file From f7f68ae23bebcfef483bf7e095715762ae2c02bd Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:53:34 +0530 Subject: [PATCH 04/20] gh #30 Addressing review comments --- profiles/Sink/Sink_HdmiCec.yaml | 16 +-- profiles/Source/Source_HdmiCec.yaml | 16 +-- src/main.c | 24 ++++- src/test_l1_hdmi_cec_driver.c | 11 ++- src/test_utils.c | 145 ---------------------------- src/test_utils.h | 98 ------------------- 6 files changed, 45 insertions(+), 265 deletions(-) delete mode 100644 src/test_utils.c delete mode 100644 src/test_utils.h diff --git a/profiles/Sink/Sink_HdmiCec.yaml b/profiles/Sink/Sink_HdmiCec.yaml index 49b1f06..9ef25d7 100644 --- a/profiles/Sink/Sink_HdmiCec.yaml +++ b/profiles/Sink/Sink_HdmiCec.yaml @@ -1,9 +1,11 @@ -Device: - Type: sink - Name: element +hdmicec: + Device: + Type: sink + Name: element -# cec Device Type 0- None, 1 - Sink, 2 - Source -cecDeviceType: 2 + # cec Device Type 0- None, 1 - Sink, 2 - Source + cecDeviceType: 2 -# Extended Error code enum suppot for the platform -extendedEnumsSupported: false \ No newline at end of file + features: + # Extended Error code enum suppot for the platform + extendedEnumsSupported: false \ No newline at end of file diff --git a/profiles/Source/Source_HdmiCec.yaml b/profiles/Source/Source_HdmiCec.yaml index 85daa2e..0cf687d 100644 --- a/profiles/Source/Source_HdmiCec.yaml +++ b/profiles/Source/Source_HdmiCec.yaml @@ -1,9 +1,11 @@ -Device: - Type: source - Name: xione +hdmicec: + Device: + Type: source + Name: xione -# cec Device Type 0- None, 1 - Sink, 2 - Source -cecDeviceType: 1 + # cec Device Type 0- None, 1 - Sink, 2 - Source + cecDeviceType: 1 -# Extended Error code enum suppot for the platform -extendedEnumsSupported: false \ No newline at end of file + features: + # Extended Error code enum suppot for the platform + extendedEnumsSupported: false \ No newline at end of file diff --git a/src/main.c b/src/main.c index 15f6b6d..e642fce 100644 --- a/src/main.c +++ b/src/main.c @@ -62,7 +62,13 @@ #include #include #include -#include "test_utils.h" + +#define TEST_UTIL_DEVICE_TYPE_SIZE 8 +#define TEST_UTIL_DEVICE_NAME_SIZE 64 + +static char deviceType[TEST_UTIL_DEVICE_TYPE_SIZE]; +static char deviceName[TEST_UTIL_DEVICE_NAME_SIZE]; +static int32_t sourceType; extern int register_hdmicec_hal_l1_tests( void ); extern int register_vcomponent_tests ( char* profile, unsigned short cpPort, char* cpPath ); @@ -73,6 +79,8 @@ int main(int argc, char** argv) char* pProfilePath = NULL; unsigned short cpPort = 8888; char* pUrl = NULL; + ut_kvp_status_t status; + while ((opt = getopt(argc, argv, "p:c:u:")) != -1) { @@ -107,12 +115,18 @@ int main(int argc, char** argv) /* Register tests as required, then call the UT-main to support switches and triggering */ UT_init( argc, argv ); - if ( test_utils_parseconfig() == -1 ) - { - printf("\n Failed to parse the configuration file"); - test_utils_parseconfig_term(); + status = ut_kvp_getStringField(ut_kvp_profile_getInstance(), "hdmicec/Device/Type", deviceType, TEST_UTIL_DEVICE_TYPE_SIZE); + if (status != UT_KVP_STATUS_SUCCESS ) { + UT_LOG_ERROR("Failed to get the platform type"); return -1; } + status = ut_kvp_getStringField(ut_kvp_profile_getInstance(), "hdmicec/Device/Name", deviceName, TEST_UTIL_DEVICE_NAME_SIZE); + if (status != UT_KVP_STATUS_SUCCESS ) { + UT_LOG_ERROR("Failed to get the platform name"); + return -1; + } + + UT_LOG_DEBUG("Device Type: %s, Device Name: %s", deviceType, deviceName); register_hdmicec_hal_l1_tests (); diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index a140374..b19ba4c 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -68,8 +68,8 @@ #include #include +#include #include "hdmi_cec_driver.h" -#include "test_utils.h" /** * Set CEC play back logical address here @@ -83,10 +83,15 @@ /// Set the CEC sink (Display device) logical address here #define DEFAULT_LOGICAL_ADDRESS_PANEL 0 +typedef enum _eCecDeviceType { + cecDeviceNone = 0, + cecDeviceSink = 1, + cecDevicesSource = 2, +}eCecDeviceType_t; static int gTestGroup = 1; static int gTestID = 1; -static bool sourceDevice=false; +static bool extendedEnumsSupported=false; #define CEC_GET_CEC_VERSION (0x9F) #define CEC_DEVICE_VENDOR_ID (0x87) @@ -2241,7 +2246,7 @@ int test_hdmicec_hal_l1_register( void ) return -1; } extendedEnumsSupported = ut_kvp_getBoolField( ut_kvp_profile_getInstance(), "hdmicec/features/extendedEnumsSupported" ); - sourceDevice = ut_kvp_getBoolField( ut_kvp_profile_getInstance(), "hdmicec/cecSourceDevice" ); + int32_t cecDeviceType = ut_kvp_getUInt32Field( ut_kvp_profile_getInstance(), "hdmicec/cecDeviceType" ); UT_add_test( pSuiteCommon, "open_Positive", test_hdmicec_hal_l1_open_positive); UT_add_test( pSuiteCommon, "open_negative", test_hdmicec_hal_l1_open_negative); diff --git a/src/test_utils.c b/src/test_utils.c deleted file mode 100644 index b98830a..0000000 --- a/src/test_utils.c +++ /dev/null @@ -1,145 +0,0 @@ -/** -* If not stated otherwise in this file or this component's LICENSE -* file the following copyright and licenses apply: -* -* Copyright 2024 RDK Management -* -* Licensed under the Apache License, Version 2.0 (the License); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an AS IS BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/** - * @addtogroup HPK Hardware Porting Kit - * @{ - * @par The Hardware Porting Kit - * HPK is the next evolution of the well-defined Hardware Abstraction Layer - * (HAL), but augmented with more comprehensive documentation and test suites - * that OEM or SOC vendors can use to self-certify their ports before taking - * them to RDKM for validation or to an operator for final integration and - * deployment. The Hardware Porting Kit effectively enables an OEM and/or SOC - * vendor to self-certify their own Video Accelerator devices, with minimal RDKM - * assistance. - * - */ - -/** - * @addtogroup Hdmi_Cec Hdmi Cec Module - * @{ - */ - -/** - * @addtogroup Hdmi_Cec_HALTEST Hdmi Cec HAL Tests - * @{ - */ - -/** - * @defgroup Hdmi_Cec_UTILS Hdmi Cec HAL Tests Utility File - * @{ - * @parblock - * - * ### Utility functions for Device Settings HAL : - * - * Utility functions required for the module across all vendors. - * - * **Pre-Conditions:** None @n - * **Dependencies:** None @n - * - * @endparblock - * - */ - -/** -* @file test_utils.c -* -*/ -#include -#include -#include -#include - -#include "hdmi_cec_driver.h" -#include "test_utils.h" - -/* Global Variables */ -char gDeviceType[TEST_UTIL_DEVICE_TYPE_SIZE]; -char gDeviceName[TEST_UTIL_DEVICE_NAME_SIZE]; -int32_t gSourceType; -int32_t gCecDeviceType; -bool gExtendedEnumSupported; - - -static int test_utils_parse_hdmi_cec() -{ - char key_string[TEST_UTIL_KVP_SIZE]; - ut_kvp_status_t status; - - gExtendedEnumSupported = ut_kvp_getBool( ut_kvp_profile_getInstance(), "extendedEnumsSupported" ); - gCecDeviceType = ut_kvp_getUInt32Field(ut_kvp_profile_getInstance(), "cecDeviceType"); - - return 0; -} - - -/* Parse configuration file */ -int test_utils_parseconfig() -{ - ut_kvp_status_t status; - - status = ut_kvp_getStringField(ut_kvp_profile_getInstance(), "Device/Type", gDeviceType, TEST_UTIL_DEVICE_TYPE_SIZE); - - if (status == UT_KVP_STATUS_SUCCESS ) { - if (!strncmp(gDeviceType, TEST_UTIL_TYPE_SOURCE_VALUE, TEST_UTIL_DEVICE_TYPE_SIZE)) { - gSourceType = 1; - } - else if(!strncmp(gDeviceType, TEST_UTIL_TYPE_SINK_VALUE, TEST_UTIL_DEVICE_TYPE_SIZE)) { - gSourceType = 0; - } - else { - UT_LOG_ERROR("Invalid platform type: %s", gDeviceType); - return -1; - } - } - else { - UT_LOG_ERROR("Failed to get the platform type"); - return -1; - } - - status = ut_kvp_getStringField(ut_kvp_profile_getInstance(), "Device/Name", gDeviceName, TEST_UTIL_DEVICE_NAME_SIZE); - - UT_LOG_DEBUG("Device Type: %s, Device Name: %s", gDeviceType, gDeviceName); - - status = test_utils_parse_hdmi_cec(); - if (status != UT_KVP_STATUS_SUCCESS ) { - UT_LOG_ERROR("Failed to parse hdmi cec configurations"); - return -1; - } - /* Note: Add for other modules*/ - //if(gDSModule & dsVideoPort) { - - return 0; -} - -void test_utils_parseconfig_term() -{ - if(gDSAudioPortConfiguration) { - free(gDSAudioPortConfiguration); - } - - if(gDSVideoPortConfiguration) { - free(gDSVideoPortConfiguration); - } -} - -/** @} */ // End of Hdmi_Cec_UTILS -/** @} */ // End of Hdmi_cec_HALTEST -/** @} */ // End of Hdmi_Cec -/** @} */ // End of HPK \ No newline at end of file diff --git a/src/test_utils.h b/src/test_utils.h deleted file mode 100644 index ddef68e..0000000 --- a/src/test_utils.h +++ /dev/null @@ -1,98 +0,0 @@ -/** -* If not stated otherwise in this file or this component's LICENSE -* file the following copyright and licenses apply: -* -* Copyright 2024 RDK Management -* -* Licensed under the Apache License, Version 2.0 (the License); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an AS IS BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/** - * @addtogroup HPK Hardware Porting Kit - * @{ - * @par The Hardware Porting Kit - * HPK is the next evolution of the well-defined Hardware Abstraction Layer - * (HAL), but augmented with more comprehensive documentation and test suites - * that OEM or SOC vendors can use to self-certify their ports before taking - * them to RDKM for validation or to an operator for final integration and - * deployment. The Hardware Porting Kit effectively enables an OEM and/or SOC - * vendor to self-certify their own Video Accelerator devices, with minimal RDKM - * assistance. - * - */ - -/** - * @addtogroup Device_Settings Device Settings Module - * @{ - */ - -/** - * @addtogroup Device_Settings_HALTEST Device Settings HAL Tests - * @{ - */ - -/** - * @defgroup Device_Settings_UTILS Device Settings HAL Tests Utility File - * @{ - * @parblock - * - * ### Utility functions for Device Settings HAL : - * - * Utility functions required for the module across all vendors. - * - * **Pre-Conditions:** None @n - * **Dependencies:** None @n - * - * @endparblock - * - */ - -/** -* @file test_utils.h -* -*/ -#ifndef __TEST_UTILS_H__ -#define __TEST_UTILS_H__ - -#include "hdmi_cec_driver.h" - -#define TEST_UTIL_KVP_SIZE 256 -#define TEST_UTIL_DEVICE_TYPE_SIZE 8 -#define TEST_UTIL_DEVICE_NAME_SIZE 64 -#define TEST_UTIL_DS_MODULE_NAME_SIZE 32 - - - -typedef enum _eCecDeviceType { - cecDeviceNone = 0, - cecDeviceSink = 1, - cecDevicesSource = 2, -}eCecDeviceType_t; - -/* Global variables */ -extern char gDeviceType[TEST_UTIL_DEVICE_TYPE_SIZE]; -extern char gDeviceName[TEST_UTIL_DEVICE_NAME_SIZE]; -extern int32_t gSourceType; -extern int32_t gCecDeviceType; -extern bool gExtendedEnumSupported; - - -/*Function prototypes */ -int test_utils_parseconfig(); -void test_utils_parseconfig_term(); - -#endif //__TEST_UTILS_H__ -/** @} */ // End of Device_Settings_UTILS -/** @} */ // End of Device_Settings_HALTEST -/** @} */ // End of Device_Settings -/** @} */ // End of HPK \ No newline at end of file From 965f3f82bfc0e305149e0d5d0386074f7f9852d9 Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:07:58 +0530 Subject: [PATCH 05/20] gh #30 Addressing the review comments * buidl issue fix --- src/test_l1_hdmi_cec_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index b19ba4c..303ced4 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -115,7 +115,7 @@ static bool extendedEnumsSupported=false; #define CHECK_FOR_EXTENDED_ERROR_CODE( result, enhanced, old )\ {\ - if ( gExtendedEnumSupported == true )\ + if ( extendedEnumsSupported == true )\ {\ UT_ASSERT_EQUAL( enhanced, result );\ }\ From 673ef4003680c6fccacf4a7602d011f322ce067b Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Mon, 24 Jun 2024 15:15:00 +0530 Subject: [PATCH 06/20] gh #30 Profilre for hdmi CEC * Fixing build issue --- src/main.c | 1 + src/test_l1_hdmi_cec_driver.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index e642fce..8cd2a04 100644 --- a/src/main.c +++ b/src/main.c @@ -62,6 +62,7 @@ #include #include #include +#include "ut_kvp_profile.h" #define TEST_UTIL_DEVICE_TYPE_SIZE 8 #define TEST_UTIL_DEVICE_NAME_SIZE 64 diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index 303ced4..d03919c 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -2258,7 +2258,7 @@ int test_hdmicec_hal_l1_register( void ) UT_add_test( pSuiteCommon, "setRxCallback_negative", test_hdmicec_hal_l1_setRxCallback_negative); UT_add_test( pSuiteCommon, "setTxCallback_Positive", test_hdmicec_hal_l1_setTxCallback_positive); UT_add_test( pSuiteCommon, "setTxCallback_negative", test_hdmicec_hal_l1_setTxCallback_negative); - if(gCecDeviceType == cecDevicesSource) + if(cecDeviceType == cecDevicesSource) { UT_add_test( pSuite_stb, "getLogicalAddressSource_Positive", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_positive); UT_add_test( pSuite_stb, "getLogicalAddressSource_negative", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_negative); @@ -2269,7 +2269,7 @@ int test_hdmicec_hal_l1_register( void ) //UT_add_test( pSuite_stb, "open_logical_address_unavailable_source", test_hdmicec_hal_l1_open_logical_address_unavailable_source); //UT_add_test( pSuiteHdmiDisConnected, "portDisconnectedSource", test_hdmicec_hal_l1_portDisconnected_source); } - else if (gCecDeviceType == cecDeviceSink) + else if (cecDeviceType == cecDeviceSink) { UT_add_test( pSuite_panel, "addLogicalAddressSink_Positive", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_positive); UT_add_test( pSuite_panel, "addLogicalAddressSink_negative", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_negative); From 4270eed00fbe68fa6dd7cdbe527188622cf29c2e Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Wed, 26 Jun 2024 10:56:18 +0530 Subject: [PATCH 07/20] gh #30 Addressing review comments * Updated YAML and removed cecDeviceType parameter * Updated profile reading funciton to take teh device type from string field already present. --- profiles/Sink/Sink_HdmiCec.yaml | 3 --- profiles/Source/Source_HdmiCec.yaml | 3 --- src/main.c | 6 ++--- src/test_l1_hdmi_cec_driver.c | 40 +++++++++++++++++++++-------- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/profiles/Sink/Sink_HdmiCec.yaml b/profiles/Sink/Sink_HdmiCec.yaml index 9ef25d7..f53746a 100644 --- a/profiles/Sink/Sink_HdmiCec.yaml +++ b/profiles/Sink/Sink_HdmiCec.yaml @@ -3,9 +3,6 @@ hdmicec: Type: sink Name: element - # cec Device Type 0- None, 1 - Sink, 2 - Source - cecDeviceType: 2 - features: # Extended Error code enum suppot for the platform extendedEnumsSupported: false \ No newline at end of file diff --git a/profiles/Source/Source_HdmiCec.yaml b/profiles/Source/Source_HdmiCec.yaml index 0cf687d..bd71684 100644 --- a/profiles/Source/Source_HdmiCec.yaml +++ b/profiles/Source/Source_HdmiCec.yaml @@ -3,9 +3,6 @@ hdmicec: Type: source Name: xione - # cec Device Type 0- None, 1 - Sink, 2 - Source - cecDeviceType: 1 - features: # Extended Error code enum suppot for the platform extendedEnumsSupported: false \ No newline at end of file diff --git a/src/main.c b/src/main.c index 8cd2a04..dedbcf5 100644 --- a/src/main.c +++ b/src/main.c @@ -67,10 +67,6 @@ #define TEST_UTIL_DEVICE_TYPE_SIZE 8 #define TEST_UTIL_DEVICE_NAME_SIZE 64 -static char deviceType[TEST_UTIL_DEVICE_TYPE_SIZE]; -static char deviceName[TEST_UTIL_DEVICE_NAME_SIZE]; -static int32_t sourceType; - extern int register_hdmicec_hal_l1_tests( void ); extern int register_vcomponent_tests ( char* profile, unsigned short cpPort, char* cpPath ); @@ -81,6 +77,8 @@ int main(int argc, char** argv) unsigned short cpPort = 8888; char* pUrl = NULL; ut_kvp_status_t status; + char deviceType[TEST_UTIL_DEVICE_TYPE_SIZE]; + char deviceName[TEST_UTIL_DEVICE_NAME_SIZE]; while ((opt = getopt(argc, argv, "p:c:u:")) != -1) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index d03919c..e5c90df 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -79,6 +79,9 @@ */ #define DEFAULT_LOGICAL_ADDRESS_STB 3 +#define TEST_UTIL_DEVICE_TYPE_SIZE 8 +#define TEST_UTIL_TYPE_SOURCE_VALUE "source" +#define TEST_UTIL_TYPE_SINK_VALUE "sink" /// Set the CEC sink (Display device) logical address here #define DEFAULT_LOGICAL_ADDRESS_PANEL 0 @@ -2236,18 +2239,33 @@ static UT_test_suite_t *pSuite_panel = NULL; */ int test_hdmicec_hal_l1_register( void ) { - + ut_kvp_status_t status; + char deviceType[TEST_UTIL_DEVICE_TYPE_SIZE]; + // Reading Extended enum support form profile file + extendedEnumsSupported = ut_kvp_getBoolField( ut_kvp_profile_getInstance(), "hdmicec/features/extendedEnumsSupported" ); + // Getting device type from profile. + status = ut_kvp_getStringField(ut_kvp_profile_getInstance(), "hdmicec/Device/Type", deviceType, TEST_UTIL_DEVICE_TYPE_SIZE); + if (status != UT_KVP_STATUS_SUCCESS ) { + UT_LOG_ERROR("Failed to get the platform type"); + return -1; + } pSuiteCommon = UT_add_suite("[L1 HDMICEC Common TestCase]", NULL, NULL); - pSuite_stb = UT_add_suite("[L1 HDMICEC STB TestCase]", NULL, NULL); - pSuite_panel = UT_add_suite("[L1 HDMICEC PANEL TestCase]", NULL, NULL); + //Checking if the HAL under test is source device HAL + if (!strncmp(gDeviceType, TEST_UTIL_TYPE_SOURCE_VALUE, TEST_UTIL_DEVICE_TYPE_SIZE)) { + pSuite_stb = UT_add_suite("[L1 HDMICEC STB TestCase]", NULL, NULL); + } + //Checking if the HAL under test is sink device HAL + else if(!strncmp(gDeviceType, TEST_UTIL_TYPE_SINK_VALUE, TEST_UTIL_DEVICE_TYPE_SIZE)) { + pSuite_panel = UT_add_suite("[L1 HDMICEC PANEL TestCase]", NULL, NULL); + } + else { + UT_LOG_ERROR("Platform type: %s", gDeviceType); + } - if ((NULL == pSuiteCommon) || (NULL == pSuite_stb) || (NULL == pSuite_panel)) + if ((NULL == pSuiteCommon)) { return -1; } - extendedEnumsSupported = ut_kvp_getBoolField( ut_kvp_profile_getInstance(), "hdmicec/features/extendedEnumsSupported" ); - int32_t cecDeviceType = ut_kvp_getUInt32Field( ut_kvp_profile_getInstance(), "hdmicec/cecDeviceType" ); - UT_add_test( pSuiteCommon, "open_Positive", test_hdmicec_hal_l1_open_positive); UT_add_test( pSuiteCommon, "open_negative", test_hdmicec_hal_l1_open_negative); UT_add_test( pSuiteCommon, "close_Positive", test_hdmicec_hal_l1_close_positive); @@ -2258,8 +2276,8 @@ int test_hdmicec_hal_l1_register( void ) UT_add_test( pSuiteCommon, "setRxCallback_negative", test_hdmicec_hal_l1_setRxCallback_negative); UT_add_test( pSuiteCommon, "setTxCallback_Positive", test_hdmicec_hal_l1_setTxCallback_positive); UT_add_test( pSuiteCommon, "setTxCallback_negative", test_hdmicec_hal_l1_setTxCallback_negative); - if(cecDeviceType == cecDevicesSource) - { + //Add Source related tests to suite only if it is an STB HAL + if (NULL != pSuite_stb) { UT_add_test( pSuite_stb, "getLogicalAddressSource_Positive", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_positive); UT_add_test( pSuite_stb, "getLogicalAddressSource_negative", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_negative); UT_add_test( pSuite_stb, "TxAsyncSource_Positive", test_hdmicec_hal_l1_hdmiCecTxAsync_sourceDevice_positive); @@ -2269,8 +2287,8 @@ int test_hdmicec_hal_l1_register( void ) //UT_add_test( pSuite_stb, "open_logical_address_unavailable_source", test_hdmicec_hal_l1_open_logical_address_unavailable_source); //UT_add_test( pSuiteHdmiDisConnected, "portDisconnectedSource", test_hdmicec_hal_l1_portDisconnected_source); } - else if (cecDeviceType == cecDeviceSink) - { + // Add Sink related tests to suite if it is an Panle HAL + if(NULL != pSuite_panel) { UT_add_test( pSuite_panel, "addLogicalAddressSink_Positive", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_positive); UT_add_test( pSuite_panel, "addLogicalAddressSink_negative", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_negative); UT_add_test( pSuite_panel, "removeLogicalAddressSink_Positive", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_positive); From 0bf10bca5259c04b33d22552d719afd2cb289b0e Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Wed, 26 Jun 2024 11:20:30 +0530 Subject: [PATCH 08/20] gh #30 Updating review comments * build issue fix --- src/test_l1_hdmi_cec_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index e5c90df..d8c3445 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -2251,15 +2251,15 @@ int test_hdmicec_hal_l1_register( void ) } pSuiteCommon = UT_add_suite("[L1 HDMICEC Common TestCase]", NULL, NULL); //Checking if the HAL under test is source device HAL - if (!strncmp(gDeviceType, TEST_UTIL_TYPE_SOURCE_VALUE, TEST_UTIL_DEVICE_TYPE_SIZE)) { + if (!strncmp(deviceType, TEST_UTIL_TYPE_SOURCE_VALUE, TEST_UTIL_DEVICE_TYPE_SIZE)) { pSuite_stb = UT_add_suite("[L1 HDMICEC STB TestCase]", NULL, NULL); } //Checking if the HAL under test is sink device HAL - else if(!strncmp(gDeviceType, TEST_UTIL_TYPE_SINK_VALUE, TEST_UTIL_DEVICE_TYPE_SIZE)) { + else if(!strncmp(deviceType, TEST_UTIL_TYPE_SINK_VALUE, TEST_UTIL_DEVICE_TYPE_SIZE)) { pSuite_panel = UT_add_suite("[L1 HDMICEC PANEL TestCase]", NULL, NULL); } else { - UT_LOG_ERROR("Platform type: %s", gDeviceType); + UT_LOG_ERROR("Platform type: %s", deviceType); } if ((NULL == pSuiteCommon)) From d20e0c5b7a8eff57d792491ae6556b6c808cba29 Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Wed, 3 Jul 2024 09:39:47 +0530 Subject: [PATCH 09/20] gh #30 : Test profile changes * Build issue resolution --- src/test_l1_hdmi_cec_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index 823fc9f..3b0b06e 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -2238,12 +2238,12 @@ static UT_test_suite_t *pSuite_panel = NULL; */ int test_hdmicec_hal_l1_register( void ) { - ut_kvp_status_t status; + ut_kvp_status_t status = UT_KVP_STATUS_SUCCESS; char deviceType[UT_KVP_MAX_ELEMENT_SIZE]; // Reading Extended enum support form profile file extendedEnumsSupported = UT_KVP_PROFILE_GET_BOOL("hdmicec/features/extendedEnumsSupported"); // Getting device type from profile. - status = UT_KVP_PROFILE_GET_STRING("hdmicec/Type",deviceType); + UT_KVP_PROFILE_GET_STRING("hdmicec/Type",deviceType); if (status != UT_KVP_STATUS_SUCCESS ) { UT_LOG_ERROR("Failed to get the platform type"); return -1; From 808fe1cd815dde1493a855f3cf66392e8b645dc8 Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Thu, 4 Jul 2024 12:03:42 +0530 Subject: [PATCH 10/20] gh #30 test profile changes * Addressing typo --- src/test_l1_hdmi_cec_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index 3b0b06e..654cbf9 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -2243,7 +2243,7 @@ int test_hdmicec_hal_l1_register( void ) // Reading Extended enum support form profile file extendedEnumsSupported = UT_KVP_PROFILE_GET_BOOL("hdmicec/features/extendedEnumsSupported"); // Getting device type from profile. - UT_KVP_PROFILE_GET_STRING("hdmicec/Type",deviceType); + UT_KVP_PROFILE_GET_STRING("hdmicec/yype",deviceType); if (status != UT_KVP_STATUS_SUCCESS ) { UT_LOG_ERROR("Failed to get the platform type"); return -1; From 2c2750be83261cbec1c18c43019128c61bdc98a9 Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Sun, 7 Jul 2024 12:29:05 +0530 Subject: [PATCH 11/20] gh #30 Test profile changes * Addressing typo review comment * Splitting source/sink test register to seperate API --- src/test_l1_hdmi_cec_driver.c | 105 ++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 38 deletions(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index 654cbf9..e6cb697 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -2230,6 +2230,58 @@ void test_hdmicec_hal_l1_portDisconnected_source( void ) static UT_test_suite_t *pSuiteCommon = NULL; static UT_test_suite_t *pSuite_stb = NULL; static UT_test_suite_t *pSuite_panel = NULL; +/** + * @brief Register source tests + * + * @return int - 0 on success, otherwise failure + */ + +static int test_hdmidec_hal_l1_register_source_tests(void) +{ + pSuite_stb = UT_add_suite("[L1 HDMICEC STB TestCase]", NULL, NULL); + if (NULL == pSuite_stb) + { + return -1; + } + UT_add_test( pSuite_stb, "getLogicalAddressSource_Positive", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_positive); + UT_add_test( pSuite_stb, "getLogicalAddressSource_negative", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_negative); + UT_add_test( pSuite_stb, "TxAsyncSource_Positive", test_hdmicec_hal_l1_hdmiCecTxAsync_sourceDevice_positive); + UT_add_test( pSuite_stb, "TxAsyncSource_negative", test_hdmicec_hal_l1_hdmiCecTxAsync_sourceDevice_negative); + UT_add_test( pSuite_stb, "TxSource_Positive", test_hdmicec_hal_l1_hdmiCecTx_sourceDevice_positive); + UT_add_test( pSuite_stb, "TxSource_negative", test_hdmicec_hal_l1_hdmiCecTx_sourceDevice_negative); + //UT_add_test( pSuite_stb, "open_logical_address_unavailable_source", test_hdmicec_hal_l1_open_logical_address_unavailable_source); + //UT_add_test( pSuiteHdmiDisConnected, "portDisconnectedSource", test_hdmicec_hal_l1_portDisconnected_source); + return 0; +} + +/** + * @brief Register sink tests + * + * @return int - 0 on success, otherwise failure + */ + +static int test_hdmidec_hal_l1_register_sink_tests(void) +{ + pSuite_panel = UT_add_suite("[L1 HDMICEC PANEL TestCase]", NULL, NULL); + if (NULL == pSuite_panel) + { + return -1; + } + UT_add_test( pSuite_panel, "addLogicalAddressSink_Positive", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_positive); + UT_add_test( pSuite_panel, "addLogicalAddressSink_negative", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_negative); + UT_add_test( pSuite_panel, "removeLogicalAddressSink_Positive", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_positive); + UT_add_test( pSuite_panel, "removeLogicalAddressSink_negative", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_negative); + UT_add_test( pSuite_panel, "getLogicalAddressSink_Positive", test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_positive); + UT_add_test( pSuite_panel, "getLogicalAddressSink_negative", test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_negative); + UT_add_test( pSuite_panel, "TxSink_Positive", test_hdmicec_hal_l1_hdmiCecTx_sinkDevice_positive); + UT_add_test( pSuite_panel, "TxSink_negative", test_hdmicec_hal_l1_hdmiCecTx_sinkDevice_negative); + UT_add_test( pSuite_panel, "TxAsyncSink_Positive", test_hdmicec_hal_l1_hdmiCecTxAsync_sinkDevice_positive); + UT_add_test( pSuite_panel, "TxAsyncSink_negative", test_hdmicec_hal_l1_hdmiCecTxAsync_sinkDevice_negative); + //UT_add_test( pSuite_panel, "addLogicalAddressWithAddressInUseSink", test_hdmicec_hal_l1_addLogicalAddressWithAddressInUse_sinkDevice); + //UT_add_test( pSuiteHdmiDisConnected, "portDisconnectedSink", test_hdmicec_hal_l1_portDisconnected_sink); + return 0; +} + /** * @brief Register the main tests for this module @@ -2240,27 +2292,16 @@ int test_hdmicec_hal_l1_register( void ) { ut_kvp_status_t status = UT_KVP_STATUS_SUCCESS; char deviceType[UT_KVP_MAX_ELEMENT_SIZE]; + int ret = 0; // Reading Extended enum support form profile file extendedEnumsSupported = UT_KVP_PROFILE_GET_BOOL("hdmicec/features/extendedEnumsSupported"); // Getting device type from profile. - UT_KVP_PROFILE_GET_STRING("hdmicec/yype",deviceType); + UT_KVP_PROFILE_GET_STRING("hdmicec/type",deviceType); if (status != UT_KVP_STATUS_SUCCESS ) { UT_LOG_ERROR("Failed to get the platform type"); return -1; } pSuiteCommon = UT_add_suite("[L1 HDMICEC Common TestCase]", NULL, NULL); - //Checking if the HAL under test is source device HAL - if (!strncmp(deviceType, TEST_UTIL_TYPE_SOURCE_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) { - pSuite_stb = UT_add_suite("[L1 HDMICEC STB TestCase]", NULL, NULL); - } - //Checking if the HAL under test is sink device HAL - else if(!strncmp(deviceType, TEST_UTIL_TYPE_SINK_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) { - pSuite_panel = UT_add_suite("[L1 HDMICEC PANEL TestCase]", NULL, NULL); - } - else { - UT_LOG_ERROR("Platform type: %s", deviceType); - } - if ((NULL == pSuiteCommon)) { return -1; @@ -2275,33 +2316,21 @@ int test_hdmicec_hal_l1_register( void ) UT_add_test( pSuiteCommon, "setRxCallback_negative", test_hdmicec_hal_l1_setRxCallback_negative); UT_add_test( pSuiteCommon, "setTxCallback_Positive", test_hdmicec_hal_l1_setTxCallback_positive); UT_add_test( pSuiteCommon, "setTxCallback_negative", test_hdmicec_hal_l1_setTxCallback_negative); - //Add Source related tests to suite only if it is an STB HAL - if (NULL != pSuite_stb) { - UT_add_test( pSuite_stb, "getLogicalAddressSource_Positive", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_positive); - UT_add_test( pSuite_stb, "getLogicalAddressSource_negative", test_hdmicec_hal_l1_getLogicalAddress_sourceDevice_negative); - UT_add_test( pSuite_stb, "TxAsyncSource_Positive", test_hdmicec_hal_l1_hdmiCecTxAsync_sourceDevice_positive); - UT_add_test( pSuite_stb, "TxAsyncSource_negative", test_hdmicec_hal_l1_hdmiCecTxAsync_sourceDevice_negative); - UT_add_test( pSuite_stb, "TxSource_Positive", test_hdmicec_hal_l1_hdmiCecTx_sourceDevice_positive); - UT_add_test( pSuite_stb, "TxSource_negative", test_hdmicec_hal_l1_hdmiCecTx_sourceDevice_negative); - //UT_add_test( pSuite_stb, "open_logical_address_unavailable_source", test_hdmicec_hal_l1_open_logical_address_unavailable_source); - //UT_add_test( pSuiteHdmiDisConnected, "portDisconnectedSource", test_hdmicec_hal_l1_portDisconnected_source); + //Checking if the HAL under test is source device HAL + if (!strncmp(deviceType, TEST_UTIL_TYPE_SOURCE_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) { + ret = test_hdmidec_hal_l1_register_source_tests(); + } + //Checking if the HAL under test is sink device HAL + else if(!strncmp(deviceType, TEST_UTIL_TYPE_SINK_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) { + ret = test_hdmidec_hal_l1_register_sink_tests (); } - // Add Sink related tests to suite if it is an Panle HAL - if(NULL != pSuite_panel) { - UT_add_test( pSuite_panel, "addLogicalAddressSink_Positive", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_positive); - UT_add_test( pSuite_panel, "addLogicalAddressSink_negative", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_negative); - UT_add_test( pSuite_panel, "removeLogicalAddressSink_Positive", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_positive); - UT_add_test( pSuite_panel, "removeLogicalAddressSink_negative", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_negative); - UT_add_test( pSuite_panel, "getLogicalAddressSink_Positive", test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_positive); - UT_add_test( pSuite_panel, "getLogicalAddressSink_negative", test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_negative); - UT_add_test( pSuite_panel, "TxSink_Positive", test_hdmicec_hal_l1_hdmiCecTx_sinkDevice_positive); - UT_add_test( pSuite_panel, "TxSink_negative", test_hdmicec_hal_l1_hdmiCecTx_sinkDevice_negative); - UT_add_test( pSuite_panel, "TxAsyncSink_Positive", test_hdmicec_hal_l1_hdmiCecTxAsync_sinkDevice_positive); - UT_add_test( pSuite_panel, "TxAsyncSink_negative", test_hdmicec_hal_l1_hdmiCecTxAsync_sinkDevice_negative); - //UT_add_test( pSuite_panel, "addLogicalAddressWithAddressInUseSink", test_hdmicec_hal_l1_addLogicalAddressWithAddressInUse_sinkDevice); - //UT_add_test( pSuiteHdmiDisConnected, "portDisconnectedSink", test_hdmicec_hal_l1_portDisconnected_sink); + else { + UT_LOG_ERROR("Platform type: %s", deviceType); } - return 0; + if(ret <0 ) + return -1; + else + return 0; } /** @} */ // End of HDMI CEC HAL Tests L1 File From 5ada039d7309d82840752a6c8c6f5ee0c9f8bd91 Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Sun, 7 Jul 2024 12:47:53 +0530 Subject: [PATCH 12/20] gh #30 Test profile changes * Restructuring APIs --- src/test_l1_hdmi_cec_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index e6cb697..6229b1d 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -2238,6 +2238,7 @@ static UT_test_suite_t *pSuite_panel = NULL; static int test_hdmidec_hal_l1_register_source_tests(void) { + if (!strncmp(deviceType, TEST_UTIL_TYPE_SOURCE_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) { pSuite_stb = UT_add_suite("[L1 HDMICEC STB TestCase]", NULL, NULL); if (NULL == pSuite_stb) { @@ -2317,7 +2318,6 @@ int test_hdmicec_hal_l1_register( void ) UT_add_test( pSuiteCommon, "setTxCallback_Positive", test_hdmicec_hal_l1_setTxCallback_positive); UT_add_test( pSuiteCommon, "setTxCallback_negative", test_hdmicec_hal_l1_setTxCallback_negative); //Checking if the HAL under test is source device HAL - if (!strncmp(deviceType, TEST_UTIL_TYPE_SOURCE_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) { ret = test_hdmidec_hal_l1_register_source_tests(); } //Checking if the HAL under test is sink device HAL From b261a2bb136c1ec54bb741a80ecf9bd4793e7ebf Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Sun, 7 Jul 2024 12:54:29 +0530 Subject: [PATCH 13/20] gh #30 Test profile changes * API restructure --- src/test_l1_hdmi_cec_driver.c | 54 +++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index 6229b1d..a133d69 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -2238,7 +2238,18 @@ static UT_test_suite_t *pSuite_panel = NULL; static int test_hdmidec_hal_l1_register_source_tests(void) { - if (!strncmp(deviceType, TEST_UTIL_TYPE_SOURCE_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) { + char deviceType[UT_KVP_MAX_ELEMENT_SIZE]; + UT_KVP_PROFILE_GET_STRING("hdmicec/type",deviceType); + if (status != UT_KVP_STATUS_SUCCESS ) { + UT_LOG_ERROR("Failed to get the platform type"); + return -1; + } + UT_LOG("Platform type %s",deviceType); + //Check if the device is Source device + if (strncmp(deviceType, TEST_UTIL_TYPE_SOURCE_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) + { + return -1; + } pSuite_stb = UT_add_suite("[L1 HDMICEC STB TestCase]", NULL, NULL); if (NULL == pSuite_stb) { @@ -2263,6 +2274,18 @@ static int test_hdmidec_hal_l1_register_source_tests(void) static int test_hdmidec_hal_l1_register_sink_tests(void) { + char deviceType[UT_KVP_MAX_ELEMENT_SIZE]; + UT_KVP_PROFILE_GET_STRING("hdmicec/type",deviceType); + if (status != UT_KVP_STATUS_SUCCESS ) { + UT_LOG_ERROR("Failed to get the platform type"); + return -1; + } + UT_LOG("Platform type %s",deviceType); + //Check if the device is Sink device. + if(strncmp(deviceType, TEST_UTIL_TYPE_SINK_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) + { + return -1; + } pSuite_panel = UT_add_suite("[L1 HDMICEC PANEL TestCase]", NULL, NULL); if (NULL == pSuite_panel) { @@ -2292,16 +2315,10 @@ static int test_hdmidec_hal_l1_register_sink_tests(void) int test_hdmicec_hal_l1_register( void ) { ut_kvp_status_t status = UT_KVP_STATUS_SUCCESS; - char deviceType[UT_KVP_MAX_ELEMENT_SIZE]; int ret = 0; // Reading Extended enum support form profile file extendedEnumsSupported = UT_KVP_PROFILE_GET_BOOL("hdmicec/features/extendedEnumsSupported"); // Getting device type from profile. - UT_KVP_PROFILE_GET_STRING("hdmicec/type",deviceType); - if (status != UT_KVP_STATUS_SUCCESS ) { - UT_LOG_ERROR("Failed to get the platform type"); - return -1; - } pSuiteCommon = UT_add_suite("[L1 HDMICEC Common TestCase]", NULL, NULL); if ((NULL == pSuiteCommon)) { @@ -2317,20 +2334,19 @@ int test_hdmicec_hal_l1_register( void ) UT_add_test( pSuiteCommon, "setRxCallback_negative", test_hdmicec_hal_l1_setRxCallback_negative); UT_add_test( pSuiteCommon, "setTxCallback_Positive", test_hdmicec_hal_l1_setTxCallback_positive); UT_add_test( pSuiteCommon, "setTxCallback_negative", test_hdmicec_hal_l1_setTxCallback_negative); - //Checking if the HAL under test is source device HAL - ret = test_hdmidec_hal_l1_register_source_tests(); - } - //Checking if the HAL under test is sink device HAL - else if(!strncmp(deviceType, TEST_UTIL_TYPE_SINK_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) { - ret = test_hdmidec_hal_l1_register_sink_tests (); - } - else { - UT_LOG_ERROR("Platform type: %s", deviceType); + //Adding source tests + ret = test_hdmidec_hal_l1_register_source_tests(); + if(ret <0 ) + { + UT_LOG_ERROR("Source test register fialed."); } + //Adding Sink tests + ret = test_hdmidec_hal_l1_register_sink_tests (); if(ret <0 ) - return -1; - else - return 0; + { + UT_LOG_ERROR("Sink test register fialed."); + } + return 0; } /** @} */ // End of HDMI CEC HAL Tests L1 File From 3f320f02ad441f272e20513af3235926432566ea Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Sun, 7 Jul 2024 12:56:52 +0530 Subject: [PATCH 14/20] gh #30 test profile changes --- src/test_l1_hdmi_cec_driver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index a133d69..d16ba2f 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -2238,6 +2238,7 @@ static UT_test_suite_t *pSuite_panel = NULL; static int test_hdmidec_hal_l1_register_source_tests(void) { + ut_kvp_status_t status = UT_KVP_STATUS_SUCCESS; char deviceType[UT_KVP_MAX_ELEMENT_SIZE]; UT_KVP_PROFILE_GET_STRING("hdmicec/type",deviceType); if (status != UT_KVP_STATUS_SUCCESS ) { @@ -2275,6 +2276,7 @@ static int test_hdmidec_hal_l1_register_source_tests(void) static int test_hdmidec_hal_l1_register_sink_tests(void) { char deviceType[UT_KVP_MAX_ELEMENT_SIZE]; + ut_kvp_status_t status = UT_KVP_STATUS_SUCCESS; UT_KVP_PROFILE_GET_STRING("hdmicec/type",deviceType); if (status != UT_KVP_STATUS_SUCCESS ) { UT_LOG_ERROR("Failed to get the platform type"); From 8820aa2b92f536f0306093d8da0020aedbb31392 Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Mon, 8 Jul 2024 06:08:00 +0000 Subject: [PATCH 15/20] gh #30 Test profile changes * Moving Call to register sink and source device to main.c to make the register calls unifrom between l1 and l2 tests * removed unused variables. --- src/main.c | 8 +++++-- src/test_l1_hdmi_cec_driver.c | 45 +++-------------------------------- src/test_register.c | 24 ++++++++++++++++--- 3 files changed, 30 insertions(+), 47 deletions(-) diff --git a/src/main.c b/src/main.c index 5674150..8f1db73 100644 --- a/src/main.c +++ b/src/main.c @@ -65,7 +65,9 @@ #include #include -extern int register_hdmicec_hal_l1_tests( void ); +extern int register_hdmicec_hal_common_l1_tests( void ); +extern int register_hdmicec_hal_source_l1_tests( void ); +extern int register_hdmicec_hal_sink_l1_tests( void ); extern int register_hdmicec_hal_source_l2_tests( void ); extern int register_hdmicec_hal_sink_l2_tests( void ); @@ -115,13 +117,15 @@ int main(int argc, char** argv) return -1; } - register_hdmicec_hal_l1_tests (); + register_hdmicec_hal_common_l1_tests(); if(strncmp(szReturnedString,"source",UT_KVP_MAX_ELEMENT_SIZE) == 0) { + register_hdmicec_hal_source_l1_tests (); register_hdmicec_hal_source_l2_tests (); } if(strncmp(szReturnedString,"sink",UT_KVP_MAX_ELEMENT_SIZE) == 0) { + register_hdmicec_hal_sink_l1_tests (); register_hdmicec_hal_sink_l2_tests (); } #ifdef VCOMPONENT diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index d16ba2f..0bf8c07 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -2236,21 +2236,8 @@ static UT_test_suite_t *pSuite_panel = NULL; * @return int - 0 on success, otherwise failure */ -static int test_hdmidec_hal_l1_register_source_tests(void) +int test_hdmidec_hal_l1_register_source_tests(void) { - ut_kvp_status_t status = UT_KVP_STATUS_SUCCESS; - char deviceType[UT_KVP_MAX_ELEMENT_SIZE]; - UT_KVP_PROFILE_GET_STRING("hdmicec/type",deviceType); - if (status != UT_KVP_STATUS_SUCCESS ) { - UT_LOG_ERROR("Failed to get the platform type"); - return -1; - } - UT_LOG("Platform type %s",deviceType); - //Check if the device is Source device - if (strncmp(deviceType, TEST_UTIL_TYPE_SOURCE_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) - { - return -1; - } pSuite_stb = UT_add_suite("[L1 HDMICEC STB TestCase]", NULL, NULL); if (NULL == pSuite_stb) { @@ -2273,21 +2260,8 @@ static int test_hdmidec_hal_l1_register_source_tests(void) * @return int - 0 on success, otherwise failure */ -static int test_hdmidec_hal_l1_register_sink_tests(void) +int test_hdmidec_hal_l1_register_sink_tests(void) { - char deviceType[UT_KVP_MAX_ELEMENT_SIZE]; - ut_kvp_status_t status = UT_KVP_STATUS_SUCCESS; - UT_KVP_PROFILE_GET_STRING("hdmicec/type",deviceType); - if (status != UT_KVP_STATUS_SUCCESS ) { - UT_LOG_ERROR("Failed to get the platform type"); - return -1; - } - UT_LOG("Platform type %s",deviceType); - //Check if the device is Sink device. - if(strncmp(deviceType, TEST_UTIL_TYPE_SINK_VALUE, UT_KVP_MAX_ELEMENT_SIZE)) - { - return -1; - } pSuite_panel = UT_add_suite("[L1 HDMICEC PANEL TestCase]", NULL, NULL); if (NULL == pSuite_panel) { @@ -2314,10 +2288,8 @@ static int test_hdmidec_hal_l1_register_sink_tests(void) * * @return int - 0 on success, otherwise failure */ -int test_hdmicec_hal_l1_register( void ) +int test_hdmicec_hal_l1_register_common_tests( void ) { - ut_kvp_status_t status = UT_KVP_STATUS_SUCCESS; - int ret = 0; // Reading Extended enum support form profile file extendedEnumsSupported = UT_KVP_PROFILE_GET_BOOL("hdmicec/features/extendedEnumsSupported"); // Getting device type from profile. @@ -2337,17 +2309,6 @@ int test_hdmicec_hal_l1_register( void ) UT_add_test( pSuiteCommon, "setTxCallback_Positive", test_hdmicec_hal_l1_setTxCallback_positive); UT_add_test( pSuiteCommon, "setTxCallback_negative", test_hdmicec_hal_l1_setTxCallback_negative); //Adding source tests - ret = test_hdmidec_hal_l1_register_source_tests(); - if(ret <0 ) - { - UT_LOG_ERROR("Source test register fialed."); - } - //Adding Sink tests - ret = test_hdmidec_hal_l1_register_sink_tests (); - if(ret <0 ) - { - UT_LOG_ERROR("Sink test register fialed."); - } return 0; } diff --git a/src/test_register.c b/src/test_register.c index 8c0d800..fbdf048 100644 --- a/src/test_register.c +++ b/src/test_register.c @@ -61,16 +61,34 @@ /* L1 Testing Functions */ -extern int test_hdmicec_hal_l1_register( void ); +extern int test_hdmicec_hal_l1_register_common_tests( void ); +extern int test_hdmidec_hal_l1_register_sink_tests( void ); +extern int test_hdmidec_hal_l1_register_source_tests( void ); extern int test_register_hdmicec_hal_source_l2_tests( void ); extern int test_register_hdmicec_hal_sink_l2_tests( void ); -int register_hdmicec_hal_l1_tests( void ) +int register_hdmicec_hal_common_l1_tests( void ) { int registerFailed=0; - registerFailed |= test_hdmicec_hal_l1_register(); + registerFailed |= test_hdmicec_hal_l1_register_common_tests(); + + return registerFailed; +} +int register_hdmicec_hal_source_l1_tests( void ) +{ + int registerFailed=0; + + registerFailed |= test_hdmidec_hal_l1_register_source_tests(); + + return registerFailed; +} +int register_hdmicec_hal_sink_l1_tests( void ) +{ + int registerFailed=0; + + registerFailed |= test_hdmidec_hal_l1_register_sink_tests(); return registerFailed; } From a65dc7b604650c5bc546fcf27beb65a9c72e59cc Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Mon, 8 Jul 2024 08:27:27 +0000 Subject: [PATCH 16/20] gh #30 Test profile change * removing unused code --- src/test_l1_hdmi_cec_driver.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index 0bf8c07..e193a6e 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -85,12 +85,6 @@ /// Set the CEC sink (Display device) logical address here #define DEFAULT_LOGICAL_ADDRESS_PANEL 0 -typedef enum _eCecDeviceType { - cecDeviceNone = 0, - cecDeviceSink = 1, - cecDevicesSource = 2, -}eCecDeviceType_t; - static int gTestGroup = 1; static int gTestID = 1; static bool extendedEnumsSupported=false; From 2c2747a30e7163c45e860861ad8768e086c2ee3d Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Fri, 26 Jul 2024 09:45:44 +0530 Subject: [PATCH 17/20] gh #30 Test profile changes * Addressing review comments --- src/test_l1_hdmi_cec_driver.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index 941e90f..a825daf 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -79,9 +79,6 @@ */ #define DEFAULT_LOGICAL_ADDRESS_STB 3 -#define TEST_UTIL_TYPE_SOURCE_VALUE "source" -#define TEST_UTIL_TYPE_SINK_VALUE "sink" - /// Set the CEC sink (Display device) logical address here #define DEFAULT_LOGICAL_ADDRESS_PANEL 0 From 0f224cad82e4183dface3897a00d7effe6fc7d1a Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:00:30 +0000 Subject: [PATCH 18/20] gh #30 Test profile changes * Updating addLogical Address and Remove Logical address according to source/sink device * Cahking physical address value according to source/sink device --- src/test_l1_hdmi_cec_driver.c | 183 ++++++---------------------------- 1 file changed, 30 insertions(+), 153 deletions(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index a825daf..94d69b0 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -546,8 +546,10 @@ void test_hdmicec_hal_l1_getPhysicalAddress_positive( void ) int handle = 0; unsigned int physicalAddress = 0; gTestID = 7; + char typeString[UT_KVP_MAX_ELEMENT_SIZE]; UT_LOG("\n In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); + UT_KVP_PROFILE_GET_STRING("hdmicec/type",typeString); result = HdmiCecOpen (&handle); //if init is failed no need to proceed further @@ -555,8 +557,9 @@ void test_hdmicec_hal_l1_getPhysicalAddress_positive( void ) result = HdmiCecGetPhysicalAddress(handle, &physicalAddress); if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL("HdmiCecGetPhysicalAddress failed"); } - if(physicalAddress > 0xffff){ - UT_FAIL("Invalid physicalAddress "); + if(((strncmp(typeString,"source",UT_KVP_MAX_ELEMENT_SIZE) == 0) && (physicalAddress > 0xffff)) || \ + ((strncmp(typeString,"sink",UT_KVP_MAX_ELEMENT_SIZE) == 0) && (physicalAddress != 0x0000))){ + UT_FAIL("Invalid physicalAddress"); } /*calling hdmicec_close should pass */ @@ -595,7 +598,7 @@ void test_hdmicec_hal_l1_getPhysicalAddress_positive( void ) * * HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE case is updated in separate L1 case */ -void test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_negative( void ) +void test_hdmicec_hal_l1_addLogicalAddress_negative( void ) { int result; int handle = 0; @@ -655,23 +658,28 @@ void test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_negative( void ) * * HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE case is updated in separate L1 case */ -void test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_positive( void ) +void test_hdmicec_hal_l1_addLogicalAddress_positive( void ) { int result; int handle = 0; - int logicalAddress = INT_MAX; + int logicalAddress = DEFAULT_LOGICAL_ADDRESS_PANEL; gTestID = 9; + char typeString[UT_KVP_MAX_ELEMENT_SIZE]; UT_LOG("\n In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); + UT_KVP_PROFILE_GET_STRING("hdmicec/type",typeString); + if(strncmp(typeString,"source",UT_KVP_MAX_ELEMENT_SIZE) == 0) + logicalAddress = DEFAULT_LOGICAL_ADDRESS_STB; result = HdmiCecOpen (&handle); //if init is failed no need to proceed further UT_ASSERT_EQUAL_FATAL(result, HDMI_CEC_IO_SUCCESS ); - logicalAddress = DEFAULT_LOGICAL_ADDRESS_PANEL; result = HdmiCecAddLogicalAddress( handle, logicalAddress ); - if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL("HdmiCecAddLogicalAddress failed"); } - + if (((strncmp(typeString,"sink",UT_KVP_MAX_ELEMENT_SIZE) == 0) && (HDMI_CEC_IO_SUCCESS != result)) || \ + ((strncmp(typeString,"source",UT_KVP_MAX_ELEMENT_SIZE) == 0) && (HDMI_CEC_IO_INVALID_ARGUMENT != result))){ + UT_FAIL("HdmiCecAddLogicalAddress call failed"); + } result = HdmiCecClose( handle ); if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL_FATAL("close failed"); } @@ -679,77 +687,6 @@ void test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_positive( void ) } -/** - * @brief Ensure HdmiCecAddLogicalAddress() returns correct error codes, during all of this API's invocation scenarios - * - * HDMI_CEC_IO_GENERAL_ERROR : is platform specific and cannot be simulated - * - * HdmiCecAddLogicalAddress not supported for source devices. Hence this API doesn't have any positive scenarios for source devices. - * - * **Test Group ID:** Basic: 01@n - * **Test Case ID:** 010@n - * - * **Pre-Conditions:**@n - * None. - * - * **Dependencies:**None@n - * **User Interaction:** None - * - * **Test Procedure:**@n - * |Variation / Step|Description|Test Data|Expected Result|Notes| - * |:--:|---------|----------|--------------|-----| - * |01|Call HdmiCecAddLogicalAddress() - trying to add logical address even before opening the module | handle, logicalAddress | HDMI_CEC_IO_NOT_OPENED| Should Pass | - * |02|Call HdmiCecOpen() - open interface | handle | HDMI_CEC_IO_SUCCESS| Should Pass | - * |03|Call HdmiCecAddLogicalAddress() - call with valid arguments. API is not valid for source devices. | handle, logicalAddress | HDMI_CEC_IO_INVALID_ARGUMENT| Should pass. | - * |04|Call HdmiCecAddLogicalAddress() - call with invalid handle | handle=0, logicalAddress | HDMI_CEC_IO_INVALID_HANDLE| Should Pass | - * |05|Call HdmiCecAddLogicalAddress() - call with invalid logical address | handle, logicalAddress=-1 | HDMI_CEC_IO_INVALID_ARGUMENT| Should Pass | - * |06|Call HdmiCecAddLogicalAddress() - call with invalid logical address. Only supported value is 0 | handle, logicalAddress=0x03 | HDMI_CEC_IO_INVALID_ARGUMENT| Should Pass | - * |07|Call HdmiCecAddLogicalAddress() - call with invalid logical address | handle, logicalAddress=0x0F | HDMI_CEC_IO_INVALID_ARGUMENT| Should Pass | - * |08|Call HdmiCecClose () - close interface | handle=hdmiHandle | HDMI_CEC_IO_SUCCESS| Should Pass | - * |09|Call HdmiCecAddLogicalAddress() - call after module is closed | handle, logicalAddress | HDMI_CEC_IO_NOT_OPENED| Should Pass | - */ -void test_hdmicec_hal_l1_addLogicalAddress_sourceDevice( void ) -{ - int result; - int handle = 0; - int logicalAddress = INT_MAX; - gTestID = 10; - - UT_LOG("\n In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); - result = HdmiCecAddLogicalAddress( handle, logicalAddress ); - CHECK_FOR_EXTENDED_ERROR_CODE(result,HDMI_CEC_IO_NOT_OPENED,HDMI_CEC_IO_INVALID_ARGUMENT); - - result = HdmiCecOpen (&handle); - //if init is failed no need to proceed further - UT_ASSERT_EQUAL_FATAL(result, HDMI_CEC_IO_SUCCESS ); - - result = HdmiCecAddLogicalAddress( 0, logicalAddress ); - CHECK_FOR_EXTENDED_ERROR_CODE(result,HDMI_CEC_IO_INVALID_HANDLE,HDMI_CEC_IO_INVALID_ARGUMENT); - - result = HdmiCecAddLogicalAddress( handle, -1 ); - if (HDMI_CEC_IO_INVALID_ARGUMENT != result) { UT_FAIL("HdmiCecAddLogicalAddress failed"); } - - result = HdmiCecAddLogicalAddress( handle, 0x3 ); - if (HDMI_CEC_IO_INVALID_ARGUMENT != result) { UT_FAIL("HdmiCecAddLogicalAddress failed"); } - - result = HdmiCecAddLogicalAddress( handle, 0xF ); - if (HDMI_CEC_IO_INVALID_ARGUMENT != result) { UT_FAIL("HdmiCecAddLogicalAddress failed"); } - - logicalAddress = DEFAULT_LOGICAL_ADDRESS_STB; - result = HdmiCecAddLogicalAddress( handle, logicalAddress ); - if (HDMI_CEC_IO_INVALID_ARGUMENT != result) { UT_FAIL("HdmiCecAddLogicalAddress failed"); } - - result = HdmiCecClose( handle ); - if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL_FATAL("Close failed"); } - - result = HdmiCecAddLogicalAddress( handle, logicalAddress ); - CHECK_FOR_EXTENDED_ERROR_CODE(result,HDMI_CEC_IO_NOT_OPENED,HDMI_CEC_IO_INVALID_ARGUMENT); - - UT_LOG("\n Exit %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); - -} - - /** * @brief Ensure HdmiCecAddLogicalAddress() returns HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE when tying to add an existing logic address * @@ -825,7 +762,7 @@ void test_hdmicec_hal_l1_addLogicalAddressWithAddressInUse_sinkDevice( void ) * |09|Call HdmiCecClose() - close interface | handle=hdmiHandle | HDMI_CEC_IO_SUCCESS| Should Pass | * |10|Call HdmiCecRemoveLogicalAddress() - call after module is closed | handle, logicalAddress | HDMI_CEC_IO_NOT_OPENED| Should Pass | */ -void test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_negative( void ) +void test_hdmicec_hal_l1_removeLogicalAddress_negative( void ) { int result; int handle = 0; @@ -893,21 +830,27 @@ void test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_negative( void ) * |04|Call HdmiCecClose() - close interface | handle=hdmiHandle | HDMI_CEC_IO_SUCCESS| Should Pass | * */ -void test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_positive( void ) +void test_hdmicec_hal_l1_removeLogicalAddress_positive( void ) { int result; int handle = 0; int logicalAddress = DEFAULT_LOGICAL_ADDRESS_PANEL; gTestID = 13; + char typeString[UT_KVP_MAX_ELEMENT_SIZE]; UT_LOG("\n In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); - + UT_KVP_PROFILE_GET_STRING("hdmicec/type",typeString); + if(strncmp(typeString,"source",UT_KVP_MAX_ELEMENT_SIZE) == 0) + logicalAddress = DEFAULT_LOGICAL_ADDRESS_STB; result = HdmiCecOpen(&handle); //if init is failed no need to proceed further UT_ASSERT_EQUAL_FATAL( result, HDMI_CEC_IO_SUCCESS ); //check need to remove/add fatal result = HdmiCecAddLogicalAddress( handle, logicalAddress ); - if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL("HdmiCecAddLogicalAddress failed"); } + if (((strncmp(typeString,"sink",UT_KVP_MAX_ELEMENT_SIZE) == 0) && (HDMI_CEC_IO_SUCCESS != result)) || \ + ((strncmp(typeString,"source",UT_KVP_MAX_ELEMENT_SIZE) == 0) && (HDMI_CEC_IO_INVALID_ARGUMENT != result))){ + UT_FAIL("HdmiCecRemoveLogicalAddress call failed"); + } result = HdmiCecRemoveLogicalAddress( handle, logicalAddress ); if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL("HdmiCecRemoveLogicalAddress failed"); } @@ -920,72 +863,6 @@ void test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_positive( void ) } -/** - * @brief Ensure HdmiCecRemoveLogicalAddress() returns correct error codes, during all of this API's invocation scenarios - * This test case is only applicable for source devices - * - * HDMI_CEC_IO_GENERAL_ERROR : is platform specific and cannot be simulated - * - * **Test Group ID:** Basic: 01@n - * **Test Case ID:** 014@n - * - * **Pre-Conditions:**@n - * None. - * - * **Dependencies:** None@n - * **User Interaction:** None - * - * **Test Procedure:**@n - * |Variation / Step|Description|Test Data|Expected Result|Notes| - * |:--:|---------|----------|--------------|-----| - * |01|Call HdmiCecRemoveLogicalAddress() - trying to remove logical address even before opening the module | handle, logicalAddress | HDMI_CEC_IO_NOT_OPENED| Should Pass | - * |02|Call HdmiCecOpen() - open interface | handle | HDMI_CEC_IO_SUCCESS| Should Pass | - * |03|Call HdmiCecRemoveLogicalAddress() - remove API is not applicable for source devices.| handle, logicalAddress | HDMI_CEC_IO_INVALID_ARGUMENT| Should pass| - * |04|Call HdmiCecRemoveLogicalAddress() - call with invalid handle | handle=0, logicalAddress | HDMI_CEC_IO_INVALID_HANDLE| Should Pass | - * |05|Call HdmiCecRemoveLogicalAddress() - call with invalid logical address | handle, logicalAddress=0xF | HDMI_CEC_IO_INVALID_ARGUMENT| Should Pass | - * |06|Call HdmiCecClose() - close interface | handle=hdmiHandle | HDMI_CEC_IO_SUCCESS| Should Pass | - * |07|Call HdmiCecRemoveLogicalAddress() - call after module is closed | handle, logicalAddress | HDMI_CEC_IO_NOT_OPENED| Should Pass | - */ -void test_hdmicec_hal_l1_removeLogicalAddress_sourceDevice( void ) -{ - int result; - int handle = 0; - int logicalAddress = DEFAULT_LOGICAL_ADDRESS_STB; - gTestID = 14; - - UT_LOG("\n In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); - - result = HdmiCecRemoveLogicalAddress(handle, logicalAddress ); - CHECK_FOR_EXTENDED_ERROR_CODE(result,HDMI_CEC_IO_NOT_OPENED,HDMI_CEC_IO_INVALID_ARGUMENT); - - result = HdmiCecOpen(&handle); - //if init is failed no need to proceed further - UT_ASSERT_EQUAL_FATAL( result, HDMI_CEC_IO_SUCCESS ); - - result = HdmiCecRemoveLogicalAddress( handle, logicalAddress ); - if (HDMI_CEC_IO_INVALID_ARGUMENT != result) { UT_FAIL("HdmiCecRemoveLogicalAddress failed"); } - - result = HdmiCecRemoveLogicalAddress( 0, logicalAddress ); - CHECK_FOR_EXTENDED_ERROR_CODE(result,HDMI_CEC_IO_INVALID_HANDLE,HDMI_CEC_IO_INVALID_ARGUMENT); - - logicalAddress = 0xF; - result = HdmiCecRemoveLogicalAddress( handle, 0xF ); - if (HDMI_CEC_IO_INVALID_ARGUMENT != result) { UT_FAIL("HdmiCecRemoveLogicalAddress failed"); } - - logicalAddress = -1; - result = HdmiCecRemoveLogicalAddress( handle, -1 ); - if (HDMI_CEC_IO_INVALID_ARGUMENT != result) { UT_FAIL("HdmiCecRemoveLogicalAddress failed"); } - - result = HdmiCecClose(handle); - if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL_FATAL("close failed"); } - - result = HdmiCecRemoveLogicalAddress(handle, logicalAddress ); - CHECK_FOR_EXTENDED_ERROR_CODE(result,HDMI_CEC_IO_NOT_OPENED,HDMI_CEC_IO_INVALID_ARGUMENT); - - UT_LOG("\n Exit %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); - -} - /** * @brief Validate negative scenarios for HdmiCecGetLogicalAddress() @@ -2254,10 +2131,6 @@ int test_hdmidec_hal_l1_register_sink_tests(void) { return -1; } - UT_add_test( pSuite_panel, "addLogicalAddressSink_Positive", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_positive); - UT_add_test( pSuite_panel, "addLogicalAddressSink_negative", test_hdmicec_hal_l1_addLogicalAddress_sinkDevice_negative); - UT_add_test( pSuite_panel, "removeLogicalAddressSink_Positive", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_positive); - UT_add_test( pSuite_panel, "removeLogicalAddressSink_negative", test_hdmicec_hal_l1_removeLogicalAddress_sinkDevice_negative); UT_add_test( pSuite_panel, "getLogicalAddressSink_Positive", test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_positive); UT_add_test( pSuite_panel, "getLogicalAddressSink_negative", test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_negative); UT_add_test( pSuite_panel, "TxSink_Positive", test_hdmicec_hal_l1_hdmiCecTx_sinkDevice_positive); @@ -2289,6 +2162,10 @@ int test_hdmicec_hal_l1_register_common_tests( void ) UT_add_test( pSuiteCommon, "getPhysicalAddress_negative", test_hdmicec_hal_l1_getPhysicalAddress_negative); UT_add_test( pSuiteCommon, "setRxCallback_Positive", test_hdmicec_hal_l1_setRxCallback_positive); UT_add_test( pSuiteCommon, "setRxCallback_negative", test_hdmicec_hal_l1_setRxCallback_negative); + UT_add_test( pSuiteCommon, "addLogicalAddress_Positive", test_hdmicec_hal_l1_addLogicalAddress_positive); + UT_add_test( pSuiteCommon, "addLogicalAddress_negative", test_hdmicec_hal_l1_addLogicalAddress_negative); + UT_add_test( pSuiteCommon, "removeLogicalAddress_Positive", test_hdmicec_hal_l1_removeLogicalAddress_positive); + UT_add_test( pSuiteCommon, "removeLogicalAddress_negative", test_hdmicec_hal_l1_removeLogicalAddress_negative); return 0; } From a1f526d2afdc8fcf71624d2637c28352f88a6f83 Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Thu, 1 Aug 2024 05:18:49 +0000 Subject: [PATCH 19/20] gh #30 Test profile changes * Addressing review comments --- src/test_l1_hdmi_cec_driver.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index 94d69b0..959b4a5 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -557,7 +557,7 @@ void test_hdmicec_hal_l1_getPhysicalAddress_positive( void ) result = HdmiCecGetPhysicalAddress(handle, &physicalAddress); if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL("HdmiCecGetPhysicalAddress failed"); } - if(((strncmp(typeString,"source",UT_KVP_MAX_ELEMENT_SIZE) == 0) && (physicalAddress > 0xffff)) || \ + if(((strncmp(typeString,"source",UT_KVP_MAX_ELEMENT_SIZE) == 0) && ((physicalAddress >= 0xffff) || (physicalAddress <= 0x0000) )) || \ ((strncmp(typeString,"sink",UT_KVP_MAX_ELEMENT_SIZE) == 0) && (physicalAddress != 0x0000))){ UT_FAIL("Invalid physicalAddress"); } @@ -986,18 +986,12 @@ void test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_positive ( void ) //if init is failed no need to proceed further UT_ASSERT_EQUAL_FATAL( result, HDMI_CEC_IO_SUCCESS ); - result = HdmiCecAddLogicalAddress( handle, logicalAddress ); - if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL("HdmiCecAddLogicalAddress failed"); } - - result = HdmiCecGetLogicalAddress(handle, &logicalAddressCrossCheck); + result = HdmiCecGetLogicalAddress(handle, &logicalAddress); if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL("HdmiCecGetLogicalAddress failed"); } - if(logicalAddress != logicalAddressCrossCheck){ - UT_FAIL("logicalAddress and logicalAddressCrossCheck are not same"); + if(logicalAddress != 0x0f){ + UT_FAIL("Invalid logicalAddress"); } - result = HdmiCecRemoveLogicalAddress( handle, logicalAddress ); - if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL("HdmiCecRemoveLogicalAddress failed"); } - /*calling hdmicec_close should pass */ result = HdmiCecClose (handle); if (HDMI_CEC_IO_SUCCESS != result) { UT_FAIL_FATAL("HdmiCecClose failed"); } From e8255ce787d743a6a8327b2b1e46a2f6f3d60710 Mon Sep 17 00:00:00 2001 From: akhilbhas <13413713+akhilbhas@users.noreply.github.com> Date: Thu, 1 Aug 2024 05:21:37 +0000 Subject: [PATCH 20/20] gh #30 test profile changes * Removing compiler warnings --- src/test_l1_hdmi_cec_driver.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test_l1_hdmi_cec_driver.c b/src/test_l1_hdmi_cec_driver.c index 959b4a5..dbe0a74 100644 --- a/src/test_l1_hdmi_cec_driver.c +++ b/src/test_l1_hdmi_cec_driver.c @@ -977,7 +977,6 @@ void test_hdmicec_hal_l1_getLogicalAddress_sinkDevice_positive ( void ) int result; int handle = 0; int logicalAddress = 0; - int logicalAddressCrossCheck = INT_MIN; gTestID = 16; UT_LOG("\n In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID);