Skip to content

Commit 90cfa9a

Browse files
committed
Allow for different result files when using GCC versus native compiler.
1 parent fd05f89 commit 90cfa9a

File tree

3 files changed

+68
-48
lines changed

3 files changed

+68
-48
lines changed

doc/src/sgml/regress.sgml

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/regress.sgml,v 1.12 2000/10/22 19:11:05 tgl Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/regress.sgml,v 1.13 2000/11/21 23:40:27 petere Exp $ -->
22

33
<chapter id="regress">
44
<title id="regress-title">Regression Tests</title>
@@ -272,52 +272,61 @@ diff results/random.out expected/random.out
272272

273273
<!-- We might want to move the following section into the developer's guide. -->
274274
<sect1 id="regress-platform">
275-
<title>Platform-specific comparison files</title>
275+
<title>Platform-specific comparison files</title>
276276

277-
<para>
278-
Since some of the tests inherently produce platform-specific results,
279-
we have provided a way to supply platform-specific result comparison
280-
files. Frequently, the same variation applies to multiple platforms;
281-
rather than supplying a separate comparison file for every platform,
282-
there is a mapping file that defines which comparison file to use.
283-
So, to eliminate bogus test "failures" for a particular platform,
284-
you must choose or make a variant result file, and then add a line
285-
to the mapping file, which is "resultmap".
286-
</para>
277+
<para>
278+
Since some of the tests inherently produce platform-specific
279+
results, we have provided a way to supply platform-specific result
280+
comparison files. Frequently, the same variation applies to
281+
multiple platforms; rather than supplying a separate comparison
282+
file for every platform, there is a mapping file that defines
283+
which comparison file to use. So, to eliminate bogus test
284+
<quote>failures</quote> for a particular platform, you must choose
285+
or make a variant result file, and then add a line to the mapping
286+
file, which is <filename>resultmap</filename>.
287+
</para>
287288

288-
<para>
289-
Each line in the mapping file is of the form
290-
<programlisting>
291-
testname/platformnamepattern=comparisonfilename
292-
</programlisting>
293-
The test name is just the name of the particular regression test module.
294-
The platform name pattern is a pattern in the style of expr(1) (that is,
295-
a regular expression with an implicit ^ anchor at the start). It is matched
296-
against the platform name as printed by config.guess. The comparison
297-
file name is the name of the substitute result comparison file.
298-
</para>
289+
<para>
290+
Each line in the mapping file is of the form
291+
<synopsis>
292+
testname/platformnamepattern=comparisonfilename
293+
</synopsis>
294+
The test name is just the name of the particular regression test
295+
module. The platform name pattern is a pattern in the style of
296+
expr(1) (that is, a regular expression with an implicit ^ anchor
297+
at the start). It is matched against the platform name as printed
298+
by <filename>config.guess</filename> with an appended
299+
<literal>:gcc</literal> or <literal>:cc</literal>, depending on
300+
whether you use the GNU compiler or the system's native compiler
301+
(on systems where there is a difference). The comparison file
302+
name is the name of the substitute result comparison file.
303+
</para>
299304

300-
<para>
301-
For example: the int2 regress test includes a deliberate entry of a value
302-
that is too large to fit in int2. The specific error message that is
303-
produced is platform-dependent; our reference platform emits
304-
<programlisting>
305-
ERROR: pg_atoi: error reading "100000": Numerical result out of range
306-
</programlisting>
307-
but a fair number of other Unix platforms emit
308-
<programlisting>
309-
ERROR: pg_atoi: error reading "100000": Result too large
310-
</programlisting>
311-
Therefore, we provide a variant comparison file, int2-too-large.out,
312-
that includes this spelling of the error message. To silence the
313-
bogus "failure" message on HPPA platforms, resultmap includes
314-
<programlisting>
315-
int2/hppa=int2-too-large
316-
</programlisting>
317-
which will trigger on any machine for which config.guess's output
318-
begins with 'hppa'. Other lines in resultmap select the variant
319-
comparison file for other platforms where it's appropriate.
320-
</para>
305+
<para>
306+
For example: the int2 regression test includes a deliberate entry
307+
of a value that is too large to fit in int2. The specific error
308+
message that is produced is platform-dependent; our reference
309+
platform emits
310+
<screen>
311+
<computeroutput>ERROR: pg_atoi: error reading "100000": Numerical result out of range</computeroutput>
312+
</screen>
313+
but a fair number of other Unix platforms emit
314+
<screen>
315+
<computeroutput>ERROR: pg_atoi: error reading "100000": Result too large</computeroutput>
316+
</screen>
317+
Therefore, we provide a variant comparison file,
318+
<filename>int2-too-large.out</filename>, that includes this
319+
spelling of the error message. To silence the bogus
320+
<quote>failure</quote> message on HPPA platforms, resultmap
321+
includes
322+
<programlisting>
323+
int2/hppa=int2-too-large
324+
</programlisting>
325+
which will trigger on any machine for which config.guess's output
326+
begins with <quote><literal>hppa</literal></quote>. Other lines
327+
in resultmap select the variant comparison file for other
328+
platforms where it's appropriate.
329+
</para>
321330

322331
</sect1>
323332

src/test/regress/GNUmakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.30 2000/10/27 20:00:19 petere Exp $
10+
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.31 2000/11/21 23:40:28 petere Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -37,6 +37,7 @@ pg_regress: pg_regress.sh GNUmakefile
3737
-e 's/@host_tuple@/$(host_tuple)/g' \
3838
-e 's,@GMAKE@,$(MAKE),g' \
3939
-e 's/@enable_shared@/$(enable_shared)/g' \
40+
-e 's/@GCC@/$(GCC)/g' \
4041
$< >$@
4142
chmod a+x $@
4243

src/test/regress/pg_regress.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.11 2000/11/21 17:34:21 petere Exp $
2+
# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.12 2000/11/21 23:40:28 petere Exp $
33

44
me=`basename $0`
55
: ${TMPDIR=/tmp}
@@ -74,6 +74,13 @@ bindir='@bindir@'
7474
datadir='@datadir@'
7575
host_platform='@host_tuple@'
7676
enable_shared='@enable_shared@'
77+
GCC=@GCC@
78+
79+
if [ "$GCC" = yes ]; then
80+
compiler=gcc
81+
else
82+
compiler=cc
83+
fi
7784

7885
unset mode
7986
unset schedule
@@ -223,9 +230,12 @@ trap '
223230
# ----------
224231
# Scan resultmap file to find which platform-specific expected files to use.
225232
# The format of each line of the file is
226-
# testname/hostplatformpattern=substitutefile
233+
# testname/hostplatformpattern=substitutefile
227234
# where the hostplatformpattern is evaluated per the rules of expr(1),
228235
# namely, it is a standard regular expression with an implicit ^ at the start.
236+
# What hostplatformpattern will be matched against is the config.guess output
237+
# followed by either ':gcc' or ':cc' (independent of the actual name of the
238+
# compiler executable).
229239
#
230240
# The tempfile hackery is needed because some shells will run the loop
231241
# inside a subshell, whereupon shell variables set therein aren't seen
@@ -236,7 +246,7 @@ cat /dev/null >$TMPFILE
236246
while read LINE
237247
do
238248
HOSTPAT=`expr "$LINE" : '.*/\(.*\)='`
239-
if [ `expr "$host_platform" : "$HOSTPAT"` -ne 0 ]
249+
if [ `expr "$host_platform:$compiler" : "$HOSTPAT"` -ne 0 ]
240250
then
241251
# remove hostnamepattern from line so that there are no shell
242252
# wildcards in SUBSTLIST; else later 'for' could expand them!

0 commit comments

Comments
 (0)