Skip to content

Commit b86ca72

Browse files
committed
Update platform-specific-expected-file support so that platforms can be
specified by regular-expression patterns. Add some more files.
1 parent 4f9d74f commit b86ca72

9 files changed

+1760
-128
lines changed

doc/src/sgml/regress.sgml

Lines changed: 65 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@ Regression test instructions and analysis.
99

1010
<Para>
1111
The PostgreSQL regression tests are a comprehensive set of tests for the
12-
SQL implementation embedded in PostgreSQL developed by Jolly Chen and
13-
Andrew Yu. It tests standard SQL operations as well as the extended
14-
capabilities of PostgreSQL.
12+
SQL implementation embedded in PostgreSQL. They test standard SQL
13+
operations as well as the extended capabilities of PostgreSQL.
1514
</Para>
1615

1716
<Para>
18-
These tests have recently been revised by Marc Fournier and Thomas Lockhart
19-
and are now packaged as
20-
functional units which should make them easier to run and easier to interpret.
21-
From <ProductName>PostgreSQL</ProductName> v6.1 onward
22-
the regression tests are current for every official release.
17+
The regression tests were originally developed by Jolly Chen and Andrew Yu,
18+
and were extensively revised/repackaged by Marc Fournier and Thomas Lockhart.
19+
From <ProductName>PostgreSQL</ProductName> v6.1 onward
20+
the regression tests are current for every official release.
2321
</Para>
2422

2523
<Para>
@@ -66,19 +64,18 @@ The runtime path is /usr/local/pgsql (other paths are possible).
6664
<Title>Regression Environment</Title>
6765

6866
<Para>
69-
The regression test is invoked by the <Command>make</Command> command which compiles
70-
a <Acronym>C</Acronym> program into a shared library
71-
in the current directory. Localized shell scripts are also created in
72-
the current directory. The output file templates are massaged into the
73-
<FileName>./expected/*.out</FileName> files. The localization replaces macros in the source
74-
files with absolute pathnames and user names.
67+
To prepare for regression testing, do <Command>make all</Command> in the regression test
68+
directory. This compiles a <Acronym>C</Acronym> program with PostgreSQL extension functions
69+
into a shared library. Localized SQL scripts and output-comparison
70+
files are also created for the tests that need them. The localization
71+
replaces macros in the source files with absolute pathnames and user names.
7572
</Para>
7673

7774
<Para>
78-
Normally, the regression test should be run as the pg_superuser since
75+
Normally, the regression tests should be run as the postgres user since
7976
the 'src/test/regress' directory and sub-directories are owned by the
80-
pg_superuser. If you run the regression test as another user the
81-
'src/test/regress' directory tree should be writeable to that user.
77+
postgres user. If you run the regression test as another user the
78+
'src/test/regress' directory tree must be writeable to that user.
8279
</Para>
8380

8481
<Para>
@@ -132,7 +129,7 @@ The runtime path is /usr/local/pgsql (other paths are possible).
132129
expected/ . .out files that represent what we *expect* the results to
133130
look like
134131

135-
results/ .. .out files that represent what the results *actually* look
132+
results/ .. .out files that contain what the results *actually* look
136133
like. Also used as temporary storage for table copy testing.
137134
</ProgramListing>
138135
</Para>
@@ -296,25 +293,6 @@ The runtime path is /usr/local/pgsql (other paths are possible).
296293

297294
</Sect2>
298295

299-
<Sect2>
300-
<Title>OID differences</Title>
301-
302-
<Para>
303-
There are several places where PostgreSQL OID (object identifiers) appear
304-
in 'regress.out'. OID's are unique 32-bit integers which are generated
305-
by the PostgreSQL backend whenever a table row is inserted or updated.
306-
If you run the regression test on a non-virgin database or run it multiple
307-
times, the OID's reported will have different values.
308-
309-
The following SQL statements in 'misc.out' have shown this behavior:
310-
311-
QUERY: SELECT user_relns() AS user_relns ORDER BY user_relns;
312-
313-
The 'a,523676' row is composed from an OID.
314-
</Para>
315-
316-
</Sect2>
317-
318296
<Sect2>
319297
<Title>Date and time differences</Title>
320298

@@ -431,5 +409,55 @@ The runtime path is /usr/local/pgsql (other paths are possible).
431409
</Sect2>
432410

433411
</Sect1>
412+
413+
<Sect1>
414+
<Title>Platform-specific comparison files</Title>
415+
416+
<Para>
417+
Since some of the tests inherently produce platform-specific results,
418+
we have provided a way to supply platform-specific result comparison
419+
files. Frequently, the same variation applies to multiple platforms;
420+
rather than supplying a separate comparison file for every platform,
421+
there is a mapping file that defines which comparison file to use.
422+
So, to eliminate bogus test "failures" for a particular platform,
423+
you must choose or make a variant result file, and then add a line
424+
to the mapping file, which is "resultmap".
425+
</Para>
426+
427+
<Para>
428+
Each line in the mapping file is of the form
429+
<ProgramListing>
430+
testname/platformnamepattern=comparisonfilename
431+
</ProgramListing>
432+
The test name is just the name of the particular regression test module.
433+
The platform name pattern is a pattern in the style of expr(1) (that is,
434+
a regular expression with an implicit ^ anchor at the start). It is matched
435+
against the platform name as printed by config.guess. The comparison
436+
file name is the name of the substitute result comparison file.
437+
</Para>
438+
439+
<Para>
440+
For example: the int2 regress test includes a deliberate entry of a value
441+
that is too large to fit in int2. The specific error message that is
442+
produced is platform-dependent; our reference platform emits
443+
<ProgramListing>
444+
ERROR: pg_atoi: error reading "100000": Numerical result out of range
445+
</ProgramListing>
446+
but a fair number of other Unix platforms emit
447+
<ProgramListing>
448+
ERROR: pg_atoi: error reading "100000": Result too large
449+
</ProgramListing>
450+
Therefore, we provide a variant comparison file, int2-too-large.out,
451+
that includes this spelling of the error message. To silence the
452+
bogus "failure" message on HPPA platforms, resultmap includes
453+
<ProgramListing>
454+
int2/hppa=int2-too-large
455+
</ProgramListing>
456+
which will trigger on any machine for which config.guess's output
457+
begins with 'hppa'. Other lines in resultmap select the variant
458+
comparison file for other platforms where it's appropriate.
459+
</Para>
460+
461+
</Sect1>
434462

435463
</Chapter>

src/test/regress/README

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ Introduction
33

44
The PostgreSQL regression tests are a comprehensive set of tests for the
55
SQL implementation embedded in PostgreSQL. They test standard SQL
6-
operations as well as the extensibility capabilities of PostgreSQL.
6+
operations as well as the extended capabilities of PostgreSQL.
77

88
The regression tests were originally developed by Jolly Chen and Andrew Yu,
99
and were extensively revised/repackaged by Marc Fournier and Thomas Lockhart.
10+
From PostgreSQL v6.1 onward the regression tests are current for every
11+
official release.
1012

1113
Some properly installed and fully functional PostgreSQL installations
1214
can fail some of these regression tests due to artifacts of floating point
@@ -17,12 +19,17 @@ Introduction
1719

1820
Preparation
1921

20-
To prepare for regression testing, do "make all". This compiles
21-
a 'C' program with PostgreSQL extension functions into a shared library
22-
in the current directory. Localized SQL scripts and output-comparison
22+
To prepare for regression testing, do "make all" in the regression test
23+
directory. This compiles a 'C' program with PostgreSQL extension functions
24+
into a shared library. Localized SQL scripts and output-comparison
2325
files are also created for the tests that need them. The localization
2426
replaces macros in the source files with absolute pathnames and user names.
2527

28+
Normally, the regression tests should be run as the postgres user since
29+
the 'src/test/regress' directory and sub-directories are owned by the
30+
postgres user. If you run the regression test as another user the
31+
'src/test/regress' directory tree must be writeable to that user.
32+
2633
It was formerly necessary to run the postmaster with system time zone
2734
set to PST, but this is no longer required. You can run the regression
2835
tests under your normal postmaster configuration. The test script will
@@ -64,11 +71,6 @@ Running the regression test
6471
need an already-installed postmaster. Instead, runcheck creates
6572
a temporary installation under the regress directory.
6673

67-
Normally, the regression tests should be run as the postgres user since
68-
the 'src/test/regress' directory and sub-directories are owned by the
69-
postgres user. If you run the regression test as another user the
70-
'src/test/regress' directory tree must be writeable to that user.
71-
7274
Comparing expected/actual output
7375

7476
The results are in files in the ./results directory. These results
@@ -172,11 +174,12 @@ Platform-specific comparison files
172174
to the mapping file, which is "resultmap".
173175

174176
Each line in the mapping file is of the form
175-
testname/platformname=comparisonfilename
177+
testname/platformnamepattern=comparisonfilename
176178
The test name is just the name of the particular regression test module.
177-
The platform name is the platform name as printed by config.guess (in
178-
the toplevel PostgreSQL src directory), or any prefix of it. The
179-
comparison file name is the name of the substitute result comparison file.
179+
The platform name pattern is a pattern in the style of expr(1) (that is,
180+
a regular expression with an implicit ^ anchor at the start). It is matched
181+
against the platform name as printed by config.guess. The comparison
182+
file name is the name of the substitute result comparison file.
180183

181184
For example: the int2 regress test includes a deliberate entry of a value
182185
that is too large to fit in int2. The specific error message that is

0 commit comments

Comments
 (0)