Skip to content

Unit test code for WifiSignalStrengthMonitor.cpp file #36

Unit test code for WifiSignalStrengthMonitor.cpp file

Unit test code for WifiSignalStrengthMonitor.cpp file #36

Workflow file for this run

name: gnome_unit_test
on:
push:
branches: [ main, develop, 'release/**']
pull_request:
branches: [ main, develop, 'release/**']
env:
THUNDER_REF: "R4.4.1"
jobs:
unit-tests:
name: Build and run unit tests
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [ gcc, clang ]
coverage: [ with-coverage, without-coverage ]
exclude:
- compiler: clang
coverage: with-coverage
- compiler: clang
coverage: without-coverage
- compiler: gcc
coverage: without-coverage
steps:
- name: Configure cache
if: ${{ !env.ACT }}
id: cache
uses: actions/cache@v3
with:
path: |
build/Thunder
build/ThunderInterfaces
build/ThunderTools
install
!install/etc/WPEFramework/plugins
!install/usr/lib/wpeframework/plugins
key: ${{ runner.os }}-${{ env.THUNDER_REF }}
- name: Install packages
run: |
sudo apt update
sudo apt-get install -y pkg-config libglib2.0-dev libnm-dev libcurl4-openssl-dev ninja-build
- name: Configure Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- run: pip install jsonref
- name: Configure CMake
uses: jwlawson/[email protected]
with:
cmake-version: '3.16.x'
- name: Checkout thunder repositories
if: steps.cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/rdkcentral/ThunderTools ThunderTools --branch ${{ env.THUNDER_REF }}
git clone https://github.com/rdkcentral/Thunder Thunder --branch ${{ env.THUNDER_REF }}
git clone https://github.com/rdkcentral/ThunderInterfaces ThunderInterfaces --branch ${{ env.THUNDER_REF }}
- name: Build ThunderTools
if: steps.cache.outputs.cache-hit != 'true'
run: >
cmake
-S "${{github.workspace}}/ThunderTools" -B build/ThunderTools
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install/usr"
-DCMAKE_MODULE_PATH="${{github.workspace}}/install/tools/cmake"
-DGENERIC_CMAKE_MODULE_PATH="${{github.workspace}}/install/tools/cmake"
&&
cmake --build build/ThunderTools --target install -j8
- name: Build Thunder
if: steps.cache.outputs.cache-hit != 'true'
run: >
cmake
-S "${{github.workspace}}/Thunder" -B build/Thunder
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install/usr"
-DCMAKE_MODULE_PATH="${{github.workspace}}/install/tools/cmake"
-DBUILD_TYPE=Debug
-DBINDING=127.0.0.1
-DPORT=9998
&&
cmake --build build/Thunder --target install -j8
- name: Build ThunderInterfaces
if: steps.cache.outputs.cache-hit != 'true'
run: >
cmake
-S "${{github.workspace}}/ThunderInterfaces" -B build/ThunderInterfaces
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install/usr"
-DCMAKE_MODULE_PATH="${{github.workspace}}/install/tools/cmake"
&&
cmake --build build/ThunderInterfaces --target install -j8
- name: Checkout networkmanager
uses: actions/checkout@v3
with:
path: networkmanager
- name: Set clang toolchain
if: ${{ matrix.compiler == 'clang' }}
run: echo "TOOLCHAIN_FILE=${{github.workspace}}/networkmanager/Tests/clang.cmake" >> $GITHUB_ENV
- name: Set gcc/with-coverage toolchain
if: ${{ matrix.compiler == 'gcc' && matrix.coverage == 'with-coverage' && !env.ACT }}
run: echo "TOOLCHAIN_FILE=${{github.workspace}}/networkmanager/Tests/gcc-with-coverage.cmake" >> $GITHUB_ENV
- name: Build networkmanager with Gnome Proxy
run: >
cmake
-S "${{github.workspace}}/networkmanager"
-B build/GnomeNetworkmanager
-DCMAKE_TOOLCHAIN_FILE="${{ env.TOOLCHAIN_FILE }}"
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install/usr"
-DCMAKE_MODULE_PATH="${{github.workspace}}/install/tools/cmake"
-DCMAKE_CXX_FLAGS="
-ftest-coverage
-DENABLE_GNOME_NETWORKMANAGER=ON
-DENABLE_UNIT_TESTING=ON
&&
cmake --build build/GnomeNetworkmanager --target install -j8
- name: Generate coverage
if: ${{ matrix.coverage == 'with-coverage' && !env.ACT }}
run: >
cp ${{github.workspace}}/networkmanager/Tests/WiFi/.lcovrc_l1 ~/.lcovrc
&&
lcov -c
-o coverage.info
-d build/networkmanager
&&
lcov
-r coverage.info
'/usr/include/*'
'*/build/networkmanager/_deps/*'
'*/install/usr/include/*'
'*/Tests/headers/*'
'*/Tests/mocks/*'
'*/Tests/WiFi/*'
-o filtered_coverage.info
&&
genhtml
-o coverage
-t "wifisignalstrengthmonitor coverage"
filtered_coverage.info