pg_regress inputdir - Mailing list pgsql-hackers

From Jorgen Austvik - Sun Norway
Subject pg_regress inputdir
Date
Msg-id 488F1836.6040604@sun.com
Whole thread Raw
Responses Re: pg_regress inputdir  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: pg_regress inputdir  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
Hi,

with regards to --inputdir, --srcdir, --outputdir and --schedule,
pg_regress does something like this:

convert files in <srcdir>/input, and place them in ./sql
convert files in <srcdir>/output, and place them in ./expected
read schedule from <schedule>
for each test in schedule:
    read test from <inputdir>/sql/<testname>.sql
    read expected result from <inputdir>/expected/<testname>.out
    write results to <outputdir>/results/<testname>.out

My problem when running pg_regress standalone, is that converted files
are written to e.g. ./sql, but read from e.g. <inputdir>/sql, which
makes the --inputdir parameter pretty unusable if it is set to something
different from some path leading to cwd.

Illustrated with code:

Writing converted source file (pg_regress.s:493):
snprintf(destfile, MAXPGPATH, "%s/%s.%s", dest, prefix, suffix);

(Where dest is "sql" or "expected".)

Reading files (pg_regress_main.c:37+38):
snprintf(infile, sizeof(infile), "%s/sql/%s.sql", inputdir, testname);

The attached patch makes pg_regress write converted files to
<inputdir>/sql and <inputdir>/expected, which is one way to make it read
and write to the same directory. Tested on Solaris x86 with pgsql "make
check" and standalone.

-J
--

Jørgen Austvik, Software Engineering - QA
Sun Microsystems Database Group

http://blogs.sun.com/austvik/
http://www.austvik.net/
Index: src/test/regress/pg_regress.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/test/regress/pg_regress.c,v
retrieving revision 1.45
diff -u -r1.45 pg_regress.c
--- src/test/regress/pg_regress.c    17 May 2008 20:02:01 -0000    1.45
+++ src/test/regress/pg_regress.c    29 Jul 2008 12:36:38 -0000
@@ -490,7 +490,7 @@
         /* build the full actual paths to open */
         snprintf(prefix, strlen(*name) - 6, "%s", *name);
         snprintf(srcfile, MAXPGPATH, "%s/%s", indir, *name);
-        snprintf(destfile, MAXPGPATH, "%s/%s.%s", dest, prefix, suffix);
+        snprintf(destfile, MAXPGPATH, "%s/%s/%s.%s", inputdir, dest, prefix, suffix);

         infile = fopen(srcfile, "r");
         if (!infile)

pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: patch: Add a separate TRUNCATE permission
Next
From: Zdenek Kotala
Date:
Subject: Re: Python 2.5 vs the buildfarm