-
Notifications
You must be signed in to change notification settings - Fork 512
Test OpenWrt hostinfo #7094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hectorespert
wants to merge
4
commits into
BOINC:master
Choose a base branch
from
hectorespert:openwrt_hostinfo
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Test OpenWrt hostinfo #7094
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| file(GLOB SRCS *.cpp) | ||
|
|
||
|
|
||
| LIST(APPEND SRCS "${PROJECT_SOURCE_DIR}/../../client/hostinfo_linux.cpp") | ||
|
hectorespert marked this conversation as resolved.
hectorespert marked this conversation as resolved.
|
||
|
|
||
| add_executable(test_client ${SRCS}) | ||
|
|
||
| TARGET_LINK_LIBRARIES(test_client "${SCHED_LIB}" "${BOINC_CRYPT_LIB}" "${BOINC_LIB}" pthread GTest::gtest GTest::gtest_main) | ||
|
|
||
|
Comment on lines
+7
to
+8
|
||
| add_test(NAME test_client COMMAND test_client) | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // This file is part of BOINC. | ||
| // https://boinc.berkeley.edu | ||
| // Copyright (C) 2026 University of California | ||
| // | ||
| // BOINC is free software; you can redistribute it and/or modify it | ||
| // under the terms of the GNU Lesser General Public License | ||
| // as published by the Free Software Foundation, | ||
| // either version 3 of the License, or (at your option) any later version. | ||
| // | ||
| // BOINC is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| // See the GNU Lesser General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with BOINC. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| #include "gtest/gtest.h" | ||
| #include "hostinfo.h" | ||
|
|
||
| #include <cstdio> | ||
| #include <string> | ||
|
|
||
| namespace test_hostinfo_linux { | ||
| class test_hostinfo_linux : public ::testing::Test {}; | ||
|
hectorespert marked this conversation as resolved.
|
||
|
|
||
| TEST_F(test_hostinfo_linux, parse_linux_os_info_os_release_ubuntu) { | ||
| std::string fixture_path(__FILE__); | ||
| fixture_path = fixture_path.substr(0, fixture_path.find_last_of('/')) + "/../testdata/os-release.ubuntu"; | ||
|
|
||
| FILE* os_release = fopen(fixture_path.c_str(), "r"); | ||
| ASSERT_NE(nullptr, os_release); | ||
|
|
||
| char os_name[256] = "", os_version[256] = ""; | ||
| EXPECT_TRUE(HOST_INFO::parse_linux_os_info(os_release, osrelease, os_name, sizeof(os_name), os_version, sizeof(os_version))); | ||
|
hectorespert marked this conversation as resolved.
|
||
| fclose(os_release); | ||
|
|
||
| EXPECT_STREQ("Ubuntu", os_name); | ||
| EXPECT_STREQ("Ubuntu 26.04 LTS", os_version); | ||
| } | ||
|
|
||
| TEST_F(test_hostinfo_linux, parse_linux_os_info_os_release_openwrt) { | ||
| std::string fixture_path(__FILE__); | ||
| fixture_path = fixture_path.substr(0, fixture_path.find_last_of('/')) + "/../testdata/os-release.openwrt"; | ||
|
|
||
| FILE* os_release = fopen(fixture_path.c_str(), "r"); | ||
| ASSERT_NE(nullptr, os_release); | ||
|
|
||
| char os_name[256] = "", os_version[256] = ""; | ||
| EXPECT_TRUE(HOST_INFO::parse_linux_os_info(os_release, osrelease, os_name, sizeof(os_name), os_version, sizeof(os_version))); | ||
|
hectorespert marked this conversation as resolved.
|
||
| fclose(os_release); | ||
|
|
||
| EXPECT_STREQ("OpenWrt", os_name); | ||
| EXPECT_STREQ("OpenWrt 25.12.4", os_version); | ||
| } | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| NAME="OpenWrt" | ||
| VERSION="25.12.4" | ||
| ID="openwrt" | ||
| ID_LIKE="lede openwrt" | ||
| PRETTY_NAME="OpenWrt 25.12.4" | ||
| VERSION_ID="25.12.4" | ||
| HOME_URL="https://openwrt.org/" | ||
| BUG_URL="https://bugs.openwrt.org/" | ||
| SUPPORT_URL="https://forum.openwrt.org/" | ||
| FIRMWARE_URL="https://downloads.openwrt.org/" | ||
| BUILD_ID="r32933-4ccb782af7" | ||
| OPENWRT_BOARD="mediatek/filogic" | ||
| OPENWRT_ARCH="aarch64_cortex-a53" | ||
| OPENWRT_TAINTS="" | ||
| OPENWRT_DEVICE_MANUFACTURER="OpenWrt" | ||
| OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/" | ||
| OPENWRT_DEVICE_PRODUCT="Generic" | ||
| OPENWRT_DEVICE_REVISION="v0" | ||
| OPENWRT_RELEASE="OpenWrt 25.12.4 r32933-4ccb782af7" | ||
| OPENWRT_BUILD_DATE="1778712129" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| PRETTY_NAME="Ubuntu 26.04 LTS" | ||
| NAME="Ubuntu" | ||
| VERSION_ID="26.04" | ||
| VERSION="26.04 LTS (Resolute Raccoon)" | ||
| VERSION_CODENAME=resolute | ||
| ID=ubuntu | ||
| ID_LIKE=debian | ||
| HOME_URL="https://www.ubuntu.com/" | ||
| SUPPORT_URL="https://help.ubuntu.com/" | ||
| BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" | ||
| PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" | ||
| UBUNTU_CODENAME=resolute | ||
| LOGO=ubuntu-logo |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.