Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh #56 hdmi-cec-source: L3 Test case Development #57

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9847182
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Sep 19, 2024
7728b3d
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Sep 25, 2024
0e99335
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Sep 26, 2024
1460121
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Sep 26, 2024
a16ec2f
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Sep 27, 2024
b7a59ae
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Sep 27, 2024
66daf00
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Sep 27, 2024
1a08094
Bumped CHANGELOG.md - 1.3.3
hari22yuva Nov 7, 2024
e276f85
Merge branch 'release/1.3.3'
hari22yuva Nov 7, 2024
49ee806
Merge pull request #62 from rdkcentral/main
hgfell683 Dec 4, 2024
4231a83
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Dec 5, 2024
9d74a68
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Dec 5, 2024
9af45bb
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Dec 9, 2024
3e678cd
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Dec 10, 2024
5027d3a
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Dec 10, 2024
167e704
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Dec 10, 2024
27d32ce
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Dec 10, 2024
9a085ab
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Dec 12, 2024
c093bda
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Dec 12, 2024
ba694ba
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Dec 16, 2024
88d5659
gh #56 hdmi-cec-source: L3 Test case Development
hgfell683 Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [1.3.3](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/compare/1.3.2...1.3.3)

- gh #61 l1 logic update fix [`#60`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/pull/60)

#### [1.3.2](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/compare/1.3.1...1.3.2)

> 5 November 2024

- gh #58 Issue fix L1 and L2 [`#59`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/pull/59)
- gh #41 Support State commands (AddDevice, RemoveDevice, PrintStatus) [`#46`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/pull/46)
- Fixed #50 : updated activate & added test_helper [`#50`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/issues/50)
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ NC="\e[39m"
# When the major version changes in the ut-core, what that signals is that the testings will have to be upgraded to support that version
# Therefore in that case it warns you but doesnt' chnage to that version, which could cause your tests to break.
# Change this to upgrade your UT-Core Major versions. Non ABI Changes 1.x.x are supported, between major revisions
UT_PROJECT_MAJOR_VERSION="3."
UT_PROJECT_MAJOR_VERSION="4."

# Clone the Unit Test Requirements
[email protected]:rdkcentral/ut-core.git
Expand Down
60 changes: 60 additions & 0 deletions docs/pages/hdmi-cec-source_L3_Low-level_TestSpec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# HDMICEC Source L3 Low Level Test Specification and Procedure Documentation

## Table of Contents

- [Overview](#overview)
- [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations)
- [References](#references)
- [Level 3 Test cases High Level Overview](#level-3-test-cases-high-level-overview)
- [Level 3 Python Test Cases High Level Overview](#level-3-python-test-cases-high-level-overview)

## Overview

This document describes the L3 Low Level Test Specification and Procedure Documentation for the Device Settings Video Port module.

### Acronyms, Terms and Abbreviations

- `HAL` \- Hardware Abstraction Layer, may include some common components
- `UT` \- Unit Test(s)
- `OEM` \- Original Equipment Manufacture
- `SoC` \- System on a Chip
- `HDMI`\- High-Definition Multimedia Interface
- `HDCP`\- High-bandwidth Digital Content Protection
- `HDR` \- High Dynamic Range
- `HLG` \- Hybrid Log-Gamma
- `SDR` \- Standard Dynamic Range
- `Y` \- yes supported
- `NA` \- Not Supported

### References

- The interface of the test is available here: [Hdmicec HAL header](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/include/hdmi_cec_driver.h)

- The Hdmicec Hal Spec document: [Hdmicec HAL Spec](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/docs/pages/hdmi-cec_halSpec.md)

## Level 3 Test Cases High Level Overview

|#|Test-case|Description|HAL APIs|
|-|---------|-----------|--------|
|1|Validate logical address|Connect port, and validate that the connected logical address is 4, 8, or 11.| `HdmiCecOpen()`,`HdmiCecGetLogicalAddress()` |
|2|Connect too many devices|Connect five other source devices to sink device using raft, before connecting the testing device. should return HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE as there is not a valid logical address.| `HdmiCecOpen()` |
|3|Rapid connection|Rapidly connect and disconnect HDMI connection in 100ms connection and 100ms disconnection cycle.| `HdmiCecOpen()` |
|4|Connect Physical Address | Enable a sink device connected to the DUT first to get the valid physical address allocated through the HAL function. The physical address should be 1.0.0.0 | `HdmiCecGetPhysicalAddress()` |
|5|Connect Physical Address with switch| EVerify the physical addresses allocated by connecting a source and sink device through an HDMI switch. The physical address should 1.1.0.0 | `HdmiCecGetPhysicalAddress()` |
|6|Reconnect physical address| Connect a sink device to the source device, get the physical address. Disconnect the sink device and attempt to get the physical address again | `HdmiCecGetPhysicalAddress()` |
|7|Transmit to invalid address|Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for a logical address that doesn't exist after the connected device is disconnected. Result should return HDMI_CEC_IO_SENT_BUT_NOT_ACKD.| `HdmiCecTx()` |
|8|Transmit after disconnection|Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for supported CEC commands (as per 1.4b HDMI CEC spec) after the connected device is disconnected. Result should return HDMI_CEC_IO_SENT_BUT_NOT_ACKD.| `HdmiCecTx()` |
|9|Transmit while connected|Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly. The result should return HDMI_CEC_IO_SENT_AND_ACKD.| `HdmiCecTx()` |
|10|Transmit to all|Broadcast a supported CEC Command to all the devices connected to the network without any error. The result should return HDMI_CEC_IO_SENT_AND_ACKD| `HdmiCecTx()` |
|11|Transmit to standby.|Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitoring the behavior of the connected device accordingly. The result should return HDMI_CEC_IO_SENT_AND_ACKD.| `HdmiCecTx()` |
|12|Send command and receive response|Transmit a CEC Command that expects a response (Eg. GetCECVersion) to a connected device and see the response is received correctly. Set the Rx Callback before sending the data. Validate the received CEC Version.| `HdmiCecSetRxCallback()` `HdmiCecTx()` |
|13|Receive command and send response|Transmit a CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (DUT TV here)| `HdmiCecSetRxCallback()`|
|14|Transmit OSD Command|Transmit an OSD CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (DUT TV here). Make the OSD String to max length| `HdmiCecSetRxCallback()`|
|15|Transmit OSD Command continuously|Transmit an OSD CEC command from the connected devices continuously for 30 seconds changing the patterns in the payload and considering the Acknowledgement and responses are received correctly from the host device (DUT TV here). Make the OSD String to max length| `HdmiCecSetRxCallback()`|
|16|Transmit logical 0|Set the Logical address to 0 on DUT and make sure that it doesn't receive the messages sent to devices with different logical address.| `HdmiCecSetRxCallback()`|
|17|Hotplug event|Generate a Hotplug event by disconnecting the device connected to the HDMI port of the Source Platform. Validating whether the CEC Transmission (use Polling command) works when the HDMI port is disconnected should result in ACK not being received while the TX still works as expected.| `HdmiCecTx()`|
|18|Hotplug event not-acked|Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgment using HAL Interface and check the behaviour. The Tx command should succeed, but the message should not be Acknowledged.| `HdmiCecTx()`|
|19|Hardware bus failure|Observe the behaviour when the CEC line is pulled high during the CEC Transmission using a CEC Adaptor that provision to keep the CEC line pulled high |`HdmiCecTx()`|
|20|Hardware bus overload|Overload the CEC bus with too many messages (by connecting more devices in the network) and observe the behaviour. |`HdmiCecTx()`|

## Level 3 Python Test Cases High Level Overview
96 changes: 96 additions & 0 deletions host/tests/hdmiCEC_Source_L3_Tests/hdmiCECSourceHelperClass.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env python3
#** *****************************************************************************
# *
# * 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.
# *
#* ******************************************************************************

import os
import sys

dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(dir_path, "../../"))
sys.path.append(os.path.join(dir_path, "../"))

from raft.framework.plugins.ut_raft.configRead import ConfigRead
from raft.framework.plugins.ut_raft.utUserResponse import utUserResponse
from raft.framework.plugins.ut_raft import utHelperClass
from raft.framework.core.logModule import logModule
from classes.hdmiCEC import hdmiCECClass

class hdmiCECHelperClass(utHelperClass):

"""
Helper class for managing HDMI CEC tests.
This class extends the `utHelperClass` and provides functionality for preparing
and cleaning up HDMI CEC tests.
"""

def __init__(self, testName:str, qcId:str, log:logModule=None ):
"""
Initializes the test helper class with test name, setup configuration, and session management.
Args:
testName (str): Name of the test.
qcId (str): Quality Control (QC) ID of the test.
log (logModule, optional): Parent log module instance for logging. Defaults to None.
"""
self.testName = ""
self.moduleName = "hdmicec"
self.rackDevice = "dut"

# Initialize the base helper class
super().__init__(testName, qcId, log)

# Open Sessions hal test
self.hal_session = self.dut.getConsoleSession("ssh_hal_test")

deviceTestSetup = self.cpe.get("test")

# Create user response Class
self.testUserResponse = utUserResponse()

# Get path to device profile file
self.moduleConfigProfileFile = os.path.join(dir_path, deviceTestSetup.get("profile"))

self.targetWorkspace = self.cpe.get("target_directory")
self.targetWorkspace = os.path.join(self.targetWorkspace, self.moduleName)

self.testCECCommands = os.path.join(dir_path, "hdmiCECTestCommands.yml")
hdmicec = ConfigRead(self.testCECCommands, self.moduleName)
self.cecCommands = hdmicec.fields.get(self.testName)

def testPrepareFunction(self):
"""
Cleans up the test environment by deinitializing the HDMI CEC instance.
Args:
powerOff (bool, optional): Flag to indicate whether to power off the device. Defaults to True.
Returns:
bool
"""

# Create the hdmiCEC class
self.testhdmiCEC = hdmiCECClass(self.moduleConfigProfileFile, self.hal_session, self.targetWorkspace)

return True

def testEndFunction(self, powerOff=True):

super().testEndFunction(powerOff)
# Clean up the hdmiCEC instance
del self.testhdmiCEC
94 changes: 94 additions & 0 deletions host/tests/hdmiCEC_Source_L3_Tests/hdmiCECSourceTestCommands.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#** *****************************************************************************
# *
# * 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.
# *
#* ******************************************************************************

hdmicec:
test01_TransmitCECCommands:
- command: "0x82" # Active Soruce
payload: ["0x00", "0x00"]
type: "Broadcast"
- command: "0x90" # "Report power status
payload: ["0x00"]
type: "Direct"
response: null
- command: "0x47" # Give OSD Name
payload: ['0x52', '0x44', '0x4b', '0x20', '0x56', '0x54', '0x53', '0x20', '0x44', '0x65', '0x76', '0x69', '0x63', '0x65']
type: "Direct"
response: null
test02_ReceiveCECCommands:
- command: "0x04" # Image View on
payload:
type: "Direct"
response: null
- command: "0x85" # Request Active source
payload:
type: "Broadcast"
response:
type: "Broadcast"
command: "0x82"
update_payload: true
payload: ["0x00", "0x00"]
description: "Active Soruce"
- command: "0x91" # Get Menu Language
payload:
type: "Direct"
response:
type: "Broadcast"
command: "0x32"
update_payload: false
payload: ["0x65", "0x6E", "0x67"]
description: "Set Menu Language"
- command: "0x8C" # Give Vendor ID
payload:
type: "Direct"
response:
type: "Broadcast"
command: "0x87"
update_payload: false
payload: ["0x00", "0x00","0x01"]
description: "Device Vendor Id"
- command: "0x8F" # Give power status
payload:
type: "Direct"
response:
type: "Direct"
command: "0x90"
update_payload: false
payload: ["0x00"]
description: "Report power status"
- command: "0x9F" # Get CEC version
payload:
type: "Direct"
response:
type: "Direct"
command: "0x9E"
update_payload: false
payload: ["0x05"]
description: "Device request for CEC version"
- command: "0x46" # Give OSD Name
payload:
type: "Direct"
response:
type: "Direct"
command: "0x47"
update_payload: false
payload: ['0x52', '0x44', '0x4b', '0x20', '0x56', '0x54', '0x53', '0x20', '0x44', '0x65', '0x76', '0x69', '0x63', '0x65']
description: "Device request OSD name"
73 changes: 73 additions & 0 deletions host/tests/hdmiCEC_Source_L3_Tests/hdmiCECSource_L3_Runall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env python3
#** *****************************************************************************
# *
# * 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.
# *
#* ******************************************************************************

import os
import sys
import importlib
from pathlib import Path

dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(dir_path))
sys.path.append(os.path.join(dir_path, "../"))
sys.path.append(os.path.join(dir_path, "../raft"))

from raft.framework.core.logModule import logModule

def Runall_L3():
skipTests = []
# Summery log for all the tests
hdmiCECSummerLog = logModule("hdmiCEC_Sink", level=logModule.INFO)

testDirectory = Path(dir_path)

# Find all test modules in the directory
test_modules = sorted(testDirectory.glob("hdmiCEC_test*.py"))

# Run each test by dynamically importing and instantiating
for test_module_path in test_modules:
# Construct module name from file name, excluding .py extension
module_name = test_module_path.stem
skip = False
for skipTest in skipTests:
if skipTest in module_name:
skip = True
break
if skip:
continue
try:
# Dynamically import the module
module = importlib.import_module(module_name)

# Dynamically access the test class from the module
# Assuming each test file has only one class named the same as the module
test_class = getattr(module, module_name)

# Instantiate and run the test
test_instance = test_class(hdmiCECSummerLog)
test_instance.run(False)

except (ImportError, AttributeError) as e:
hdmiCECSummerLog.error(f"Failed to import {module_name}: {e}")

if __name__ == '__main__':
Runall_L3()
Loading