Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: Unit tests

on:
pull_request:
branches: ["master"]

jobs:
build:
runs-on: ubuntu-24.04


- name: Install dependencies
run: |
sudo apt -y install build-essential pkg-config cmake ninja-build libusb-1.0-0-dev zlib1g-dev libssl-dev
sudo apt -y install nodejs npm

- name: Install GStreamer
run: |
sudo apt update
sudo apt install -y libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

- name: Set up Python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You most likely don't need that, as Python in installed on the runners by default

uses: actions/setup-python@v4
with:
python-version: '3.x'
- run: pip install jsonref

- name: Checkout ThunderTools
uses: actions/checkout@v3
with:
repository: rdkcentral/ThunderTools
ref: R5_1
path: ThunderTools

- name: Build ThunderTools
run: >
cmake -G Ninja -S ThunderTools -B build/ThunderTools -DCMAKE_INSTALL_PREFIX="install"
cmake --build build/ThunderTools --target install

- name: Checkout Thunder
uses: actions/checkout@v3
with:
repository: rdkcentral/Thunder
ref: R5_1
path: Thunder

- name: Build Thunder
run: >
cmake -G Ninja -S Thunder -B build/Thunder \
-DBINDING="127.0.0.1" \
-DCMAKE_BUILD_TYPE="Debug" \
-DCMAKE_INSTALL_PREFIX="install" \
-DPORT="55555" \
-DTOOLS_SYSROOT="${PWD}" \
-DINITV_SCRIPT=OFF
cmake --build build/Thunder --target install

- name: Checkout ThunderInterfaces
uses: actions/checkout@v3
with:
repository: rdkcentral/ThunderInterfaces
ref: R5_1
path: ThunderInterfaces

- name: Build ThunderInterfaces
run: >
cmake -G Ninja -S ThunderInterfaces -B build/ThunderInterfaces \
-DCMAKE_INSTALL_PREFIX="install"
cmake --build build/ThunderInterfaces --target install

- name: Checkout ThunderNanoServices
uses: actions/checkout@v3
with:
repository: rdkcentral/ThunderNanoServices
ref: R5_1
path: ThunderNanoServices

- name: Build ThunderNanoServices
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to build ThunderNanoServices and ThunderNanoServicesRDK for these tests?

run: >
cmake -G Ninja -S ThunderNanoServices -B build/ThunderNanoServices \
-DCMAKE_INSTALL_PREFIX="install" \
-DPLUGIN_COMMANDER=ON \
-DPLUGIN_DIALSERVER=ON \
-DPLUGIN_DICTIONARY=ON \
-DPLUGIN_FILETRANSFER=ON \
-DPLUGIN_INPUTSWITCH=ON \
-DPLUGIN_PROCESSMONITOR=ON \
-DPLUGIN_RESOURCEMONITOR=ON \
-DPLUGIN_SYSTEMCOMMANDS=ON \
-DPLUGIN_SWITCHBOARD=ON \
-DPLUGIN_WEBPROXY=ON \
-DPLUGIN_WEBSHELL=ON
cmake --build build/ThunderNanoServices --target install

- name: Checkout ThunderNanoServicesRDK
uses: actions/checkout@v3
with:
repository: rdkcentral/ThunderNanoServicesRDK
ref: R5_1
path: ThunderNanoServicesRDK

- name: Build ThunderNanoServicesRDK
run: >
cmake -G Ninja -S ThunderNanoServicesRDK -B build/ThunderNanoServicesRDK \
-DCMAKE_INSTALL_PREFIX="install" \
-DPLUGIN_DEVICEINFO=ON \
-DPLUGIN_MESSAGECONTROL=ON \
-DPLUGIN_MESSENGER=ON \
-DPLUGIN_MONITOR=ON \
-DPLUGIN_OPENCDMI=ON \
-DPLUGIN_PERFORMANCEMETRICS=ON
cmake --build build/ThunderNanoServicesRDK --target install

- name: Checkout ThunderClientLibraries
uses: actions/checkout@v3
with:
repository: rdkcentral/ThunderClientLibraries
ref: R5_1
path: ThunderClientLibraries

- name: Build ThunderClientLibraries
run: >
cmake -G Ninja -S ThunderClientLibraries -B build/ThunderClientLibraries \
-DCMAKE_INSTALL_PREFIX="install" \
-DBLUETOOTHAUDIOSINK=ON \
-DDEVICEINFO=ON \
-DDISPLAYINFO=ON \
-DSECURITYAGENT=ON \
-DPLAYERINFO=ON \
-DPROTOCOLS=ON \
-DVIRTUALINPUT=ON \
-DCDMI=ON \
-DL1_TESTS=ON \
-DL2_TESTS=ON
cmake --build build/ThunderClientLibraries --target install

- name: Export path
run: >
export LD_LIBRARY_PATH=${PWD}/install/lib:${LD_LIBRARY_PATH}
export PATH=${PWD}/install/bin:${PATH}

- name: Run unit tests
run: /bin/bash ThunderClientLibraries/run.sh -c

- name: Upload test results to automatic test result management system
run: >
gtest-json-result-push.py ${{github.workspace}}/ThunderClientLibraries/TestReport.json https://rdkeorchestrationservice.as-g8.cf.comcast.net/rdke_orchestration_api/push_unit_test_results `pwd`

4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ option(CRYPTOGRAPHY

option(INSTALL_TESTS "Install the test applications" OFF)

option(L1_TESTS "Install the test applications" OFF)

option(L2_TESTS "Install the test applications" OFF)

if (BUILD_REFERENCE)
add_definitions (-DBUILD_REFERENCE=${BUILD_REFERENCE})
endif()
Expand Down
8 changes: 8 additions & 0 deletions Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,12 @@ if(CDMI)
add_subdirectory(ocdmtest)
endif()

if(L1_TESTS)
add_subdirectory(L1Tests)
endif()

if(L2_TESTS)
add_subdirectory(L2Tests)
endif()


56 changes: 56 additions & 0 deletions Tests/L1Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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.

cmake_minimum_required(VERSION 3.8)
project(L1Test)

set(CMAKE_CXX_STANDARD 11)

find_package(Thunder)
find_package(ClientOCDM REQUIRED)
find_package(${NAMESPACE}Core REQUIRED)
find_package(${NAMESPACE}COM REQUIRED)
find_package(${NAMESPACE}Messaging REQUIRED)
find_package(CompileSettingsDebug CONFIG REQUIRED)
find_package(GTest REQUIRED)
include(CTest)

file(GLOB TESTS tests/*.cpp)

add_executable(${PROJECT_NAME}
gtest_main.cpp
${TESTS}
)

include_directories(../../Source/ocdm)
link_directories(../../Source/ocdm)

target_link_libraries(${PROJECT_NAME}
${NAMESPACE}Core::${NAMESPACE}Core
${NAMESPACE}COM::${NAMESPACE}COM
${NAMESPACE}Messaging::${NAMESPACE}Messaging
CompileSettingsDebug::CompileSettingsDebug
ClientOCDM::ClientOCDM
GTest::GTest
)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")

gtest_add_tests(TARGET ${PROJECT_NAME})

install(TARGETS ${PROJECT_NAME} DESTINATION bin)
26 changes: 26 additions & 0 deletions Tests/L1Tests/gtest_main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.
*/

#include <gtest/gtest.h>

int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
24 changes: 24 additions & 0 deletions Tests/L1Tests/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# This script will build and run the L1 tests

rm -rf build

mkdir build

cd build

export GTEST_OUTPUT="json"

cmake ..

make

./L1Test

#Generate coverage report
if [ "$1" != "" ] && [ $1 = "-c" ]; then
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info
genhtml coverage.info --output-directory coverage_report
fi
43 changes: 43 additions & 0 deletions Tests/L1Tests/tests/open_cdm_ext_tests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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.
*/

#include "open_cdm_impl.h"
#include "open_cdm_ext.h"
#include <gtest/gtest.h>
using namespace testing;

class OpenCDMExtTest : public ::testing::Test {
protected:

void SetUp() override {
}

void TearDown() override {
}
};

TEST_F(OpenCDMExtTest, opencdmCreateSystem)
{
int status = 0;
const char keySystem[] = "playready";
struct OpenCDMSystem* result;
result = opencdm_create_system(keySystem);
EXPECT_EQ(result, nullptr);
}

39 changes: 39 additions & 0 deletions Tests/L1Tests/tests/open_cdm_tests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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.
*/

#include "open_cdm.h"
#include <gtest/gtest.h>
using namespace testing;

class OpenCDMTest : public ::testing::Test {
protected:

void SetUp() override {
}

void TearDown() override {
}
};

TEST_F(OpenCDMTest, status)
{
int status = 1;
EXPECT_EQ(status, 1);
}

Loading