Skip to content

Tests: forward the command line to gtest so --gtest_filter works - #245

Open
matthargett wants to merge 1 commit into
BabylonJS:mainfrom
rebeckerspecialties:unittests-gtest-argv
Open

matthargett wants to merge 1 commit into
BabylonJS:mainfrom
rebeckerspecialties:unittests-gtest-argv

Conversation

@matthargett

@matthargett matthargett commented Sep 16, 2026

Copy link
Copy Markdown

RunTests() called testing::InitGoogleTest() without the command line, so --gtest_filter, --gtest_repeat, --gtest_break_on_failure and the rest were silently ignored on every host — running ./UnitTests --gtest_filter=Console.* still ran the whole suite. The Win32 host had its own copy of the two gtest calls.

  • RunTests(int argc, char** argv) forwards the command line; the macOS, Linux and Win32 hosts pass theirs through.
  • RunTests() stays for the iOS app and the Android JNI (a synthetic argv[0]).

Verified on macOS: full suite unchanged (23/23), --gtest_filter='Console.*' now runs 2 tests. Fork twin: rebeckerspecialties#29.

RunTests() called InitGoogleTest() without argv, so --gtest_filter,
--gtest_repeat and the other gtest flags were silently ignored on every
host; the Win32 host had its own copy of the two calls. The desktop
hosts now pass argc/argv through RunTests(int, char**); iOS and the
Android JNI keep the argument-less form.

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.

🟢 Approval recommended

No unresolved issues were identified.

Pull request overview

Forwards command-line arguments to GoogleTest so flags like --gtest_filter work across desktop test runners.

Changes:

  • Adds an argument-aware RunTests overload.
  • Updates macOS, Linux, and Win32 hosts to forward argc/argv.
  • Preserves synthetic arguments for iOS and Android.
File summaries
File Description
Tests/UnitTests/Win32/App.cpp Uses the shared argument-aware test runner.
Tests/UnitTests/Shared/Shared.h Declares both runner overloads.
Tests/UnitTests/Shared/Shared.cpp Forwards arguments to GoogleTest.
Tests/UnitTests/macOS/App.mm Forwards macOS process arguments.
Tests/UnitTests/Linux/App.cpp Forwards Linux process arguments.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants