Test OpenWrt hostinfo#7094
Open
hectorespert wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new Linux-focused unit-test module to validate parsing of /etc/os-release content for Ubuntu and OpenWrt.
Changes:
- Introduces new
os-releasefixtures for Ubuntu and OpenWrt. - Adds
test_hostinfo_linux.cppwith gtest coverage forHOST_INFO::parse_linux_os_info. - Wires a new
clientunit-test subdirectory into the unit-test build and execution script.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit-tests/testdata/os-release.ubuntu | Adds Ubuntu /etc/os-release fixture for parser tests. |
| tests/unit-tests/testdata/os-release.openwrt | Adds OpenWrt /etc/os-release fixture for parser tests. |
| tests/unit-tests/client/test_hostinfo_linux.cpp | Adds gtest cases that parse the fixtures and assert expected name/version. |
| tests/unit-tests/client/CMakeLists.txt | Defines test_client test executable and links required libs. |
| tests/unit-tests/CMakeLists.txt | Adds client unit-test subdirectory to the test build. |
| tests/executeUnitTests.sh | Includes the new client module in the unit-test execution list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,9 @@ | |||
| file(GLOB SRCS *.cpp) | |||
|
|
|||
| LIST(APPEND SRCS "${PROJECT_SOURCE_DIR}/../../client/hostinfo_linux.cpp") | |||
| @@ -0,0 +1,9 @@ | |||
| file(GLOB SRCS *.cpp) | |||
Comment on lines
+7
to
+8
| TARGET_LINK_LIBRARIES(test_client "${SCHED_LIB}" "${BOINC_CRYPT_LIB}" "${BOINC_LIB}" pthread GTest::gtest GTest::gtest_main) | ||
|
|
|
|
||
| TARGET_LINK_LIBRARIES(test_client "${SCHED_LIB}" "${BOINC_CRYPT_LIB}" "${BOINC_LIB}" pthread GTest::gtest GTest::gtest_main) | ||
|
|
||
| add_test(NAME test_client COMMAND test_client) |
Comment on lines
+28
to
+29
| std::string fixture_path(__FILE__); | ||
| fixture_path = fixture_path.substr(0, fixture_path.find_last_of('/')) + "/../testdata/lsb-release.ubuntu"; |
| #include <string> | ||
|
|
||
| namespace test_hostinfo_linux { | ||
| class test_hostinfo_linux : public ::testing::Test {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
Add support to run unit tests for client code and test hostinfo processing with OpenWrt data
Alternate Designs
Release Notes
Summary by cubic
Add unit tests for Linux host info parsing, covering
os-releasefor Ubuntu 26.04 and OpenWrt 25.12.4, andlsb-releasefor Ubuntu. Adds a Linux-only client unit-test target and updates the test runner to build and run it on non-macOS, ensuring OS name and version are parsed correctly.Written for commit ef53cd0. Summary will update on new commits. Review in cubic