diff --git a/.github/scripts/rtrouted.sh b/.github/scripts/rtrouted.sh index 06e672cf..be9ea7ce 100755 --- a/.github/scripts/rtrouted.sh +++ b/.github/scripts/rtrouted.sh @@ -1,59 +1,15 @@ #!/bin/bash -set -e - -# Use local directory relative to where script is run (should be build/ directory) -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -export RBUS_ROOT="$(pwd)/rbus_deps" +export RBUS_ROOT=${HOME}/rbus export RBUS_INSTALL_DIR=${RBUS_ROOT}/install export RBUS_BRANCH=main - -mkdir -p $RBUS_ROOT +mkdir -p $RBUS_INSTALL_DIR cd $RBUS_ROOT - -# Build and install cJSON first (rbus dependency) -echo "Building cJSON..." -git clone https://github.com/DaveGamble/cJSON.git -cmake -S cJSON -B build/cjson \ - -DCMAKE_INSTALL_PREFIX=${RBUS_INSTALL_DIR}/usr \ - -DENABLE_CJSON_TEST=OFF \ - -DBUILD_SHARED_AND_STATIC_LIBS=ON -make -C build/cjson && make -C build/cjson install - -# Build and install msgpack (rbus dependency) -echo "Building msgpack..." -git clone https://github.com/msgpack/msgpack-c.git -cd msgpack-c -git checkout b6803a5fecbe321458faafd6a079dac466614ff9 # 3.1.0 -cd .. -cmake -S msgpack-c -B build/msgpack \ - -DCMAKE_INSTALL_PREFIX=${RBUS_INSTALL_DIR}/usr \ - -DMSGPACK_ENABLE_CXX=OFF \ - -DMSGPACK_BUILD_EXAMPLES=OFF \ - -DMSGPACK_BUILD_TESTS=OFF -make -C build/msgpack && make -C build/msgpack install - -# Now build rbus -echo "Building rbus..." git clone https://github.com/rdkcentral/rbus -cmake -S rbus -B build/rbus \ - -DCMAKE_INSTALL_PREFIX=${RBUS_INSTALL_DIR}/usr \ - -DCMAKE_PREFIX_PATH=${RBUS_INSTALL_DIR}/usr \ - -DBUILD_FOR_DESKTOP=ON \ - -DCMAKE_BUILD_TYPE=Debug +cmake -Hrbus -Bbuild/rbus -DCMAKE_INSTALL_PREFIX=${RBUS_INSTALL_DIR}/usr -DBUILD_FOR_DESKTOP=ON -DCMAKE_BUILD_TYPE=Debug make -C build/rbus && make -C build/rbus install - -# Set up environment and start rtrouted -export PATH=${RBUS_INSTALL_DIR}/usr/bin:${PATH} +export PATH=${RBUS_INSTALL_DIR}/usr/bin:${PATH} && \ export LD_LIBRARY_PATH=${RBUS_INSTALL_DIR}/usr/lib:${LD_LIBRARY_PATH} - -echo "Starting rtrouted..." -nohup rtrouted -f -l DEBUG > /tmp/rtrouted_log.txt 2>&1 & -sleep 2 - -# Copy libraries to temp location -mkdir -p ${RBUS_INSTALL_DIR}/usr/lib/rbus_temp_lib -cp ${RBUS_INSTALL_DIR}/usr/lib/librbuscore.so* ${RBUS_INSTALL_DIR}/usr/lib/rbus_temp_lib/ 2>/dev/null || true -cp ${RBUS_INSTALL_DIR}/usr/lib/librtMessage.so* ${RBUS_INSTALL_DIR}/usr/lib/rbus_temp_lib/ 2>/dev/null || true -cp ${RBUS_INSTALL_DIR}/usr/lib/libcjson.so* ${RBUS_INSTALL_DIR}/usr/lib/rbus_temp_lib/ 2>/dev/null || true - -echo "rtrouted setup complete" +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/ diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index adeb4013..ab7eff25 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -26,10 +26,12 @@ jobs: with: fetch-depth: 0 + # Install the dependent packages - name: Install packages run: | sudo apt update - sudo apt-get -y install valgrind libcunit1 libcunit1-doc libcunit1-dev libcurl4-openssl-dev openssl libexpat1-dev gcovr uuid-dev libdbus-1-dev libnanomsg-dev libmsgpack-dev libcjson-dev + sudo apt-get -y install valgrind libcunit1 libcunit1-doc libcunit1-dev libcurl4-openssl-dev openssl libexpat1-dev gcovr libgtest-dev lcov gcovr libmsgpack* libcjson-dev build-essential uuid-dev + pip install codecov - name: Make Build Directory run: mkdir build @@ -42,39 +44,26 @@ jobs: - name: CMake working-directory: build run: | - export RBUS_ROOT=$(pwd)/rbus_deps - export RBUS_INSTALL_DIR=${RBUS_ROOT}/install - export C_INCLUDE_PATH=${RBUS_INSTALL_DIR}/usr/include - mkdir _install - mkdir _install/lib - cp ${RBUS_INSTALL_DIR}/usr/lib/librbus* _install/lib - cmake .. \ - -DBUILD_TESTING:BOOL=true \ - -DBUILD_GIT:BOOL=true \ - -DCMAKE_PREFIX_PATH="${RBUS_INSTALL_DIR}/usr" \ - -DCMAKE_INCLUDE_PATH="${RBUS_INSTALL_DIR}/usr/include" + cmake .. -DBUILD_TESTING:BOOL=true -DBUILD_GIT:BOOL=true - name: Build working-directory: build run: | - export RBUS_ROOT=$(pwd)/rbus_deps - export RBUS_INSTALL_DIR=${RBUS_ROOT}/install - export C_INCLUDE_PATH=${RBUS_INSTALL_DIR}/usr/include - export CPLUS_INCLUDE_PATH=${RBUS_INSTALL_DIR}/usr/include - export LDFLAGS="-L/usr/lib/x86_64-linux-gnu -ldbus-1 -lnanomsg" - make all - - - name: Run Tests - working-directory: build - run: | - export RBUS_ROOT=$(pwd)/rbus_deps - export RBUS_INSTALL_DIR=${RBUS_ROOT}/install - export LD_LIBRARY_PATH=${RBUS_INSTALL_DIR}/usr/lib/rbus_temp_lib:${LD_LIBRARY_PATH}:$(pwd)/_install/lib:$(pwd)/_install/lib64 - make test + ps aux + export RBUS_ROOT=${HOME}/rbus + export RBUS_INSTALL_DIR=${RBUS_ROOT}/install && \ + export LD_LIBRARY_PATH=${RBUS_INSTALL_DIR}/usr/lib/rbus_temp_lib:${LD_LIBRARY_PATH} + export C_INCLUDE_PATH=${RBUS_INSTALL_DIR}/usr/include + mkdir _install + mkdir _install/lib + cp ${RBUS_INSTALL_DIR}/usr/lib/librbus* _install/lib + make all test + # ARGS=-VV make test # use this version for debugging + - name: Stop rtrouted run: | - killall -9 rtrouted || true + killall -9 rtrouted - name: Generate Coverage Report working-directory: build diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index cb85b2ef..86744d38 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -37,16 +37,7 @@ endif() endif() set(HEADERS app/libpd.h) add_executable(webpa ${SOURCES} ${HEADERS}) -if (NOT BUILD_YOCTO) -add_dependencies(webpa cJSON cimplog trower-base64 wdmp-c nanomsg msgpack wrp-c libparodus dbus CcspCommonLibrary) -if (NOT BUILD_GIT) -add_dependencies(webpa rbus) -endif() -if (FEATURE_SUPPORT_WEBCONFIG) -add_dependencies(webpa curl webcfg) -endif() -endif() -set(COMMON_LIBS -Wl,--start-group -lccsp_common -llibparodus -lrbus -lwrp-c -lwdmp-c -ldbus-1 -lnanomsg -lrtMessage -lmsgpackc -ltrower-base64 -lcjson -lcimplog -Wl,--end-group -lpthread -lm -lrt -luuid) +set(COMMON_LIBS -lccsp_common -ldbus-1 -lwrp-c -lpthread -lwdmp-c -lmsgpackc -ltrower-base64 -lm -llibparodus -lnanomsg -lcjson -lrt -luuid -lcimplog -lrbus) if (BUILD_YOCTO) set(COMMON_LIBS "${COMMON_LIBS} -llog4c -lrdkloggers -lprint_uptime") endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 11b306fa..15b12bda 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -120,10 +120,10 @@ target_link_libraries (test_webpa_test_set gcov -Wl,--no-as-needed ) #------------------------------------------------------------------------------- # test_webpa_internal #------------------------------------------------------------------------------- -add_test(NAME test_webpa_internal COMMAND ${MEMORY_CHECK} ./test_webpa_internal) -add_executable(test_webpa_internal test_webpa_internal.c ../source/broadband/webpa_rbus.c ../source/broadband/webpa_parameter.c ../source/broadband/webpa_adapter.c ../source/app/libpd.c ../source/app/privilege.c ../source/broadband/webpa_internal.c ../source/broadband/webpa_notification.c) -target_link_libraries (test_webpa_internal ${WEBPA_COMMON_LIBS} -llibparodus -lwdmp-c -lrbus -ldbus-1 -lccsp_common -lcunit) -target_link_libraries (test_webpa_internal gcov -Wl,--no-as-needed ) +# add_test(NAME test_webpa_internal COMMAND ${MEMORY_CHECK} ./test_webpa_internal) +# add_executable(test_webpa_internal test_webpa_internal.c ../source/broadband/webpa_rbus.c ../source/broadband/webpa_parameter.c ../source/broadband/webpa_adapter.c ../source/app/libpd.c ../source/app/privilege.c ../source/broadband/webpa_internal.c ../source/broadband/webpa_notification.c) +# target_link_libraries (test_webpa_internal ${WEBPA_COMMON_LIBS} -llibparodus -lwdmp-c -lrbus -ldbus-1 -lccsp_common -lcunit) +# target_link_libraries (test_webpa_internal gcov -Wl,--no-as-needed ) # Code coverage @@ -152,8 +152,8 @@ COMMAND lcov -q --capture --directory ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/test_webpa_notification_cunit.dir/__/src --output-file test_webpa_notification_cunit.info COMMAND lcov -q --capture --directory ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/test_webpa_test_set.dir/__/src --output-file test_webpa_test_set.info -COMMAND lcov -q --capture --directory -${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/test_webpa_internal.dir/__/src --output-file test_webpa_internal.info +#COMMAND lcov -q --capture --directory +#${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/test_webpa_internal.dir/__/src --output-file test_webpa_internal.info COMMAND lcov -a test_libpd.info @@ -165,7 +165,7 @@ COMMAND lcov -a test_webpa_set_attr.info -a test_webpa_replace.info -a test_webpa_notification.info --a test_webpa_internal.info +#-a test_webpa_internal.info -a test_webpa_table.info -a test_webpa_notification_cunit.info -a test_webpa_test_set.info