Repository navigation
Declare the ORCA entry points in the unit test gpopt mock - #2254
Merged
Merged
Conversation
gpopt_mock.c defines SerializeDXLPlan(), GPOPTOptimizedPlan(), LibraryVersion(), EnableXform(), DisableXform(), InitGPOPT() and TerminateGPOPT(), but the only declarations of them are in the ORCA C++ headers, which a C file cannot include. With the warning flags configure picks, every definition is then a -Wmissing-prototypes warning, and src/Makefile.custom makes it an error: gpopt_mock.c:10:1: error: no previous prototype for 'SerializeDXLPlan' [-Werror=missing-prototypes] Since gpopt_mock.o is part of every test program's MOCK_OBJS, "make check" in any src/backend/*/test directory stops there. "make unittest-check" from the top of the tree does not see this, because it passes CFLAGS=-DUNITTEST on the command line, which replaces the configured warning flags altogether; so CI stays green while running a single directory's tests, as one does while writing them, fails. Declare the seven functions in the mock, and give InitGPOPT() and TerminateGPOPT() the (void) parameter list the declarations have.
tuhaihe
force-pushed
the
fix/unit-test-harness-pg16
branch
from
November 7, 2026 00:35
afc5997 to
fd6f5e8
Compare
tuhaihe
enabled auto-merge (rebase)
November 7, 2026 00:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
make checkin anysrc/backend/*/testdirectory fails to build onmain:gpopt_mock.cdefines seven ORCA entry points whose only declarations live in the ORCA C++ headers, which a C file cannot include. With the configured warning flags each definition is a-Wmissing-prototypeswarning, andsrc/Makefile.customturns it into an error. Becausegpopt_mock.ois in every test program'sMOCK_OBJS, every test directory stops there.CI does not see this: top-level
make unittest-checkpassesCFLAGS=-DUNITTESTon the command line, which replaces the configured warning flags. Running one directory's tests while writing them — the normal workflow — fails.The fix declares the seven functions in the mock and gives
InitGPOPT()/TerminateGPOPT()the(void)parameter lists their declarations have. Test harness only; nothing in the server changes.This is the first of the independent fixes listed in discussion #2210.
Type of Change
Test Plan
make installcheckmake -C src/test installcheck-cbdb-parallelBuilt with
--enable-cassert --enable-debug --enable-orca, GCC 12.2.1:main:make -C src/backend/{utils/mmgr,access/transam,access/rmgrdesc}/test checkall fail with the error above.make -C src/backend/<dir>/test checkbuilds and passes in 27 of the 30 test directories (210 tests). The other three —access/appendonly,access/gin,utils/fmgr— now get past the mock and stop at warnings in their own test files that only show up under the configured-O3(-Werror=aggressive-loop-optimizations,-Werror=return-type,-Werror=suggest-attribute=format). Those are separate and not touched here.make CFLAGS=-DUNITTEST -C src/backend unittest-check: still passes, 227 tests.Impact
User-facing changes: None.
Dependencies: None.
Checklist
Additional Context
Discussion: #2210 (commit 1 of the series).
The discussion's description of this commit is out of date. Two of the three items it lists are already on
main: quotingDLSUFFIXinmock.mk(452df84) and includingfmgr.hingpopt_mock.c(e938d9b). A third change, addingfmgr_last_builtin_oid/fmgr_builtin_oid_indextofmgrtab_mock.c, has been dropped: no test program links the realfmgr.o, so nothing references those symbols, and every test directory links without them.