diff --git a/.github/scripts/rtrouted.sh b/.github/scripts/rtrouted.sh index 7c35d464..be9ea7ce 100755 --- a/.github/scripts/rtrouted.sh +++ b/.github/scripts/rtrouted.sh @@ -13,4 +13,3 @@ nohup rtrouted -f -l DEBUG > /tmp/rtrouted_log.txt & mkdir ${RBUS_INSTALL_DIR}/usr/lib/rbus_temp_lib cp ${RBUS_INSTALL_DIR}/usr/lib/librbuscore.so* ${RBUS_INSTALL_DIR}/usr/lib/rbus_temp_lib/ cp ${RBUS_INSTALL_DIR}/usr/lib/librtMessage.so* ${RBUS_INSTALL_DIR}/usr/lib/rbus_temp_lib/ -cp ${RBUS_INSTALL_DIR}/usr/lib/libcjson.so ${RBUS_INSTALL_DIR}/usr/lib/rbus_temp_lib/ diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index adcd9e36..40d0b58c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -4,7 +4,7 @@ name: CI on: - pull_request_target: + pull_request: push: paths-ignore: - 'AUTHORS' @@ -15,16 +15,15 @@ on: tags-ignore: - 'v[0-9]+.[0-9]+.[0-9]+' branches: - - main - master jobs: test: name: Unit Tests - runs-on: [ ubuntu-20.04 ] + runs-on: [ ubuntu-latest ] steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 @@ -32,15 +31,12 @@ jobs: - name: Install packages run: | sudo apt update - sudo apt-get -y install valgrind libcunit1 libcunit1-doc libcunit1-dev libmsgpack-dev gcovr libtool + sudo apt-get -y install valgrind libcunit1 libcunit1-doc libcunit1-dev libmsgpack-dev gcovr libtool libcjson-dev uuid-dev pip install coverage - name: Make Build Directory run: mkdir build - - name: Get Sonarcloud Binaries - uses: sonarsource/sonarcloud-github-c-cpp@v2 - - name: CMake working-directory: build run: | @@ -63,26 +59,21 @@ jobs: mkdir _install mkdir _install/lib cp ${RBUS_INSTALL_DIR}/usr/lib/librbus* _install/lib - build-wrapper-linux-x86-64 --out-dir bw-output make all test + make all test - name: Stop rtrouted run: | killall -9 rtrouted - - name: Merge GCOV Reports for Sonarcloud + - name: Generate Coverage Report working-directory: build run: | - gcovr --sonarqube coverage.xml -r .. - - - name: Upload SonarCloud - run: | - sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dproject.settings=.sonar-project.properties -Dsonar.login=${{ secrets.SONAR_TOKEN }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + gcovr --xml coverage.xml -r .. || echo "Coverage generation skipped" - name: Upload Codecov.io - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 + if: always() + uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v4.6.0 with: - directory: . - flags: unittests - fail_ci_if_error: true + files: ./build/coverage.xml + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index aa50b37b..cc990bc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,7 +222,7 @@ ExternalProject_Add(cjwt GIT_REPOSITORY https://github.com/Comcast/cjwt.git GIT_TAG "1b023c41bb2d6dbbf493c202ed81f06c84d5b51b" #GIT_TAG "1.0.1" - CMAKE_ARGS += -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DBUILD_TESTING=OFF + CMAKE_ARGS += -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DBUILD_TESTING=OFF -DCMAKE_C_FLAGS=-Wno-deprecated-declarations ) add_library(libcjwt STATIC SHARED IMPORTED) add_dependencies(libcjwt cjwt) @@ -235,6 +235,10 @@ ExternalProject_Add(ucresolv GIT_REPOSITORY https://github.com/Comcast/libucresolv.git GIT_TAG "1.0.0" CMAKE_ARGS += -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} + PATCH_COMMAND + ${CMAKE_COMMAND} -E echo "Patching ucresolv: removing dn_expand macro" + COMMAND sed -i "/__dn_expand/d" ${CMAKE_CURRENT_SOURCE_DIR}/build/_prefix/ucresolv/src/ucresolv/src/ucresolv.h + COMMAND sed -i "/__dn_expand/d" ${CMAKE_CURRENT_SOURCE_DIR}/build/_prefix/ucresolv/src/ucresolv/include/resolv/resolv.h ) add_library(libucresolv STATIC SHARED IMPORTED) add_dependencies(libucresolv ucresolv) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 064ae51e..b7ef8a2f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -268,7 +268,14 @@ set(XMIDT_SRC ${XMIDT_SRC} ../src/client_list.c ../src/spin_thread.c ../src/partners_check.c + ../src/token.c + ) + +if (PARODUS_SECERT_ENABLE) +set(XMIDT_SRC ${XMIDT_SRC} ../src/rdkconfig_generic) +endif (PARODUS_SECERT_ENABLE) + if (ENABLE_WEBCFGBIN) set(XMIDT_SRC ${XMIDT_SRC} ../src/upstream_rbus.c ../src/xmidtsend_rbus.c) endif (ENABLE_WEBCFGBIN) diff --git a/tests/test_crud_internal.c b/tests/test_crud_internal.c index 7ed73ca1..c1859721 100644 --- a/tests/test_crud_internal.c +++ b/tests/test_crud_internal.c @@ -184,7 +184,7 @@ void test_retrieveFromMemoryFailure() { int ret = -1; cJSON *jsonresponse; - ParodusCfg cfg; + ParodusCfg cfg={0}; set_parodus_cfg(&cfg); ret = retrieveFromMemory("hw-model", &jsonresponse ); assert_int_equal (ret, -1);