From 7197f767a3ca8753e320e373ab23e3456aff637b Mon Sep 17 00:00:00 2001 From: TheNotary Date: Tue, 10 Sep 2024 11:26:32 -0500 Subject: [PATCH] makes the usb test more conditional so the build will pass on CI --- docs/env_setup_and_building.md | 2 ++ test/keyboard_test.cpp | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/env_setup_and_building.md b/docs/env_setup_and_building.md index 408011f..9d0b623 100644 --- a/docs/env_setup_and_building.md +++ b/docs/env_setup_and_building.md @@ -7,6 +7,8 @@ As that the project is my only repo demonstrating sourcing dependencies in a C++ #### Building on Terminal ("Developer Command Prompt") +Note: There's an integration test that can be enabled by setting the env variable "KEYBOARD_ATTACHED" to 1. + At the root of the repo, run: ``` # Skip these, they were for gitbash but there are pathing issues that ruined it diff --git a/test/keyboard_test.cpp b/test/keyboard_test.cpp index 044f719..12ea35b 100644 --- a/test/keyboard_test.cpp +++ b/test/keyboard_test.cpp @@ -8,7 +8,6 @@ #include "../src/demo/blink_loader.h" - namespace KeyboardTest { using namespace rk84; @@ -77,7 +76,11 @@ namespace KeyboardTest was_reasonable = true; EXPECT_TRUE(was_reasonable); - EXPECT_EQ(list.size(), 1); + + // Only do this if an KEYBOARD_ATTACHED is set to 1 + const char* keyboardAttachedEnv = std::getenv("KEYBOARD_ATTACHED"); + if (keyboardAttachedEnv != nullptr && std::string(keyboardAttachedEnv) == "1") + EXPECT_EQ(list.size(), 1); } }