HAWQ-1048. Fixed unit-tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/dffc760d Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/dffc760d Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/dffc760d Branch: refs/heads/HAWQ-964 Commit: dffc760de7c1ed9ec1a40e5e94d16be202e75b97 Parents: 38cb4b0 Author: Oleksandr Diachenko <[email protected]> Authored: Mon Oct 3 13:17:10 2016 -0700 Committer: Oleksandr Diachenko <[email protected]> Committed: Mon Oct 3 13:17:10 2016 -0700 ---------------------------------------------------------------------- src/backend/access/external/pxffilters.c | 7 +++++++ .../access/external/test/pxffilters_test.c | 20 +++++++++++++++++++- .../access/external/test/pxfheaders_test.c | 9 +++++++++ .../utils/mmgr/test/memaccounting_test.c | 2 ++ 4 files changed, 37 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/dffc760d/src/backend/access/external/pxffilters.c ---------------------------------------------------------------------- diff --git a/src/backend/access/external/pxffilters.c b/src/backend/access/external/pxffilters.c index 4c28bc1..2ada44e 100644 --- a/src/backend/access/external/pxffilters.c +++ b/src/backend/access/external/pxffilters.c @@ -321,6 +321,9 @@ pxf_free_filter(PxfFilterDesc* filter) static char * pxf_serialize_filter_list(List *expressionItems) { + + printf("Serializing filter list 1\n"); + StringInfo resbuf; ListCell *lc = NULL; @@ -330,6 +333,8 @@ pxf_serialize_filter_list(List *expressionItems) resbuf = makeStringInfo(); initStringInfo(resbuf); + printf("Serializing filter list 2\n"); + /* * Iterate through the expression items in the list and serialize them one after the other. */ @@ -393,6 +398,8 @@ pxf_serialize_filter_list(List *expressionItems) } } + printf("Serializing filter list 30\n"); + if (resbuf->len == 0) { pfree(resbuf->data); http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/dffc760d/src/backend/access/external/test/pxffilters_test.c ---------------------------------------------------------------------- diff --git a/src/backend/access/external/test/pxffilters_test.c b/src/backend/access/external/test/pxffilters_test.c index 65b1aef..c1c54cd 100644 --- a/src/backend/access/external/test/pxffilters_test.c +++ b/src/backend/access/external/test/pxffilters_test.c @@ -25,6 +25,9 @@ #include "c.h" #include "../pxffilters.c" +void run__const_to_str(Const* input, StringInfo result, char* expected); +void run__const_to_str__negative(Const* input, StringInfo result, char* value); + void test__supported_filter_type(void **state) { @@ -62,7 +65,7 @@ test__supported_filter_type(void **state) /* go over pxf_supported_types array */ int nargs = sizeof(pxf_supported_types) / sizeof(Oid); - assert_int_equal(nargs, 13); + assert_int_equal(nargs, 14); for (i = 0; i < nargs; ++i) { assert_true(supported_filter_type(pxf_supported_types[i])); @@ -475,14 +478,29 @@ test__opexpr_to_pxffilter__unsupportedOpNot(void **state) void test__pxf_serialize_filter_list__oneFilter(void **state) { + + printf("Entered one filter test 1\n"); + + int c = 1, d = 1, f = 1; + + for ( c = 1 ; c <= 32767 ; c++ ) + for ( d = 1 ; d <= 32767 ; d++ ) + for ( f = 1 ; f <= 10 ; f++ ) + {} + List* filter_list = NIL; + printf("Entered one filter test 2\n"); + PxfFilterDesc* filter = build_filter( PXF_ATTR_CODE, 1, NULL, PXF_CONST_CODE, 0, "1984", PXFOP_GT); + + printf("Entered one filter test 3\n"); filter_list = lappend(filter_list, filter); + char* result = pxf_serialize_filter_list(filter_list); assert_string_equal(result, "a0c1984o2"); http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/dffc760d/src/backend/access/external/test/pxfheaders_test.c ---------------------------------------------------------------------- diff --git a/src/backend/access/external/test/pxfheaders_test.c b/src/backend/access/external/test/pxfheaders_test.c index 7c79b5a..454ecdc 100644 --- a/src/backend/access/external/test/pxfheaders_test.c +++ b/src/backend/access/external/test/pxfheaders_test.c @@ -32,6 +32,15 @@ static extvar_t *mock_extvar = NULL; static char *old_pxf_remote_service_login = NULL; static char *old_pxf_remote_service_secret = NULL; +void expect_churl_headers(const char *key, const char *value); +void expect_churl_headers_alignment(); +void store_gucs(); +void setup_gphd_uri(); +void setup_input_data(); +void setup_external_vars(); +void expect_external_vars(); +void restore_gucs(); + void test__build_http_header__remote_login_is_null(void **state) { http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/dffc760d/src/backend/utils/mmgr/test/memaccounting_test.c ---------------------------------------------------------------------- diff --git a/src/backend/utils/mmgr/test/memaccounting_test.c b/src/backend/utils/mmgr/test/memaccounting_test.c index a946040..841d171 100644 --- a/src/backend/utils/mmgr/test/memaccounting_test.c +++ b/src/backend/utils/mmgr/test/memaccounting_test.c @@ -40,6 +40,8 @@ #define AllocPointerGetChunk(ptr) \ ((StandardChunkHeader *)(((char *)(ptr)) - ALLOC_CHUNKHDRSZ)) +void write_stderr_mock(const char *fmt,...); + static StringInfoData outputBuffer; /* We will capture write_stderr output using write_stderr_mock */
