Skip to content

Commit

Permalink
Merge pull request #130 from microsoft/fixtestpresets
Browse files Browse the repository at this point in the history
Add CMake test preset for running non-root tests
  • Loading branch information
abeltrano authored Jan 25, 2024
2 parents 373506b + 74e2165 commit 07be44c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ obj/
# CMake
build/
out/
Testing/

# vcpkg
vcpkg_installed*/
Expand Down
19 changes: 6 additions & 13 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@
"name": "test-common",
"hidden": true,
"output": {
"outputOnFailure": true
"outputOnFailure": true,
"shortProgress": true
}
},
{
Expand All @@ -214,24 +215,16 @@
]
},
{
"name": "local-base",
"hidden": true,
"description": "Run tests that don't require a remote connection",
"name": "non-root",
"configurePreset": "dev-linux",
"inherits": [
"test-common"
],
"filter": {
"include": {
"label": "[local]"
"exclude": {
"name": "(root)"
}
}
},
{
"name": "local",
"configurePreset": "dev-linux",
"inherits": [
"local-base"
]
}
]
}
16 changes: 8 additions & 8 deletions tests/unit/linux/wpa-controller/TestHostapd.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "detail/WpaDaemonManager.hxx"

TEST_CASE("Create a Hostapd instance", "[wpa][hostapd][client][remote]")
TEST_CASE("Create a Hostapd instance (root)", "[wpa][hostapd][client][remote]")
{
using namespace Wpa;

Expand Down Expand Up @@ -40,7 +40,7 @@ TEST_CASE("Create a Hostapd instance", "[wpa][hostapd][client][remote]")
}
}

TEST_CASE("Send Ping() command", "[wpa][hostapd][client][remote]")
TEST_CASE("Send Ping() command (root)", "[wpa][hostapd][client][remote]")
{
using namespace Wpa;

Expand All @@ -58,7 +58,7 @@ TEST_CASE("Send Ping() command", "[wpa][hostapd][client][remote]")
}
}

TEST_CASE("Send command: GetStatus()", "[wpa][hostapd][client][remote]")
TEST_CASE("Send command: GetStatus() (root)", "[wpa][hostapd][client][remote]")
{
using namespace Wpa;

Expand Down Expand Up @@ -96,7 +96,7 @@ TEST_CASE("Send command: GetStatus()", "[wpa][hostapd][client][remote]")
}
}

TEST_CASE("Send GetProperty() command", "[wpa][hostapd][client][remote]")
TEST_CASE("Send GetProperty() command (root)", "[wpa][hostapd][client][remote]")
{
using namespace Wpa;

Expand Down Expand Up @@ -135,7 +135,7 @@ TEST_CASE("Send GetProperty() command", "[wpa][hostapd][client][remote]")
}
}

TEST_CASE("Send SetProperty() command", "[wpa][hostapd][client][remote]")
TEST_CASE("Send SetProperty() command (root)", "[wpa][hostapd][client][remote]")
{
using namespace Wpa;

Expand All @@ -159,7 +159,7 @@ TEST_CASE("Send SetProperty() command", "[wpa][hostapd][client][remote]")
// TODO: validate that the property was actually set. Need to find a property whose value is retrievable.
}

TEST_CASE("Send control commands: Enable(), Disable()", "[wpa][hostapd][client][remote]")
TEST_CASE("Send control commands: Enable(), Disable() (root)", "[wpa][hostapd][client][remote]")
{
using namespace Wpa;

Expand Down Expand Up @@ -211,15 +211,15 @@ TEST_CASE("Send control commands: Enable(), Disable()", "[wpa][hostapd][client][
// Also, keep Terminate() test cases at end-of-file since Catch2 will run
// tests in declaration order by default, which minimizes the possibility
// of a test case being run after the daemon has been terminated.
TEST_CASE("Send command: Terminate() doesn't throw", "[wpa][hostapd][client][remote]")
TEST_CASE("Send command: Terminate() doesn't throw (root)", "[wpa][hostapd][client][remote]")
{
using namespace Wpa;

Hostapd hostapd(WpaDaemonManager::InterfaceNameDefault);
REQUIRE_NOTHROW(hostapd.Terminate());
}

TEST_CASE("Send command: Terminate() ping failure", "[wpa][hostapd][client][remote]")
TEST_CASE("Send command: Terminate() ping failure (root)", "[wpa][hostapd][client][remote]")
{
using namespace Wpa;
using namespace std::chrono_literals;
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/linux/wpa-controller/TestWpaController.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ constexpr auto WpaTypesSupported = {
};
} // namespace TestDetail

TEST_CASE("Send/receive WpaController request/response", "[wpa][hostapd][client][remote]")
TEST_CASE("Send/receive WpaController request/response (root)", "[wpa][hostapd][client][remote]")
{
using namespace TestDetail;
using namespace Wpa;
Expand Down

0 comments on commit 07be44c

Please sign in to comment.