Skip to content

Commit df77071

Browse files
committed
Massive regression test patches from Thomas *woo hoo!*
1 parent a902829 commit df77071

24 files changed

+1752
-1939
lines changed

src/backend/utils/adt/dt.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.17 1997/04/25 18:40:13 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.18 1997/04/27 02:55:49 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -455,6 +455,9 @@ timespan_ne(TimeSpan *timespan1, TimeSpan *timespan2)
455455
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
456456
return FALSE;
457457

458+
if (TIMESPAN_IS_INVALID(*timespan1) || TIMESPAN_IS_INVALID(*timespan2))
459+
return FALSE;
460+
458461
return( (timespan1->time != timespan2->time)
459462
|| (timespan1->month != timespan2->month));
460463
} /* timespan_ne() */
@@ -467,10 +470,13 @@ timespan_lt(TimeSpan *timespan1, TimeSpan *timespan2)
467470
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
468471
return FALSE;
469472

473+
if (TIMESPAN_IS_INVALID(*timespan1) || TIMESPAN_IS_INVALID(*timespan2))
474+
return FALSE;
475+
470476
span1 = timespan1->time;
471-
if (timespan1->month != 0) span1 += (timespan1->month * 30);
477+
if (timespan1->month != 0) span1 += (timespan1->month * (30*86400));
472478
span2 = timespan2->time;
473-
if (timespan2->month != 0) span2 += (timespan2->month * 30);
479+
if (timespan2->month != 0) span2 += (timespan2->month * (30*86400));
474480

475481
return( span1 < span2);
476482
} /* timespan_lt() */
@@ -483,10 +489,13 @@ timespan_gt(TimeSpan *timespan1, TimeSpan *timespan2)
483489
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
484490
return FALSE;
485491

492+
if (TIMESPAN_IS_INVALID(*timespan1) || TIMESPAN_IS_INVALID(*timespan2))
493+
return FALSE;
494+
486495
span1 = timespan1->time;
487-
if (timespan1->month != 0) span1 += (timespan1->month * 30);
496+
if (timespan1->month != 0) span1 += (timespan1->month * (30*86400));
488497
span2 = timespan2->time;
489-
if (timespan2->month != 0) span2 += (timespan2->month * 30);
498+
if (timespan2->month != 0) span2 += (timespan2->month * (30*86400));
490499

491500
return( span1 > span2);
492501
} /* timespan_gt() */
@@ -499,10 +508,13 @@ timespan_le(TimeSpan *timespan1, TimeSpan *timespan2)
499508
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
500509
return FALSE;
501510

511+
if (TIMESPAN_IS_INVALID(*timespan1) || TIMESPAN_IS_INVALID(*timespan2))
512+
return FALSE;
513+
502514
span1 = timespan1->time;
503-
if (timespan1->month != 0) span1 += (timespan1->month * 30);
515+
if (timespan1->month != 0) span1 += (timespan1->month * (30*86400));
504516
span2 = timespan2->time;
505-
if (timespan2->month != 0) span2 += (timespan2->month * 30);
517+
if (timespan2->month != 0) span2 += (timespan2->month * (30*86400));
506518

507519
return( span1 <= span2);
508520
} /* timespan_le() */
@@ -515,10 +527,13 @@ timespan_ge(TimeSpan *timespan1, TimeSpan *timespan2)
515527
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
516528
return FALSE;
517529

530+
if (TIMESPAN_IS_INVALID(*timespan1) || TIMESPAN_IS_INVALID(*timespan2))
531+
return FALSE;
532+
518533
span1 = timespan1->time;
519-
if (timespan1->month != 0) span1 += (timespan1->month * 30);
534+
if (timespan1->month != 0) span1 += (timespan1->month * (30*86400));
520535
span2 = timespan2->time;
521-
if (timespan2->month != 0) span2 += (timespan2->month * 30);
536+
if (timespan2->month != 0) span2 += (timespan2->month * (30*86400));
522537

523538
return( span1 >= span2);
524539
} /* timespan_ge() */

src/test/regress/GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.6 1997/04/26 06:31:55 scrappy Exp $
10+
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.7 1997/04/27 02:56:03 scrappy Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

1414
SRCDIR= ../..
1515
include ../../Makefile.global
1616

17-
CFLAGS+= -I$(LIBPQDIR)
17+
CFLAGS+= -I$(LIBPQDIR) -I../../include
1818

1919
LDADD+= -L$(LIBPQDIR) -lpq
2020

src/test/regress/README

Lines changed: 98 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,39 @@
22
Introduction
33

44
The PostgreSQL regression tests are a comprehensive set of tests for the
5-
SQL implementation embeded in PostgreSQL developed by Jolly Chen and
6-
Andrew Yu. It tests standard SQL operations as well as the extensability
5+
SQL implementation embedded in PostgreSQL developed by Jolly Chen and
6+
Andrew Yu. It tests standard SQL operations as well as the extensibility
77
capabilities of PostgreSQL.
88

9+
These tests have recently been revised by Marc Fournier and others to
10+
become current for PostgreSQL v6.1. The tests are now packaged as
11+
functional units and should be easier to run and easier to interpret.
12+
13+
Some properly installed and fully functional PostgreSQL installations
14+
can fail these regression tests due to artifacts of the genetic optimizer.
15+
See the v6.1-specific release notes in this document for further details.
16+
917
Preparation
1018

11-
The regression test is invoked thru by the 'make' command which compiles
19+
The regression test is invoked by the 'make' command which compiles
1220
a 'c' program with PostgreSQL extension functions into a shared library
1321
in the current directory. Localized shell scripts are also created in
14-
the current directory. The 'expected.input' file is massaged into the
15-
'expected.out' file. The localization replaces macros in the source
22+
the current directory. The output file templates are massaged into the
23+
./expected/*.out files. The localization replaces macros in the source
1624
files with absolute pathnames and user names.
1725

26+
The postmaster should be invoked with the system time zone set for
27+
Berkeley, California. On some systems, this can be accomplished by
28+
setting the TZ environment variable before starting the postmaster
29+
(for csh/bash; use set/export for some other shells):
30+
31+
setenv TZ PST8PDT7,M04.01.0,M10.05.03
32+
/usr/local/pgsql/bin/postmaster -s
33+
1834
Directory Layout
1935

2036
input/ .... .source files that are converted using 'make all' into
21-
.sql files in the 'sql' subdirectory
37+
some of the .sql files in the 'sql' subdirectory
2238

2339
output/ ... .source files that are converted using 'make all' into
2440
.out files in the 'expected' subdirectory
@@ -29,7 +45,7 @@ Directory Layout
2945
look like
3046

3147
results/ .. .out files that represent what the results *actually* look
32-
like
48+
like. Also used as temporary storage for table copy testing.
3349

3450
Running the regression test
3551

@@ -45,14 +61,14 @@ Running the regression test
4561
Normally, the regression test should be run as the pg_superuser as the
4662
'src/test/regress' directory and sub-directories are owned by the
4763
pg_superuser. If you run the regression test as another user the
48-
'src/test/regress' directory should be writeable to that user.
64+
'src/test/regress' directory tree should be writeable to that user.
4965

5066
Comparing expected/actual output
5167

52-
The results are in the file 'regress.out' which can be compared
53-
with the 'expected.out' file using 'diff'. The files will NOT
54-
compare exactly. The following paragraphs attempt to explain the
55-
differences.
68+
The results are in the files in the ./results directory. These
69+
results can be compared with results in the ./expected directory
70+
using 'diff'. The files might not compare exactly. The following
71+
paragraphs attempt to explain the differences.
5672

5773
OID differences
5874

@@ -62,7 +78,7 @@ OID differences
6278
If you run the regression test on a non-virgin database or run it multiple
6379
times, the OID's reported will have different values.
6480

65-
The following SQL statements in 'regress.out' have shown this behavior:
81+
The following SQL statements in 'misc.out' have shown this behavior:
6682

6783
QUERY: SELECT user_relns() AS user_relns ORDER BY user_relns;
6884

@@ -96,8 +112,8 @@ POLYGON differences
96112

97113
Several of the tests involve operations on geographic date about the
98114
Oakland/Berkley CA street map. The map data is expressed as polygons
99-
whose verticies are represened as pairs of FLOAT8 numbers (decimal
100-
lattitude and longitude). Initially, some tables are created and
115+
whose vertices are represented as pairs of FLOAT8 numbers (decimal
116+
latitude and longitude). Initially, some tables are created and
101117
loaded with geographic data, then some views are created which join
102118
two tables using the polygon intersection operator (##), then a select
103119
is done on the view.
@@ -111,24 +127,84 @@ POLYGON differences
111127

112128
DATE/TIME differences
113129

130+
On many supported platforms, you can force PostgreSQL to believe that it
131+
is running in the same time zone as Berkeley, California. See details in
132+
the section on how to run the regression tests.
133+
114134
The Makefile attempts to adjust for timezone differences, but it is
115-
totally possible to eliminate them. People outside North America
135+
not possible to totally eliminate them. People outside North America
116136
will probabablly find the Makefile's adjustments are incorrect. Also
117137
entries that use the time -infinity display with year 1970 plus/minus the
118138
number of hours you are different from GMT.
119139

120-
--------[ old stuff that needs to be rewritten ]-----
140+
Random differences
141+
142+
There is at least one test case in misc.out which is intended to produce
143+
random results. This causes misc to fail the regression testing.
144+
Typing "diff results/misc.out expected/misc.out" should produce only
145+
one or a few lines of differences for this reason, but other floating
146+
point differences on dissimilar architectures might cause many more
147+
differences.
121148

122-
The 'expected.input' file and the 'sample.regress.out' file
149+
The 'expected' files
123150

124-
The 'expected.input' file was created on a SPARC Solaris 2.4 system
125-
using the 'postgres5-1.02a5.tar.gz' source tree. It has been compared
151+
The ./expected/*.out files were adapted from the original monolithic
152+
'expected.input' file provided by Jolly Chen et al. Newer versions of these
153+
files generated on various development machines have been substituted after
154+
careful (?) inspection. Many of the development machines are running a
155+
Unix OS variant (FreeBSD, Linux, etc) on Ix86 hardware.
156+
157+
The original 'expected.input' file was created on a SPARC Solaris 2.4
158+
system using the 'postgres5-1.02a5.tar.gz' source tree. It was compared
126159
with a file created on an I386 Solaris 2.4 system and the differences
127-
are only in the floating point polygons in the 3rd digit to the right
160+
were only in the floating point polygons in the 3rd digit to the right
128161
of the decimal point. (see below)
129162

130-
The 'sample.regress.out' file is from the postgres-1.01 release
163+
The original 'sample.regress.out' file was from the postgres-1.01 release
131164
constructed by Jolly Chen and is included here for reference. It may
132165
have been created on a DEC ALPHA machine as the 'Makefile.global'
133166
in the postgres-1.01 release has PORTNAME=alpha.
134167

168+
Current release notes
169+
170+
There are no release notes for PostgreSQL v6.0.
171+
172+
v6.1beta release notes
173+
174+
The regression tests have been adapted and extensively modified for the
175+
v6.1 release of PostgreSQL.
176+
177+
Three new data types (datetime, timespan, and circle) have been added to
178+
the native set of PostgreSQL types. Points, boxes, paths, and polygons
179+
have had their output formats improved, but the old-style input formats
180+
are accepted by v6.1. The source data files have not been updated to the
181+
new formats, but should be for the next release. The polygon output in
182+
misc.out has only been spot-checked for correctness relative to the
183+
original regression output.
184+
185+
To get consistant results from the regression tests, compile the PostgreSQL
186+
backend with the genetic optimizer (GEQ) turned off. The genetic algorithms
187+
introduce a random behavior in the output ordering which causes the
188+
simple "diff" implementation of the tests to fail. To turn off the genetic
189+
optimizer, edit the src/include/config.h file and comment-out the line
190+
containing "#define GEQ", then do a "make clean install" to regenerate
191+
the backend. Existing v6.1 databases are not affected by the choice of
192+
optimizer, so there is no need to reload after changing the optimizer.
193+
The new genetic optimizer has very nice performance with many-table joins,
194+
so you may want to make sure to re-enable it and reinstall the code after
195+
you have concluded your regression testing.
196+
197+
XXX update this for the production release - tgl 97/04/26
198+
The interpretation of array specifiers (the curly braces around atomic
199+
values) appears to have changed sometime after the original regression
200+
tests were generated. The current ./expected/*.out files reflect this
201+
new interpretation, which may not be correct!
202+
203+
XXX update this for the production release - tgl 97/04/26
204+
The float8 regression test fails. This may be due to the parser continuing
205+
rather than aborting when given invalid constants for input values.
206+
207+
XXX update this for the production release - tgl 97/04/26
208+
Regression tests involving indexed tables fail in at least some environments.
209+
This may indicate a problem with the current index code.
210+

src/test/regress/data/stud_emp.data

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
jeff 23 (8,7.7) 600 sharon 3.50000000000000000e+00
2-
cim 30 (10.5,4.7) 400 3.39999999999999990e+00
3-
linda 19 (0.9,6.1) 100 2.89999999999999990e+00
1+
jeff 23 (8,7.7) 600 sharon 3.50000000000000000e+00 \N
2+
cim 30 (10.5,4.7) 400 \N 3.39999999999999990e+00 \N
3+
linda 19 (0.9,6.1) 100 \N 2.89999999999999990e+00 \N

0 commit comments

Comments
 (0)