[freebsd/kyua] c325d1: Add GoogleTest framework support

0 views
Skip to first unread message

Enji Cooper

unread,
Dec 26, 2025, 3:03:36 PM (3 days ago) Dec 26
to kyua...@googlegroups.com
Branch: refs/heads/master
Home: https://github.com/freebsd/kyua
Commit: c325d1f1607200a2706710c80f2ef1f048429cd3
https://github.com/freebsd/kyua/commit/c325d1f1607200a2706710c80f2ef1f048429cd3
Author: Enji Cooper <ng...@FreeBSD.org>
Date: 2025-12-26 (Fri, 26 Dec 2025)

Changed paths:
M NEWS
M cli/main.cpp
M configure.ac
M doc/kyuafile.5.in
M engine/Kyuafile
M engine/Makefile.am.inc
A engine/googletest.cpp
A engine/googletest.hpp
A engine/googletest_helpers.cpp
A engine/googletest_list.cpp
A engine/googletest_list.hpp
A engine/googletest_list_test.cpp
A engine/googletest_result.cpp
A engine/googletest_result.hpp
A engine/googletest_result_fwd.hpp
A engine/googletest_result_test.cpp
A engine/googletest_test.cpp

Log Message:
-----------
Add GoogleTest framework support

This change adds fine grained execution of GoogleTest framework-based test
programs.

First, the GoogleTest test is executed with `--gtest_list_tests`. Next,
based on the output from `--gtest_list_tests`, the testcases are run
individually. Finally, the output from each unique testcase is scraped
and digested by Kyua in a format that Kyua supports.

The output from each unique testcase is based on the standard output it
provides, per the test output protocol defined in the GoogleTest docs on
github [1], [2], and instrumented via various demo programs I created,
which can be found on GitHub
[here](https://github.com/ngie-eign/scratch/tree/main/programming/c++/gtest).

This is initial framework integration. There're additional improvements that
can be made by leveraging either the JSON or XML structured output format,
instead of scraping standard output using beginning and ending sentinels to
search for regular expressions. In order to do that though without reinventing
the wheel, Kyua would need to rely on an external JSON or XML library.

This test interface supports fine grained execution of test programs
like the ATF test interface, but matches behavior of plain/TAP interfaces by
instead supporting metadata passing via `$TEST_ENV_` prefixed environment
variables.

This support adds additional tests for verifying pass, fail, skip (available in
GoogleTest 1.9.0+), and disabled result determination, using mock output and a
mock test program (`engine/googletest_helpers`), for parity with other test
formats (ATF, plain, TAP). The helper test program purposely avoids relying on
`getopt_long*` for portability reasons, and the GoogleTest test infrastructure,
in order to limit Kyua's dependencies.

As part of this change, `store/read_transaction.cpp` needed to support
optional reasons provided with skip results. While it's bad form to omit
test results with tests, providing a reason is optional with GoogleTest, and
unfortunately not all portions of the test framework output a reason when
`GTEST_SKIP()` is called. See the issue in [3] for one such example issue when
`GTEST_SKIP()` is called from SetUp test fixtures.

1. https://github.com/google/googletest/blob/main/docs/primer.md
2. https://github.com/google/googletest/blob/main/docs/advanced.md
3. https://github.com/google/googletest/issues/2208

Signed-off-by: Enji Cooper <ng...@FreeBSD.org>


Commit: 5893f4958573ee16c682bcafbee0afaf9c70474b
https://github.com/freebsd/kyua/commit/5893f4958573ee16c682bcafbee0afaf9c70474b
Author: Enji Cooper <ng...@FreeBSD.org>
Date: 2025-12-26 (Fri, 26 Dec 2025)

Changed paths:
M NEWS
M cli/main.cpp
M configure.ac
M doc/kyuafile.5.in
M engine/Kyuafile
M engine/Makefile.am.inc
A engine/googletest.cpp
A engine/googletest.hpp
A engine/googletest_helpers.cpp
A engine/googletest_list.cpp
A engine/googletest_list.hpp
A engine/googletest_list_test.cpp
A engine/googletest_result.cpp
A engine/googletest_result.hpp
A engine/googletest_result_fwd.hpp
A engine/googletest_result_test.cpp
A engine/googletest_test.cpp

Log Message:
-----------
Merge pull request #203 from ngie-eign/add-googletest-support

Add GoogleTest support


Compare: https://github.com/freebsd/kyua/compare/f86bce440f69...5893f4958573

To unsubscribe from these emails, change your notification settings at https://github.com/freebsd/kyua/settings/notifications
Reply all
Reply to author
Forward
0 new messages