Re: pg_regress inputdir - Mailing list pgsql-hackers
From | Jorgen Austvik - Sun Norway |
---|---|
Subject | Re: pg_regress inputdir |
Date | |
Msg-id | 48970E75.1030906@sun.com Whole thread Raw |
In response to | Re: pg_regress inputdir (Alvaro Herrera <alvherre@commandprompt.com>) |
Responses |
Re: pg_regress inputdir
|
List | pgsql-hackers |
Alvaro Herrera wrote: > In my opinion, the need > for running tests outside the test dir is not very strong (or we would > have heard complaints before), and thus the solution is to remove > --inputdir and --outputdir. Attached is a patch that removes --inputdir and --outputdir. I still prefere the first patch (that fixed my problem), but removing them is probably better than having them when they don't work. Tested with psql make check on solaris x86. -J -- Jørgen Austvik, Software Engineering - QA Sun Microsystems Database Group Index: src/test/regress/pg_regress_main.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/test/regress/pg_regress_main.c,v retrieving revision 1.3 diff -u -r1.3 pg_regress_main.c --- src/test/regress/pg_regress_main.c 1 Jan 2008 19:46:00 -0000 1.3 +++ src/test/regress/pg_regress_main.c 4 Aug 2008 11:19:04 -0000 @@ -34,12 +34,9 @@ char expectfile[MAXPGPATH]; char psql_cmd[MAXPGPATH * 3]; - snprintf(infile, sizeof(infile), "%s/sql/%s.sql", - inputdir, testname); - snprintf(outfile, sizeof(outfile), "%s/results/%s.out", - outputdir, testname); - snprintf(expectfile, sizeof(expectfile), "%s/expected/%s.out", - inputdir, testname); + snprintf(infile, sizeof(infile), "sql/%s.sql", testname); + snprintf(outfile, sizeof(outfile), "results/%s.out", testname); + snprintf(expectfile, sizeof(expectfile), "expected/%s.out", testname); add_stringlist_item(resultfiles, outfile); add_stringlist_item(expectfiles, expectfile); Index: src/test/regress/pg_regress.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/test/regress/pg_regress.c,v retrieving revision 1.46 diff -u -r1.46 pg_regress.c --- src/test/regress/pg_regress.c 3 Aug 2008 05:12:38 -0000 1.46 +++ src/test/regress/pg_regress.c 4 Aug 2008 11:19:04 -0000 @@ -32,6 +32,9 @@ #include "getopt_long.h" #include "pg_config_paths.h" +#define LOG_DIRECTORY "log" +#define RESULTS_DIRECTORY "results" + /* for resultmap we need a list of pairs of strings */ typedef struct _resultmap { @@ -68,8 +71,6 @@ /* options settable from command line */ _stringlist *dblist = NULL; bool debug = false; -char *inputdir = "."; -char *outputdir = "."; char *psqldir = NULL; static _stringlist *loadlanguage = NULL; static int max_connections = 0; @@ -560,8 +561,7 @@ FILE *f; /* scan the file ... */ - snprintf(buf, sizeof(buf), "%s/resultmap", inputdir); - f = fopen(buf, "r"); + f = fopen("resultmap", "r"); if (!f) { /* OK if it doesn't exist, else complain */ @@ -1702,8 +1702,7 @@ FILE *difffile; /* create the log file (copy of running status output) */ - snprintf(file, sizeof(file), "%s/regression.out", outputdir); - logfilename = strdup(file); + logfilename = "regression.out"; logfile = fopen(logfilename, "w"); if (!logfile) { @@ -1713,8 +1712,7 @@ } /* create the diffs file as empty */ - snprintf(file, sizeof(file), "%s/regression.diffs", outputdir); - difffilename = strdup(file); + difffilename = "regression.diffs"; difffile = fopen(difffilename, "w"); if (!difffile) { @@ -1726,9 +1724,8 @@ fclose(difffile); /* also create the output directory if not present */ - snprintf(file, sizeof(file), "%s/results", outputdir); - if (!directory_exists(file)) - make_directory(file); + if (!directory_exists(RESULTS_DIRECTORY)) + make_directory(RESULTS_DIRECTORY); } static void @@ -1799,14 +1796,12 @@ printf(_("Options:\n")); printf(_(" --dbname=DB use database DB (default \"regression\")\n")); printf(_(" --debug turn on debug mode in programs that are run\n")); - printf(_(" --inputdir=DIR take input files from DIR (default \".\")\n")); printf(_(" --load-language=lang load the named language before running the\n")); printf(_(" tests; can appear multiple times\n")); printf(_(" --create-role=ROLE create the specified role before testing\n")); printf(_(" --max-connections=N maximum number of concurrent connections\n")); printf(_(" (default is 0 meaning unlimited)\n")); printf(_(" --multibyte=ENCODING use ENCODING as the multibyte encoding\n")); - printf(_(" --outputdir=DIR place output files in DIR (default \".\")\n")); printf(_(" --schedule=FILE use test ordering schedule from FILE\n")); printf(_(" (can be used multiple times to concatenate)\n")); printf(_(" --srcdir=DIR absolute path to source directory (for VPATH builds)\n")); @@ -1844,11 +1839,9 @@ {"version", no_argument, NULL, 'V'}, {"dbname", required_argument, NULL, 1}, {"debug", no_argument, NULL, 2}, - {"inputdir", required_argument, NULL, 3}, {"load-language", required_argument, NULL, 4}, {"max-connections", required_argument, NULL, 5}, {"multibyte", required_argument, NULL, 6}, - {"outputdir", required_argument, NULL, 7}, {"schedule", required_argument, NULL, 8}, {"temp-install", required_argument, NULL, 9}, {"no-locale", no_argument, NULL, 10}, @@ -1900,9 +1893,6 @@ case 2: debug = true; break; - case 3: - inputdir = strdup(optarg); - break; case 4: add_stringlist_item(&loadlanguage, optarg); break; @@ -1912,9 +1902,6 @@ case 6: encoding = strdup(optarg); break; - case 7: - outputdir = strdup(optarg); - break; case 8: add_stringlist_item(&schedulelist, optarg); break; @@ -2028,37 +2015,37 @@ make_directory(temp_install); /* and a directory for log files */ - snprintf(buf, sizeof(buf), "%s/log", outputdir); - if (!directory_exists(buf)) - make_directory(buf); + if (!directory_exists(LOG_DIRECTORY)) + make_directory(LOG_DIRECTORY); /* "make install" */ #ifndef WIN32_ONLY_COMPILER snprintf(buf, sizeof(buf), - SYSTEMQUOTE "\"%s\" -C \"%s\" DESTDIR=\"%s/install\" install with_perl=no with_python=no > \"%s/log/install.log\"2>&1" SYSTEMQUOTE, - makeprog, top_builddir, temp_install, outputdir); + SYSTEMQUOTE "\"%s\" -C \"%s\" DESTDIR=\"%s/install\" install with_perl=no with_python=no > \"%s/install.log\"2>&1" SYSTEMQUOTE, + makeprog, top_builddir, temp_install, LOG_DIRECTORY); #else snprintf(buf, sizeof(buf), - SYSTEMQUOTE "perl \"%s/src/tools/msvc/install.pl\" \"%s/install\" >\"%s/log/install.log\" 2>&1" SYSTEMQUOTE, - top_builddir, temp_install, outputdir); + SYSTEMQUOTE "perl \"%s/src/tools/msvc/install.pl\" \"%s/install\" >\"%s/install.log\" 2>&1" SYSTEMQUOTE, + top_builddir, temp_install, LOG_DIRECTORY); #endif if (system(buf)) { - fprintf(stderr, _("\n%s: installation failed\nExamine %s/log/install.log for the reason.\nCommand was: %s\n"),progname, outputdir, buf); + fprintf(stderr, _("\n%s: installation failed\nExamine %s/install.log for the reason.\nCommand was: %s\n"), progname,LOG_DIRECTORY, buf); exit_nicely(2); } /* initdb */ header(_("initializing database system")); snprintf(buf, sizeof(buf), - SYSTEMQUOTE "\"%s/initdb\" -D \"%s/data\" -L \"%s\" --noclean%s%s > \"%s/log/initdb.log\" 2>&1" SYSTEMQUOTE, + SYSTEMQUOTE "\"%s/initdb\" -D \"%s/data\" -L \"%s\" --noclean%s%s > \"%s/initdb.log\" 2>&1" SYSTEMQUOTE, bindir, temp_install, datadir, debug ? " --debug" : "", nolocale ? " --no-locale" : "", - outputdir); + LOG_DIRECTORY + ); if (system(buf)) { - fprintf(stderr, _("\n%s: initdb failed\nExamine %s/log/initdb.log for the reason.\nCommand was: %s\n"), progname,outputdir, buf); + fprintf(stderr, _("\n%s: initdb failed\nExamine %s/initdb.log for the reason.\nCommand was: %s\n"), progname,LOG_DIRECTORY, buf); exit_nicely(2); } @@ -2093,11 +2080,11 @@ */ header(_("starting postmaster")); snprintf(buf, sizeof(buf), - SYSTEMQUOTE "\"%s/postgres\" -D \"%s/data\" -F%s -c \"listen_addresses=%s\" > \"%s/log/postmaster.log\"2>&1" SYSTEMQUOTE, + SYSTEMQUOTE "\"%s/postgres\" -D \"%s/data\" -F%s -c \"listen_addresses=%s\" > \"%s/postmaster.log\" 2>&1"SYSTEMQUOTE, bindir, temp_install, debug ? " -d 5" : "", hostname ? hostname : "", - outputdir); + LOG_DIRECTORY); postmaster_pid = spawn_process(buf); if (postmaster_pid == INVALID_PID) { @@ -2129,7 +2116,7 @@ if (WaitForSingleObject(postmaster_pid, 0) == WAIT_OBJECT_0) #endif { - fprintf(stderr, _("\n%s: postmaster failed\nExamine %s/log/postmaster.log for the reason\n"), progname,outputdir); + fprintf(stderr, _("\n%s: postmaster failed\nExamine %s/postmaster.log for the reason\n"), progname, LOG_DIRECTORY); exit_nicely(2); } @@ -2137,7 +2124,7 @@ } if (i >= 60) { - fprintf(stderr, _("\n%s: postmaster did not respond within 60 seconds\nExamine %s/log/postmaster.log for thereason\n"), progname, outputdir); + fprintf(stderr, _("\n%s: postmaster did not respond within 60 seconds\nExamine %s/postmaster.log for the reason\n"),progname, LOG_DIRECTORY); /* * If we get here, the postmaster is probably wedged somewhere in
pgsql-hackers by date: