[
https://issues.apache.org/jira/browse/HAWQ-876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15354437#comment-15354437
]
ASF GitHub Bot commented on HAWQ-876:
-------------------------------------
Github user xunzhang commented on a diff in the pull request:
https://github.com/apache/incubator-hawq/pull/758#discussion_r68878643
--- Diff: src/test/feature/lib/sql_util.cpp ---
@@ -108,8 +111,24 @@ void SQLUtility::execSQLFile(const string &sqlFile,
conn->setOutputFile(outFileAbsPath);
EXPECT_EQ(0, conn->runSQLFile(newSqlFile).getLastStatus());
conn->resetOutput();
- EXPECT_FALSE(conn->checkDiff(ansFileAbsPath, outFileAbsPath, true));
- if (conn->checkDiff(ansFileAbsPath, outFileAbsPath, true) == false) {
+
+ // initFile if any
+ string initFileAbsPath;
+ if (!initFile.empty()) {
+ initFileAbsPath = testRootPath + "/" + initFile;
+ if (!std::ifstream(initFileAbsPath))
+ ASSERT_TRUE(false) << initFileAbsPath << " doesn't exist";
+ fp = splitFilePath(initFileAbsPath);
+ // double check to avoid empty fileBaseName
+ if (fp.fileBaseName.empty())
+ ASSERT_TRUE(false) << initFileAbsPath << " is invalid";
+ } else {
+ initFileAbsPath = "";
+ }
+
+ bool is_sql_ans_diff = conn->checkDiff(ansFileAbsPath, outFileAbsPath,
true, initFileAbsPath);
+ EXPECT_FALSE(is_sql_ans_diff);
+ if (is_sql_ans_diff == false) {
--- End diff --
why you need to check here? You have already check it above:
`EXPECT_FALSE(is_sql_ans_diff);`, I think the if-else clause is redundant.
> Add the support for initFile option of gpdiff.pl in hawq googletest framework.
> ------------------------------------------------------------------------------
>
> Key: HAWQ-876
> URL: https://issues.apache.org/jira/browse/HAWQ-876
> Project: Apache HAWQ
> Issue Type: Bug
> Reporter: Paul Guo
> Assignee: Lei Chang
>
> Hawq googletest framework depends on hawq tool gpdiff.pl. The tool provides
> an enhanced diff comparison between sql output file and expected_out file. It
> supports a useful option "-gpd_init <initFile>' which defines some directives
> for comparison. This option is quite useful for some complex sql tests.
> Current hawq googletest work does not use this option. We need to add this.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)