Add C++ test to obs-studio-server#1706
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a Catch2-based C++ unit-test executable for obs-studio-server and restructures the server build so the core code can be linked into tests (and the main server executable) via a new static library.
Changes:
- Introduces new Catch2 test(s) for
osn::Sourceconcurrency behavior plus OBS init/teardown helpers. - Refactors
obs-studio-serverCMake to build aobs-studio-server-libstatic library and link both the server executable and unit tests against it. - Updates CI unit-test runner to execute both client and server Catch2 test suites.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| obs-studio-server/tests/test-osn-source.cpp | Adds a Catch2 test exercising concurrent GetProperties / Release on browser sources. |
| obs-studio-server/tests/test-helper.hpp | Declares a small helper for initializing/finalizing OBS for tests. |
| obs-studio-server/tests/test-helper.cpp | Implements OBS initialization/teardown and runtime parsing of test working directory. |
| obs-studio-server/source/nodeobs_api.cpp | Guards crash-manager server callback registration behind a g_server null check. |
| obs-studio-server/CMakeLists.txt | Builds server core as a static lib and adds a Catch2 unit-test executable with test discovery. |
| ci/run-unit-tests.js | Runs both obs-studio-client and obs-studio-server CTest-discovered Catch2 suites in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f24f68f to
99d1c4d
Compare
* Add support for Catch2 C++ test * Turn obs-server into a static lib * Add osn-source test
b1ba437 to
9f370fe
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* give crashManager a lifetime that matches or exceeds g_server.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This reverts commit 16e14aa.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
|
Description
g_serverinobs-studio-server/source/nodeobs_api.cppsince we do not need ipc server running during these testsUtilObjCIntconstructor by explicitly initializingstatetoEState::IdleandworkertonullptrMotivation and Context
There are some tests that we can run much more easily from C++. We can get better code coverage from these tests in certain cases.
How Has This Been Tested?
Verified this test passes when run locally in Xcode.
Types of changes
Checklist: