diff --git a/L2HalMock/README.md b/L2HalMock/README.md new file mode 100644 index 00000000..b5af8e40 --- /dev/null +++ b/L2HalMock/README.md @@ -0,0 +1,156 @@ + +README contains all the dependencies based on the peru yml file and steps to build the emulator binaries.All the run time instructions ,VM setup instructions and package dependency instructions are captured in this repo + + + +# Utils dependencis for ubuntu 22.04 machine +------------------------------------------------ + + + + +## Generic dependencies +--------------------- +sudo apt install -y git + +pip install flake8 + +sudo pip install peru + +sudo apt-get install -y libtool + +suod apt install -y autoconf + +sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y + +sudo apt update + +sudo apt install -y g++-9 gcc-9 + +sudo apt-get install -y libglib2.0-dev + +sudo apt-get install -y libdbus-1-dev + +sudo apt-get install -y curl + + +# Install system-level dependencies +RUN apt-get update && \ + apt-get install -y \ + git \ + wget \ + vim \ + build-essential \ + libtool \ + autoconf \ + g++-9 \ + gcc-9 \ + libglib2.0-dev \ + libdbus-1-dev \ + curl \ + cmake \ + ninja-build \ + net-tools \ + netcat \ + psmisc \ + libusb-1.0-0-dev \ + zlib1g-dev \ + libssl-dev \ + python3-pip \ + libjsoncpp-dev \ + libjansson4 \ + libjansson-dev \ + libcurl4-openssl-dev \ + libwebsocketpp-dev \ + libwebsockets-dev \ + libboost-all-dev + +# Create a directory in the image where you want to copy the files +RUN mkdir -p /usr/lib/aarch64-linux-gnu/ + +# Copy files from the host machine to the image +RUN cp -r /usr/lib/x86_64-linux-gnu/dbus-1.0 /usr/lib/aarch64-linux-gnu/ + +# Copy the custom config files to the appropriate location in the image +COPY dbus/system.conf /usr/share/dbus-1/system.conf +COPY dbus/session.conf /usr/share/dbus-1/session.conf + + +## Thuder dependencies +-------------------- +sudo apt install -y build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev libssl-dev + +sudo apt install -y python3-pip + +pip install jsonref + +## Hdmicec emulator hal dependencies +---------------------------------- +sudo apt-get install -y libjsoncpp-dev + +sudo apt-get install -y libjansson4 libjansson-dev + +sudo apt-get install -y libcurl4-openssl-dev + +sudo apt-get install -y libwebsocketpp-dev + +sudo apt-get install -y libwebsockets-dev + +pip install websockets + +sudo apt-get install -y libboost-all-dev + +## flask server dependencies +---------------------------- +sudo pip install pandas + +sudo pip install beautifulsoup4 + +sudo pip install flask + +sudo pip install colorama + +-------------------------------------------------- +# pre-setup +# clone rdk-e/rdkservices repository +# After cloning rdkservices.git, clone the repository https://github.com/rdk-e/FLASK-FOR-HAL-MOCK +# switch to branch peru, copy the peru.yaml file present insde the repo to L2HalMock folder inside rdkservices + +# Build step +----------------------------------------------- +./build.sh + +# Using Debug Build we can build individual modules +----------------------------------------------- +./debug_build.sh + +# Execute the framework +----------------------------------------------- +./run.sh + +# For executing test scripts +----------------------------------------------- +cd workspace/deps/rdk/flask/Test_Framework + +update details in Config.py + +python3 TestManager.py + + +# README FOR CI CD HAL MOCK WORKFLOW +------------------------------------ + +--> HAL_MOCK yml is the workflow file designed to pull/setup the container/docker, build the binaries and execute testcases on the hal mock virtual environment. +--> A pull request/push on from a branch to sprint,release,develop and main triggers the HAL_MOCK yml. +--> Paths excluded in the yaml file are tools,tests,.github workflows and readme docs. Which makes the workflow to not trigger job when changes happens in any of these files. +--> Conditional commit message check has also been enabled in the workflow,which allows the user to trigger the hal mock environment job only when user specifies hdmicecsource_halmock in the commit message. +--> Workflow steps are:- + --> pull the customized docker from JFROG artifactory. + --> clone and build the required binaries for the mock environment inside docker. + --> make all services up + --> execute the currently developed testcases (L2) on Hdmicec source. + --> generate a test report containing the execution details. + --> fetch the report, upload it as an artifact. + --> users can download this test report artifact from the executed job summary. + --> stop all services +--> Destroy the container/Docker \ No newline at end of file diff --git a/L2HalMock/Sample_Flask_Script.py b/L2HalMock/Sample_Flask_Script.py new file mode 100644 index 00000000..705bee3d --- /dev/null +++ b/L2HalMock/Sample_Flask_Script.py @@ -0,0 +1,127 @@ +#** ***************************************************************************** +# * +# * 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 requests +import json + +flask_server = "127.0.0.1:8000" + +config_data = { + "apiName": "setDeviceConfig", + "arguments": { + "devices": [ + { + "device": [ + {"name": "xione_uk"}, + {"islocal": 1}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "301"}, + {"logicalAddress": "3"}, + {"vendorId": "4567"}, + {"osdName": "404753747265616D696E672054776F"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "4"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "9"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + }, + { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 1}, + {"physicalAddress": "0"}, + {"logicalAddress": "0"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + } + ] + } + } + +api_data = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecOpen": [ + { "return": 1 }, + { "outParams": [{"handle": 2345678}] } + ] + }, + { + "HdmiCecGetLogicalAddress": [ + { "return": 0 }, + { "outParams": [{"logicalAddress": "0x4"}] } + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + { "return": 0 }, + { "outParams": [{"physicalAddress": "0x304"}] } + ] + } + ] + } + } + + +# fetch the cec network data from flask using http get requests +createDevice_response = requests.get("http://{}/Database.setDeviceConfig/{}".format(flask_server, json.dumps(config_data))) +print(createDevice_response.text) + +# fetch the api overrides data from flask using http get requests +createApiOverrides_response = requests.get("http://{}/Hdmicec.setAPIConfig/{}".format(flask_server, json.dumps(api_data))) +print(createApiOverrides_response.text) + + diff --git a/L2HalMock/build.sh b/L2HalMock/build.sh new file mode 100644 index 00000000..a8bfea9f --- /dev/null +++ b/L2HalMock/build.sh @@ -0,0 +1,218 @@ +#!/bin/bash + +# Access the passed plugins inside the script +SelectedPlugins="$1" + +echo "Building for Plugins: $SelectedPlugins" + +# Check for the presence of "string to find" +if grep -q "FrontPanel" <<< "$SelectedPlugins"; then + echo "Found: $SelectedPlugins" + FrontPanel="ON" +fi + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +RDK_DIR=$SCRIPTS_DIR/../ +WORKSPACE=$SCRIPTS_DIR/workspace +rm -rf $WORKSPACE; +mkdir $WORKSPACE; + +cd $WORKSPACE +echo -e "${GREEN}========================================Building thunder tools===============================================${NC}" +git clone -b R4_4 https://github.com/rdkcentral/ThunderTools.git +cmake -G Ninja -S ThunderTools -B $WORKSPACE/build/ThunderTools -DCMAKE_INSTALL_PREFIX="$WORKSPACE/install/usr" +cmake --build $WORKSPACE/build/ThunderTools --target install + +cd $WORKSPACE +echo -e "${GREEN}========================================Building Thunder===============================================${NC}" +git clone -b R4_4 https://github.com/rdkcentral/Thunder.git +cmake -G Ninja -S Thunder -B $WORKSPACE/build/Thunder -DBINDING="127.0.0.1" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="$WORKSPACE/install/usr" -DCMAKE_MODULE_PATH="${WORKSPACE}/install/usr/include/WPEFramework/Modules" -DDATA_PATH="${WORKSPACE}/install/usr/share/WPEFramework" -DPERSISTENT_PATH="${WORKSPACE}/install/var/wpeframework" -DPORT="55555" -DPROXYSTUB_PATH="${WORKSPACE}/install/usr/lib/wpeframework/proxystubs" -DSYSTEM_PATH="${WORKSPACE}/install/usr/lib/wpeframework/plugins" -DVOLATILE_PATH="tmp" +cmake --build $WORKSPACE/build/Thunder --target install + +echo -e "${GREEN}========================================Do peru sync===============================================${NC}" +(cp $SCRIPTS_DIR/peru.yaml . && peru sync && peru sync --no-cache) + + +echo -e "${GREEN}========================================Building flux===============================================${NC}" +(cd $WORKSPACE/deps/third-party/flux && autoreconf; autoreconf -f -i && ./configure && make && make install && cd -) + + +echo -e "${GREEN}========================================Building directfb===============================================${NC}" +(cd $WORKSPACE/deps/third-party/directfb && autoreconf; autoreconf -f -i && ./configure && make && make install && cd -) + + +echo -e "${GREEN}========================================Building log4c===============================================${NC}" +(cd $WORKSPACE/deps/third-party/log4c && autoreconf; autoreconf -f -i && ./configure && make && make install && cd -) + +set +e #exit on error +echo -e "${GREEN}========================================Building safeclib===============================================${NC}" +(cd $WORKSPACE/deps/third-party/safeclib && autoreconf; autoreconf -f -i && ./configure && make && make install && cd -) + +echo -e "${GREEN}========================================Building dbus===============================================${NC}" +(cd $WORKSPACE/deps/third-party/dbus/ && autoreconf; autoreconf -f -i && ./configure && make && make install && cd -) + +echo -e "${GREEN}========================================Build glib===============================================${NC}" +(cd $WORKSPACE/deps/third-party/glib && meson _build && ninja -C _build ) + +echo -e "${GREEN}========================================SafeC header===============================================${NC}" +# cp -r $WORKSPACE/deps/rdk/safec/recipes-common/safec-common-wrapper/files/safec_lib.h /usr/include +cp -r $SCRIPTS_DIR/patches/rdkservices/iarmbus/safec_lib.h /usr/include +cd $WORKSPACE/deps/rdk/safec/recipes-common/safec-common-wrapper/files +# ls +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_str_lib.h /usr/include +# cp -r $SCRIPTS_DIR/patches/rdkservices/iarmbus/safe_str_lib.h /usr/include +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_config.h /usr/include +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_lib_errno.h /usr/include +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_types.h /usr/include +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_compile.h /usr/include +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_mem_lib.h /usr/include +cp -r $WORKSPACE/deps/third-party/dbus/dbus/*.h /usr/include/dbus-1.0/dbus +cp -r /usr/local/lib/libsafec* /usr/lib/ +cp -r $WORKSPACE/deps/third-party/glib/_build/glib/glibconfig.h /usr/include +cp -r $WORKSPACE/deps/rdk/halif-power_manager/include/*.h /usr/include +cp -r $WORKSPACE/deps/rdk/halif-deepsleep_manager/include/deepSleepMgr.h /usr/include +cp -r $WORKSPACE/deps/rdk/SyscallWrapper/source/secure_wrapper.h /usr/include +cp -r $WORKSPACE/deps/rdk/iarmmgrs/mfr/include/*.h /usr/include +cp -r $WORKSPACE/deps/rdk/iarmmgrs/hal/include/*.h /usr/include +cp -r $WORKSPACE/deps/rdk/iarmmgrs/sysmgr/include/*.h /usr/include +cp -r $WORKSPACE/deps/rdk/rdkservices-apis/apis/Ids.h /usr/include +cp -r $WORKSPACE/deps/rdk/rdkservices-apis/apis/PowerManager/IPowerManager.h /usr/include/interface +set +e #exit on error + + +echo -e "${GREEN}========================================iarmmgrs-emulator===============================================${NC}" +(cd $WORKSPACE/deps/rdk/iarmmgrs-emulator && ./build.sh) +mkdir -p $WORKSPACE/deps/rdk/iarmmgrs/install/lib +cp -r $WORKSPACE/deps/rdk/iarmmgrs-emulator/power/*.so $WORKSPACE/deps/rdk/iarmmgrs/install/lib +cp -r $WORKSPACE/deps/rdk/iarmmgrs-emulator/ir/*.so $WORKSPACE/deps/rdk/iarmmgrs/install/lib + +echo "Entering directory $PWD" +cp $SCRIPTS_DIR/env.sh $WORKSPACE/env.sh +cp $SCRIPTS_DIR/invokeEnv.sh $WORKSPACE/deps/rdk/env.sh +cd $WORKSPACE +set -e #exit on error +source ./env.sh + +set -x #enable debugging mode +# Build IARM +echo -e "${GREEN}========================================Build IARM===============================================${NC}" +cd $WORKSPACE/deps/rdk/iarmbus/ +rm build.sh +cp $SCRIPTS_DIR/patches/rdkservices/iarmbus/build.sh $WORKSPACE/deps/rdk/iarmbus/ +(cd $WORKSPACE/deps/rdk/iarmbus/ && ./build.sh) + +# Build DSHalMrg +echo -e "${GREEN}========================================Build DSHalMrg===============================================${NC}" +# Build DSHalMrg +(cd $WORKSPACE/deps/rdk/devicesettings/hal && make && make install) + +echo -e "${GREEN}========================================Build DeviceSettings===============================================${NC}" +# Build DeviceSettings +cd /usr/include/ +mkdir wdmp-c +cp $SCRIPTS_DIR/patches/rdkservices/files/wdmp-c.h /usr/include/wdmp-c +cp $SCRIPTS_DIR/patches/rdkservices/rfcapi.h /usr/include +cp $WORKSPACE/deps/rdk/halif-deepsleep_manager/include/deepSleepMgr.h /usr/include +(cd $WORKSPACE/deps/rdk/devicesettings/ && ./build.sh) + +echo -e "${GREEN}========================================Build glib===============================================${NC}" +(cd $WORKSPACE/deps/third-party/glib && meson _build && ninja -C _build && ninja -C _build install) +cp $WORKSPACE/deps/third-party/glib/_build/glib/glibconfig.h /usr/include/glib-2.0 + +echo -e "${GREEN}========================================iarm_event_Sender===============================================${NC}" +(cd $WORKSPACE/deps/rdk/sender/ && ./build.sh) + + +echo -e "${GREEN}========================================Build iarmmgr===============================================${NC}" +# Build iarmmgr +cd $WORKSPACE/deps/rdk/iarmmgrs +patch -s -p1 < $SCRIPTS_DIR/patches/rdkservices/iarmmgrs/ds.patch +rm build.sh +cp $SCRIPTS_DIR/patches/rdkservices/iarmmgrs/build.sh $WORKSPACE/deps/rdk/iarmmgrs +(cd $WORKSPACE/deps/rdk/iarmmgrs && ./build.sh) + +echo -e "${GREEN}========================================Build HdmiCec===============================================${NC}" +# Build HdmiCec +mv $WORKSPACE/deps/rdk/hdmicec/soc/L2HalMock/common $WORKSPACE/deps/rdk/hdmicec/soc/L2HalMock/common_bkp; +mv $WORKSPACE/deps/rdk/hdmicec/soc/L2HalMock/hdmicec-hal-emulator $WORKSPACE/deps/rdk/hdmicec/soc/L2HalMock/common +(cd $WORKSPACE/deps/rdk/hdmicec/ && ./build.sh) + +echo -e "${GREEN}========================================Build HdmiCecSource===============================================${NC}" +# Build HdmiCecSource +cd $WORKSPACE/install/usr/include/WPEFramework/Modules/ +patch -s -p0 < $SCRIPTS_DIR/patches/rdkservices/FindConfigGenerator_cmake.patch + +if grep -q "HdmiCecSource" <<< "$SelectedPlugins"; then +cp $SCRIPTS_DIR/patches/rdkservices/properties/HdmiCecSource/device.properties /etc/ +fi + +if grep -q "HdmiCecSink" <<< "$SelectedPlugins"; then +cp $SCRIPTS_DIR/patches/rdkservices/properties/HdmiCecSink/device.properties /etc/ +fi + +cd $WORKSPACE/ +#Run time dependency +mkdir -p $WORKSPACE/install/etc/WPEFramework/plugins +cp $SCRIPTS_DIR/patches/rdkservices/files/HdmiCecSource.json $WORKSPACE/install/etc/WPEFramework/plugins/ +cp $SCRIPTS_DIR/patches/rdkservices/files/HdmiCecSink.json $WORKSPACE/install/etc/WPEFramework/plugins/ + +#Code Coverage patch +# cd $RDK_DIR +# patch -s -p1 < $SCRIPTS_DIR/patches/rdkservices/HdmiCecSource.patch +# patch -s -p1 < $SCRIPTS_DIR/patches/rdkservices/HdmiCecSink.patch +# patch -s -p1 < $SCRIPTS_DIR/patches/rdkservices/FrontPanel.patch +# patch -s -p1 < $SCRIPTS_DIR/patches/rdkservices/Hdcp_Profile.patch + +#included CmakeHelperFunctions.cmake instead to during in CMakeLists.txt +cp ${WORKSPACE}/install/usr/lib/cmake/WPEFramework/common/CmakeHelperFunctions.cmake $WORKSPACE/install/usr/include/WPEFramework/Modules +cp -r $RDK_DIR/Tests/L2HALMockTests/. $WORKSPACE/deps/rdk/flask +cp $RDK_DIR/L2HalMock/patches/rdkservices/files/rfcapi.h $RDK_DIR/helpers + +#wdmp dependency +cd /usr/local/include/ +mkdir wdmp-c +cp $SCRIPTS_DIR/patches/rdkservices/files/wdmp-c.h /usr/local/include/wdmp-c + +cd /usr/include/ +mkdir rdk +cd /usr/include/rdk +mkdir iarmmgrs-hal +cp $WORKSPACE/deps/rdk/iarmmgrs/hal/include/pwrMgr.h /usr/include/rdk/iarmmgrs-hal + +sed -i 's/sendNotify/Notify/g' $RDK_DIR/HdmiCecSource/HdmiCecSource.cpp +sed -i 's/sendNotify/Notify/g' $RDK_DIR/HdmiCecSink/HdmiCecSink.cpp +sed -i 's/sendNotify/Notify/g' $RDK_DIR/HdcpProfile/HdcpProfile.cpp + +cd $RDK_DIR; +cmake -S . -B build \ +-DCMAKE_INSTALL_PREFIX="$WORKSPACE/install/usr" \ +-DCMAKE_MODULE_PATH="$WORKSPACE/install/usr/include/WPEFramework/Modules" \ +-DRDK_SERVICE_L2HALMOCK=ON \ +-DUSE_THUNDER_R4=ON \ +-DPLUGIN_FRONTPANEL=$FrontPanel \ +-DCOMCAST_CONFIG=OFF \ +-DCEC_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/ccec/include" \ +-DOSAL_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/osal/include" \ +-DCEC_HOST_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/host/include" \ +-DDS_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/install/lib/libds.so" \ +-DDS_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/ds/include" \ +-DDSHAL_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/hal/include" \ +-DDSRPC_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/rpc/include" \ +-DIARMBUS_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmbus/core/include" \ +-DIARMRECEIVER_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmmgrs/receiver/include" \ +-DIARMPWR_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmmgrs/hal/include" \ +-DCEC_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCEC.so" \ +-DIARMBUS_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/iarmbus/install/libIARMBus.so" \ +-DDSHAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/install/lib/libdshalcli.so" \ +-DCEC_HAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCECHal.so" \ +-DOSAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCECOSHal.so" \ +-DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -Wall -Werror -Wno-error=format=-Wl,-wrap,system -Wl,-wrap,popen -Wl,-wrap,syslog" + +(cd $RDK_DIR && cmake --build build --target install) + +set +x #disable debugging mode diff --git a/L2HalMock/dbus/session.conf b/L2HalMock/dbus/session.conf new file mode 100644 index 00000000..cf9662c1 --- /dev/null +++ b/L2HalMock/dbus/session.conf @@ -0,0 +1,81 @@ + + + + + + session + + + + + unix:tmpdir=/tmp + + + EXTERNAL + + + + + + + + + + + + + + /etc/dbus-1/session.conf + + + session.d + + /etc/dbus-1/session.d + + + /etc/dbus-1/session-local.conf + + contexts/dbus_contexts + + + + + 1000000000 + 250000000 + 1000000000 + 250000000 + 1000000000 + + 120000 + 240000 + 150000 + 100000 + 10000 + 100000 + 10000 + 50000 + 50000 + 50000 + + diff --git a/L2HalMock/dbus/system.conf b/L2HalMock/dbus/system.conf new file mode 100644 index 00000000..c7314d51 --- /dev/null +++ b/L2HalMock/dbus/system.conf @@ -0,0 +1,229 @@ + + + + + + + + + + + system + + + + messagebus + + + + + + + + + + + + /usr/libexec/dbus-daemon-launch-helper + + + + /var/run/dbus/pid + + + + + + + + EXTERNAL + + + + unix:path=/run/dbus/system_bus_socket + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /etc/dbus-1/system.conf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + system.d + + /etc/dbus-1/system.d + + + + /etc/dbus-1/system-local.conf + + contexts/dbus_contexts + + + + diff --git a/L2HalMock/debug_build.sh b/L2HalMock/debug_build.sh new file mode 100644 index 00000000..4c1fd789 --- /dev/null +++ b/L2HalMock/debug_build.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +YELLOW='\033[0;33m' # Yellow text +NC='\033[0m' # No color (resets to default) + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +RDK_DIR=$SCRIPTS_DIR/../ +WORKSPACE=$SCRIPTS_DIR/workspace + +PS3='Please enter your choice: ' +options=("Build IARM" "Build DeviceSettings" "Build HdmiCec" "Build rdkservices" "Build All" "Quit") +# set -x #enable debugging mode +select opt in "${options[@]}" +do + case $opt in + "Build IARM") + echo "you chose choice $opt" + # Build IARM + echo -e "${GREEN}========================================Build IARM===============================================${NC}" + (cd $WORKSPACE/deps/rdk/iarmbus/ && ./build.sh) + ;; + "Build DeviceSettings") + echo "you chose choice $opt" + echo -e "${GREEN}========================================Build DeviceSettings===============================================${NC}" + # Build DeviceSettings + (cd $WORKSPACE/deps/rdk/devicesettings/ && ./build.sh) + ;; + + "Build HdmiCec") + echo "you chose choice $opt" + echo -e "${GREEN}========================================Build HdmiCec===============================================${NC}" + # Build HdmiCec + (cd $WORKSPACE/deps/rdk/hdmicec/ && ./build.sh) + ;; + + "Build rdkservices") + echo "you chose choice $opt" + echo -e "${GREEN}========================================Build rdkservices===============================================${NC}" + cd $RDK_DIR; + + cmake -S . -B build \ + -DCMAKE_INSTALL_PREFIX="$WORKSPACE/install/usr" \ + -DCMAKE_MODULE_PATH="$WORKSPACE/install/usr/include/WPEFramework/Modules" \ + -DPLUGIN_HDMICECSOURCE=ON \ + -DPLUGIN_HDMICECSINK=ON \ + -DUSE_THUNDER_R4=ON \ + -DCOMCAST_CONFIG=OFF \ + -DCEC_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/ccec/include" \ + -DOSAL_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/osal/include" \ + -DCEC_HOST_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/host/include" \ + -DDS_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/install/lib/libds.so" \ + -DDS_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/ds/include" \ + -DDSHAL_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/hal/include" \ + -DDSRPC_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/rpc/include" \ + -DIARMBUS_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmbus/core/include" \ + -DIARMRECEIVER_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmmgrs/receiver/include" \ + -DIARMPWR_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmmgrs/hal/include" \ + -DCEC_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCEC.so" \ + -DIARMBUS_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/iarmbus/install/libIARMBus.so" \ + -DDSHAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/install/lib/libdshalcli.so" \ + -DCEC_HAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCECHal.so" \ + -DOSAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCECOSHal.so" \ + -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -Wall -Werror -Wno-error=format=-Wl,-wrap,system -Wl,-wrap,popen -Wl,-wrap,syslog" + + (cd $RDK_DIR && cmake --build build --target install) + ;; + + "Build All") + echo "you chose choice $opt" + echo -e "${GREEN}========================================Building All===============================================${NC}" + ./build.sh + ;; + + "Quit") + break + ;; + *) echo "invalid option $REPLY";; + esac + echo -e "${YELLOW}1) Build IARM 2) Build DeviceSettings 3) Build HdmiCec 4) Build rdkservices 5) Build All 6) Quit${NC}" +done + +set +x #disable debugging mode diff --git a/L2HalMock/env.sh b/L2HalMock/env.sh new file mode 100644 index 00000000..fa684191 --- /dev/null +++ b/L2HalMock/env.sh @@ -0,0 +1,91 @@ +set -x #enable debugging mode + +source /root/.bashrc +#If Local compliation enable below +# source ~/.bashrc + +export PLATFORM_SOC=intel + +SCRIPT=$(readlink -f "$0") +#SCRIPTS_DIR=`dirname "$SCRIPT"` +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +export BUILDS_DIR=$SCRIPT_DIR/workspace +export RDK_PROJECT_ROOT_PATH=$SCRIPT_DIR/workspace/deps/rdk +export COMBINED_ROOT=$BUILDS_DIR +export NUM_DIR=$BUILDS_DIR/96e2377 +export DS_PATH=$BUILDS_DIR/deps/rdk/devicesettings +export USE_DBUS=y +export TOOLCHAIN_DIR=$COMBINED_ROOT/sdk/toolchain/staging_dir +export CROSS_TOOLCHAIN=/usr +export CROSS_COMPILE=$CROSS_TOOLCHAIN/bin/i686-cm-linux +export CC=gcc-9 +export CXX=g++-9 +export OPENSOURCE_BASE=/usr +#export DFB_ROOT=$TOOLCHAIN_DIR +export DFB_LIB=$TOOLCHAIN_DIR/lib +export IARM_PATH=$BUILDS_DIR/deps/rdk/iarmbus +export FUSION_PATH=$BUILDS_DIR/deps/rdk/fusiondale +export SDK_FSROOT=$COMBINED_ROOT/sdk/fsroot/ramdisk +export FSROOT=$COMBINED_ROOT +export GLIB_INCLUDE_PATH=$CROSS_TOOLCHAIN/include/glib-2.0 +export GLIB_LIBRARY_PATH=/usr/local/lib +# export GLIB_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu +export GLIB_CONFIG_INCLUDE_PATH=$GLIB_LIBRARY_PATH/glib-2.0 +export GLIB_CONFIG_PATH=$GLIB_LIBRARY_PATH/glib-2.0 +export GLIBS='-lglib-2.0 -lz' + +export MFR_PATH=$COMBINED_ROOT/ri/mpe_os/platforms/intel/groveland/mfrlibs +export MFR_FPD_PATH=$COMBINED_ROOT/mfrlibs +export _ENABLE_WAKEUP_KEY=-D_ENABLE_WAKEUP_KEY +export RF4CE_PATH=$COMBINED_ROOT/rf4ce/ +export USE_GREEN_PEAK_RF4CE_INTERFACE=-DUSE_GREEN_PEAK_RF4CE_INTERFACE + +export IARM_LIB_PATH=$BUILDS_DIR/deps/rdk/iarmbus/install +THUNDER_LIB_PATH=$BUILDS_DIR/install/usr/lib +THUNDER_PATH=$BUILDS_DIR/install/usr/bin + +export SAFEC_INCLUDE_PATH=$BUILDS_DIR/deps/third-party/safeclib/src/.libs/ + +#export SAFECLIB_PATH=$BUILDS_DIR/deps/third-party/safeclib/include/ +export SAFEC_INCLUDE_PATH=/usr/local/include/libsafec + +export DFB_INCLUDE_PATH=/usr/local/include/directfb + +export HDMICEC_PATH=$BUILDS_DIR/deps/rdk/hdmicec +#export CCEC_HOST=${HDMICEC_PATH}/host/include/ccec/host +#export INCLUDE_DRI_IARMBUS=${HDMICEC_PATH}/ccec/drivers/include/ccec/drivers/iarmbus +#export CCEC_INCLUDE_CCEC=${HDMICEC_PATH}/ccec/include/ccec +#export DS_HAL_INCLUDE=${DS_PATH}/hal/include +#export DS_RPC_INCLUDE=${DS_PATH}/rpc/include +#export DS_DS_INCLUDE=${DS_PATH}/ds/include +#export IARM_CORE_INC=$BUILDS_DIR/deps/rdk/iarmbus/core/include +#export INCLUDE_OSAL=$BUILDS_DIR/deps/rdk/hdmicec/osal/include/osal +#export NUM_HAL_INCLUDE=$BUILDS_DIR/96e2377/hal/include +#export NUM_COMMON_INC=$NUM_DIR/mfr/common/include +#export NUM_IR_INC=$NUM_DIR/ir/include +#export NUM_POW_INC=$NUM_DIR/power/include +#export NUM_PWMGR_INC=$NUM_DIR/pwrmgr2/include +#export NUM_REC_INC=$NUM_DIR/receiver/include +HDMICEC_LIB_PATH=${HDMICEC_PATH}/install/lib + +DS_LIB_PATH=${DS_PATH}/install/lib + +export LD_LIBRARY_PATH=${THUNDER_LIB_PATH}:${IARM_LIB_PATH}:${HDMICEC_LIB_PATH}:${DS_LIB_PATH} + +DS_INCLUDE_PATH=${DS_PATH}/ds/include +IARM_INCLUDE_PATH=${IARM_PATH}/core/include +IARM_LIB_PATH=${IARM_PATH}/install +export IARM_MGRS_PATH=$BUILDS_DIR/deps/rdk/iarmmgrs +export IARM_MGRS=$BUILDS_DIR/deps/rdk/iarmmgrs +export GLIB_HEADER_PATH=$CROSS_TOOLCHAIN/include/glib-2.0 +export PLATFORM_SOC=L2HalMock +export UTILS_PATH=$IARM_MGRS/utils + +# Temporary +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin + +export PATH=${IARM_MGRS}:${HDMICEC_PATH}:${HDMICEC_LIB_PATH}:${DS_PATH}:${IARM_PATH}:${IARM_LIB_PATH}:${DS_INCLUDE_PATH}:${DS_LIB_PATH}:${THUNDER_PATH}:${PATH} + +set +x #disable debugging mode + +echo "Done!" diff --git a/L2HalMock/generate_coveragereport.sh b/L2HalMock/generate_coveragereport.sh new file mode 100644 index 00000000..853a6568 --- /dev/null +++ b/L2HalMock/generate_coveragereport.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +RDK_DIR=$SCRIPTS_DIR/../ + +echo -e "${GREEN}======================== Kill WPEFramework ====================================${NC}" +killall -QUIT WPEFramework +sleep 5 +echo -e "${GREEN}======================== Generate coverage Report ====================================${NC}" +cp ${RDK_DIR}/Tests/L2HALMockTests/Test_Framework/.lcovrc_halmock ~/.lcovrc + +lcov -c -o coverage.info -d ${RDK_DIR}/build/ +lcov -r coverage.info '/usr/include/*' '*/install/usr/include/*' '*/ccec/*' '*/helpers/*' -o filtered_coverage.info + +genhtml -o coverage -t "HALMock RDKServices Coverage" filtered_coverage.info \ No newline at end of file diff --git a/L2HalMock/invokeEnv.sh b/L2HalMock/invokeEnv.sh new file mode 100644 index 00000000..779c9c05 --- /dev/null +++ b/L2HalMock/invokeEnv.sh @@ -0,0 +1,4 @@ +set -x #enable debugging mode + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $SCRIPT_DIR/../../../env.sh diff --git a/L2HalMock/patches/rdkservices/FindConfigGenerator_cmake.patch b/L2HalMock/patches/rdkservices/FindConfigGenerator_cmake.patch new file mode 100644 index 00000000..aec8a770 --- /dev/null +++ b/L2HalMock/patches/rdkservices/FindConfigGenerator_cmake.patch @@ -0,0 +1,38 @@ +Signed-off-by: Kishore Darmaradje +--- +--- ./FindConfigGenerator.cmake_old 2024-01-18 11:55:45.984677544 -0500 ++++ ./FindConfigGenerator.cmake 2024-01-22 14:08:37.000000000 -0500 +@@ -88,7 +88,8 @@ + message(STATUS "Component: ${_component}") + endif() + endif() +- ++ ++ #[[ + if(ARG_CUSTOM_PARAMS_WHITELIST) + set(CONFIG_GENERATOR_PARAMS_WHITELIST "${ARG_CUSTOM_PARAMS_WHITELIST}") + else() +@@ -188,10 +189,10 @@ + list(APPEND _execute_command ${plugin} "${CMAKE_CURRENT_BINARY_DIR}/config") + + execute_process(COMMAND ${PYTHON_EXECUTABLE} ${_execute_command} RESULT_VARIABLE rv) +- if(NOT ${rv} EQUAL 0) +- message(FATAL_ERROR "config_generator failed.") +- return() +- endif() ++ if(NOT ${rv} EQUAL 0) ++ message(FATAL_ERROR "config_generator failed.") ++ return() ++ endif() + set(config_generated "Y") + else() + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20.0 OR NOT LEGACY_CONFIG_GENERATOR) +@@ -337,6 +338,7 @@ + unset(_plugins) + unset(_classname) + unset(_component) +- ++ ]] + endfunction(write_config) + ++ diff --git a/L2HalMock/patches/rdkservices/FrontPanel.patch b/L2HalMock/patches/rdkservices/FrontPanel.patch new file mode 100644 index 00000000..6a3410ff --- /dev/null +++ b/L2HalMock/patches/rdkservices/FrontPanel.patch @@ -0,0 +1,22 @@ +Signed-off-by: Kishore Darmaradje +--- +diff --git a/FrontPanel/FrontPanel.cpp b/FrontPanel/FrontPanel.cpp +index e8a1dc5a..25bd6bf3 100644 +--- a/FrontPanel/FrontPanel.cpp ++++ b/FrontPanel/FrontPanel.cpp +@@ -67,6 +67,7 @@ + #define API_VERSION_NUMBER_MINOR 0 + #define API_VERSION_NUMBER_PATCH 6 + ++extern "C" void __gcov_exit(); + namespace + { + +@@ -224,6 +225,7 @@ namespace WPEFramework + patternUpdateTimer.Revoke(m_updateTimer); + + DeinitializeIARM(); ++ __gcov_exit(); + } + void FrontPanel::powerModeChange(const char *owner, IARM_EventId_t eventId, void *data, size_t len) + { diff --git a/L2HalMock/patches/rdkservices/files/FrontPanel.json b/L2HalMock/patches/rdkservices/files/FrontPanel.json new file mode 100644 index 00000000..dd829935 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/FrontPanel.json @@ -0,0 +1,9 @@ +{ + "locator":"libWPEFrameworkFrontPanel.so", + "classname":"FrontPanel", + "precondition":[ + "Platform" + ], + "callsign":"org.rdk.FrontPanel", + "autostart":true +} diff --git a/L2HalMock/patches/rdkservices/files/rfcapi.h b/L2HalMock/patches/rdkservices/files/rfcapi.h new file mode 100644 index 00000000..d92f6d15 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/rfcapi.h @@ -0,0 +1,75 @@ +/* + * If not stated otherwise in this file or this component's Licenses.txt file the + * following copyright and licenses apply: + * + * Copyright 2016 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. +*/ + +#ifndef RFCAPI_H_ +#define RFCAPI_H_ + +#include +#include + +#define RFCVAR_FILE "/opt/secure/RFC/rfcVariable.ini" +#define TR181STORE_FILE "/opt/secure/RFC/tr181store.ini" + +#ifdef __cplusplus +extern "C" +{ +#endif +#ifndef RDKC +#include +#endif + +#define MAX_PARAM_LEN (2*1024) + +#ifdef RDKC +typedef enum +{ + SUCCESS=0, + FAILURE, + NONE, + EMPTY +}DATATYPE; +#endif + +#ifdef RDKC +typedef struct _RFC_Param_t { + char name[MAX_PARAM_LEN]; + char value[MAX_PARAM_LEN]; + DATATYPE type; +} RFC_ParamData_t; +#else +typedef struct _RFC_Param_t { + char name[MAX_PARAM_LEN]; + char value[MAX_PARAM_LEN]; + DATA_TYPE type; +} RFC_ParamData_t; +#endif +#ifdef RDKC +int getRFCParameter(const char* pcParameterName, RFC_ParamData_t *pstParamData); +#else +WDMP_STATUS getRFCParameter(const char *pcCallerID, const char* pcParameterName, RFC_ParamData_t *pstParamData); +WDMP_STATUS setRFCParameter(const char *pcCallerID, const char* pcParameterName, const char* pcParameterValue, DATA_TYPE eDataType); +const char* getRFCErrorString(WDMP_STATUS code); +bool isRFCEnabled(const char *); +bool isFileInDirectory(const char *, const char *); +#endif +#ifdef __cplusplus +} +#endif + +#endif diff --git a/L2HalMock/patches/rdkservices/files/wdmp-c.h b/L2HalMock/patches/rdkservices/files/wdmp-c.h new file mode 100644 index 00000000..b339e5c0 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/wdmp-c.h @@ -0,0 +1,261 @@ +/** +* Copyright 2016 Comcast Cable Communications Management, LLC +* +* 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. +* +*/ +#ifndef __WDMP_C_H__ +#define __WDMP_C_H__ + +#include +#include + + +typedef enum +{ + WDMP_STRING = 0, + WDMP_INT, + WDMP_UINT, + WDMP_BOOLEAN, + WDMP_DATETIME, + WDMP_BASE64, + WDMP_LONG, + WDMP_ULONG, + WDMP_FLOAT, + WDMP_DOUBLE, + WDMP_BYTE, + WDMP_NONE +} DATA_TYPE; + +typedef enum +{ + WDMP_SUCCESS = 0, /**< Success. */ + WDMP_FAILURE, /**< General Failure */ + WDMP_ERR_TIMEOUT, + WDMP_ERR_NOT_EXIST, + WDMP_ERR_INVALID_PARAMETER_NAME, + WDMP_ERR_INVALID_PARAMETER_TYPE, + WDMP_ERR_INVALID_PARAMETER_VALUE, + WDMP_ERR_NOT_WRITABLE, + WDMP_ERR_SETATTRIBUTE_REJECTED, + WDMP_ERR_NAMESPACE_OVERLAP, + WDMP_ERR_UNKNOWN_COMPONENT, + WDMP_ERR_NAMESPACE_MISMATCH, + WDMP_ERR_UNSUPPORTED_NAMESPACE, + WDMP_ERR_DP_COMPONENT_VERSION_MISMATCH, + WDMP_ERR_INVALID_PARAM, + WDMP_ERR_UNSUPPORTED_DATATYPE, + WDMP_STATUS_RESOURCES, + WDMP_ERR_WIFI_BUSY, + WDMP_ERR_INVALID_ATTRIBUTES, + WDMP_ERR_WILDCARD_NOT_SUPPORTED, + WDMP_ERR_SET_OF_CMC_OR_CID_NOT_SUPPORTED, + WDMP_ERR_VALUE_IS_EMPTY, + WDMP_ERR_VALUE_IS_NULL, + WDMP_ERR_DATATYPE_IS_NULL, + WDMP_ERR_CMC_TEST_FAILED, + WDMP_ERR_NEW_CID_IS_MISSING, + WDMP_ERR_CID_TEST_FAILED, + WDMP_ERR_SETTING_CMC_OR_CID, + WDMP_ERR_INVALID_INPUT_PARAMETER, + WDMP_ERR_ATTRIBUTES_IS_NULL, + WDMP_ERR_NOTIFY_IS_NULL, + WDMP_ERR_INVALID_WIFI_INDEX, + WDMP_ERR_INVALID_RADIO_INDEX, + WDMP_ERR_ATOMIC_GET_SET_FAILED, + WDMP_ERR_DEFAULT_VALUE +} WDMP_STATUS; + +typedef struct +{ + char *name; + char *value; + DATA_TYPE type; +} param_t; + +typedef enum +{ + GET = 0, + GET_ATTRIBUTES, + SET, + SET_ATTRIBUTES, + TEST_AND_SET, + REPLACE_ROWS, + ADD_ROWS, + DELETE_ROW +} REQ_TYPE; + +typedef struct +{ + char *paramNames[512]; + size_t paramCnt; +} get_req_t; + +typedef struct +{ + param_t *param; + size_t paramCnt; +} set_req_t; + +typedef struct +{ + param_t *param; + char *newCid; + char *oldCid; + char *syncCmc; + size_t paramCnt; +} test_set_req_t; + + +typedef struct +{ + size_t paramCnt; + char **names; + char **values; +} TableData; + +typedef struct +{ + char *objectName; + TableData *rows; + size_t rowCnt; +} table_req_t; + +typedef struct { + REQ_TYPE reqType; + union { + get_req_t *getReq; + set_req_t *setReq; + table_req_t *tableReq; + test_set_req_t *testSetReq; + } u; +} req_struct; + +typedef struct +{ + char *name; + uint64_t start; + uint32_t duration; +} money_trace_span; + +typedef struct +{ + money_trace_span *spans; + size_t count; +} money_trace_spans; + +typedef struct +{ + char **paramNames; + size_t paramCnt; + param_t **params; + size_t *retParamCnt; +} get_res_t; + +typedef struct +{ + char *syncCMC; + char *syncCID; + param_t *params; +} param_res_t; + +typedef struct +{ + char *newObj; +} table_res_t; + +typedef struct +{ + REQ_TYPE reqType; + union { + get_res_t *getRes; + param_res_t *paramRes; + table_res_t *tableRes; + } u; + money_trace_spans *timeSpan; + WDMP_STATUS *retStatus; + size_t paramCnt; +} res_struct; + +/*----------------------------------------------------------------------------*/ +/* Macros */ +/*----------------------------------------------------------------------------*/ +/* none */ + +/*----------------------------------------------------------------------------*/ +/* Data Structures */ +/*----------------------------------------------------------------------------*/ +/* none */ + +/*----------------------------------------------------------------------------*/ +/* File Scoped Variables */ +/*----------------------------------------------------------------------------*/ +/* none */ + +/*----------------------------------------------------------------------------*/ +/* Function Prototypes */ +/*----------------------------------------------------------------------------*/ +/* none */ + +/*----------------------------------------------------------------------------*/ +/* External Functions */ +/*----------------------------------------------------------------------------*/ + +/** +* To convert json string to struct +* +* @note If the reqObj returned is not NULL, the value pointed at by +* bytes must be freed using wdmp_free_req_struct() by the caller. +* +* @param payload [in] payload JSON string to be converted +* @param reqObj [out] the resulting req_struct structure if successful +*/ + +void wdmp_parse_request(char * payload, req_struct **reqObj); + + +/** +* To convert response struct to json string + +* @param resObj [in] the response structure to be converted +* @param payload [out] the resulting payload string if successful +*/ + +void wdmp_form_response(res_struct *resObj, char **payload); + +/** +* Free the req_struct structure if allocated by the wdmp-c library. +* +* @note Do not call this function on the req_struct structure if the wdmp-c +* library did not create the structure! +* +* @param msg [in] the req_struct structure to free +*/ +void wdmp_free_req_struct( req_struct *reqObj ); + +/** +* Free the res_struct structure if allocated by the wdmp-c library. +* +* @note Do not call this function on the res_struct structure if the wdmp-c +* library did not create the structure! +* +* @param msg [in] the res_struct structure to free +*/ +void wdmp_free_res_struct( res_struct *resObj ); + +/*----------------------------------------------------------------------------*/ +/* Internal functions */ +/*----------------------------------------------------------------------------*/ +/* none */ + +#endif diff --git a/L2HalMock/patches/rdkservices/iarmbus/build.sh b/L2HalMock/patches/rdkservices/iarmbus/build.sh new file mode 100755 index 00000000..34c29ea9 --- /dev/null +++ b/L2HalMock/patches/rdkservices/iarmbus/build.sh @@ -0,0 +1,35 @@ +#!/bin/bash +########################################################################## +# If not stated otherwise in this file or this component's Licenses.txt +# file the following copyright and licenses apply: +# +# Copyright 2016 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. +########################################################################## +# +set -x + +source $PWD/../env.sh + +export LDFLAGS="`pkg-config --libs libsafec`" +export USE_DBUS=y +export CXX=g++ +make +if [ $? -ne 0 ] ; then + echo IarmBus Build Failed + exit 1 +else + echo IarmBus Build Success + exit 0 +fi diff --git a/L2HalMock/patches/rdkservices/iarmmgrs/build.sh b/L2HalMock/patches/rdkservices/iarmmgrs/build.sh new file mode 100644 index 00000000..a708a63e --- /dev/null +++ b/L2HalMock/patches/rdkservices/iarmmgrs/build.sh @@ -0,0 +1,34 @@ +#!/bin/bash +########################################################################## +# If not stated otherwise in this file or this component's Licenses.txt +# file the following copyright and licenses apply: +# +# Copyright 2016 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. +########################################################################## +# +set -x + +source $PWD/../env.sh + +export USE_DBUS=y +# export CXX=g++ +make +if [ $? -ne 0 ] ; then + echo iarmmgr Build Failed + exit 1 +else + echo iarmmgr Build Success + exit 0 +fi \ No newline at end of file diff --git a/L2HalMock/patches/rdkservices/rfcapi.h b/L2HalMock/patches/rdkservices/rfcapi.h new file mode 100644 index 00000000..d92f6d15 --- /dev/null +++ b/L2HalMock/patches/rdkservices/rfcapi.h @@ -0,0 +1,75 @@ +/* + * If not stated otherwise in this file or this component's Licenses.txt file the + * following copyright and licenses apply: + * + * Copyright 2016 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. +*/ + +#ifndef RFCAPI_H_ +#define RFCAPI_H_ + +#include +#include + +#define RFCVAR_FILE "/opt/secure/RFC/rfcVariable.ini" +#define TR181STORE_FILE "/opt/secure/RFC/tr181store.ini" + +#ifdef __cplusplus +extern "C" +{ +#endif +#ifndef RDKC +#include +#endif + +#define MAX_PARAM_LEN (2*1024) + +#ifdef RDKC +typedef enum +{ + SUCCESS=0, + FAILURE, + NONE, + EMPTY +}DATATYPE; +#endif + +#ifdef RDKC +typedef struct _RFC_Param_t { + char name[MAX_PARAM_LEN]; + char value[MAX_PARAM_LEN]; + DATATYPE type; +} RFC_ParamData_t; +#else +typedef struct _RFC_Param_t { + char name[MAX_PARAM_LEN]; + char value[MAX_PARAM_LEN]; + DATA_TYPE type; +} RFC_ParamData_t; +#endif +#ifdef RDKC +int getRFCParameter(const char* pcParameterName, RFC_ParamData_t *pstParamData); +#else +WDMP_STATUS getRFCParameter(const char *pcCallerID, const char* pcParameterName, RFC_ParamData_t *pstParamData); +WDMP_STATUS setRFCParameter(const char *pcCallerID, const char* pcParameterName, const char* pcParameterValue, DATA_TYPE eDataType); +const char* getRFCErrorString(WDMP_STATUS code); +bool isRFCEnabled(const char *); +bool isFileInDirectory(const char *, const char *); +#endif +#ifdef __cplusplus +} +#endif + +#endif diff --git a/L2HalMock/run.sh b/L2HalMock/run.sh new file mode 100644 index 00000000..4f33bdb1 --- /dev/null +++ b/L2HalMock/run.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +#Fetch the Args +GivenPlugins="$1" + +echo "Starting Services for Plugins: $GivenPlugins" + +echo "Found: $GivenPlugins" + + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +WORKSPACE=$SCRIPTS_DIR/workspace + +# Define the port to check and maximum number of seconds to wait +flask_port=8000 +timeout_duration=60 + +# Function to wait for a port to become available +wait_for_port() { + local port="$1" + local timeout="$2" + + for ((i=0; i= 2: + second_argument = sys.argv[1] + print(f"Two plugins are given: {second_argument}") +elif len(sys.argv) >= 3: + third_argument = sys.argv[2] + print(f"three plugins are given: {third_argument}") +elif len(sys.argv) >= 4: + forth_argument = sys.argv[3] + print(f"4 plugins are given: {argument}") +else: + print("No second argument provided.") + +print("GIVEN PLUGIN NAMES/TC NAME {}" .format(argument)) +# Pushing the initial configuration (cec network data & +# Pushing the initial configuration (cec network data & api override data) to Flask +#Utils.initialize_flask() +print("") + +# Activating the HdmiCecSource plugin using controller1.activate curl command +#CecUtils.activate_cec() +#time.sleep(5) + +print("") +print("***** Test Execution Starts *****") +print("") + +tc_name = result +flag = 0 +track = 0 + +list_of_plugins = ['HdmiCecSource','HdmiCecSink','FrontPanel','HdcpProfile','DisplayInfo'] + +plugin_name = [] + +for each in list_of_plugins: + if each in argument or each in result: + plugin_name.append(each) + track = track + 1 + +if track == 2 or track > 2: + Utils.info_log("Executing Testcases for the given plugins") + if "HdmiCecSource" in plugin_name or "HdmiCecSink" in plugin_name: + Utils.initialize_flask() + print("") + +# Activating the HdmiCecSource plugin using controller1.activate curl command + CecUtils.activate_cec() + time.sleep(5) + else: + print("Plugins changed does not require FLASK HTTP Server for execution and build") + + if "HdmiCecSource" in plugin_name: + # Execute the testcases + import TCID013 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID014 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID015 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID022 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID023 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID024 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID001 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID002 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID003 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID004 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID005 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID006 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID007 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID008 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID009 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID010 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID011 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID012 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID016 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID017 + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID018 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID019 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID020 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID026 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID027 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID032 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID031 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID030 + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID029 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID028 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID025 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID021 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + else: + print("Skipping HdmiCecSource as no changes are added") + + if "HdmiCecSink" in plugin_name: + import TCID_031_HDMICECSINK_getEnabled_HAL_False + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_Emulate + import TCID_035_Arc_start_stop + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_028_HDMICECSINK_abortCombinationsEmulation + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_036_HDMICECSINK_OSDStringMenuLanguageEmulation + import TCID_037_HDMICECSINK_sendEvents + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_032_HDMICECSINK_EmulateTextViewONStandbyBy + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_001_HDMICECSINK_getEnabled + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_HDMICECSINK_setEnabled + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_003_HDMICECSINK_getOSDName + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_005_HDMICECSINK_getVendorID + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_HDMICECSINK_setOSDName + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_006_HDMICECSINK_setVendorID + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_008_HDMICECSINK_getActiveSource + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_007_HDMICECSINK_getActiveRoute + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_009_HDMICECSINK_getAudioDeviceConnectedStatus + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_010_HDMICECSINK_getDeviceList + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_011_HDMICECSINK_requestActiveSource + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_012_HDMICECSINK_requestShortAudioDescriptor + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_013_HDMICECSINK_sendAudioDevicePowerOnMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_014_HDMICECSINK_getAudioStatusMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_015_HDMICECSINK_sendKeyPressEvent + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_016_HDMICECSINK_sendUserControlPressed + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_017_HDMICECSINK_sendUserControlReleased + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_018_HDMICECSINK_sendStandbyMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_019_HDMICECSINK_setActivePath + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_020_HDMICECSINK_setActiveSource + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_021_HDMICECSINK_setmenuLanguage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_022_HDMICECSINK_setLatencyInfo + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_023_HDMICECSINK_setRoutingChange + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_024_HDMICECSINK_setupArcRouting + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_025_HDMICECSINK_printDeviceList + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_026_HDMICECSINK_requestAudioDevicePowerStatus + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_029_HDMICECSINK_getActiveSourcewithroutingChange + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_030_HDMICECSINK_sendGetAudioStatusMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_033_HDMICECSINK_setRoutingChangeNegative + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_034_HDMICECSINK_active_source + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + else: + print("Skipping HDMICECSINK as no changes are added") + + + if "FrontPanel" in plugin_name: + #Utils.initialize_flask() + print("Executing Test Framework without HTTP server and Websocket") + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_001_DS_FrontPanel_getBrightness + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_011_DS_FrontPanel_setPreferences #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_DS_FrontPanel_getPreferences + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_003_DS_FrontPanel_is24HourClock + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_014_DS_FrontPanel_setClockBrightness #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_DS_FrontPanel_getClockBrightness #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_005_DS_FrontPanel_powerLedOff + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_006_DS_FrontPanel_powerLedOn + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_007_DS_FrontPanel_set24HourClock + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_008_DS_FrontPanel_setBlink + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_009_DS_FrontPanel_setClockTestPattern + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_010_DS_FrontPanel_setLED + print("\033[32m------########################################################################################################################---------.\033[0m") + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_013_DS_FrontPanel_setBrightness + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_015_DS_FrontPanel_getSetbrightnesscombination + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_012_DS_FrontPanel_getFrontPanelLights + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_017_DS_FrontPanel_sendEventsSimulation + import TCID_016_DS_FrontPanel_Deactivate + else: + print("Skipping FrontPanel as no changes are added") + + if "HdcpProfile" in plugin_name: + print("Detected change in HdcpProfile") + import TCID_001_HDCPProfile_getHDCPStatus + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_HDCPProfile_getSettopHDCPSupport #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_HDCPProfile_Events + time.sleep(2) + import TCID_003_HDCPProfile_ActivateDeactivateSimulation + + else: + print("skipping HdcpProfile as no changes are required") + + if "HdcpProfile" in plugin_name: + print("Detected change in DisplayInfo") + import TCID_001_DS_DeviceInfo_edid + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_DS_DisplayInfo_widthincentimeters + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_003_DS_DisplayInfo_heightincentimeters + print("\033[32m------########################################################################################################################---------.\033[0m") + else: + print("skipping DisplayInfo as no changes are required") +else: + track = 1 +if "HdmiCecSource" in argument or "HdmiCecSource" in result: + if track < 2: + flag = 1 + if flag == 1 or flag == 15: + Utils.initialize_flask() + print("") + +# Activating the HdmiCecSource plugin using controller1.activate curl command + CecUtils.activate_cec() + time.sleep(5) + + # Execute the testcases for HdmiCecSource + Utils.info_log("Executing Testcases for HdmiCecSource") + # Execute the testcases + import TCID013 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID014 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID015 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID022 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID023 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID024 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID001 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID002 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID003 + import TCID004 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID005 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID006 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID007 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID008 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID009 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID010 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID011 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID012 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID016 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID017 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID018 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID019 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID020 + import TCID020 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID026 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID027 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID032 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID031 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID030 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID029 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID028 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID025 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID021 + print("\033[32m------########################################################################################################################---------.\033[0m") + else: + print("Executed HdmiCecSource TestCases") +if "HdmiCecSink" in argument or "HdmiCecSink" in result: + if track < 2: + flag = 2 + Utils.info_log("Executing HdmiCecSink Test suite") + Utils.initialize_flask() + print("") + +# Activating the HdmiCecSource plugin using controller1.activate curl command + CecUtils.activate_cec() + time.sleep(5) + + import TCID_031_HDMICECSINK_getEnabled_HAL_False + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_Emulate + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_035_Arc_start_stop + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_028_HDMICECSINK_abortCombinationsEmulation + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_036_HDMICECSINK_OSDStringMenuLanguageEmulation + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_037_HDMICECSINK_sendEvents + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_032_HDMICECSINK_EmulateTextViewONStandbyBy + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_001_HDMICECSINK_getEnabled + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_HDMICECSINK_setEnabled + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_003_HDMICECSINK_getOSDName + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_005_HDMICECSINK_getVendorID + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_HDMICECSINK_setOSDName + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_006_HDMICECSINK_setVendorID + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_008_HDMICECSINK_getActiveSource + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_007_HDMICECSINK_getActiveRoute + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_009_HDMICECSINK_getAudioDeviceConnectedStatus + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_010_HDMICECSINK_getDeviceList + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_011_HDMICECSINK_requestActiveSource + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_012_HDMICECSINK_requestShortAudioDescriptor + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_013_HDMICECSINK_sendAudioDevicePowerOnMessage + import TCID_014_HDMICECSINK_getAudioStatusMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_015_HDMICECSINK_sendKeyPressEvent + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_016_HDMICECSINK_sendUserControlPressed + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_017_HDMICECSINK_sendUserControlReleased + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_018_HDMICECSINK_sendStandbyMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_019_HDMICECSINK_setActivePath + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_020_HDMICECSINK_setActiveSource + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_021_HDMICECSINK_setmenuLanguage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_022_HDMICECSINK_setLatencyInfo + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_023_HDMICECSINK_setRoutingChange + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_024_HDMICECSINK_setupArcRouting + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_025_HDMICECSINK_printDeviceList + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_026_HDMICECSINK_requestAudioDevicePowerStatus + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_029_HDMICECSINK_getActiveSourcewithroutingChange + import TCID_030_HDMICECSINK_sendGetAudioStatusMessage + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_033_HDMICECSINK_setRoutingChangeNegative + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_034_HDMICECSINK_active_source + print("\033[32m------########################################################################################################################---------.\033[0m") + else: + print("Executed HdmiCecSink TestCases") +if "FrontPanel" in argument or "FrontPanel" in result: + if track < 2: + flag = 3 + Utils.info_log("Executing FrontPanel Test suite") + print("\033[32m------########################################################################################################################---------.\033[0m") + + #Utils.initialize_flask() + print("Executing Test Framework without HTTP server and Websocket") + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_001_DS_FrontPanel_getBrightness + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_011_DS_FrontPanel_setPreferences #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_DS_FrontPanel_getPreferences + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_003_DS_FrontPanel_is24HourClock + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_014_DS_FrontPanel_setClockBrightness #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_DS_FrontPanel_getClockBrightness #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_005_DS_FrontPanel_powerLedOff + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_006_DS_FrontPanel_powerLedOn + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_007_DS_FrontPanel_set24HourClock + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_008_DS_FrontPanel_setBlink + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_009_DS_FrontPanel_setClockTestPattern + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_010_DS_FrontPanel_setLED + print("\033[32m------########################################################################################################################---------.\033[0m") + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_013_DS_FrontPanel_setBrightness + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_015_DS_FrontPanel_getSetbrightnesscombination + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_012_DS_FrontPanel_getFrontPanelLights + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_017_DS_FrontPanel_sendEventsSimulation + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_018_DS_FrontPanel_negative + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_020_DS_FrontPanel_powerLed_invalid + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_021_DS_FrontPanel_LEDBrightnessNegative + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_022_DS_FrontPanel_24HrClock_invalid + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_016_DS_FrontPanel_Deactivate + + +if "HdcpProfile" in argument or "HdcpProfile" in result: + if track < 2: + flag = 4 + Utils.info_log("Executing HDCPProfile Test suite") + print("\033[32m------########################################################################################################################---------.\033[0m") + time.sleep(30) + #Utils.initialize_flask() + print("Executing Test Framework without HTTP server and Websocket") + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_001_HDCPProfile_getHDCPStatus + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_HDCPProfile_getSettopHDCPSupport #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_HDCPProfile_Events + time.sleep(28) + import TCID_003_HDCPProfile_ActivateDeactivateSimulation + #import TCID_003_HDCPProfile_ActivateDeactivateSimulation +if "DisplayInfo" in argument or "DisplayInfo" in result: + if track < 2: + flag = 5 + Utils.info_log("Executing DisplayInfo Test suite") + print("\033[32m------########################################################################################################################---------.\033[0m") + #Utils.initialize_flask() #Flask initialization not required as its a static Mock + print("Executing Test Framework without HTTP server and Websocket") + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_001_DS_DeviceInfo_edid + print("\033[32m------########################################################################################################################---------.\033[0m") + import TTCID_002_DS_DisplayInfo_widthincentimeters + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_003_DS_DisplayInfo_heightincentimeters + +if argument == "DeviceSettings": + flag = 3 + Utils.highlight_log("Executing DeviceSettings Test suite") +if argument == "Bluetooth": + flag = 4 + Utils.highlight_log("Executing Bluetooth Test Suite") +if argument == "Wifi": + flag = 5 + Utils.highlight_log("Executing Wifi Test Suite") +if argument == "HdmiInput": + flag = 6 +if argument == "all": + flag = 15 + Utils.highlight_log("Executing Complete Test Suite for all plugins") +if "TCID" in result: + flag = 0 + print( + "\033[32m------########################################################################################################################---------.\033[0m") + print("Execution of testcase {}".format(argument)) + __import__(tc_name) + +if argument != "HdmiCecSource" or argument != "HdmiCecSink" or argument != "all": + print("Execution of testcase {}" .format(argument)) +if flag == 2 or flag == 15: + Utils.info_log("Executed HdmiCecSinkTestcases") +if flag == 15: + Utils.info_log("Executed Complete Test suite") +else: + print("Executed TestManager") + +print("***** Test Execution Ends *****") + +# Generate a html report file with all testcase execution details +ReportGenerator.generate_html_report(build_name, now) diff --git a/Tests/L2HALMockTests/Test_Framework/Utilities/ReportGenerator.py b/Tests/L2HALMockTests/Test_Framework/Utilities/ReportGenerator.py new file mode 100644 index 00000000..4739fb0f --- /dev/null +++ b/Tests/L2HALMockTests/Test_Framework/Utilities/ReportGenerator.py @@ -0,0 +1,186 @@ +#** ***************************************************************************** +# * +# * 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 csv +import os +import pandas as pd +from bs4 import BeautifulSoup + +passed_tc_list = [] +failed_tc_list = [] + + +def append_test_results_to_csv(tc_id, output, status, message): + + # Assign the headers for report file + headers = ["Curl API/TC Name", "Output Response", " TC Status ", " Remarks "] + + # Open the report file in append mode + with open("TestReport.csv", "a", newline="") as csvfile: + writer = csv.writer(csvfile) + + # Write headers if the headers in report file is empty + if csvfile.tell() == 0: + writer.writerow(headers) + + # Write the testcase details to a new row + writer.writerow([tc_id, output, status, message]) + + + +# Report Generation in .html file format +def generate_html_report(build_name, now): + + # To read csv file named "TestReport" + a = pd.read_csv("TestReport.csv") + + # Format the date and time as strings to generate the test report file + date = now.strftime("%d-%m-%Y") + time = now.strftime("%Hh%Mm%Ss") + + # To save as html file with build name, execution data and time + a.to_html("TestReport_{}_{}_{}.html".format(build_name, date, time), index=False) + # To remove the TestReport.csv file + #os.remove("TestReport.csv") + + # Add custom CSS style for a black background + # Read the HTML file + with open("TestReport_{}_{}_{}.html".format(build_name, date, time), "r") as f: + html = f.read() + + styled_html = f""" + + {html} + """ + + # Parse the HTML using BeautifulSoup + soup = BeautifulSoup(html, "html.parser") + + # Find the table element + table = soup.find("table") + + # Create a list of elements with the data + + # Calculate the length of the failed_tc_list string + failed_tc_length = str(len(failed_tc_list)) + passed_tc_length = str(len(passed_tc_list)) + + # Create a formatted string with the length in red + #formatted_length_failed = f"\033[91m{failed_tc_length}\033[0m" + #formatted_length_passed = f"\033[92m{passed_tc_length}\033[0m" + formatted_length_failed = failed_tc_length + formatted_length_passed = passed_tc_length + + current_date = now.strftime("%d/%m/%Y") + current_time = now.strftime("%H:%M:%S") + data = [soup.new_tag("p")] + # Now you can use the formatted_length wherever you need it + ##data[-1].string = f"Number of Testcases Failed: {str(formatted_length_failed)}" + #data[-1].string = f"Number of Testcases Failed: {str(len(failed_tc_list))}" + ##data.append(soup.new_tag("p")) + #data[-1].string = f"Number of Testcases Passed: {str(len(passed_tc_list))}" + ##data[-1].string = f"Number of Testcases Passed: {str(formatted_length_passed)}" + ##data.append(soup.new_tag("p")) + ##data[-1].string = f"Time of Execution: {current_time}" + ##data.append(soup.new_tag("p")) + ##data[-1].string = f"Date of Execution: {current_date}" + ##data.append(soup.new_tag("p")) + ##data[-1].string = f"Build Name: {build_name}" + + styled_html = f""" + + + + + +

L2 Test Execution Report

+ {html} +

Execution Summary

+

Number of Testcases Failed: {str(formatted_length_failed)}

+

Number of Testcases Passed: {str(formatted_length_passed)}

+

Time of Execution: {current_time}

+

Date of Execution: {current_date}

+

Build Name: {build_name}

+ + + """ + + + # Insert the data elements before the table element + for element in reversed(data): + table.insert_before(element) + + + # Replace the old html file with new one + with open("TestReport_{}_{}_{}.html".format(build_name, date, time), "w") as f: + f.write(str(soup)) + + # Read the html file + with open("TestReport_{}_{}_{}.html".format(build_name, date, time)) as html_file: + soup = BeautifulSoup(html_file, "html.parser") + + # Find all the elements + headers = soup.find_all("th") + + # Add the style attribute to each element + for header in headers: + header["style"] = "text-align: center" + + + # Write the modified html to a same report file + with open("TestReport_{}_{}_{}.html".format(build_name, date, time), "w") as html_file: + #html_file.write(soup.prettify()) + html_file.write(styled_html) + # Move the html file to the 'Test Execution Reports' Directory + os.rename("TestReport_{}_{}_{}.html".format(build_name, date, time), + "Test Execution Reports/TestReport_{}_{}_{}.html".format( + build_name, date, time)) diff --git a/Tests/L2HALMockTests/Test_Framework/Utilities/Utils.py b/Tests/L2HALMockTests/Test_Framework/Utilities/Utils.py new file mode 100644 index 00000000..abe02b39 --- /dev/null +++ b/Tests/L2HALMockTests/Test_Framework/Utilities/Utils.py @@ -0,0 +1,206 @@ +#** ***************************************************************************** +# * +# * 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. +# * +#* ****************************************************************************** + +# This file contains all the common functions required for test framework + +import subprocess +import os +import json +import requests +import Config +from os import path +import logging +from colorama import Fore, Style +import time + + +def error_log(message): + print(Fore.RED + f"ERROR: {message}" + Style.RESET_ALL) + +def warning_log(message): + print(Fore.YELLOW + f"LOGGER: {message}" + Style.RESET_ALL) + +def info_log(message): + print(Fore.CYAN + f"INFO: {message}" + Style.RESET_ALL) + +def initiliaze_flask_for_HdmiCecSource(): + '''This function is used to push the initial data towards the Flask server''' + try: + # Push the initial cec network data to Flask using http get requests - setDeviceConfig API + create_device_response = requests.get("http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data_hdmicecsource))) + print("Inside Utils.py : " + create_device_response.text + " : " + str(Config.config_data_hdmicecsource)) + print("configured device data using - http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data_hdmicecsource))) + print("") + + # Push the api overrides data to Flask using http get requests - setAPIConfig API + create_api_overrides_response = requests.get("http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data_hdmicecsource))) + print("Inside Utils.py : " + create_api_overrides_response.text + " : " + str(Config.api_data_hdmicecsource)) + print("configured hal api data using - http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data_hdmicecsource))) + print("") + + # Compare the obtained response with actual response + if "Success" in str(create_device_response.text) and "Success" in str(create_api_overrides_response.text): + print("Inside Utils.py : Successfully pushed the initial data (setDeviceConfig & setAPIConfig) to Flask") + else: + print("Inside Utils.py : Failed to push the initial data (setDeviceConfig & setAPIConfig) to Flask") + + except: + print("Inside Utils.py : Exception in initialize_flask function") + +def initialize_flask(): + '''This function is used to push the initial data towards the Flask server''' + try: + # Push the initial cec network data to Flask using http get requests - setDeviceConfig API + create_device_response = requests.get("http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data))) + print("Inside Utils.py : " + create_device_response.text + " : " + str(Config.config_data)) + print("configured device data using - http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data))) + print("") + + # Push the api overrides data to Flask using http get requests - setAPIConfig API + create_api_overrides_response = requests.get("http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data))) + print("Inside Utils.py : " + create_api_overrides_response.text + " : " + str(Config.api_data)) + print("configured hal api data using - http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data))) + print("") + + # Compare the obtained response with actual response + if "Success" in str(create_device_response.text) and "Success" in str(create_api_overrides_response.text): + print("Inside Utils.py : Successfully pushed the initial data (setDeviceConfig & setAPIConfig) to Flask") + else: + print("Inside Utils.py : Failed to push the initial data (setDeviceConfig & setAPIConfig) to Flask") + + except: + print("Inside Utils.py : Exception in initialize_flask function") + + +def send_curl_command(curl_command): + '''This function is used to send the curl commands to get the output response using os module''' + output_response = "" + try: + # Send the curl command using os.system module + response = os.popen(curl_command) + + # Find the line that is a valid JSON for extracting only the json response + for line in response.readlines(): + try: + # Try to parse the current line as JSON + json.loads(line) + output_response = line + # Exit the loop as we found the JSON line + break + except json.JSONDecodeError: + # If current line is not a valid JSON, just pass and continue with the next line + pass + + # Check the output response and add a message if the obtained output response is null + if len(output_response) < 5: + output_response = "< No response from WPEFramework >" + except: + print("Inside Utils.py : Exception in send_curl_command function") + finally: + # Return the output json response of given curl command as a string + return output_response + +#abort Device config with 5 different device configurations. +def abort_data(data): + print("Sending abort configurations") + create_device_response = requests.get("http://{}/Database.setDeviceConfig/{}".format(Config.flask_server_ip, json.dumps(data))) + print("Inside Utils.py : " + create_device_response.text + " : " + str(data)) + print("configured device data using - http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(data))) + print("") + +def initialize_flask_without_audio_device(): + '''This function is used to push the initial data towards the Flask server''' + try: + # Push the initial cec network data to Flask using http get requests - setDeviceConfig API + create_device_response = requests.get("http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data_no_audio))) + print("Inside Utils.py : " + create_device_response.text + " : " + str(Config.config_data)) + print("configured device data using - http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data_no_audio))) + print("") + + # Push the api overrides data to Flask using http get requests - setAPIConfig API + create_api_overrides_response = requests.get("http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data))) + print("Inside Utils.py : " + create_api_overrides_response.text + " : " + str(Config.api_data)) + print("configured hal api data using - http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data))) + print("") + + # Compare the obtained response with actual response + if "Success" in str(create_device_response.text) and "Success" in str(create_api_overrides_response.text): + print( + "Inside Utils.py : Successfully pushed the initial data (setDeviceConfig & setAPIConfig) to Flask") + else: + print("Inside Utils.py : Failed to push the initial data (setDeviceConfig & setAPIConfig) to Flask") + + except: + print("Inside Utils.py : Exception in initialize_flask function") + +def restart_services(): + '''This function is used to kill the WPEFramework & Websocket services and to restart those''' + try: + # Kill the port WPEFramework with -QUIT to generate .gcda filek + os.system("killall -QUIT WPEFramework") + + # Kill the port 55555 which runs the WPEFramework + os.system("fuser -k 55555/tcp") + + # Kill the port 9000 which runs the Websocket server + os.system("fuser -k 9000/tcp") + + # Start the websocket server using python subprocess module + subprocess.Popen(["python3", "websocket_server.py"], cwd=Config.directory_websocket) + time.sleep(5) + subprocess.run(["chmod", "+x", "restart.sh"], check=True) + subprocess.Popen(["./restart.sh"], cwd=Config.WPEFramework_restart) + time.sleep(5) + # file_path = path.relpath(Config.WPEFramework_logs_path) + + # Open a file for writing the output and error of WPEFramework process + # with open(file_path, "w") as logfile: + + # Run the command to start the WPEFramework and redirect the output and error to the file + # subprocess.Popen(["WPEFramework", "-f", "-c", "config.json"], + # cwd=Config.directory_thunder, stdout=logfile, stderr=logfile) + # subprocess.Popen(["./restart.sh"], cwd=Config.WPEFramework_restart, stdout=logfile, stderr=logfile) + except: + print("Inside Utils.py : Exception in restart_services function") + +def netstat_output(): + + #Run the netstat -ntlp command + + output = subprocess.run(['netstat','-ntlp'],capture_output=True,text=True) + + #Return the output as a string + + return output.stdout diff --git a/Tests/L2HALMockTests/Test_Framework/lcovrc_halmock b/Tests/L2HALMockTests/Test_Framework/lcovrc_halmock new file mode 100644 index 00000000..879fe2ce --- /dev/null +++ b/Tests/L2HALMockTests/Test_Framework/lcovrc_halmock @@ -0,0 +1,181 @@ +# +# /etc/lcovrc - system-wide defaults for LCOV +# +# To change settings for a single user, place a customized copy of this file +# at location ~/.lcovrc +# + +# Specify an external style sheet file (same as --css-file option of genhtml) +#genhtml_css_file = gcov.css + +# Specify coverage rate limits (in %) for classifying file entries +# HI: hi_limit <= rate <= 100 graph color: green +# MED: med_limit <= rate < hi_limit graph color: orange +# LO: 0 <= rate < med_limit graph color: red +genhtml_hi_limit = 75 +genhtml_med_limit = 50 + +# Width of line coverage field in source code view +genhtml_line_field_width = 12 + +# Width of branch coverage field in source code view +genhtml_branch_field_width = 16 + +# Width of overview image (used by --frames option of genhtml) +genhtml_overview_width = 80 + +# Resolution of overview navigation: this number specifies the maximum +# difference in lines between the position a user selected from the overview +# and the position the source code window is scrolled to (used by --frames +# option of genhtml) +genhtml_nav_resolution = 4 + +# Clicking a line in the overview image should show the source code view at +# a position a bit further up so that the requested line is not the first +# line in the window. This number specifies that offset in lines (used by +# --frames option of genhtml) +genhtml_nav_offset = 10 + +# Do not remove unused test descriptions if non-zero (same as +# --keep-descriptions option of genhtml) +genhtml_keep_descriptions = 0 + +# Do not remove prefix from directory names if non-zero (same as --no-prefix +# option of genhtml) +genhtml_no_prefix = 0 + +# Do not create source code view if non-zero (same as --no-source option of +# genhtml) +genhtml_no_source = 0 + +# Replace tabs with number of spaces in source view (same as --num-spaces +# option of genhtml) +genhtml_num_spaces = 8 + +# Highlight lines with converted-only data if non-zero (same as --highlight +# option of genhtml) +genhtml_highlight = 0 + +# Include color legend in HTML output if non-zero (same as --legend option of +# genhtml) +genhtml_legend = 0 + +# Use FILE as HTML prolog for generated pages (same as --html-prolog option of +# genhtml) +#genhtml_html_prolog = FILE + +# Use FILE as HTML epilog for generated pages (same as --html-epilog option of +# genhtml) +#genhtml_html_epilog = FILE + +# Use custom filename extension for pages (same as --html-extension option of +# genhtml) +#genhtml_html_extension = html + +# Compress all generated html files with gzip. +#genhtml_html_gzip = 1 + +# Include sorted overview pages (can be disabled by the --no-sort option of +# genhtml) +genhtml_sort = 1 + +# Include function coverage data display (can be disabled by the +# --no-func-coverage option of genhtml) +#genhtml_function_coverage = 1 + +# Include branch coverage data display (can be disabled by the +# --no-branch-coverage option of genhtml) +#genhtml_branch_coverage = 1 + +# Specify the character set of all generated HTML pages +genhtml_charset=UTF-8 + +# Allow HTML markup in test case description text if non-zero +genhtml_desc_html=0 + +# Specify the precision for coverage rates +#genhtml_precision=1 + +# Show missed counts instead of hit counts +#genhtml_missed=1 + +# Demangle C++ symbols +#genhtml_demangle_cpp=1 + +# Name of the tool used for demangling C++ function names +#genhtml_demangle_cpp_tool = c++filt + +# Specify extra parameters to be passed to the demangling tool +#genhtml_demangle_cpp_params = "" + +# Location of the gcov tool (same as --gcov-info option of geninfo) +#geninfo_gcov_tool = gcov + +# Adjust test names to include operating system information if non-zero +#geninfo_adjust_testname = 0 + +# Calculate checksum for each source code line if non-zero (same as --checksum +# option of geninfo if non-zero, same as --no-checksum if zero) +#geninfo_checksum = 1 + +# Specify whether to capture coverage data for external source files (can +# be overridden by the --external and --no-external options of geninfo/lcov) +#geninfo_external = 1 + +# Enable libtool compatibility mode if non-zero (same as --compat-libtool option +# of geninfo if non-zero, same as --no-compat-libtool if zero) +#geninfo_compat_libtool = 0 + +# Use gcov's --all-blocks option if non-zero +#geninfo_gcov_all_blocks = 1 + +# Specify compatiblity modes (same as --compat option of geninfo). +#geninfo_compat = libtool=on, hammer=auto, split_crc=auto + +# Adjust path to source files by removing or changing path components that +# match the specified pattern (Perl regular expression format) +#geninfo_adjust_src_path = /tmp/build => /usr/src + +# Specify if geninfo should try to automatically determine the base-directory +# when collecting coverage data. +geninfo_auto_base = 1 + +# Use gcov intermediate format? Valid values are 0, 1, auto +geninfo_intermediate = auto + +# Specify if exception branches should be excluded from branch coverage. +geninfo_no_exception_branch = 0 + +# Directory containing gcov kernel files +# lcov_gcov_dir = /proc/gcov + +# Location of the insmod tool +lcov_insmod_tool = /sbin/insmod + +# Location of the modprobe tool +lcov_modprobe_tool = /sbin/modprobe + +# Location of the rmmod tool +lcov_rmmod_tool = /sbin/rmmod + +# Location for temporary directories +lcov_tmp_dir = /tmp + +# Show full paths during list operation if non-zero (same as --list-full-path +# option of lcov) +lcov_list_full_path = 0 + +# Specify the maximum width for list output. This value is ignored when +# lcov_list_full_path is non-zero. +lcov_list_width = 80 + +# Specify the maximum percentage of file names which may be truncated when +# choosing a directory prefix in list output. This value is ignored when +# lcov_list_full_path is non-zero. +lcov_list_truncate_max = 20 + +# Specify if function coverage data should be collected and processed. +lcov_function_coverage = 1 + +# Specify if branch coverage data should be collected and processed. +lcov_branch_coverage = 0 diff --git a/Tests/L2HALMockTests/Test_Framework/restart.sh b/Tests/L2HALMockTests/Test_Framework/restart.sh new file mode 100644 index 00000000..42b1ef67 --- /dev/null +++ b/Tests/L2HALMockTests/Test_Framework/restart.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +WORKSPACE=$SCRIPTS_DIR/../../../.. + +echo -e "${GREEN}========================================Run rdkservices===============================================${NC}" +cd $WORKSPACE +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH/usr/local/lib/:$WORKSPACE/deps/rdk/hdmicec/install/lib:$WORKSPACE/deps/rdk/hdmicec/ccec/drivers/test:$WORKSPACE/deps/rdk/iarmbus/install/:$WORKSPACE/install/usr/lib:$WORKSPACE/deps/rdk/devicesettings/install/lib +$WORKSPACE/install/usr/bin/WPEFramework -f -c $WORKSPACE/install/etc/WPEFramework/config.json & \ No newline at end of file