Created
February 9, 2018 09:07
-
-
Save danielgustafsson/d1d1ff5c53c40a87408bbd0ea24d789c to your computer and use it in GitHub Desktop.
This file contains 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
diff --git a/src/backend/executor/test/nodeSubplan_test.c b/src/backend/executor/test/nodeSubplan_test.c | |
index 36a581f587..462db0d8ef 100644 | |
--- a/src/backend/executor/test/nodeSubplan_test.c | |
+++ b/src/backend/executor/test/nodeSubplan_test.c | |
@@ -5,6 +5,38 @@ | |
#include "../nodeSubplan.c" | |
+/* | |
+ * These functions are defined in explain_gp.c, which in turn is included | |
+ * from explain.c. Since the mocker.py utility has trouble mocking this | |
+ * structure, we include the relevant functions we need here instead. | |
+ */ | |
+void cdbexplain_localExecStats(struct PlanState *planstate, | |
+ struct CdbExplain_ShowStatCtx *showstatctx) | |
+{ | |
+ check_expected(planstate); | |
+ check_expected(showstatctx); | |
+ mock(); | |
+} | |
+ | |
+void | |
+cdbexplain_recvExecStats(struct PlanState *planstate, | |
+ struct CdbDispatchResults *dispatchResults, | |
+ int sliceIndex, | |
+ struct CdbExplain_ShowStatCtx *showstatctx) | |
+{ | |
+ check_expected(planstate); | |
+ check_expected(dispatchResults); | |
+ check_expected(sliceIndex); | |
+ check_expected(showstatctx); | |
+ mock(); | |
+} | |
+ | |
+void | |
+cdbexplain_sendExecStats(QueryDesc *queryDesc) | |
+{ | |
+ mock(); | |
+} | |
+ | |
/* Function passed to testing framework | |
* in order to force SetupInterconnect to fail */ | |
void | |
diff --git a/src/test/unit/mock/mocker.py b/src/test/unit/mock/mocker.py | |
index 00a4ce7517..b1aa5af438 100755 | |
--- a/src/test/unit/mock/mocker.py | |
+++ b/src/test/unit/mock/mocker.py | |
@@ -18,6 +18,8 @@ class CFile(object): | |
# __attribute__((XXX)): it gets difficult to match arguments. | |
# Remove it as it's a noisy keyword for us. | |
attribute_pat = re.compile(r'__attribute__\s*\(\((format\s*\([^\)]+\)\s*|format_arg\s*\(\d+\)\s*|.+?)\)\)') | |
+ # #include <filename>.c | |
+ include_c_pat = re.compile(r'#include ".+\.c"') | |
# function pattern | |
func_pat = re.compile( | |
@@ -62,6 +64,12 @@ class CFile(object): | |
if 'be-secure' not in self.path and 'guc_gp.c' not in self.path: | |
content = CFile.s_comment_pat.sub('', content) | |
content = CFile.attribute_pat.sub('', content) | |
+ # .c files included in other .c files can generally not be found from | |
+ # where the mock files are located which leads to compilation failure. | |
+ # Since we thus far arent interested in handling this anyways, let's | |
+ # skip this for now except for the guc special case | |
+ if 'guc' not in self.path: | |
+ content = CFile.include_c_pat.sub('', content) | |
return content | |
def skip_func_body(self, content, index): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
typo: arent -> aren't