OSDN Git Service

Fix bug in PreCommit_CheckForSerializationFailure. A transaction that has
[pg-rex/syncrep.git] / src / test / regress / GNUmakefile
1 #-------------------------------------------------------------------------
2 #
3 # GNUmakefile--
4 #    Makefile for src/test/regress (the regression tests)
5 #
6 # Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
7 # Portions Copyright (c) 1994, Regents of the University of California
8 #
9 # src/test/regress/GNUmakefile
10 #
11 #-------------------------------------------------------------------------
12
13 subdir = src/test/regress
14 top_builddir = ../../..
15 include $(top_builddir)/src/Makefile.global
16
17 # file with extra config for temp build
18 TEMP_CONF =
19 ifdef TEMP_CONFIG
20 TEMP_CONF += --temp-config=$(TEMP_CONFIG)
21 endif
22
23 # where to find psql for testing an existing installation
24 PSQLDIR = $(bindir)
25
26 # maximum simultaneous connections for parallel tests
27 MAXCONNOPT =
28 ifdef MAX_CONNECTIONS
29 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
30 endif
31
32 # stuff to pass into build of pg_regress
33 EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
34         '-DMAKEPROG="$(MAKE)"' \
35         '-DSHELLPROG="$(SHELL)"' \
36         '-DDLSUFFIX="$(DLSUFFIX)"'
37
38 ##
39 ## Prepare for tests
40 ##
41
42 # Build regression test driver
43
44 all: pg_regress$(X)
45
46 pg_regress$(X): pg_regress.o pg_regress_main.o | submake-libpgport
47         $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
48
49 # dependencies ensure that path changes propagate
50 pg_regress.o: pg_regress.c $(top_builddir)/src/port/pg_config_paths.h
51         $(CC) $(CFLAGS) $(CPPFLAGS) -I$(top_builddir)/src/port $(EXTRADEFS) -c -o $@ $<
52
53 $(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
54         $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
55
56 install: all installdirs
57         $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
58
59 installdirs:
60         $(MKDIR_P) '$(DESTDIR)$(pgxsdir)/$(subdir)'
61
62 uninstall:
63         rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
64
65
66 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
67
68 NAME = regress
69 OBJS = regress.o
70
71 include $(top_srcdir)/src/Makefile.shlib
72
73 all: all-lib
74
75 # Test input and expected files.  These are created by pg_regress itself, so we
76 # don't have a rule to create them.  We do need rules to clean them however.
77 input_files = $(patsubst $(srcdir)/input/%.source,sql/%.sql, $(wildcard $(srcdir)/input/*.source))
78 output_files := $(patsubst $(srcdir)/output/%.source,expected/%.out, $(wildcard $(srcdir)/output/*.source))
79
80
81 # not installed by default
82
83 regress_data_files = \
84         $(filter-out $(addprefix $(srcdir)/,$(output_files)),$(wildcard $(srcdir)/expected/*.out)) \
85         $(wildcard $(srcdir)/input/*.source) \
86         $(wildcard $(srcdir)/output/*.source) \
87         $(filter-out $(addprefix $(srcdir)/,$(input_files)),$(wildcard $(srcdir)/sql/*.sql)) \
88         $(wildcard $(srcdir)/data/*.data) \
89         $(srcdir)/parallel_schedule $(srcdir)/serial_schedule $(srcdir)/resultmap
90
91 install-tests: all install install-lib installdirs-tests
92         $(MAKE) -C $(top_builddir)/contrib/spi install
93         for file in $(regress_data_files); do \
94           $(INSTALL_DATA) $$file '$(DESTDIR)$(pkglibdir)/regress/'$$file || exit; \
95         done
96
97 installdirs-tests: installdirs
98         $(MKDIR_P)  $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files))))
99
100
101 # Get some extra C modules from contrib/spi and contrib/dummy_seclabel...
102
103 all: refint$(DLSUFFIX) autoinc$(DLSUFFIX) dummy_seclabel$(DLSUFFIX)
104
105 refint$(DLSUFFIX): $(top_builddir)/contrib/spi/refint$(DLSUFFIX)
106         cp $< $@
107
108 autoinc$(DLSUFFIX): $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX)
109         cp $< $@
110
111 dummy_seclabel$(DLSUFFIX): $(top_builddir)/contrib/dummy_seclabel/dummy_seclabel$(DLSUFFIX)
112         cp $< $@
113
114 $(top_builddir)/contrib/spi/refint$(DLSUFFIX): $(top_srcdir)/contrib/spi/refint.c
115         $(MAKE) -C $(top_builddir)/contrib/spi refint$(DLSUFFIX)
116
117 $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): $(top_srcdir)/contrib/spi/autoinc.c
118         $(MAKE) -C $(top_builddir)/contrib/spi autoinc$(DLSUFFIX)
119
120 $(top_builddir)/contrib/dummy_seclabel/dummy_seclabel$(DLSUFFIX): $(top_builddir)/contrib/dummy_seclabel/dummy_seclabel.c
121         $(MAKE) -C $(top_builddir)/contrib/dummy_seclabel dummy_seclabel$(DLSUFFIX)
122
123 # Tablespace setup
124
125 .PHONY: tablespace-setup
126 tablespace-setup:
127         rm -rf ./testtablespace
128         mkdir ./testtablespace
129
130
131 ##
132 ## Run tests
133 ##
134
135 REGRESS_OPTS = --dlpath=.
136
137 check: all tablespace-setup
138         $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF) $(EXTRA_TESTS)
139
140 installcheck: all tablespace-setup
141         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS)
142
143 installcheck-parallel: all tablespace-setup
144         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
145
146 standbycheck: all
147         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/standby_schedule --use-existing
148
149 # old interfaces follow...
150
151 runcheck: check
152 runtest: installcheck
153 runtest-parallel: installcheck-parallel
154
155 bigtest: all tablespace-setup
156         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule numeric_big
157
158 bigcheck: all tablespace-setup
159         $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big
160
161
162 ##
163 ## Clean up
164 ##
165
166 clean distclean maintainer-clean: clean-lib
167 # things built by `all' target
168         rm -f $(OBJS) refint$(DLSUFFIX) autoinc$(DLSUFFIX) dummy_seclabel$(DLSUFFIX)
169         rm -f pg_regress_main.o pg_regress.o pg_regress$(X)
170 # things created by various check targets
171         rm -f $(output_files) $(input_files)
172         rm -rf testtablespace
173         rm -rf $(pg_regress_clean_files)