You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ut-core's autogenerate scripts (scripts/autogenerate.sh, autogenerate_tests.sh, autogenerate_skeletons.sh, autogenerate_shared.sh) today generate compilable C tests from a provided header, but they cannot generate CPP/gtest tests, and they cannot generate gmock mocks for a C++ interface. Unit-testing an abstract C++ interface needs both: a mock of the interface, and a gtest test skeleton that drives it.
Note: GoogleMock's own mock generator (gmock_gen.py, googlemock/scripts/generator/) that historically produced MOCK_METHOD classes from a header was removed from googletest by the pinned 1.15.2 (it existed up to ~1.10). So autogeneration must be provided by ut-core's own tooling rather than the upstream script.
Proposed Solution
Extend ut-core's autogenerate tooling to, given a C++ interface header:
Generate a compilable CPP/gtest test skeleton that instantiates the mock and stubs out UT_ADD_TEST cases — the CPP analogue of today's C-test generation.
Reuse the existing skeleton/shared machinery where possible; add a CPP/gtest code path selected by variant or flag.
This subsumes / directly relates to the existing open issues #174 (Add support in auto-generate script to generate CPP tests for GTEST) and #161 (Autogenerate scripts for generating CPP/gtest tests) — the AIDL team has reportedly already used ut-core to generate CPP tests, so liaise on the expected shape.
Acceptance Criteria
Given a user-provided C++ interface header, the autogenerate script emits:
a compilable gmock mock class (one UT_MOCK_METHOD per virtual method, correct signatures/const/override), and
a compilable gtest test skeleton referencing that mock and the UT_ macros,
matching the ergonomics of today's C-test generation.
Generated output builds under the CPP/gtest variant without hand-editing (skeleton bodies may be TODO stubs).
Covered by an entry in scripts/test_autogenerate_script.sh.
The bundled googletest parser is unavailable; prefer a lightweight header parse consistent with the current C generator, or a vetted C++ parser — to be decided in design.
Problem/Opportunity
ut-core's autogenerate scripts (
scripts/autogenerate.sh,autogenerate_tests.sh,autogenerate_skeletons.sh,autogenerate_shared.sh) today generate compilable C tests from a provided header, but they cannot generate CPP/gtest tests, and they cannot generate gmock mocks for a C++ interface. Unit-testing an abstract C++ interface needs both: a mock of the interface, and a gtest test skeleton that drives it.Note: GoogleMock's own mock generator (
gmock_gen.py,googlemock/scripts/generator/) that historically producedMOCK_METHODclasses from a header was removed from googletest by the pinned1.15.2(it existed up to ~1.10). So autogeneration must be provided by ut-core's own tooling rather than the upstream script.Proposed Solution
Extend ut-core's autogenerate tooling to, given a C++ interface header:
UT_MOCK_METHODentry per pure-virtual method (using the wrappers from Feature: Wrap GoogleMock (gmock) in ut-core with UT_ mocking macros + examples #253).UT_ADD_TESTcases — the CPP analogue of today's C-test generation.This subsumes / directly relates to the existing open issues #174 (Add support in auto-generate script to generate CPP tests for GTEST) and #161 (Autogenerate scripts for generating CPP/gtest tests) — the AIDL team has reportedly already used ut-core to generate CPP tests, so liaise on the expected shape.
Acceptance Criteria
UT_MOCK_METHODper virtual method, correct signatures/const/override), andUT_macros,matching the ergonomics of today's C-test generation.
scripts/test_autogenerate_script.sh.Additional Notes
UT_MOCK_*macros) landing first.