hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hubertzh...@apache.org
Subject incubator-hawq git commit: HAWQ-440. Fix bug in pg_regress of commit HAWQ-432.
Date Tue, 23 Feb 2016 09:37:11 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master ca4111fc7 -> dbec94962


HAWQ-440. Fix bug in pg_regress of commit HAWQ-432.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/dbec9496
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/dbec9496
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/dbec9496

Branch: refs/heads/master
Commit: dbec949620be482c1dd0b5d2cb377e5cb8bd1a04
Parents: ca4111f
Author: hubertzhang <hzhang@pivotal.io>
Authored: Tue Feb 23 17:35:24 2016 +0800
Committer: hubertzhang <hzhang@pivotal.io>
Committed: Tue Feb 23 17:35:24 2016 +0800

----------------------------------------------------------------------
 src/test/regress/pg_regress.c      | 18 ++++++++----------
 src/test/regress/pg_regress.h      |  2 --
 src/test/regress/pg_regress_main.c |  7 +------
 3 files changed, 9 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/dbec9496/src/test/regress/pg_regress.c
----------------------------------------------------------------------
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index e4d676c..ffe2161 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -91,8 +91,8 @@ static int	port = -1;
 static char *user = NULL;
 static char *srcdir = NULL;
 static _stringlist *extraroles = NULL;
-char *initfile = NULL;
-char *expected_statuses_file = NULL;
+static char *initfile = "./init_file";
+static char *expected_statuses_file = "expected_statuses";
 
 /* internal variables */
 static const char *progname;
@@ -846,8 +846,6 @@ initialize_environment(void)
 		new_pgoptions = malloc(strlen(old_pgoptions) + strlen(my_pgoptions) + 12);
 		sprintf(new_pgoptions, "PGOPTIONS=%s %s", old_pgoptions, my_pgoptions);
 		putenv(new_pgoptions);
-
-		free(new_pgoptions);
 	}
 
 	{
@@ -1062,7 +1060,6 @@ spawn_process(const char *cmdline)
 
 	cmdline2 = malloc(strlen(cmdline) + 8);
 	sprintf(cmdline2, "cmd /c %s", cmdline);
-	free(cmdline2);
 
 #ifndef __CYGWIN__
 	AddUserToTokenDacl(restrictedToken);
@@ -2078,6 +2075,12 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function
tfunc
 	hostname = "localhost";
 #endif
 
+	/*
+	 * We call the initialization function here because that way we can set
+	 * default parameters and let them be overwritten by the commandline.
+	 */
+	ifunc();
+
 	while ((c = getopt_long(argc, argv, "hV", long_options, &option_index)) != -1)
 	{
 		switch (c)
@@ -2177,11 +2180,6 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function
tfunc
 	}
 
 	/*
-	 * Set default values if user didn't pass arguments
-	 */
-	ifunc();
-
-	/*
 	 * Initialization
 	 */
 	open_result_files();

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/dbec9496/src/test/regress/pg_regress.h
----------------------------------------------------------------------
diff --git a/src/test/regress/pg_regress.h b/src/test/regress/pg_regress.h
index 906cef4..94db0b4 100644
--- a/src/test/regress/pg_regress.h
+++ b/src/test/regress/pg_regress.h
@@ -38,8 +38,6 @@ extern char *datadir;
 extern char *host_platform;
 
 extern _stringlist *dblist;
-extern char *initfile;
-extern char *expected_statuses_file;
 extern bool debug;
 extern char *inputdir;
 extern char *outputdir;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/dbec9496/src/test/regress/pg_regress_main.c
----------------------------------------------------------------------
diff --git a/src/test/regress/pg_regress_main.c b/src/test/regress/pg_regress_main.c
index afbf132..b3245b5 100644
--- a/src/test/regress/pg_regress_main.c
+++ b/src/test/regress/pg_regress_main.c
@@ -108,12 +108,7 @@ static void
 psql_init(void)
 {
 	/* set default regression database name */
-	if (!dblist)
-		add_stringlist_item(&dblist, "regression");
-	if(!expected_statuses_file)
-		expected_statuses_file = "expected_statuses";
-	if(!initfile)
-		initfile = "./init_file";
+	add_stringlist_item(&dblist, "regression");
 }
 
 int


Mime
View raw message