Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Pre-requisites

CMake >=3.10

Ubuntu 20.04 +:

Install the dependencies:

# Install dependencies
sudo apt-get install python3-distutils
sudo apt-get install diffstat
sudo apt-get install chrpath
sudo apt-get install make
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install texinfo
sudo apt-get install libiptc0

Install libprotobuf-dev v3.7.0 or higher. For < Ubuntu 22.04, protobuf must be manually installed to fetch a later version:

Code Block
languagebash
firstline1
titleInstall libprotobuf v3.7.0
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.7.0/protobuf-all-3.7.0.tar.gz
 
 
tar -zxvf protobuf-all-3.7.0.tar.gz
 
 
cd protobuf-3.7.0/
./configure
make -j10
make check -j10
sudo make install -j10
 
 
# Check version
protoc --version
 
 
# If version still not correct add to end of ~/.bashrc
vi ~/./bashrc
 
 
+ alias protoc=/usr/local/bin/protoc

#Exit out of vi 
 
source  ~/.bashrc
 
# Check version
protoc --version

Otherwise, can install protobuf normally:

sudo apt-get install protobuf-compiler

Run Tests Manually

Code Block
languagebash
titleRun tests manually
#Go to rialto repo, if you don't have it, clone it
mkdir build && cd build

#install:
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt install pkg-config

cmake .. -DCMAKE_BUILD_TYPEFLAG=UnitTests

make test_executable

./tests/[component_path]/[test_executable]

Run Test Build Script

The 'build_ut.py' script can be used to easily run a test/s in the rialto repository.

build_ut must be amended whenever a new component is added or a existing component test path changes. The initial list of tests are as followed (please see build_ut.py for an up to date list):

Code Block
languagepy
titlebuild_ut script components
# Rialto Component Tests & Paths
# {Component Name : {Test Suite, Test Path}}
suiteInfo = {
    "servermain" : {"suite" : "RialtoServerMainUnitTests", "path" : "/tests/playermedia/server/main/"},
    "servergstplayer" : {"suite" : "RialtoServerGstPlayerUnitTests", "path" : "/tests/playermedia/server/gstplayer/"},
    "serveripc" : {"suite" : "RialtoServerIpcUnitTests", "path" : "/tests/playermedia/server/ipc/"},
    "serverservice" : {"suite" : "RialtoServerServiceUnitTests", "path" : "/tests/playermedia/server/service/"},
    "client" : {"suite" : "RialtoClientUnitTests", "path" : "/tests/playermedia/client/main/"},
    "clientipc" : {"suite" : "RialtoClientIpcUnitTests", "path" : "/tests/playermedia/client/ipc/"},
    "common" : {"suite" : "RialtoPlayerCommonUnitTests", "path" : "/tests/playermedia/common/"},
    "logging" : {"suite" : "RialtoLoggingUnitTests", "path" : "/tests/logging/"},
    "manager" : {"suite" : "RialtoServerManagerUnitTests", "path" : "/tests/serverManager/"},
    "ipc" : {"suite" : "RialtoIpcUnitTests", "path" : "/tests/ipc/"},
}

The build script can be run with a variety of arguments:

Code Block
languagebash
titlebuild_ut options
# Run on ~/rialto
# Configure the location of the output build files (default /build)
./build_ut.py -o build2
 
# Configure the file to write the results of the build and tests
# By not supplying this option output is defaulted to stdout
# If no string provided, results will be written to 'gtest_result.log' in the root of the repo
./build_ut.py -f
./build_ut.py -f test.log
 
# Configure which suite tests you would like to run
# By not supplying this option, all test suites will be run
./build_ut.py -s server
 
# Configure the googletest filter to use when running the tests
# For more details, see: https://github.com/google/googletest/blob/main/docs/advanced.md#running-a-subset-of-the-tests
./build_ut.py -gtgf TestFilter
 
# Option to list the tests available for the requested suites
./build_ut.py -l
 
# Option to clean the directory after running (remove output directory)
./build_ut.py -c
 
# Option to skip building of the tests
./build_ut.py -nb
 
# Option to skip running of the tests
./build_ut.py -nt

# Option to run tests with valgrind check. -f or -xml option can be used here to specify output file name.
./build_ut.py -val

# Option to run tests and generate coverage report. Output will be written to ./build/coverage_report/ directory.
./build_ut.py -cov

Examples:

Code Block
languagebash
titlebuild_ut examples
# To run the server only tests, write the results to a file and clean after
./build_ut.py -s server -c -f
 
 
# To run only the 'RialtoServerCreateMediaPlayerTest' test group in server
./build_ut.py -s server -gt RialtoServerCreateMediaPlayerTest.*
#To run only the specific test under 'SessionServerAppManagerTests.' in a particular component name 'manager'(with a suite name of 'RialtoServerManagerUnitTests')
./build_ut.py -s manager -gf SessionServerAppManagerTests.*
 
 
# To run any tests in all suites that 'Create' something, but exclude 'Player
./build_ut.py -gtgf *Create*:-*Player*