Skip to content

Add C++ test to obs-studio-server#1706

Merged
sandboxcoder merged 16 commits into
stagingfrom
rno/obs-source-getproperties-test
Jun 5, 2026
Merged

Add C++ test to obs-studio-server#1706
sandboxcoder merged 16 commits into
stagingfrom
rno/obs-source-getproperties-test

Conversation

@sandboxcoder

@sandboxcoder sandboxcoder commented May 22, 2026

Copy link
Copy Markdown
Contributor

Description

  • This pull request depends on another pull request. After that PR is merged, we can merge this one.
  • Add support for Catch2 testing framework C++ obs-studio-server tests
  • Turn obs-studio-server into static lib
  • Add null check on g_server in obs-studio-server/source/nodeobs_api.cpp since we do not need ipc server running during these tests
  • Fix undefined behavior in UtilObjCInt constructor by explicitly initializing state to EState::Idle and worker to nullptr

Motivation 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

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::Source concurrency behavior plus OBS init/teardown helpers.
  • Refactors obs-studio-server CMake to build a obs-studio-server-lib static 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.

Comment thread obs-studio-server/tests/test-osn-source.cpp
Comment thread obs-studio-server/tests/test-osn-source.cpp Outdated
Comment thread obs-studio-server/tests/test-osn-source.cpp
Comment thread obs-studio-server/tests/obs-setup.cpp
Comment thread obs-studio-server/tests/obs-setup.cpp Outdated
Comment thread obs-studio-server/CMakeLists.txt
Comment thread obs-studio-server/CMakeLists.txt Outdated
Comment thread obs-studio-server/CMakeLists.txt Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment thread obs-studio-server/tests/obs-setup.cpp
Comment thread obs-studio-server/tests/obs-setup.cpp
Comment thread obs-studio-server/tests/obs-setup.cpp
Comment thread obs-studio-server/tests/test-osn-source.cpp

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@sandboxcoder sandboxcoder marked this pull request as ready for review May 29, 2026 16:00
Comment thread obs-studio-server/tests/obs-setup.cpp Outdated
Comment thread obs-studio-server/tests/test-osn-source.cpp Outdated
Comment thread obs-studio-server/CMakeLists.txt Outdated
* Add support for Catch2 C++ test
* Turn obs-server into a static lib
* Add osn-source test
@sandboxcoder sandboxcoder force-pushed the rno/obs-source-getproperties-test branch from b1ba437 to 9f370fe Compare June 4, 2026 00:58
@sandboxcoder sandboxcoder changed the base branch from messages-pacing-during-congestion to staging June 4, 2026 00:59
@sandboxcoder sandboxcoder requested a review from Copilot June 4, 2026 01:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Comment thread obs-studio-server/source/nodeobs_api.cpp Outdated
Comment thread obs-studio-server/source/nodeobs_api.cpp Outdated
Comment thread obs-studio-server/CMakeLists.txt Outdated
Comment thread obs-studio-server/tests/obs-setup.cpp Outdated
Comment thread obs-studio-server/tests/obs-setup.cpp Outdated
Comment thread obs-studio-server/tests/test-osn-source.cpp Outdated
sandboxcoder and others added 5 commits June 3, 2026 20:11
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread obs-studio-server/tests/test-osn-source.cpp

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread obs-studio-server/CMakeLists.txt
sandboxcoder and others added 5 commits June 3, 2026 21:17
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Comment thread obs-studio-server/tests/test-osn-source.cpp
Comment thread obs-studio-server/tests/obs-setup.cpp
Comment thread obs-studio-server/tests/obs-setup.cpp
Comment thread obs-studio-server/tests/obs-setup.cpp
Comment thread obs-studio-server/CMakeLists.txt
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ sandboxcoder
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@sandboxcoder sandboxcoder merged commit 3394e11 into staging Jun 5, 2026
20 of 21 checks passed
@sandboxcoder sandboxcoder deleted the rno/obs-source-getproperties-test branch June 5, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants