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

Commitf140007

Browse files
committed
Run UTF8-requiring collation tests by default
The tests collate.icu.utf8 and collate.linux.utf8 were previously onlyrun when explicitly selected via EXTRA_TESTS. They require a UTF8database, because the error messages in the expected files refer tothat, and they use some non-ASCII characters in the tests. Sinceusers can select any locale and encoding for the regression test run,it was not possible to include these tests automatically.To fix, use psql's \if facility to check various prerequisites such asplatform and the server encoding and quit the tests at the verybeginning if the configuration is not adequate. We then need tomaintain alternative expected files for these tests, but they are verytiny and never need to change after this.These two tests are now run automatically as part of the regressiontests.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://www.postgresql.org/message-id/flat/052295c2-a2e1-9a21-bd36-8fbff8686cf3%402ndquadrant.com
1 parent870b1d6 commitf140007

File tree

9 files changed

+55
-10
lines changed

9 files changed

+55
-10
lines changed

‎doc/src/sgml/regress.sgml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,6 @@ make check LANG=C ENCODING=EUC_JP
363363
<screen>
364364
make check EXTRA_TESTS=numeric_big
365365
</screen>
366-
To run the collation tests:
367-
<screen>
368-
make check EXTRA_TESTS='collate.linux.utf8 collate.icu.utf8' LANG=en_US.utf8
369-
</screen>
370-
The <literal>collate.linux.utf8</literal> test works only on Linux/glibc
371-
platforms. The <literal>collate.icu.utf8</literal> test only works when
372-
support for ICU was built. Both tests will only succeed when run in a
373-
database that uses UTF-8 encoding.
374366
</para>
375367
</sect2>
376368

‎src/test/regress/expected/collate.icu.utf8.out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
/*
22
* This test is for ICU collations.
33
*/
4+
/* skip test if not UTF8 server encoding or no ICU collations installed */
5+
SELECT getdatabaseencoding() <> 'UTF8' OR
6+
(SELECT count(*) FROM pg_collation WHERE collprovider = 'i') = 0
7+
AS skip_test \gset
8+
\if :skip_test
9+
\quit
10+
\endif
411
SET client_encoding TO UTF8;
512
CREATE SCHEMA collate_tests;
613
SET search_path = collate_tests;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* This test is for ICU collations.
3+
*/
4+
/* skip test if not UTF8 server encoding or no ICU collations installed */
5+
SELECT getdatabaseencoding() <> 'UTF8' OR
6+
(SELECT count(*) FROM pg_collation WHERE collprovider = 'i') = 0
7+
AS skip_test \gset
8+
\if :skip_test
9+
\quit

‎src/test/regress/expected/collate.linux.utf8.out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* locales is installed. It must be run in a database with UTF-8 encoding,
44
* because other encodings don't support all the characters used.
55
*/
6+
SELECT getdatabaseencoding() <> 'UTF8' OR
7+
(SELECT count(*) FROM pg_collation WHERE collname IN ('de_DE', 'en_US', 'sv_SE', 'tr_TR') AND collencoding = pg_char_to_encoding('UTF8')) <> 4 OR
8+
version() !~ 'linux-gnu'
9+
AS skip_test \gset
10+
\if :skip_test
11+
\quit
12+
\endif
613
SET client_encoding TO UTF8;
714
CREATE SCHEMA collate_tests;
815
SET search_path = collate_tests;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* This test is for Linux/glibc systems and assumes that a full set of
3+
* locales is installed. It must be run in a database with UTF-8 encoding,
4+
* because other encodings don't support all the characters used.
5+
*/
6+
SELECT getdatabaseencoding() <> 'UTF8' OR
7+
(SELECT count(*) FROM pg_collation WHERE collname IN ('de_DE', 'en_US', 'sv_SE', 'tr_TR') AND collencoding = pg_char_to_encoding('UTF8')) <> 4 OR
8+
version() !~ 'linux-gnu'
9+
AS skip_test \gset
10+
\if :skip_test
11+
\quit

‎src/test/regress/parallel_schedule

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ test: brin gin gist spgist privileges init_privs security_label collate matview
7878
# ----------
7979
# Another group of parallel tests
8080
# ----------
81-
test: create_table_like alter_generic alter_operator misc async dbsize misc_functions sysviews tsrf tidscan
81+
test: create_table_like alter_generic alter_operator misc async dbsize misc_functions sysviews tsrf tidscan collate.icu.utf8
8282

8383
# rules cannot run concurrently with any test that creates
8484
# a view or rule in the public schema
85-
test: rules psql psql_crosstab amutils stats_ext
85+
# collate.*.utf8 tests cannot be run in parallel with each other
86+
test: rules psql psql_crosstab amutils stats_ext collate.linux.utf8
8687

8788
# run by itself so it can run parallel workers
8889
test: select_parallel

‎src/test/regress/serial_schedule

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,13 @@ test: misc_functions
133133
test: sysviews
134134
test: tsrf
135135
test: tidscan
136+
test: collate.icu.utf8
136137
test: rules
137138
test: psql
138139
test: psql_crosstab
139140
test: amutils
140141
test: stats_ext
142+
test: collate.linux.utf8
141143
test: select_parallel
142144
test: write_parallel
143145
test: publication

‎src/test/regress/sql/collate.icu.utf8.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
* This test is for ICU collations.
33
*/
44

5+
/* skip test if not UTF8 server encoding or no ICU collations installed*/
6+
SELECT getdatabaseencoding()<>'UTF8'OR
7+
(SELECTcount(*)FROM pg_collationWHERE collprovider='i')=0
8+
AS skip_test \gset
9+
\if :skip_test
10+
\quit
11+
\endif
12+
513
SET client_encoding TO UTF8;
614

715
CREATESCHEMAcollate_tests;

‎src/test/regress/sql/collate.linux.utf8.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
* because other encodings don't support all the characters used.
55
*/
66

7+
SELECT getdatabaseencoding()<>'UTF8'OR
8+
(SELECTcount(*)FROM pg_collationWHERE collnameIN ('de_DE','en_US','sv_SE','tr_TR')AND collencoding= pg_char_to_encoding('UTF8'))<>4OR
9+
version() !~'linux-gnu'
10+
AS skip_test \gset
11+
\if :skip_test
12+
\quit
13+
\endif
14+
715
SET client_encoding TO UTF8;
816

917
CREATESCHEMAcollate_tests;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp