Skip to content

Commit 22dfd11

Browse files
committed
Move test modules from contrib to src/test/modules
This is advance preparation for introducing even more test modules; the easy solution is to add them to contrib, but that's bloated enough that it seems a good time to think of something different. Moved modules are dummy_seclabel, test_shm_mq, test_parser and worker_spi. (test_decoding was also a candidate, but there was too much opposition to moving that one. We can always reconsider later.)
1 parent 5b12987 commit 22dfd11

38 files changed

+212
-280
lines changed

contrib/Makefile

+1-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ SUBDIRS = \
1616
dblink \
1717
dict_int \
1818
dict_xsyn \
19-
dummy_seclabel \
2019
earthdistance \
2120
file_fdw \
2221
fuzzystrmatch \
@@ -51,12 +50,9 @@ SUBDIRS = \
5150
tablefunc \
5251
tcn \
5352
test_decoding \
54-
test_parser \
55-
test_shm_mq \
5653
tsearch2 \
5754
unaccent \
58-
vacuumlo \
59-
worker_spi
55+
vacuumlo
6056

6157
ifeq ($(with_openssl),yes)
6258
SUBDIRS += sslinfo

doc/src/sgml/contrib.sgml

-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ CREATE EXTENSION <replaceable>module_name</> FROM unpackaged;
113113
&dblink;
114114
&dict-int;
115115
&dict-xsyn;
116-
&dummy-seclabel;
117116
&earthdistance;
118117
&file-fdw;
119118
&fuzzystrmatch;
@@ -141,8 +140,6 @@ CREATE EXTENSION <replaceable>module_name</> FROM unpackaged;
141140
&tablefunc;
142141
&tcn;
143142
&test-decoding;
144-
&test-parser;
145-
&test-shm-mq;
146143
&tsearch2;
147144
&unaccent;
148145
&uuid-ossp;

doc/src/sgml/dummy-seclabel.sgml

-74
This file was deleted.

doc/src/sgml/ref/security_label.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_
207207
<title>See Also</title>
208208
<simplelist type="inline">
209209
<member><xref linkend="sepgsql"></member>
210-
<member><xref linkend="dummy-seclabel"></member>
210+
<member><filename>src/test/modules/dummy_seclabel</filename></member>
211211
</simplelist>
212212
</refsect1>
213213
</refentry>

doc/src/sgml/release-9.1.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8062,7 +8062,7 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
80628062

80638063
<listitem>
80648064
<para>
8065-
Add <link linkend="dummy-seclabel"><filename>dummy_seclabel</></link>
8065+
Add <filename>dummy_seclabel</>
80668066
contrib module (KaiGai Kohei)
80678067
</para>
80688068

doc/src/sgml/release-9.4.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@
503503
</para>
504504

505505
<para>
506-
This feature is illustrated in <xref linkend="test-shm-mq">.
506+
This feature is illustrated in <filename>contrib/test_shm_mq</filename>.
507507
</para>
508508
</listitem>
509509

doc/src/sgml/test-parser.sgml

-90
This file was deleted.

doc/src/sgml/test-shm-mq.sgml

-71
This file was deleted.

src/test/Makefile

+10-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ subdir = src/test
1212
top_builddir = ../..
1313
include $(top_builddir)/src/Makefile.global
1414

15-
SUBDIRS = regress isolation
15+
SUBDIRS = regress isolation modules
1616

17-
$(recurse)
17+
# We want to recurse to all subdirs for all standard targets, except that
18+
# installcheck and install should not recurse into the subdirectory "modules".
19+
20+
recurse_alldirs_targets := $(filter-out installcheck install, $(standard_targets))
21+
installable_dirs := $(filter-out modules, $(SUBDIRS))
22+
23+
$(call recurse,$(recurse_alldirs_targets))
24+
$(call recurse,installcheck, $(installable_dirs))
25+
$(call recurse,install, $(installable_dirs))

src/test/modules/Makefile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# src/test/modules/Makefile
2+
3+
subdir = src/test/modules
4+
top_builddir = ../../..
5+
include $(top_builddir)/src/Makefile.global
6+
7+
SUBDIRS = \
8+
worker_spi \
9+
dummy_seclabel \
10+
test_shm_mq \
11+
test_parser
12+
13+
$(recurse)
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# contrib/dummy_seclabel/Makefile
1+
# src/test/modules/dummy_seclabel/Makefile
22

33
MODULES = dummy_seclabel
44
PGFILEDESC = "dummy_seclabel - regression testing of the SECURITY LABEL statement"
@@ -8,8 +8,8 @@ PG_CONFIG = pg_config
88
PGXS := $(shell $(PG_CONFIG) --pgxs)
99
include $(PGXS)
1010
else
11-
subdir = contrib/dummy_seclabel
12-
top_builddir = ../..
11+
subdir = src/test/modules/dummy_seclabel
12+
top_builddir = ../../../..
1313
include $(top_builddir)/src/Makefile.global
1414
include $(top_srcdir)/contrib/contrib-global.mk
1515
endif
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
The dummy_seclabel module exists only to support regression
2+
testing of the SECURITY LABEL statement. It is not intended
3+
to be used in production.
4+
5+
Rationale
6+
=========
7+
8+
The SECURITY LABEL statement allows the user to assign security
9+
labels to database objects; however, security labels can only be assigned
10+
when specifically allowed by a loadable module, so this module is provided
11+
to allow proper regression testing.
12+
13+
Security label providers intended to be used in production will typically be
14+
dependent on a platform-specific feature such as
15+
SE-Linux. This module is platform-independent,
16+
and therefore better-suited to regression testing.
17+
18+
Usage
19+
=====
20+
21+
Here's a simple example of usage:
22+
23+
# postgresql.conf
24+
shared_preload_libraries = 'dummy_seclabel'
25+
26+
postgres=# CREATE TABLE t (a int, b text);
27+
CREATE TABLE
28+
postgres=# SECURITY LABEL ON TABLE t IS 'classified';
29+
SECURITY LABEL
30+
31+
The dummy_seclabel module provides only four hardcoded
32+
labels: unclassified, classified,
33+
secret, and top secret.
34+
It does not allow any other strings as security labels.
35+
36+
These labels are not used to enforce access controls. They are only used
37+
to check whether the SECURITY LABEL statement works as expected,
38+
or not.
39+
40+
Author
41+
======
42+
43+
KaiGai Kohei <kaigai@ak.jp.nec.com>

0 commit comments

Comments
 (0)