Rename pg_regress option --multibyte to --encoding

Also refactor things a little bit so that the same methods for setting
test locale and encoding can be used everywhere.
This commit is contained in:
Peter Eisentraut 2011-04-15 08:42:05 +03:00
parent 98eded936c
commit f536d41942
7 changed files with 25 additions and 30 deletions

View File

@ -9,8 +9,9 @@ DATA_TSEARCH = unaccent.rules
REGRESS = unaccent
# Adjust REGRESS_OPTS because we need a UTF8 database
REGRESS_OPTS = --dbname=$(CONTRIB_TESTDB) --multibyte=UTF8 --no-locale
# We need a UTF8 database
ENCODING = UTF8
NO_LOCALE = 1
ifdef USE_PGXS
PG_CONFIG = pg_config

View File

@ -221,9 +221,9 @@ gmake check LC_COLLATE=en_US.utf8 LC_CTYPE=fr_CA.utf8
<para>
You can also choose the database encoding explicitly by setting
the variable <envar>MULTIBYTE</envar>, for example:
the variable <envar>ENCODING</envar>, for example:
<screen>
gmake check LANG=C MULTIBYTE=EUC_JP
gmake check LANG=C ENCODING=EUC_JP
</screen>
Setting the database encoding this way typically only makes sense
if the locale is C; otherwise the encoding is chosen automatically

View File

@ -430,8 +430,14 @@ submake-libpgport:
PL_TESTDB = pl_regression
CONTRIB_TESTDB = contrib_regression
pg_regress_check = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --temp-install=./tmp_check --top-builddir=$(top_builddir)
pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --psqldir=$(PSQLDIR)
ifdef NO_LOCALE
NOLOCALE += --no-locale
endif
pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
pg_regress_check = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --temp-install=./tmp_check --top-builddir=$(top_builddir) $(pg_regress_locale_flags)
pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --psqldir=$(PSQLDIR) $(pg_regress_locale_flags)
pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ log/

View File

@ -16,14 +16,8 @@ override CPPFLAGS := \
# where to find psql for testing an existing installation
PSQLDIR = $(bindir)
# default encoding
MULTIBYTE = SQL_ASCII
# locale
NOLOCALE =
ifdef NO_LOCALE
NOLOCALE += --no-locale
endif
# default encoding for regression tests
ENCODING = SQL_ASCII
ifneq ($(build_os),mingw32)
abs_builddir := $(shell pwd)
@ -83,11 +77,11 @@ endif
check: all
./pg_regress --dbname=regress1,connectdb --top-builddir=$(top_builddir) --temp-install=./tmp_check --multibyte=$(MULTIBYTE) $(NOLOCALE) $(THREAD) --schedule=$(srcdir)/ecpg_schedule --create-role=connectuser,connectdb
./pg_regress --dbname=regress1,connectdb --top-builddir=$(top_builddir) --temp-install=./tmp_check $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule --create-role=connectuser,connectdb
# the same options, but with --listen-on-tcp
checktcp: all
./pg_regress --dbname=regress1,connectdb --top-builddir=$(top_builddir) --temp-install=./tmp_check --multibyte=$(MULTIBYTE) $(NOLOCALE) $(THREAD) --schedule=$(srcdir)/ecpg_schedule_tcp --create-role=connectuser,connectdb --host=localhost
./pg_regress --dbname=regress1,connectdb --top-builddir=$(top_builddir) --temp-install=./tmp_check $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule_tcp --create-role=connectuser,connectdb --host=localhost
installcheck: all
./pg_regress --psqldir=$(PSQLDIR) --dbname=regress1,connectdb --top-builddir=$(top_builddir) --multibyte=$(MULTIBYTE) $(NOLOCALE) $(THREAD) --schedule=$(srcdir)/ecpg_schedule --create-role=connectuser,connectdb
./pg_regress --psqldir=$(PSQLDIR) --dbname=regress1,connectdb --top-builddir=$(top_builddir) $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule --create-role=connectuser,connectdb

View File

@ -29,12 +29,6 @@ ifdef MAX_CONNECTIONS
MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
endif
# locale
NOLOCALE =
ifdef NO_LOCALE
NOLOCALE += --no-locale
endif
# stuff to pass into build of pg_regress
EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
'-DMAKEPROG="$(MAKE)"' \
@ -138,7 +132,7 @@ tablespace-setup:
## Run tests
##
REGRESS_OPTS = --dlpath=. $(if $(MULTIBYTE),--multibyte=$(MULTIBYTE)) $(NOLOCALE)
REGRESS_OPTS = --dlpath=.
check: all tablespace-setup
$(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF) $(EXTRA_TESTS)

View File

@ -727,7 +727,7 @@ initialize_environment(void)
putenv("LC_MESSAGES=C");
/*
* Set multibyte as requested
* Set encoding as requested
*/
if (encoding)
doputenv("PGCLIENTENCODING", encoding);
@ -1880,7 +1880,7 @@ help(void)
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(_(" --encoding=ENCODING use ENCODING as the 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"));
@ -1925,7 +1925,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
{"inputdir", required_argument, NULL, 3},
{"load-language", required_argument, NULL, 4},
{"max-connections", required_argument, NULL, 5},
{"multibyte", required_argument, NULL, 6},
{"encoding", required_argument, NULL, 6},
{"outputdir", required_argument, NULL, 7},
{"schedule", required_argument, NULL, 8},
{"temp-install", required_argument, NULL, 9},

View File

@ -88,7 +88,7 @@ sub installcheck
my @args = (
"../../../$Config/pg_regress/pg_regress","--dlpath=.",
"--psqldir=../../../$Config/psql","--schedule=${schedule}_schedule",
"--multibyte=SQL_ASCII","--no-locale"
"--encoding=SQL_ASCII","--no-locale"
);
push(@args,$maxconn) if $maxconn;
system(@args);
@ -101,7 +101,7 @@ sub check
my @args = (
"../../../$Config/pg_regress/pg_regress","--dlpath=.",
"--psqldir=../../../$Config/psql","--schedule=${schedule}_schedule",
"--multibyte=SQL_ASCII","--no-locale",
"--encoding=SQL_ASCII","--no-locale",
"--temp-install=./tmp_check","--top-builddir=\"$topdir\""
);
push(@args,$maxconn) if $maxconn;
@ -125,7 +125,7 @@ sub ecpgcheck
"--dbname=regress1,connectdb",
"--create-role=connectuser,connectdb",
"--schedule=${schedule}_schedule",
"--multibyte=SQL_ASCII",
"--encoding=SQL_ASCII",
"--no-locale",
"--temp-install=./tmp_chk",
"--top-builddir=\"$topdir\""