Commit 09922597 authored by Magnus Hagander's avatar Magnus Hagander

Rewrite ECPG regression test driver in C, by splitting the standard

regression driver into two parts and reusing half of it. Required to
run ECPG tests without a shell on MSVC builds.

Fix ECPG thread tests for MSVC build (incl output files).

Joachim Wieland and Magnus Hagander
parent e514740e
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.67 2007/03/29 12:02:24 meskes Exp $
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.68 2007/06/12 11:07:30 mha Exp $
subdir = src/interfaces/ecpg/test
top_builddir = ../../../..
......@@ -8,12 +8,12 @@ include $(top_builddir)/src/Makefile.global
# this is also defined in test/connect/Makefile
TEMP_PORT = 5$(DEF_PGPORT)
# where to find psql for testing an existing installation
PSQLDIR = $(bindir)
# default encoding
MULTIBYTE = SQL_ASCII
# threading
THREAD := $(shell grep -q "define ENABLE_THREAD_SAFETY" ../include/ecpg_config.h && echo "--enable-threading")
# locale
NOLOCALE =
ifdef NO_LOCALE
......@@ -26,6 +26,15 @@ else
abs_builddir := $(shell pwd -W)
endif
# stuff to pass into build of pg_regress
EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
'-DMAKEPROG="$(MAKE)"' \
'-DSHELLPROG="$(SHELL)"' \
'-DDLSUFFIX="$(DLSUFFIX)"'
REGRESSINCLUDES = "-I$(top_builddir)/src/test/regress"
REGRESSDRIVER = "$(top_builddir)/src/test/regress/pg_regress.o"
all install installdirs uninstall distprep:
$(MAKE) -C connect $@
$(MAKE) -C expected $@
......@@ -45,20 +54,21 @@ clean distclean maintainer-clean:
$(MAKE) -C compat_informix $@
$(MAKE) -C thread $@
rm -rf tmp_check results log
rm -f pg_regress regression.diffs
rm -f pg_regress regression.diffs pg_regress_ecpg.o
# Build regression test driver
all: pg_regress$(X)
pg_regress$(X): pg_regress_ecpg.o
$(CC) $(CFLAGS) $^ $(REGRESSDRIVER) $(LDFLAGS) $(LIBS) -o $@
all: pg_regress
# dependencies ensure that path changes propagate
pg_regress_ecpg.o: pg_regress_ecpg.c $(top_builddir)/src/port/pg_config_paths.h
$(CC) $(CFLAGS) $(CPPFLAGS) -I$(top_builddir)/src/port $(REGRESSINCLUDES) $(EXTRADEFS) -c -o $@ $<
pg_regress: pg_regress.sh $(top_builddir)/src/Makefile.global
sed -e 's,@bindir@,$(bindir),g' \
-e 's,@libdir@,$(libdir),g' \
-e 's,@pkglibdir@,$(pkglibdir),g' \
-e 's,@datadir@,$(datadir),g' \
-e 's/@VERSION@/$(VERSION)/g' \
-e 's/@host_tuple@/$(host_tuple)/g' \
-e 's,@GMAKE@,$(MAKE),g' \
-e 's/@enable_shared@/$(enable_shared)/g' \
$< >$@
$(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
$(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
# When doing a VPATH build, copy over the .pgc, .stdout and .stderr
# files so that the driver script can find them. We have to use an
......@@ -78,11 +88,11 @@ endif
check: all
sh ./pg_regress --dbname=regress1 --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) $(THREAD)
./pg_regress --dbname=regress1,connectdb --top-builddir=$(top_builddir) --temp-install=./tmp_check --temp-port=$(TEMP_PORT) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) $(THREAD) --schedule=$(srcdir)/ecpg_schedule --create-role=connectuser,connectdb
# the same options, but with --listen-on-tcp
checktcp: all
sh ./pg_regress --dbname=regress1 --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) --listen-on-tcp $(THREAD)
./pg_regress --dbname=regress1,connectdb --top-builddir=$(top_builddir) --temp-install=./tmp_check --temp-port=$(TEMP_PORT) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) $(THREAD) --schedule=$(srcdir)/ecpg_schedule_tcp --create-role=connectuser,connectdb --host=localhost
installcheck: all
sh ./pg_regress --dbname=regress1 --top-builddir=$(top_builddir) --load-language=plpgsql $(NOLOCALE)
./pg_regress --psqldir=$(PSQLDIR) --dbname=regress1,connectdb --top-builddir=$(top_builddir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) $(THREAD) --schedule=$(srcdir)/ecpg_schedule --create-role=connectuser,connectdb
test: compat_informix/dec_test
test: compat_informix/charfuncs
test: compat_informix/rfmtdate
test: compat_informix/rfmtlong
test: compat_informix/rnull
test: compat_informix/test_informix
test: compat_informix/test_informix2
test: connect/test2
test: connect/test3
test: connect/test4
test: connect/test5
test: pgtypeslib/dt_test
test: pgtypeslib/dt_test2
test: pgtypeslib/num_test
test: pgtypeslib/num_test2
test: preproc/comment
test: preproc/define
test: preproc/init
test: preproc/type
test: preproc/variable
test: preproc/whenever
test: sql/array
test: sql/binary
test: sql/code100
test: sql/copystdout
test: sql/define
test: sql/desc
test: sql/dynalloc
test: sql/dynalloc2
test: sql/dyntest
test: sql/execute
test: sql/fetch
test: sql/func
test: sql/indicators
test: sql/quote
test: sql/show
test: sql/insupd
test: sql/parser
test: thread/thread
test: thread/thread_implicit
......@@ -153,15 +153,19 @@ void *test_thread(void *arg)
/* build up connection name, and connect to database */
#ifndef WIN32_ONLY_COMPILER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#else
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
/* exec sql whenever sqlerror sqlprint ; */
#line 107 "thread.pgc"
#line 111 "thread.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , l_connection, 0);
#line 108 "thread.pgc"
#line 112 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 108 "thread.pgc"
#line 112 "thread.pgc"
if( sqlca.sqlcode != 0 )
{
......@@ -169,10 +173,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
return( NULL );
}
{ ECPGtrans(__LINE__, l_connection, "begin transaction ");
#line 114 "thread.pgc"
#line 118 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 114 "thread.pgc"
#line 118 "thread.pgc"
/* insert into test_thread table */
......@@ -183,10 +187,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 119 "thread.pgc"
#line 123 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 119 "thread.pgc"
#line 123 "thread.pgc"
if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
......@@ -194,16 +198,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* all done */
{ ECPGtrans(__LINE__, l_connection, "commit");
#line 125 "thread.pgc"
#line 129 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 125 "thread.pgc"
#line 129 "thread.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
#line 126 "thread.pgc"
#line 130 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 126 "thread.pgc"
#line 130 "thread.pgc"
return( NULL );
}
......
......@@ -154,15 +154,19 @@ void *test_thread(void *arg)
/* build up connection name, and connect to database */
#ifndef WIN32_ONLY_COMPILER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#else
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
/* exec sql whenever sqlerror sqlprint ; */
#line 108 "thread_implicit.pgc"
#line 112 "thread_implicit.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , l_connection, 0);
#line 109 "thread_implicit.pgc"
#line 113 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 109 "thread_implicit.pgc"
#line 113 "thread_implicit.pgc"
if( sqlca.sqlcode != 0 )
{
......@@ -170,10 +174,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
return( NULL );
}
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
#line 115 "thread_implicit.pgc"
#line 119 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 115 "thread_implicit.pgc"
#line 119 "thread_implicit.pgc"
/* insert into test_thread table */
......@@ -184,10 +188,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 120 "thread_implicit.pgc"
#line 124 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 120 "thread_implicit.pgc"
#line 124 "thread_implicit.pgc"
if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
......@@ -195,16 +199,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* all done */
{ ECPGtrans(__LINE__, NULL, "commit");
#line 126 "thread_implicit.pgc"
#line 130 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 126 "thread_implicit.pgc"
#line 130 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
#line 127 "thread_implicit.pgc"
#line 131 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 127 "thread_implicit.pgc"
#line 131 "thread_implicit.pgc"
return( NULL );
}
......
This diff is collapsed.
/*-------------------------------------------------------------------------
*
* pg_regress_ecpg --- regression test driver for ecpg
*
* This is a C implementation of the previous shell script for running
* the regression tests, and should be mostly compatible with it.
* Initial author of C translation: Magnus Hagander
*
* This code is released under the terms of the PostgreSQL License.
*
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress_ecpg.c,v 1.1 2007/06/12 11:07:30 mha Exp $
*
*-------------------------------------------------------------------------
*/
#include "pg_regress.h"
#define LINEBUFSIZE 300
static void
ecpg_filter(const char *sourcefile, const char *outfile)
{
/*
* Create a filtered copy of sourcefile, replacing
* #line x "./../bla/foo.h"
* with
* #line x "foo.h"
*/
FILE *s, *t;
char linebuf[LINEBUFSIZE];
s = fopen(sourcefile, "r");
if (!s)
{
fprintf(stderr, "Could not open file %s for reading\n", sourcefile);
exit_nicely(2);
}
t = fopen(outfile, "w");
if (!t)
{
fprintf(stderr, "Could not open file %s for writing\n", outfile);
exit_nicely(2);
}
while (fgets(linebuf, LINEBUFSIZE, s))
{
/* check for "#line " in the beginning */
if (strstr(linebuf, "#line ") == linebuf)
{
char *p = strchr(linebuf, '"');
char *n;
int plen = 1;
while (*p && (*(p + plen) == '.' || strchr(p + plen, '/') != NULL))
{
plen++;
}
/* plen is one more than the number of . and / characters */
if (plen > 1)
{
n = (char *) malloc(plen);
strncpy(n, p+1, plen - 1);
n[plen-1] = '\0';
replace_string(linebuf, n, "");
}
}
fputs(linebuf, t);
}
fclose(s);
fclose(t);
}
/*
* start an ecpg test process for specified file (including redirection),
* and return process ID
*/
static PID_TYPE
ecpg_start_test(const char *testname,
_stringlist **resultfiles,
_stringlist **expectfiles,
_stringlist **tags)
{
PID_TYPE pid;
char inprg[MAXPGPATH];
char insource[MAXPGPATH];
char *outfile_stdout, expectfile_stdout[MAXPGPATH];
char *outfile_stderr, expectfile_stderr[MAXPGPATH];
char *outfile_source, expectfile_source[MAXPGPATH];
char cmd[MAXPGPATH * 3];
char *testname_dash;
snprintf(inprg, sizeof(inprg), "%s/%s", inputdir, testname);
testname_dash = strdup(testname);
replace_string(testname_dash, "/", "-");
snprintf(expectfile_stdout, sizeof(expectfile_stdout),
"%s/expected/%s.stdout",
outputdir, testname_dash);
snprintf(expectfile_stderr, sizeof(expectfile_stderr),
"%s/expected/%s.stderr",
outputdir, testname_dash);
snprintf(expectfile_source, sizeof(expectfile_source),
"%s/expected/%s.c",
outputdir, testname_dash);
/*
* We can use replace_string() here because the replacement string does
* not occupy more space than the replaced one.
*/
outfile_stdout = strdup(expectfile_stdout);
replace_string(outfile_stdout, "/expected/", "/results/");
outfile_stderr = strdup(expectfile_stderr);
replace_string(outfile_stderr, "/expected/", "/results/");
outfile_source = strdup(expectfile_source);
replace_string(outfile_source, "/expected/", "/results/");
add_stringlist_item(resultfiles, outfile_stdout);
add_stringlist_item(expectfiles, expectfile_stdout);
add_stringlist_item(tags, "stdout");
add_stringlist_item(resultfiles, outfile_stderr);
add_stringlist_item(expectfiles, expectfile_stderr);
add_stringlist_item(tags, "stderr");
add_stringlist_item(resultfiles, outfile_source);
add_stringlist_item(expectfiles, expectfile_source);
add_stringlist_item(tags, "source");
snprintf(insource, sizeof(insource), "%s.c", testname);
ecpg_filter(insource, outfile_source);
snprintf(inprg, sizeof(inprg), "%s/%s", inputdir, testname);
snprintf(cmd, sizeof(cmd),
SYSTEMQUOTE "\"%s\" >\"%s\" 2>\"%s\"" SYSTEMQUOTE,
inprg,
outfile_stdout,
outfile_stderr);
pid = spawn_process(cmd);
if (pid == INVALID_PID)
{
fprintf(stderr, _("could not start process for test %s\n"),
testname);
exit_nicely(2);
}
free(outfile_stdout);
free(outfile_stderr);
free(outfile_source);
return pid;
}
static void
ecpg_init(void)
{
/* no reason to set -w for ecpg checks, except for when on windows */
if (strstr(host_platform, "-win32"))
basic_diff_opts = "-w";
else
basic_diff_opts = "";
if (strstr(host_platform, "-win32"))
pretty_diff_opts = "-C3 -w";
else
pretty_diff_opts = "-C3";
}
int
main(int argc, char *argv[])
{
return regression_main(argc, argv, ecpg_init, ecpg_start_test);
}
compat_informix/dec_test:stdout:i.86-pc-win32vc=compat_informix-dec_test-MinGW32.stdout
pgtypeslib/num_test:stdout:i.86-pc-win32vc=pgtypeslib-num_test-MinGW32.stdout
pgtypeslib/num_test2:stdout:i.86-pc-win32vc=pgtypeslib-num_test2-MinGW32.stdout
......@@ -103,7 +103,11 @@ void *test_thread(void *arg)
EXEC SQL END DECLARE SECTION;
/* build up connection name, and connect to database */
#ifndef WIN32_ONLY_COMPILER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#else
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
EXEC SQL WHENEVER sqlerror sqlprint;
EXEC SQL CONNECT TO REGRESSDB1 AS :l_connection;
if( sqlca.sqlcode != 0 )
......
......@@ -104,7 +104,11 @@ void *test_thread(void *arg)
EXEC SQL END DECLARE SECTION;
/* build up connection name, and connect to database */
#ifndef WIN32_ONLY_COMPILER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#else
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
EXEC SQL WHENEVER sqlerror sqlprint;
EXEC SQL CONNECT TO REGRESSDB1 AS :l_connection;
if( sqlca.sqlcode != 0 )
......
......@@ -6,7 +6,7 @@
# Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.67 2007/03/13 22:56:48 tgl Exp $
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.68 2007/06/12 11:07:32 mha Exp $
#
#-------------------------------------------------------------------------
......@@ -51,7 +51,7 @@ EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
all: submake-libpgport pg_regress$(X)
pg_regress$(X): pg_regress.o
pg_regress$(X): pg_regress.o pg_regress_main.o
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LIBS) -o $@
# dependencies ensure that path changes propagate
......@@ -165,7 +165,7 @@ clean distclean maintainer-clean: clean-lib
# things built by `all' target
rm -f $(NAME)$(DLSUFFIX) $(OBJS)
$(MAKE) -C $(contribdir)/spi clean
rm -f $(output_files) $(input_files) pg_regress.o pg_regress$(X)
rm -f $(output_files) $(input_files) pg_regress_main.o pg_regress.o pg_regress$(X)
# things created by various check targets
rm -rf testtablespace
rm -rf results tmp_check log
......
This diff is collapsed.
/*-------------------------------------------------------------------------
* pg_regress.h --- regression test driver
*
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/test/regress/pg_regress.h,v 1.1 2007/06/12 11:07:34 mha Exp $
*-------------------------------------------------------------------------
*/
#include "postgres_fe.h"
#include <unistd.h>
#ifndef WIN32
#define PID_TYPE pid_t
#define INVALID_PID (-1)
#else
#define PID_TYPE HANDLE
#define INVALID_PID INVALID_HANDLE_VALUE
#endif
/* simple list of strings */
typedef struct _stringlist
{
char *str;
struct _stringlist *next;
} _stringlist;
typedef PID_TYPE (*test_function)(const char *,
_stringlist **,
_stringlist **,
_stringlist **);
typedef void (*init_function)(void);
extern char *bindir;
extern char *libdir;
extern char *datadir;
extern char *host_platform;
extern _stringlist *dblist;
extern bool debug;
extern char *inputdir;
extern char *outputdir;
/*
* This should not be global but every module should be able to read command
* line parameters.
*/
extern char *psqldir;
extern const char *basic_diff_opts;
extern const char *pretty_diff_opts;
int regression_main(int argc, char *argv[],
init_function ifunc, test_function tfunc);
void add_stringlist_item(_stringlist ** listhead, const char *str);
PID_TYPE spawn_process(const char *cmdline);
void exit_nicely(int code);
void replace_string(char *string, char *replace, char *replacement);
/*-------------------------------------------------------------------------
*
* pg_regress_main --- regression test for the main backend
*
* This is a C implementation of the previous shell script for running
* the regression tests, and should be mostly compatible with it.
* Initial author of C translation: Magnus Hagander
*
* This code is released under the terms of the PostgreSQL License.
*
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/test/regress/pg_regress_main.c,v 1.1 2007/06/12 11:07:34 mha Exp $
*
*-------------------------------------------------------------------------
*/
#include "pg_regress.h"
/*
* start a psql test process for specified file (including redirection),
* and return process ID
*/
static PID_TYPE
psql_start_test(const char *testname,
_stringlist **resultfiles,
_stringlist **expectfiles,
_stringlist **tags)
{
PID_TYPE pid;
char infile[MAXPGPATH];
char outfile[MAXPGPATH];
char expectfile[MAXPGPATH];
char psql_cmd[MAXPGPATH * 3];
snprintf(infile, sizeof(infile), "%s/sql/%s.sql",
inputdir, testname);
snprintf(outfile, sizeof(outfile), "%s/results/%s.out",
outputdir, testname);
snprintf(expectfile, sizeof(expectfile), "%s/expected/%s.out",
inputdir, testname);
add_stringlist_item(resultfiles, outfile);
add_stringlist_item(expectfiles, expectfile);
snprintf(psql_cmd, sizeof(psql_cmd),
SYSTEMQUOTE "\"%s%spsql\" -X -a -q -d \"%s\" < \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
psqldir ? psqldir : "",
psqldir ? "/" : "",
dblist->str,
infile,
outfile);
pid = spawn_process(psql_cmd);
if (pid == INVALID_PID)
{
fprintf(stderr, _("could not start process for test %s\n"),
testname);
exit_nicely(2);
}
return pid;
}
static void
psql_init(void)
{
/* set default regression database name */
add_stringlist_item(&dblist, "regression");
}
int
main(int argc, char *argv[])
{
return regression_main(argc, argv, psql_init, psql_start_test);
}
float4/i.86-pc-mingw32=float4-exp-three-digits
float4/i.86-pc-win32vc=float4-exp-three-digits
float8/i.86-.*-freebsd=float8-small-is-zero
float8/i.86-.*-openbsd=float8-small-is-zero
float8/i.86-.*-netbsd=float8-small-is-zero
float8/m68k-.*-netbsd=float8-small-is-zero
float8/i.86-pc-mingw32=float8-exp-three-digits-win32
float8/i.86-pc-win32vc=float8-exp-three-digits-win32
float8/i.86-pc-cygwin=float8-small-is-zero
int8/i.86-pc-mingw32=int8-exp-three-digits
int8/i.86-pc-win32vc=int8-exp-three-digits
\ No newline at end of file
float4:out:i.86-pc-mingw32=float4-exp-three-digits.out
float4:out:i.86-pc-win32vc=float4-exp-three-digits.out
float8:out:i.86-.*-freebsd=float8-small-is-zero.out
float8:out:i.86-.*-openbsd=float8-small-is-zero.out
float8:out:i.86-.*-netbsd=float8-small-is-zero.out
float8:out:m68k-.*-netbsd=float8-small-is-zero.out
float8:out:i.86-pc-mingw32=float8-exp-three-digits-win32.out
float8:out:i.86-pc-win32vc=float8-exp-three-digits-win32.out
float8:out:i.86-pc-cygwin=float8-small-is-zero.out
int8:out:i.86-pc-mingw32=int8-exp-three-digits.out
int8:out:i.86-pc-win32vc=int8-exp-three-digits.out
......@@ -3,7 +3,7 @@ package Install;
#
# Package that provides 'make install' functionality for msvc builds
#
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.15 2007/05/13 15:33:07 mha Exp $
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.16 2007/06/12 11:07:34 mha Exp $
#
use strict;
use warnings;
......@@ -25,6 +25,7 @@ sub Install
require 'config.pl';
chdir("../../..") if (-f "../../../configure");
chdir("../../../..") if (-f "../../../../configure");
my $conf = "";
if (-d "debug")
{
......@@ -115,6 +116,7 @@ sub CopySetOfFiles
{
chomp;
next if /regress/; # Skip temporary install in regression subdir
next if /ecpg.test/; # Skip temporary install in regression subdir
my $tgt = $target . basename($_);
print ".";
my $src = $norecurse?(dirname($spec) . '/' . $_):$_;
......
......@@ -3,7 +3,7 @@ package Mkvcbuild;
#
# Package that generates build files for msvc build
#
# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.11 2007/04/27 16:45:54 mha Exp $
# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.12 2007/06/12 11:07:34 mha Exp $
#
use Carp;
use Win32;
......@@ -154,6 +154,15 @@ sub mkvcbuild
$ecpg->AddDefine('PATCHLEVEL=1');
$ecpg->AddReference($libpgport);
my $pgregress_ecpg = $solution->AddProject('pg_regress_ecpg','exe','misc');
$pgregress_ecpg->AddFile('src\interfaces\ecpg\test\pg_regress_ecpg.c');
$pgregress_ecpg->AddFile('src\test\regress\pg_regress.c');
$pgregress_ecpg->AddIncludeDir('src\port');
$pgregress_ecpg->AddIncludeDir('src\test\regress');
$pgregress_ecpg->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
$pgregress_ecpg->AddDefine('FRONTEND');
$pgregress_ecpg->AddReference($libpgport);
# src/bin
my $initdb = AddSimpleFrontend('initdb', 1);
$initdb->AddLibrary('wsock32.lib ws2_32.lib');
......@@ -315,6 +324,7 @@ sub mkvcbuild
my $pgregress = $solution->AddProject('pg_regress','exe','misc');
$pgregress->AddFile('src\test\regress\pg_regress.c');
$pgregress->AddFile('src\test\regress\pg_regress_main.c');
$pgregress->AddIncludeDir('src\port');
$pgregress->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
$pgregress->AddDefine('FRONTEND');
......
@echo off
REM $PostgreSQL: pgsql/src/tools/msvc/clean.bat,v 1.4 2007/03/23 09:53:33 mha Exp $
REM $PostgreSQL: pgsql/src/tools/msvc/clean.bat,v 1.5 2007/06/12 11:07:34 mha Exp $
set D=%CD%
if exist ..\msvc if exist ..\..\..\src cd ..\..\..
......@@ -59,6 +59,10 @@ call :del tsearch2\tsearch2.sql
call :del tsearch2\uninstall_tsearch2.sql
cd %D%
REM Clean up ecpg regression test files
msbuild ecpg_regression.proj /t:clean /v:q
goto :eof
......
<?xml version="1.0"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="all">
<!--
MSBuild project file to build ecpg regression tests
-->
<PropertyGroup>
<TESTDIR>..\..\interfaces\ecpg\test</TESTDIR>
<CONFIG>Debug</CONFIG>
<OUTDIR>..\..\..\..\..\$(CONFIG)\</OUTDIR>
</PropertyGroup>
<PropertyGroup Condition="'$(CONFIG)'=='DEBUG'">
<!-- set debug runtime library if necessary to be compatible with the LIB files generated -->
<DEBUGLIB>d</DEBUGLIB>
</PropertyGroup>
<ItemGroup>
<Pgc Include="$(TESTDIR)\**\*.pgc" Exclude="$(TESTDIR)\performance\perftest.pgc"/>
</ItemGroup>
<ItemGroup>
<OutputToDelete Include="$(TESTDIR)\**\*.exe" />
<OutputToDelete Include="$(TESTDIR)\**\*.exe.manifest" />
<OutputToDelete Include="$(TESTDIR)\**\*.obj" />
<OutputToDelete Include="$(TESTDIR)\**\*.c" Exclude="$(TESTDIR)\pg_regress_ecpg.c;$(TESTDIR)\expected\*.c" />
</ItemGroup>
<Target Name="all" Inputs="@(Pgc)" Outputs="%(RelativeDir)%(Filename).exe">
<!-- Set special parameters for some tests -->
<CreateProperty Value="-C INFORMIX" Condition="'%(Pgc.RelativeDir)'=='$(TESTDIR)\compat_informix\'">
<Output TaskParameter="Value" PropertyName="ECPGPARAM" />
</CreateProperty>
<CreateProperty Value="-C INFORMIX -r no_indicator" Condition="'%(Pgc.FileName)'=='rnull'">
<Output TaskParameter="Value" PropertyName="ECPGPARAM" />
</CreateProperty>
<!-- Run ECPG and the Visual C++ compiler on the files. Don't bother with dependency check between the steps -->
<Exec WorkingDirectory="%(Pgc.RelativeDir)" Command="$(OUTDIR)ecpg\ecpg -I ../../include --regression $(ECPGPARAM) -o %(Pgc.Filename).c %(Pgc.Filename).pgc" />
<Exec WorkingDirectorY="%(Pgc.RelativeDir)" Command="cl /nologo %(Pgc.FileName).c /TC /MD$(DEBUGLIB) /DENABLE_THREAD_SAFETY /DWIN32 /DWIN32_ONLY_COMPILER /I. /I..\..\include /I..\..\..\libpq /I..\..\..\..\include /link /defaultlib:$(OUTDIR)libecpg\libecpg.lib /defaultlib:$(OUTDIR)libecpg_compat\libecpg_compat.lib /defaultlib:$(OUTDIR)libpgtypes\libpgtypes.lib" />
</Target>
<!-- Clean up all output files -->
<Target Name="clean">
<Delete Files="@(OutputToDelete)" />
</Target>
</Project>
@echo off
REM $PostgreSQL: pgsql/src/tools/msvc/vcregress.bat,v 1.11 2007/04/21 20:58:05 mha Exp $
REM $PostgreSQL: pgsql/src/tools/msvc/vcregress.bat,v 1.12 2007/06/12 11:07:34 mha Exp $
SETLOCAL
SET STARTDIR=%CD%
......@@ -11,6 +11,7 @@ if /I "%1"=="check" SET what=CHECK
if /I "%1"=="installcheck" SET what=INSTALLCHECK
if /I "%1"=="plcheck" SET what=PLCHECK
if /I "%1"=="contribcheck" SET what=CONTRIBCHECK
if /I "%1"=="ecpgcheck" SET what=ECPGCHECK
if "%what%"=="" goto usage
SET CONFIG=Debug
......@@ -28,10 +29,20 @@ SET SCHEDULE=parallel
SET TEMPPORT=54321
IF NOT "%2"=="" SET SCHEDULE=%2
SET PERL5LIB=..\..\tools\msvc
IF "%what%"=="ECPGCHECK" (
cd "%STARTDIR%"
msbuild ecpg_regression.proj /p:config=%CONFIG%
if errorlevel 1 exit /b 1
cd "%TOPDIR%"
cd src\interfaces\ecpg\test
SET SCHEDULE=ecpg
)
SET PERL5LIB=%TOPDIR%\src\tools\msvc
if "%what%"=="INSTALLCHECK" ..\..\..\%CONFIG%\pg_regress\pg_regress --psqldir="..\..\..\%CONFIG%\psql" --schedule=%SCHEDULE%_schedule --multibyte=SQL_ASCII --load-language=plpgsql --no-locale
if "%what%"=="CHECK" ..\..\..\%CONFIG%\pg_regress\pg_regress --psqldir="..\..\..\%CONFIG%\psql" --schedule=%SCHEDULE%_schedule --multibyte=SQL_ASCII --load-language=plpgsql --no-locale --temp-install=./tmp_check --top-builddir="%TOPDIR%" --temp-port=%TEMPPORT%
if "%what%"=="ECPGCHECK" ..\..\..\..\%CONFIG%\pg_regress_ecpg\pg_regress_ecpg --psqldir="..\..\..\%CONFIG%\psql" --dbname=regress1,connectdb --create-role=connectuser,connectdb --schedule=%SCHEDULE%_schedule --multibyte=SQL_ASCII --load-language=plpgsql --no-locale --temp-install=./tmp_check --top-builddir="%TOPDIR%" --temp-port=%TEMPPORT%
if "%what%"=="PLCHECK" call :plcheck
if "%what%"=="CONTRIBCHECK" call :contribcheck
SET E=%ERRORLEVEL%
......@@ -40,7 +51,7 @@ cd "%STARTDIR%"
exit /b %E%
:usage
echo "Usage: vcregress <check|installcheck> [schedule]"
echo "Usage: vcregress <check|installcheck|plcheck|contribcheck|ecpgcheck> [schedule]"
goto :eof
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment