Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc855872

Browse files
committed
regress: allow to specify directory containing expected files, for ecpg
The ecpg tests have their input directory in the build directory, as the testsneed to be built. Until now that required copying the expected/ directory tothe build directory in VPATH builds. To avoid needing to implement the samefor the meson build, add support for specifying the location of the expecteddirectory.Now that that's not needed anymore, remove the copying of ecpg's expecteddirectory to the build directory in VPATH builds.Author: Nazir Bilal Yavuz <byavuz81@gmail.com>Author: Andres Freund <andres@anarazel.de>Reviewed-by: Andres Freund <andres@anarazel.de>Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>Discussion:https://postgr.es/m/20220718202327.pspcqz5mwbi2yb7w@awork3.anarazel.de
1 parent1509abe commitc855872

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

‎src/interfaces/ecpg/test/Makefile

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,16 @@ pg_regress_ecpg.o: pg_regress_ecpg.c $(top_builddir)/src/port/pg_config_paths.h
5959
$(top_builddir)/src/port/pg_config_paths.h:$(top_builddir)/src/Makefile.global
6060
$(MAKE) -C$(top_builddir)/src/port pg_config_paths.h
6161

62-
# When doing a VPATH build, copy over the .pgc, .stdout and .stderr
63-
# files so that the driver script can find them. We have to use an
64-
# absolute path for the targets, because otherwise make will try to
65-
# locate the missing files using VPATH, and will find them in
66-
# $(srcdir), but the point here is that we want to copy them from
67-
# $(srcdir) to the build directory.
68-
69-
ifdefVPATH
70-
remaining_files_src :=$(wildcard$(srcdir)/*/*.pgc)$(wildcard$(srcdir)/expected/*.c)$(wildcard$(srcdir)/expected/*.stdout)$(wildcard$(srcdir)/expected/*.stderr)
71-
remaining_files_build :=$(patsubst$(srcdir)/%,$(abs_builddir)/%,$(remaining_files_src))
72-
73-
all:$(remaining_files_build)
74-
$(remaining_files_build):$(abs_builddir)/%:$(srcdir)/%
75-
ln -s$<$@
76-
endif
77-
78-
# Common options for tests. Also pick up anything passed in EXTRA_REGRESS_OPTS
79-
REGRESS_OPTS = --dbname=ecpg1_regression,ecpg2_regression --create-role=regress_ecpg_user1,regress_ecpg_user2$(EXTRA_REGRESS_OPTS)
62+
# Common options for tests
63+
#
64+
# Need to specify expecteddir explicitly, as the inputdir is located in the
65+
# build directory, because the files need to be compiled. Other pg_regress
66+
# style tests have the expecteddir in the source directory.
67+
#
68+
# Also pick up anything passed in EXTRA_REGRESS_OPTS.
69+
REGRESS_OPTS = --expecteddir=$(srcdir)\
70+
--dbname=ecpg1_regression,ecpg2_regression --create-role=regress_ecpg_user1,regress_ecpg_user2\
71+
$(EXTRA_REGRESS_OPTS)
8072

8173
check: all
8274
$(with_temp_install) ./pg_regress$(REGRESS_OPTS) --temp-instance=./tmp_check$(TEMP_CONF) --bindir=$(pg_regress_locale_flags)$(THREAD) --schedule=$(srcdir)/ecpg_schedule sql/twophase

‎src/interfaces/ecpg/test/pg_regress_ecpg.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ ecpg_start_test(const char *testname,
164164
char*appnameenv;
165165

166166
snprintf(inprg,sizeof(inprg),"%s/%s",inputdir,testname);
167-
snprintf(insource,sizeof(insource),"%s.c",testname);
167+
snprintf(insource,sizeof(insource),"%s/%s.c",inputdir,testname);
168168

169169
/* make a version of the test name that has dashes in place of slashes */
170170
initStringInfo(&testname_dash);
@@ -177,13 +177,13 @@ ecpg_start_test(const char *testname,
177177

178178
snprintf(expectfile_stdout,sizeof(expectfile_stdout),
179179
"%s/expected/%s.stdout",
180-
outputdir,testname_dash.data);
180+
expecteddir,testname_dash.data);
181181
snprintf(expectfile_stderr,sizeof(expectfile_stderr),
182182
"%s/expected/%s.stderr",
183-
outputdir,testname_dash.data);
183+
expecteddir,testname_dash.data);
184184
snprintf(expectfile_source,sizeof(expectfile_source),
185185
"%s/expected/%s.c",
186-
outputdir,testname_dash.data);
186+
expecteddir,testname_dash.data);
187187

188188
snprintf(outfile_stdout,sizeof(outfile_stdout),
189189
"%s/results/%s.stdout",

‎src/test/regress/pg_regress.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ _stringlist *dblist = NULL;
7373
booldebug= false;
7474
char*inputdir=".";
7575
char*outputdir=".";
76+
char*expecteddir=".";
7677
char*bindir=PGBINDIR;
7778
char*launcher=NULL;
7879
static_stringlist*loadextension=NULL;
@@ -1975,6 +1976,7 @@ help(void)
19751976
printf(_(" --debug turn on debug mode in programs that are run\n"));
19761977
printf(_(" --dlpath=DIR look for dynamic libraries in DIR\n"));
19771978
printf(_(" --encoding=ENCODING use ENCODING as the encoding\n"));
1979+
printf(_(" --expecteddir=DIR take expected files from DIR (default \".\")\n"));
19781980
printf(_(" -h, --help show this help, then exit\n"));
19791981
printf(_(" --inputdir=DIR take input files from DIR (default \".\")\n"));
19801982
printf(_(" --launcher=CMD use CMD as launcher of psql\n"));
@@ -2038,6 +2040,7 @@ regression_main(int argc, char *argv[],
20382040
{"load-extension",required_argument,NULL,22},
20392041
{"config-auth",required_argument,NULL,24},
20402042
{"max-concurrent-tests",required_argument,NULL,25},
2043+
{"expecteddir",required_argument,NULL,26},
20412044
{NULL,0,NULL,0}
20422045
};
20432046

@@ -2164,6 +2167,9 @@ regression_main(int argc, char *argv[],
21642167
case25:
21652168
max_concurrent_tests=atoi(optarg);
21662169
break;
2170+
case26:
2171+
expecteddir=pg_strdup(optarg);
2172+
break;
21672173
default:
21682174
/* getopt_long already emitted a complaint */
21692175
fprintf(stderr,_("\nTry \"%s -h\" for more information.\n"),
@@ -2203,6 +2209,7 @@ regression_main(int argc, char *argv[],
22032209

22042210
inputdir=make_absolute_path(inputdir);
22052211
outputdir=make_absolute_path(outputdir);
2212+
expecteddir=make_absolute_path(expecteddir);
22062213
dlpath=make_absolute_path(dlpath);
22072214

22082215
/*

‎src/test/regress/pg_regress.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ extern _stringlist *dblist;
5353
externbooldebug;
5454
externchar*inputdir;
5555
externchar*outputdir;
56+
externchar*expecteddir;
5657
externchar*launcher;
5758

5859
externconstchar*basic_diff_opts;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp