hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odiache...@apache.org
Subject incubator-hawq git commit: HAWQ-400. Support expected exit codes for regression tests, fixed leaks. [Forced Update!]
Date Sat, 20 Feb 2016 00:29:02 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/HAWQ-400 8f5e585f4 -> 4fddda4a2 (forced update)


HAWQ-400. Support expected exit codes for regression tests, fixed leaks.


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

Branch: refs/heads/HAWQ-400
Commit: 4fddda4a2ce550829f6a8478af9ccdfef40a5fe5
Parents: 73eb65f
Author: Oleksandr Diachenko <odiachenko@pivotal.io>
Authored: Thu Feb 18 15:03:20 2016 -0800
Committer: Oleksandr Diachenko <odiachenko@pivotal.io>
Committed: Fri Feb 19 16:28:59 2016 -0800

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


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4fddda4a/src/test/regress/pg_regress.c
----------------------------------------------------------------------
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index b1f1846..c68d78c 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;
-static char *initfile = "./init_file";
-static char *expected_statuses_file = "expected_statuses";
+char *initfile = NULL;
+char *expected_statuses_file = NULL;
 
 /* internal variables */
 static const char *progname;
@@ -575,7 +575,7 @@ load_expected_statuses(char *filename)
 	f = fopen(filename, "r");
 	if (!f)
 	{
-		fprintf(stderr, _("could not open file with expected statuses for reading: \n"));
+		fprintf(stderr, _("could not open file with expected statuses for reading: %s\n"), filename);
 		exit_nicely(2);
 	}
 
@@ -780,6 +780,8 @@ doputenv(const char *var, const char *val)
 
 	sprintf(s, "%s=%s", var, val);
 	putenv(s);
+
+	free(s);
 }
 
 /*
@@ -844,6 +846,8 @@ 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);
 	}
 
 	{
@@ -892,6 +896,7 @@ initialize_environment(void)
 	convert_sourcefiles();
 	load_resultmap();
 	load_expected_statuses(expected_statuses_file);
+	free(expected_statuses_file);
 }
 
 /*
@@ -982,6 +987,7 @@ spawn_process(const char *cmdline)
 		execl(shellprog, shellprog, "-c", cmdline2, (char *) NULL);
 		fprintf(stderr, _("%s: could not exec \"%s\": %s\n"),
 				progname, shellprog, strerror(errno));
+		free(cmdline2);
 		exit(1);				/* not exit_nicely here... */
 	}
 	/* in parent */
@@ -1057,6 +1063,7 @@ spawn_process(const char *cmdline)
 
 	cmdline2 = malloc(strlen(cmdline) + 8);
 	sprintf(cmdline2, "cmd /c %s", cmdline);
+	free(cmdline2);
 
 #ifndef __CYGWIN__
 	AddUserToTokenDacl(restrictedToken);
@@ -1276,6 +1283,7 @@ results_differ(const char *testname, const char *resultsfile, const
char *defaul
 
 	  snprintf(m_pretty_diff_opts, sizeof(m_pretty_diff_opts),
 			   "%s --gpd_init %s", pretty_diff_opts, initfile);
+	  free(initfile);
 	}
 	else
 	{
@@ -2072,12 +2080,6 @@ 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)
@@ -2157,7 +2159,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function
tfunc
 				initfile = strdup(optarg);
 				break;
 			case 20:
-				expected_statuses_file = strdup(optarg);
+				//expected_statuses_file = strdup(optarg);
 				break;
 			default:
 				/* getopt_long already emitted a complaint */
@@ -2177,6 +2179,11 @@ 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/4fddda4a/src/test/regress/pg_regress.h
----------------------------------------------------------------------
diff --git a/src/test/regress/pg_regress.h b/src/test/regress/pg_regress.h
index 94db0b4..906cef4 100644
--- a/src/test/regress/pg_regress.h
+++ b/src/test/regress/pg_regress.h
@@ -38,6 +38,8 @@ 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/4fddda4a/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 b3245b5..afbf132 100644
--- a/src/test/regress/pg_regress_main.c
+++ b/src/test/regress/pg_regress_main.c
@@ -108,7 +108,12 @@ static void
 psql_init(void)
 {
 	/* set default regression database name */
-	add_stringlist_item(&dblist, "regression");
+	if (!dblist)
+		add_stringlist_item(&dblist, "regression");
+	if(!expected_statuses_file)
+		expected_statuses_file = "expected_statuses";
+	if(!initfile)
+		initfile = "./init_file";
 }
 
 int


Mime
View raw message