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

Commit20a43b1

Browse files
committed
Only unset the locale environment when --no-locale is used (the way it was
presumably designed, but didn't act). This allows running the temp installtests in a non-C locale, thus exercising users' real environments better.Document how to change locales for test runs.
1 parent715ea2b commit20a43b1

File tree

2 files changed

+50
-17
lines changed

2 files changed

+50
-17
lines changed

‎doc/src/sgml/regress.sgml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.60 2008/09/05 12:11:18 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.61 2009/02/11 14:03:41 petere Exp $ -->
22

33
<chapter id="regress">
44
<title id="regress-title">Regression Tests</title>
@@ -204,13 +204,43 @@ gmake installcheck
204204
<title>Locale differences</title>
205205

206206
<para>
207-
If you run the tests againstan already-installed server that was
207+
If you run the tests againsta server that was
208208
initialized with a collation-order locale other than C, then
209209
there might be differences due to sort order and follow-up
210210
failures. The regression test suite is set up to handle this
211211
problem by providing alternative result files that together are
212212
known to handle a large number of locales.
213213
</para>
214+
215+
<para>
216+
To run the tests in a different locale when using the
217+
temporary-installation method, pass the appropriate
218+
locale-related environment variables on
219+
the <command>make</command> command line, for example:
220+
<programlisting>
221+
gmake check LC_ALL=de_DE.utf8
222+
</programlisting>
223+
or analogously to use no locale:
224+
<programlisting>
225+
gmake check LC_ALL=C
226+
</programlisting>
227+
When running the tests against an existing installation, the
228+
locale setup is determined by the existing installation. To
229+
change it, initialize the database cluster with a different
230+
locale by passing the appropriate options
231+
to <command>initdb</command>.
232+
</para>
233+
234+
<para>
235+
In general, it is nevertheless advisable to try to run the
236+
regression tests in the locale setup that is wanted for
237+
production use, as this will exercise the locale- and
238+
encoding-related code portions that will actually be used in
239+
production. Depending on the operating system environment, you
240+
might get failures, but then you will at least know what
241+
locale-specific behaviors to expect when running real
242+
applications.
243+
</para>
214244
</sect2>
215245

216246
<sect2>

‎src/test/regress/pg_regress.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.59 2009/01/28 15:32:21 mha Exp $
14+
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.60 2009/02/11 14:03:42 petere Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -686,22 +686,25 @@ initialize_environment(void)
686686
{
687687
char*tmp;
688688

689-
/*
690-
* Clear out any non-C locale settings
691-
*/
692-
unsetenv("LC_COLLATE");
693-
unsetenv("LC_CTYPE");
694-
unsetenv("LC_MONETARY");
695-
unsetenv("LC_MESSAGES");
696-
unsetenv("LC_NUMERIC");
697-
unsetenv("LC_TIME");
698-
unsetenv("LC_ALL");
699-
unsetenv("LANG");
700-
unsetenv("LANGUAGE");
701-
/* On Windows the default locale cannot be English, so force it */
689+
if (nolocale)
690+
{
691+
/*
692+
* Clear out any non-C locale settings
693+
*/
694+
unsetenv("LC_COLLATE");
695+
unsetenv("LC_CTYPE");
696+
unsetenv("LC_MONETARY");
697+
unsetenv("LC_MESSAGES");
698+
unsetenv("LC_NUMERIC");
699+
unsetenv("LC_TIME");
700+
unsetenv("LC_ALL");
701+
unsetenv("LANG");
702+
unsetenv("LANGUAGE");
703+
/* On Windows the default locale cannot be English, so force it */
702704
#if defined(WIN32)|| defined(__CYGWIN__)
703-
putenv("LANG=en");
705+
putenv("LANG=en");
704706
#endif
707+
}
705708

706709
/*
707710
* Set multibyte as requested

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp