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

dsFPD L3 Python update #250

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ classDiagram

- **testSetupConfig.yaml**
- This configuration file contains the list of requirements for tests to execute. Eg: Copying the streams, setting environment variables etc.
- Example configuration file [dsFPD_L3_testSetup.yml](../../../host/tests/dsFPD_L3_Tests/dsFPD_L3_testSetup.yml)
- Example configuration file [dsFPD_L3_testSetup.yml](../../../host/tests/L3_TestCases/dsFPD/dsFPD_L3_testSetup.yml)

- **testSuite.yaml**
- **testConfig.yaml**
- This configuration file contains the list of menu items for C/C++ L3 test running on `DUT`
- Example configuration file [dsFPD_test_suite.yml](../../../host/tests/dsClasses/dsFPD_test_suite.yml)
- Example configuration file [dsFPD_testConfig.yml](../../../host/tests/dsClasses/dsFPD_testConfig.yml)
21 changes: 11 additions & 10 deletions docs/pages/dsFPD/ds-front-panel-display_L3_TestProcedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [dsFPD_test03_SetVerifyLEDIndicatorsBlink.py](#dsfpd_test03_setverifyledindicatorsblinkpy)
- [dsFPD_test04_SetVerifyLEDIndicatorsColor.py](#dsfpd_test04_setverifyledindicatorscolorpy)
- [dsFPD_test05_SetVerifyFPPattern.py](#dsfpd_test05_setverifyfppatternpy)
- [dsFPD_L3_Runall.py](#dsfpd_l3_runallpy)

## Acronyms, Terms and Abbreviations

Expand Down Expand Up @@ -101,15 +102,7 @@ dsFPD:
assets:
device:
defaults: &defaults
artifacts:
- "<PATH>/bin/hal_test"
- "<PATH>/bin/libut_control.so"
- "<PATH>/profiles/source/Source_FPD.yaml"
- "<PATH>/profiles/sink/Sink_FPD.yaml"
Sumip98 marked this conversation as resolved.
Show resolved Hide resolved
- "<PATH>/bin/run.sh"
execute:
- "chmod +x <PATH>/hal_test"
- "chmod +x <PATH>/run.sh"
test01_EnableDisableAndVerifyLEDIndicators:
<<: *defaults
test02_SetVerifyLEDIndicatorsBrightness:
Expand All @@ -124,7 +117,7 @@ dsFPD:

#### Test Suite Configuration

Example Test Setup configuration File: [dsFPD_test_suite.yml](../../../host/tests/dsClasses/dsFPD_test_suite.yml)
Example Test Setup configuration File: [dsFPD_testConfig.yml](../../../host/tests/dsClasses/dsFPD_testConfig.yml)

Update the execute command according to the device path where `HAL` binaries are copied.

Expand Down Expand Up @@ -472,4 +465,12 @@ Success Criteria

- Test Conclusion:

Upon receiving user responses for all indicators, the test will conclude and present a final result: PASS or FAIL based on the user inputs throughout the test execution.
Upon receiving user responses for all indicators, the test will conclude and present a final result: PASS or FAIL based on the user inputs throughout the test execution.

### dsFPD_L3_Runall.py

This python file runs all the tests supported

```bash
python dsFPD_L3_Runall.py --config </PATH>/ut/host/tests/configs/example_rack_config.yml --deviceConfig </PATH>/ut/host/tests/configs/deviceConfig.yml
```
14 changes: 6 additions & 8 deletions host/tests/L3_TestCases/dsFPD/dsFPDHelperClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,18 @@ def __init__(self, testName:str, qcId:str, log:logModule=None ):

thanushreevani marked this conversation as resolved.
Show resolved Hide resolved
thanushreevani marked this conversation as resolved.
Show resolved Hide resolved
# Load test setup configuration
thanushreevani marked this conversation as resolved.
Show resolved Hide resolved
self.testSetup = ConfigRead(self.testSetupPath, self.moduleName)
#open Hal Seesion
#open Hal Session
self.hal_session = self.dut.getConsoleSession("ssh_hal_test")
self.deviceTestSetup = self.cpe.get("test")

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

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

self.deviceDownloadPath = self.cpe.get("target_directory")
self.targetPath = self.cpe.get("target_directory")
Sumip98 marked this conversation as resolved.
Show resolved Hide resolved
self.targetPath = os.path.join(self.targetPath, self.moduleName)

#TODO: Current version supports only manual verification.
def testVerifyIndicator(self, indicator, state, manual=False):
Expand Down Expand Up @@ -95,10 +97,6 @@ def testRunPrerequisites(self):

test = self.testSetup.get("assets").get("device").get(self.testName)
thanushreevani marked this conversation as resolved.
Show resolved Hide resolved

# Download test artifacts to device
url = test.get("artifacts")
if url is not None:
self.downloadToDevice(url, self.deviceDownloadPath, self.rackDevice)
# Run commands as part of test prerequisites
cmds = test.get("execute")
if cmds is not None:
Expand All @@ -120,7 +118,7 @@ def testPrepareFunction(self):

self.testRunPrerequisites()
# Create the dsFPD class
self.testdsFPD = dsFPDClass(self.deviceProfile, self.hal_session, self.deviceDownloadPath)
self.testdsFPD = dsFPDClass(self.moduleConfigProfileFile, self.hal_session, self.targetPath)

return True

Expand Down
65 changes: 65 additions & 0 deletions host/tests/L3_TestCases/dsFPD/dsFPD_L3_Runall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/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(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():
# Summery log for all the tests
dsFPDSummeryLog = logModule("dsFPDSummeryLog", level=logModule.INFO)

testDirectory = Path(dir_path)

# Find all test modules in the directory
test_modules = sorted(testDirectory.glob("dsFPD_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
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(dsFPDSummeryLog)
test_instance.run(False)

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

if __name__ == '__main__':
Runall_L3()
8 changes: 0 additions & 8 deletions host/tests/L3_TestCases/dsFPD/dsFPD_L3_testSetup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@ dsFPD: # Prefix must always exist
assets:
device:
defaults: &defaults
artifacts:
- "<PATH>/bin/hal_test"
- "<PATH>/bin/libut_control.so"
- "<PATH>/profiles/source/Source_FPD.yaml"
- "<PATH>/profiles/sink/Sink_FPD.yaml"
- "<PATH>/bin/run.sh"
execute:
thanushreevani marked this conversation as resolved.
Show resolved Hide resolved
- "chmod +x <PATH>/hal_test"
- "chmod +x <PATH>/run.sh"
test01_EnableDisableAndVerifyLEDIndicators:
<<: *defaults
test02_SetVerifyLEDIndicatorsBrightness:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@
sys.path.append(os.path.join(dir_path, "../../"))

from L3_TestCases.dsFPD.dsFPDHelperClass import dsFPDHelperClass
from raft.framework.core.logModule import logModule
from dsClasses.dsFPD import dsFPDState


class dsFPD_test01_EnableDisableAndVerifyLEDIndicators(dsFPDHelperClass):

def __init__(self):
def __init__(self,log:logModule=None):
"""
Initializes the dsFPD_test01_EnableDisableAndVerifyLEDIndicators test .

Args:
None.
"""
self.testName = "test01_EnableDisableAndVerifyLEDIndicators"
super().__init__(self.testName, '1')
self.qcID = '1'
super().__init__(self.testName, self.qcID,log)



Expand All @@ -52,8 +54,6 @@ def testFunction(self):
bool: final result of the test.
"""

self.log.testStart(self.testName, '1')

# initialize the dsFPD module
self.testdsFPD.initialise()

Expand Down Expand Up @@ -91,5 +91,7 @@ def testFunction(self):
return result

if __name__ == '__main__':
test = dsFPD_test01_EnableDisableAndVerifyLEDIndicators()
summerLogName = os.path.splitext(os.path.basename(__file__))[0] + "_summery"
summeryLog = logModule(summerLogName, level=logModule.INFO)
test = dsFPD_test01_EnableDisableAndVerifyLEDIndicators(summeryLog)
test.run(False)
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@
sys.path.append(os.path.join(dir_path, "../../"))

from L3_TestCases.dsFPD.dsFPDHelperClass import dsFPDHelperClass
from raft.framework.core.logModule import logModule
from dsClasses.dsFPD import dsFPDState


class dsFPD_test02_SetVerifyLEDIndicatorsBrightness(dsFPDHelperClass):

def __init__(self):
def __init__(self,log:logModule=None):
"""
Initializes the test02_SetVerifyLEDIndicatorsBrightness test .

Args:
None.
"""
self.testName = "test02_SetVerifyLEDIndicatorsBrightness"
super().__init__(self.testName, '2')
self.qcID = '2'
super().__init__(self.testName, self.qcID,log)


#TODO: Current version supports only manual verification.
Expand Down Expand Up @@ -70,8 +72,6 @@ def testFunction(self):
bool: final result of the test.
"""

self.log.testStart(self.testName, '2')

# initialize the dsFPD module
self.testdsFPD.initialise()

Expand Down Expand Up @@ -130,5 +130,7 @@ def testFunction(self):
return result

if __name__ == '__main__':
test = dsFPD_test02_SetVerifyLEDIndicatorsBrightness()
summerLogName = os.path.splitext(os.path.basename(__file__))[0] + "_summery"
summeryLog = logModule(summerLogName, level=logModule.INFO)
test = dsFPD_test02_SetVerifyLEDIndicatorsBrightness(summeryLog)
test.run(False)
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
sys.path.append(os.path.join(dir_path, "../../"))

from L3_TestCases.dsFPD.dsFPDHelperClass import dsFPDHelperClass
from raft.framework.core.logModule import logModule
from dsClasses.dsFPD import dsFPDState


class dsFPD_test03_SetVerifyLEDIndicatorsBlink(dsFPDHelperClass):

def __init__(self):
def __init__(self,log:logModule=None):
"""
Initializes the test03_SetVerifyLEDIndicatorsBlink test .

Expand All @@ -43,7 +44,8 @@ def __init__(self):
self.testName = "test03_SetVerifyLEDIndicatorsBlink"
self.duration = 1000
self.iteration = 5
super().__init__(self.testName, '3')
self.qcID = '3'
super().__init__(self.testName, self.qcID,log)


#TODO: Current version supports only manual verification.
Expand Down Expand Up @@ -71,8 +73,6 @@ def testFunction(self):
bool: final result of the test.
"""

self.log.testStart(self.testName, '3')

# initialize the dsFPD module
self.testdsFPD.initialise()

Expand Down Expand Up @@ -100,5 +100,7 @@ def testFunction(self):
return result

if __name__ == '__main__':
test = dsFPD_test03_SetVerifyLEDIndicatorsBlink()
summerLogName = os.path.splitext(os.path.basename(__file__))[0] + "_summery"
summeryLog = logModule(summerLogName, level=logModule.INFO)
test = dsFPD_test03_SetVerifyLEDIndicatorsBlink(summeryLog)
test.run(False)
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@
sys.path.append(os.path.join(dir_path, "../../"))

from L3_TestCases.dsFPD.dsFPDHelperClass import dsFPDHelperClass
from raft.framework.core.logModule import logModule
from dsClasses.dsFPD import dsFPDState


class dsFPD_test04_SetVerifyLEDIndicatorsColor(dsFPDHelperClass):

def __init__(self):
def __init__(self,log:logModule=None):
"""
Initializes the test04_SetVerifyLEDIndicatorsColor test .

Args:
None.
"""
self.testName = "test04_SetVerifyLEDIndicatorsColor"
super().__init__(self.testName, '4')
self.qcID = '4'
super().__init__(self.testName, self.qcID,log)


def testVerifyIndicatorColor(self, indicator, color, manual=False):
Expand Down Expand Up @@ -70,8 +72,6 @@ def testFunction(self):
bool: final result of the test.
"""

self.log.testStart(self.testName, '4')

# initialize the dsFPD module
self.testdsFPD.initialise()

Expand Down Expand Up @@ -113,5 +113,7 @@ def testFunction(self):
return result

if __name__ == '__main__':
test = dsFPD_test04_SetVerifyLEDIndicatorsColor()
summerLogName = os.path.splitext(os.path.basename(__file__))[0] + "_summery"
summeryLog = logModule(summerLogName, level=logModule.INFO)
test = dsFPD_test04_SetVerifyLEDIndicatorsColor(summeryLog)
test.run(False)
Loading