Remove thunder mocks from test directory#285
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes in-repo Thunder mock/patch artifacts and shifts unit-test dependencies toward fetching Thunder (and GoogleTest) via CMake FetchContent, with corresponding CI workflow simplifications.
Changes:
- Added
tests/thunderFetchContent setup for Thunder + GoogleTest and removed the old Thunder patching approach. - Deleted
tests/mocks/thunder/*mock headers/sources and introduced new mock/support headers undertests/mocks/. - Updated test CMake and GitHub workflows to stop cloning/building Thunder directly and to adjust test build inputs/includes.
Reviewed changes
Copilot reviewed 19 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| CMakeLists.txt | Adds test-only FetchContent fallback for Thunder when not found via find_package. |
| tests/thunder/CMakeLists.txt | New FetchContent-based provisioning for Thunder + GoogleTest for unit tests. |
| tests/patches/thunder/SubscribeStub.patch | Removes the old Thunder source patch used by CI/tests. |
| tests/mocks/thunder/SystemInfo.h | Removes Thunder-specific subsystem mock. |
| tests/mocks/thunder/Module.h | Removes Thunder-specific module header used by old mocks/tests. |
| tests/mocks/thunder/Module.cpp | Removes Thunder-specific module translation unit used by old mocks/tests. |
| tests/mocks/thunder/DispatcherMock.h | Removes Thunder dispatcher mock. |
| tests/mocks/thunder/CommunicatorMock.h | Removes Thunder communicator client mock. |
| tests/mocks/thunder/Communicator.h | Removes Thunder communicator shim header. |
| tests/mocks/thunder/Communicator.cpp | Removes Thunder communicator shim implementation. |
| tests/mocks/mockauthservices.h | Adds authentication/security-related mock used by legacy tests. |
| tests/mocks/WorkerPoolImplementation.h | Adds a WorkerPool test implementation used by L2 tests. |
| tests/mocks/ThunderPortability.h | Adds portability macros/types used by tests when building against Thunder/WPEFramework headers. |
| tests/mocks/ServiceMock.h | Adds PluginHost::IShell mock used by tests. |
| tests/mocks/InterfaceIteratorMock.h | Adds iterator mock used by legacy/network tests. |
| tests/mocks/IStringIteratorMock.h | Adds string iterator mock template used by legacy/network tests. |
| tests/mocks/FactoriesImplementation.h | Adds PluginHost::IFactories implementation for request/response factories in tests. |
| tests/mocks/COMLinkMock.h | Adds COMLink mock used for RPC instantiation in tests. |
| tests/l1Test/CMakeLists.txt | Makes Core/Plugins find_package conditional on targets already existing. |
| tests/l2Test/CMakeLists.txt | Removes GoogleTest FetchContent provisioning and makes Core/Plugins find_package conditional. |
| tests/l2Test/rdk/CMakeLists.txt | Switches tests to use plugin/Module.cpp and removes Thunder-mocks include dir; conditional find_package. |
| tests/l2Test/libnm/CMakeLists.txt | Removes GoogleTest FetchContent provisioning (now assumed external) and switches to plugin/Module.cpp. |
| tests/l2Test/legacy/CMakeLists.txt | Switches tests to use plugin/Module.cpp and removes Thunder-mocks include dir; conditional find_package. |
| .github/workflows/rdk_proxy_L1_L2_test.yml | Stops cloning/patching/building Thunder in CI. |
| .github/workflows/libnm_proxy_L1_test.yml | Stops cloning/patching/building Thunder in CI. |
| .github/workflows/legacy_L1_L2_test.yml | Stops cloning/patching/building Thunder in CI; adjusts IARM stub generation steps. |
| .github/workflows/gdbus_proxy_L1_test.yml | Stops cloning/patching/building Thunder in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| find_package(CURL) | ||
| find_package(PkgConfig REQUIRED) | ||
| find_package(${NAMESPACE}Core REQUIRED) | ||
| find_package(${NAMESPACE}Plugins REQUIRED) | ||
|
|
||
| include(FetchContent) | ||
| FetchContent_Declare( | ||
| googletest | ||
| URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip | ||
| ) | ||
|
|
||
| FetchContent_MakeAvailable(googletest) | ||
| # Thunder targets may already exist from FetchContent (test-only builds) | ||
| if(NOT TARGET ${NAMESPACE}Core::${NAMESPACE}Core) | ||
| find_package(${NAMESPACE}Core REQUIRED) | ||
| endif() | ||
| if(NOT TARGET ${NAMESPACE}Plugins::${NAMESPACE}Plugins) | ||
| find_package(${NAMESPACE}Plugins REQUIRED) | ||
| endif() |
There was a problem hiding this comment.
This CMakeLists no longer provides GoogleTest/GoogleMock (it removed the prior FetchContent block), but subtargets under l1Test/l2Test still link against gmock_main and use gtest_SOURCE_DIR include paths. Unless those are guaranteed to be defined earlier by the top-level build, configuring unit tests will fail on environments without system gmock/gtest. Consider adding a local fallback here (FetchContent or find_package(GTest)) or ensuring the top-level unit-test path always brings in GoogleTest before adding tests/ subdirectories.
CMakeLists.txt
Outdated
| # If neither is found, use FetchContent for test-only builds | ||
| if (NOT WPEFramework_FOUND AND NOT Thunder_FOUND) | ||
| message(FATAL_ERROR | ||
| "Neither WPEFramework nor Thunder could be found.\n" | ||
| "Install one of them and ensure its CMake package is discoverable via CMAKE_PREFIX_PATH or default locations.") | ||
| if(ENABLE_UNIT_TESTING) | ||
| message(STATUS "Thunder not found via find_package — using FetchContent for test builds") | ||
| add_subdirectory(tests/thunder) | ||
| else() | ||
| message(FATAL_ERROR | ||
| "Neither WPEFramework nor Thunder could be found.\n" | ||
| "Install one of them and ensure its CMake package is discoverable via CMAKE_PREFIX_PATH or default locations.\n" | ||
| "Alternatively, enable ENABLE_UNIT_TESTING to use FetchContent.") | ||
| endif() |
There was a problem hiding this comment.
When ENABLE_UNIT_TESTING is ON and Thunder/WPEFramework is found via find_package, this path won’t add tests/thunder, so GoogleTest (gmock_main, gtest_SOURCE_DIR) is never provided. The test CMakeLists currently assumes FetchContent has populated these, which can break local/unit-test builds unless the environment happens to provide gmock_main system-wide. Consider fetching GoogleTest unconditionally when ENABLE_UNIT_TESTING is enabled (or moving GoogleTest FetchContent to a dedicated tests CMake module that always runs for unit tests), independent of whether Thunder is discovered via find_package.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 30 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
.github/workflows/rdk_proxy_L1_L2_test.yml:82
- The workflow still creates placeholder IARM artifacts under
install/usr/lib, but after removing the Thunder build/install steps this directory may not exist on a cache miss.touch install/usr/lib/libIARMBus.sowill fail ifinstall/usr/libhasn't been created. Addmkdir -p install/usr/libbefore touching these files (similar to what was done inlegacy_L1_L2_test.yml).
PATH=${{github.workspace}}/install/usr/bin:${PATH}
LD_LIBRARY_PATH=${{github.workspace}}/install/usr/lib:${{github.workspace}}/install/usr/lib/wpeframework/plugins:${LD_LIBRARY_PATH}
rdkproxy_l2_test --gtest_color=yes --gtest_output="xml:/tmp/gtest_log/rdkproxy_l2_test.xml"
.github/workflows/libnm_proxy_L1_test.yml:93
- After removing the Thunder build/install steps, the workflow may run on a cache miss without
install/usr/libexisting. Thetouch install/usr/lib/libIARMBus.soandtouch install/usr/lib/libmfrlib.socommands will fail if that directory isn’t created first. Addmkdir -p install/usr/libbefore thesetouchcalls.
- name: Generate coverage
run: |
lcov -c -o coverage.info -d build/networkmanager_libnm/
lcov -e coverage.info '*/networkmanager/plugin/gnome/*' -o filtered_coverage.info
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if(ENABLE_UNIT_TESTING) | ||
| # Fetch GoogleTest for all test targets | ||
| include(FetchContent) | ||
| set(GOOGLE_TEST_VERSION "v1.15.2" CACHE STRING "GoogleTest git tag/branch/commit to use") | ||
| FetchContent_Declare( | ||
| googletest | ||
| GIT_REPOSITORY https://github.com/google/googletest.git | ||
| GIT_TAG ${GOOGLE_TEST_VERSION} | ||
| ) | ||
| set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
| FetchContent_MakeAvailable(googletest) |
There was a problem hiding this comment.
ENABLE_UNIT_TESTING now triggers FetchContent_MakeAvailable(googletest), which requires a newer CMake (>=3.14). With cmake_minimum_required(VERSION 3.3), unit-test builds will fail on older CMake versions. Consider bumping the project minimum CMake version (or at least gating unit testing with a clear version check/message) so the stated minimum matches actual requirements.
No description provided.