Declare the ORCA entry points in the unit test gpopt mock 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.
diff --git a/src/test/unit/mock/gpopt_mock.c b/src/test/unit/mock/gpopt_mock.c index 4f70eb0..fd270d5 100644 --- a/src/test/unit/mock/gpopt_mock.c +++ b/src/test/unit/mock/gpopt_mock.c
@@ -6,6 +6,15 @@ #include "nodes/plannodes.h" #include "optimizer/orcaopt.h" +/* Declared in C++ headers (gpopt/utils/funcs.h, gpopt/CGPOptimizer.h) */ +extern char *SerializeDXLPlan(Query *pquery); +extern PlannedStmt *GPOPTOptimizedPlan(Query *pquery, bool pfUnexpectedFailure, OptimizerOptions *opts); +extern Datum LibraryVersion(void); +extern Datum EnableXform(PG_FUNCTION_ARGS); +extern Datum DisableXform(PG_FUNCTION_ARGS); +extern void InitGPOPT(void); +extern void TerminateGPOPT(void); + char * SerializeDXLPlan(Query *pquery) { @@ -42,13 +51,13 @@ } void -InitGPOPT () +InitGPOPT(void) { elog(ERROR, "mock implementation of InitGPOPT called"); } void -TerminateGPOPT () +TerminateGPOPT(void) { elog(ERROR, "mock implementation of TerminateGPOPT called"); }