Skip to content

Commit 0a48df6

Browse files
df7cbsteve-chavez
authored andcommitted
Standardize pg_regress usage
Standard PGXS `make installcheck` usage depends on a existing postgres server. Tests will run in a contrib_regression database created by pg_regress. The pg_regress option --use-existing makes pg_regress require an existing contrib_regression database, but the Makefile does not create it. Removing that option makes using the testsuite easier. Similarly, the init.sql file was not loaded by the Makefile, but it is required to run the tests. Move it into tests/sql/ and name it 00_init.sql so it gets run first. With these changes, the testsuite runs without any further tweaking during the Debian package builds for apt.postgresql.org. Signed-off-by: Christoph Berg <myon@debian.org>
1 parent d21a1da commit 0a48df6

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql $(EXTENSION).control
3434

3535
TESTS = $(wildcard test/sql/*.sql)
3636
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
37-
REGRESS_OPTS = --use-existing --inputdir=test
37+
REGRESS_OPTS = --inputdir=test
3838

3939
MODULE_big = $(EXTENSION)
4040
SRC = $(wildcard $(SRC_DIR)/*.c)

test/expected/00_init.out

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
CREATE TABLE projects
2+
( id integer
3+
, name text
4+
, project_name text
5+
, client_id integer
6+
, subclient_id int
7+
);
8+
-- ensure these dropped column cases are tested
9+
ALTER TABLE projects DROP COLUMN project_name;
10+
ALTER TABLE projects DROP COLUMN subclient_id;
11+
INSERT INTO projects VALUES (1, 'Windows 7', 1);
12+
INSERT INTO projects VALUES (2, 'has,comma', 1);
13+
INSERT INTO projects VALUES (NULL, NULL, NULL);
14+
INSERT INTO projects VALUES (4, 'OSX', 2);
15+
INSERT INTO projects VALUES (NULL, 'has"quote', NULL);
16+
INSERT INTO projects VALUES (5, 'has,comma and "quote"', 7);
17+
INSERT INTO projects VALUES (6, E'has \n LF', 7);
18+
INSERT INTO projects VALUES (7, E'has \r CR', 8);
19+
INSERT INTO projects VALUES (8, E'has \r\n CRLF"', 8);
20+
create extension if not exists pg_csv;
21+
CREATE TABLE nasty (
22+
"unusual"",names" INTEGER GENERATED ALWAYS AS IDENTITY,
23+
text TEXT
24+
);
25+
INSERT INTO nasty (text) VALUES ('test');
File renamed without changes.

0 commit comments

Comments
 (0)