summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera2014-11-30 02:55:00 +0000
committerAlvaro Herrera2014-11-30 02:55:00 +0000
commit22dfd116a127a2fc916a4fdac282ee69d4905a25 (patch)
treef72fa75958a5c9bbecda92bee316258c5680c410
parent5b12987b2e80fcf3af1f6fd23954da5c453e9e64 (diff)
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.)
-rw-r--r--contrib/Makefile6
-rw-r--r--doc/src/sgml/contrib.sgml3
-rw-r--r--doc/src/sgml/dummy-seclabel.sgml74
-rw-r--r--doc/src/sgml/ref/security_label.sgml2
-rw-r--r--doc/src/sgml/release-9.1.sgml2
-rw-r--r--doc/src/sgml/release-9.4.sgml2
-rw-r--r--doc/src/sgml/test-parser.sgml90
-rw-r--r--doc/src/sgml/test-shm-mq.sgml71
-rw-r--r--src/test/Makefile12
-rw-r--r--src/test/modules/Makefile13
-rw-r--r--src/test/modules/dummy_seclabel/Makefile (renamed from contrib/dummy_seclabel/Makefile)6
-rw-r--r--src/test/modules/dummy_seclabel/README43
-rw-r--r--src/test/modules/dummy_seclabel/dummy_seclabel.c (renamed from contrib/dummy_seclabel/dummy_seclabel.c)0
-rw-r--r--src/test/modules/test_parser/.gitignore (renamed from contrib/test_parser/.gitignore)0
-rw-r--r--src/test/modules/test_parser/Makefile (renamed from contrib/test_parser/Makefile)6
-rw-r--r--src/test/modules/test_parser/README61
-rw-r--r--src/test/modules/test_parser/expected/test_parser.out (renamed from contrib/test_parser/expected/test_parser.out)0
-rw-r--r--src/test/modules/test_parser/sql/test_parser.sql (renamed from contrib/test_parser/sql/test_parser.sql)0
-rw-r--r--src/test/modules/test_parser/test_parser--1.0.sql (renamed from contrib/test_parser/test_parser--1.0.sql)2
-rw-r--r--src/test/modules/test_parser/test_parser--unpackaged--1.0.sql (renamed from contrib/test_parser/test_parser--unpackaged--1.0.sql)2
-rw-r--r--src/test/modules/test_parser/test_parser.c (renamed from contrib/test_parser/test_parser.c)2
-rw-r--r--src/test/modules/test_parser/test_parser.control (renamed from contrib/test_parser/test_parser.control)0
-rw-r--r--src/test/modules/test_shm_mq/.gitignore (renamed from contrib/test_shm_mq/.gitignore)0
-rw-r--r--src/test/modules/test_shm_mq/Makefile (renamed from contrib/test_shm_mq/Makefile)6
-rw-r--r--src/test/modules/test_shm_mq/README49
-rw-r--r--src/test/modules/test_shm_mq/expected/test_shm_mq.out (renamed from contrib/test_shm_mq/expected/test_shm_mq.out)0
-rw-r--r--src/test/modules/test_shm_mq/setup.c (renamed from contrib/test_shm_mq/setup.c)4
-rw-r--r--src/test/modules/test_shm_mq/sql/test_shm_mq.sql (renamed from contrib/test_shm_mq/sql/test_shm_mq.sql)0
-rw-r--r--src/test/modules/test_shm_mq/test.c (renamed from contrib/test_shm_mq/test.c)4
-rw-r--r--src/test/modules/test_shm_mq/test_shm_mq--1.0.sql (renamed from contrib/test_shm_mq/test_shm_mq--1.0.sql)2
-rw-r--r--src/test/modules/test_shm_mq/test_shm_mq.control (renamed from contrib/test_shm_mq/test_shm_mq.control)0
-rw-r--r--src/test/modules/test_shm_mq/test_shm_mq.h (renamed from contrib/test_shm_mq/test_shm_mq.h)2
-rw-r--r--src/test/modules/test_shm_mq/worker.c (renamed from contrib/test_shm_mq/worker.c)4
-rw-r--r--src/test/modules/worker_spi/Makefile (renamed from contrib/worker_spi/Makefile)6
-rw-r--r--src/test/modules/worker_spi/worker_spi--1.0.sql (renamed from contrib/worker_spi/worker_spi--1.0.sql)2
-rw-r--r--src/test/modules/worker_spi/worker_spi.c (renamed from contrib/worker_spi/worker_spi.c)4
-rw-r--r--src/test/modules/worker_spi/worker_spi.control (renamed from contrib/worker_spi/worker_spi.control)0
-rw-r--r--src/test/regress/GNUmakefile12
38 files changed, 212 insertions, 280 deletions
diff --git a/contrib/Makefile b/contrib/Makefile
index b37d0dd2c31..195d4472c57 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -16,7 +16,6 @@ SUBDIRS = \
dblink \
dict_int \
dict_xsyn \
- dummy_seclabel \
earthdistance \
file_fdw \
fuzzystrmatch \
@@ -51,12 +50,9 @@ SUBDIRS = \
tablefunc \
tcn \
test_decoding \
- test_parser \
- test_shm_mq \
tsearch2 \
unaccent \
- vacuumlo \
- worker_spi
+ vacuumlo
ifeq ($(with_openssl),yes)
SUBDIRS += sslinfo
diff --git a/doc/src/sgml/contrib.sgml b/doc/src/sgml/contrib.sgml
index ec68f10b65c..a698d0fb2f8 100644
--- a/doc/src/sgml/contrib.sgml
+++ b/doc/src/sgml/contrib.sgml
@@ -113,7 +113,6 @@ CREATE EXTENSION <replaceable>module_name</> FROM unpackaged;
&dblink;
&dict-int;
&dict-xsyn;
- &dummy-seclabel;
&earthdistance;
&file-fdw;
&fuzzystrmatch;
@@ -141,8 +140,6 @@ CREATE EXTENSION <replaceable>module_name</> FROM unpackaged;
&tablefunc;
&tcn;
&test-decoding;
- &test-parser;
- &test-shm-mq;
&tsearch2;
&unaccent;
&uuid-ossp;
diff --git a/doc/src/sgml/dummy-seclabel.sgml b/doc/src/sgml/dummy-seclabel.sgml
deleted file mode 100644
index d064705f2ae..00000000000
--- a/doc/src/sgml/dummy-seclabel.sgml
+++ /dev/null
@@ -1,74 +0,0 @@
-<!-- doc/src/sgml/dummy-seclabel.sgml -->
-
-<sect1 id="dummy-seclabel" xreflabel="dummy_seclabel">
- <title>dummy_seclabel</title>
-
- <indexterm zone="dummy-seclabel">
- <primary>dummy_seclabel</primary>
- </indexterm>
-
- <para>
- The <filename>dummy_seclabel</> module exists only to support regression
- testing of the <command>SECURITY LABEL</> statement. It is not intended
- to be used in production.
- </para>
-
- <sect2>
- <title>Rationale</title>
-
- <para>
- The <command>SECURITY LABEL</> statement allows the user to assign security
- labels to database objects; however, security labels can only be assigned
- when specifically allowed by a loadable module, so this module is provided
- to allow proper regression testing.
- </para>
-
- <para>
- Security label providers intended to be used in production will typically be
- dependent on a platform-specific feature such as
- <productname>SE-Linux</productname>. This module is platform-independent,
- and therefore better-suited to regression testing.
- </para>
- </sect2>
-
- <sect2>
- <title>Usage</title>
-
- <para>
- Here's a simple example of usage:
- </para>
-
-<programlisting>
-# postgresql.conf
-shared_preload_libraries = 'dummy_seclabel'
-</programlisting>
-
-<programlisting>
-postgres=# CREATE TABLE t (a int, b text);
-CREATE TABLE
-postgres=# SECURITY LABEL ON TABLE t IS 'classified';
-SECURITY LABEL
-</programlisting>
-
- <para>
- The <filename>dummy_seclabel</> module provides only four hardcoded
- labels: <literal>unclassified</>, <literal>classified</>,
- <literal>secret</>, and <literal>top secret</>.
- It does not allow any other strings as security labels.
- </para>
- <para>
- These labels are not used to enforce access controls. They are only used
- to check whether the <command>SECURITY LABEL</> statement works as expected,
- or not.
- </para>
- </sect2>
-
- <sect2>
- <title>Author</title>
-
- <para>
- KaiGai Kohei <email>[email protected]</email>
- </para>
- </sect2>
-
-</sect1>
diff --git a/doc/src/sgml/ref/security_label.sgml b/doc/src/sgml/ref/security_label.sgml
index 6e2bd25240b..998fe3b7c03 100644
--- a/doc/src/sgml/ref/security_label.sgml
+++ b/doc/src/sgml/ref/security_label.sgml
@@ -207,7 +207,7 @@ SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sepgsql"></member>
- <member><xref linkend="dummy-seclabel"></member>
+ <member><filename>src/test/modules/dummy_seclabel</filename></member>
</simplelist>
</refsect1>
</refentry>
diff --git a/doc/src/sgml/release-9.1.sgml b/doc/src/sgml/release-9.1.sgml
index 4f86b64e846..79a8b078bcf 100644
--- a/doc/src/sgml/release-9.1.sgml
+++ b/doc/src/sgml/release-9.1.sgml
@@ -8062,7 +8062,7 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
<listitem>
<para>
- Add <link linkend="dummy-seclabel"><filename>dummy_seclabel</></link>
+ Add <filename>dummy_seclabel</>
contrib module (KaiGai Kohei)
</para>
diff --git a/doc/src/sgml/release-9.4.sgml b/doc/src/sgml/release-9.4.sgml
index 9bbf9530438..b2bcecd6e6b 100644
--- a/doc/src/sgml/release-9.4.sgml
+++ b/doc/src/sgml/release-9.4.sgml
@@ -503,7 +503,7 @@
</para>
<para>
- This feature is illustrated in <xref linkend="test-shm-mq">.
+ This feature is illustrated in <filename>contrib/test_shm_mq</filename>.
</para>
</listitem>
diff --git a/doc/src/sgml/test-parser.sgml b/doc/src/sgml/test-parser.sgml
deleted file mode 100644
index 28b1e91c584..00000000000
--- a/doc/src/sgml/test-parser.sgml
+++ /dev/null
@@ -1,90 +0,0 @@
-<!-- doc/src/sgml/test-parser.sgml -->
-
-<sect1 id="test-parser" xreflabel="test_parser">
- <title>test_parser</title>
-
- <indexterm zone="test-parser">
- <primary>test_parser</primary>
- </indexterm>
-
- <para>
- <filename>test_parser</> is an example of a custom parser for full-text
- search. It doesn't do anything especially useful, but can serve as
- a starting point for developing your own parser.
- </para>
-
- <para>
- <filename>test_parser</> recognizes words separated by white space,
- and returns just two token types:
-
-<programlisting>
-mydb=# SELECT * FROM ts_token_type('testparser');
- tokid | alias | description
--------+-------+---------------
- 3 | word | Word
- 12 | blank | Space symbols
-(2 rows)
-</programlisting>
-
- These token numbers have been chosen to be compatible with the default
- parser's numbering. This allows us to use its <function>headline()</>
- function, thus keeping the example simple.
- </para>
-
- <sect2>
- <title>Usage</title>
-
- <para>
- Installing the <literal>test_parser</> extension creates a text search
- parser <literal>testparser</>. It has no user-configurable parameters.
- </para>
-
- <para>
- You can test the parser with, for example,
-
-<programlisting>
-mydb=# SELECT * FROM ts_parse('testparser', 'That''s my first own parser');
- tokid | token
--------+--------
- 3 | That's
- 12 |
- 3 | my
- 12 |
- 3 | first
- 12 |
- 3 | own
- 12 |
- 3 | parser
-</programlisting>
- </para>
-
- <para>
- Real-world use requires setting up a text search configuration
- that uses the parser. For example,
-
-<programlisting>
-mydb=# CREATE TEXT SEARCH CONFIGURATION testcfg ( PARSER = testparser );
-CREATE TEXT SEARCH CONFIGURATION
-
-mydb=# ALTER TEXT SEARCH CONFIGURATION testcfg
-mydb-# ADD MAPPING FOR word WITH english_stem;
-ALTER TEXT SEARCH CONFIGURATION
-
-mydb=# SELECT to_tsvector('testcfg', 'That''s my first own parser');
- to_tsvector
--------------------------------
- 'that':1 'first':3 'parser':5
-(1 row)
-
-mydb=# SELECT ts_headline('testcfg', 'Supernovae stars are the brightest phenomena in galaxies',
-mydb(# to_tsquery('testcfg', 'star'));
- ts_headline
------------------------------------------------------------------
- Supernovae &lt;b&gt;stars&lt;/b&gt; are the brightest phenomena in galaxies
-(1 row)
-</programlisting>
- </para>
-
- </sect2>
-
-</sect1>
diff --git a/doc/src/sgml/test-shm-mq.sgml b/doc/src/sgml/test-shm-mq.sgml
deleted file mode 100644
index dd431d0a2e4..00000000000
--- a/doc/src/sgml/test-shm-mq.sgml
+++ /dev/null
@@ -1,71 +0,0 @@
-<!-- doc/src/sgml/test-shm-mq.sgml -->
-
-<sect1 id="test-shm-mq" xreflabel="test_shm_mq">
- <title>test_shm_mq</title>
-
- <indexterm zone="test-shm-mq">
- <primary>test_shm_mq</primary>
- </indexterm>
-
- <para>
- <filename>test_shm_mq</> is an example of how to use dynamic shared memory
- and the shared memory message queue facilities to coordinate a user backend
- with the efforts of one or more background workers. It is not intended to
- do anything useful on its own; rather, it is a demonstration of how these
- facilities can be used, and a unit test of those facilities.
- </para>
-
- <para>
- The function is this extension send the same message repeatedly through
- a loop of processes. The message payload, the size of the message queue
- through which it is sent, and the number of processes in the loop are
- configurable. At the end, the message may be verified to ensure that it
- has not been corrupted in transmission.
- </para>
-
- <sect2>
- <title>Functions</title>
-
-<synopsis>
-test_shm_mq(queue_size int8, message text,
- repeat_count int4 default 1, num_workers int4 default 1)
- RETURNS void
-</synopsis>
-
- <para>
- This function sends and receives messages synchronously. The user
- backend sends the provided message to the first background worker using
- a message queue of the given size. The first background worker sends
- the message to the second background worker, if the number of workers
- is greater than one, and so forth. Eventually, the last background
- worker sends the message back to the user backend. If the repeat count
- is greater than one, the user backend then sends the message back to
- the first worker. Once the message has been sent and received by all
- the coordinating processes a number of times equal to the repeat count,
- the user backend verifies that the message finally received matches the
- one originally sent and throws an error if not.
- </para>
-
-<synopsis>
-test_shm_mq_pipelined(queue_size int8, message text,
- repeat_count int4 default 1, num_workers int4 default 1,
- verify bool default true)
- RETURNS void
-</synopsis>
-
- <para>
- This function sends the same message multiple times, as specified by the
- repeat count, to the first background worker using a queue of the given
- size. These messages are then forwarded to each background worker in
- turn, in each case using a queue of the given size. Finally, the last
- background worker sends the messages back to the user backend. The user
- backend uses non-blocking sends and receives, so that it may begin receiving
- copies of the message before it has finished sending all copies of the
- message. The <literal>verify</> argument controls whether or not the
- received copies are checked against the message that was sent. (This
- takes nontrivial time so it may be useful to disable it for benchmarking
- purposes.)
- </para>
-
- </sect2>
-</sect1>
diff --git a/src/test/Makefile b/src/test/Makefile
index 0fd7eabf08f..9238860febd 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -12,6 +12,14 @@ subdir = src/test
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
-SUBDIRS = regress isolation
+SUBDIRS = regress isolation modules
-$(recurse)
+# We want to recurse to all subdirs for all standard targets, except that
+# installcheck and install should not recurse into the subdirectory "modules".
+
+recurse_alldirs_targets := $(filter-out installcheck install, $(standard_targets))
+installable_dirs := $(filter-out modules, $(SUBDIRS))
+
+$(call recurse,$(recurse_alldirs_targets))
+$(call recurse,installcheck, $(installable_dirs))
+$(call recurse,install, $(installable_dirs))
diff --git a/src/test/modules/Makefile b/src/test/modules/Makefile
new file mode 100644
index 00000000000..9d5aa97b4ba
--- /dev/null
+++ b/src/test/modules/Makefile
@@ -0,0 +1,13 @@
+# src/test/modules/Makefile
+
+subdir = src/test/modules
+top_builddir = ../../..
+include $(top_builddir)/src/Makefile.global
+
+SUBDIRS = \
+ worker_spi \
+ dummy_seclabel \
+ test_shm_mq \
+ test_parser
+
+$(recurse)
diff --git a/contrib/dummy_seclabel/Makefile b/src/test/modules/dummy_seclabel/Makefile
index e69aa1ff6c4..909ac9ace72 100644
--- a/contrib/dummy_seclabel/Makefile
+++ b/src/test/modules/dummy_seclabel/Makefile
@@ -1,4 +1,4 @@
-# contrib/dummy_seclabel/Makefile
+# src/test/modules/dummy_seclabel/Makefile
MODULES = dummy_seclabel
PGFILEDESC = "dummy_seclabel - regression testing of the SECURITY LABEL statement"
@@ -8,8 +8,8 @@ PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
-subdir = contrib/dummy_seclabel
-top_builddir = ../..
+subdir = src/test/modules/dummy_seclabel
+top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
diff --git a/src/test/modules/dummy_seclabel/README b/src/test/modules/dummy_seclabel/README
new file mode 100644
index 00000000000..75320aaeaca
--- /dev/null
+++ b/src/test/modules/dummy_seclabel/README
@@ -0,0 +1,43 @@
+The dummy_seclabel module exists only to support regression
+testing of the SECURITY LABEL statement. It is not intended
+to be used in production.
+
+Rationale
+=========
+
+The SECURITY LABEL statement allows the user to assign security
+labels to database objects; however, security labels can only be assigned
+when specifically allowed by a loadable module, so this module is provided
+to allow proper regression testing.
+
+Security label providers intended to be used in production will typically be
+dependent on a platform-specific feature such as
+SE-Linux. This module is platform-independent,
+and therefore better-suited to regression testing.
+
+Usage
+=====
+
+Here's a simple example of usage:
+
+# postgresql.conf
+shared_preload_libraries = 'dummy_seclabel'
+
+postgres=# CREATE TABLE t (a int, b text);
+CREATE TABLE
+postgres=# SECURITY LABEL ON TABLE t IS 'classified';
+SECURITY LABEL
+
+The dummy_seclabel module provides only four hardcoded
+labels: unclassified, classified,
+secret, and top secret.
+It does not allow any other strings as security labels.
+
+These labels are not used to enforce access controls. They are only used
+to check whether the SECURITY LABEL statement works as expected,
+or not.
+
+Author
+======
+
+KaiGai Kohei <[email protected]>
diff --git a/contrib/dummy_seclabel/dummy_seclabel.c b/src/test/modules/dummy_seclabel/dummy_seclabel.c
index b5753cc9084..b5753cc9084 100644
--- a/contrib/dummy_seclabel/dummy_seclabel.c
+++ b/src/test/modules/dummy_seclabel/dummy_seclabel.c
diff --git a/contrib/test_parser/.gitignore b/src/test/modules/test_parser/.gitignore
index 5dcb3ff9723..5dcb3ff9723 100644
--- a/contrib/test_parser/.gitignore
+++ b/src/test/modules/test_parser/.gitignore
diff --git a/contrib/test_parser/Makefile b/src/test/modules/test_parser/Makefile
index 7e068abd3e6..0c755aac73b 100644
--- a/contrib/test_parser/Makefile
+++ b/src/test/modules/test_parser/Makefile
@@ -1,4 +1,4 @@
-# contrib/test_parser/Makefile
+# src/test/modules/test_parser/Makefile
MODULE_big = test_parser
OBJS = test_parser.o $(WIN32RES)
@@ -14,8 +14,8 @@ PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
-subdir = contrib/test_parser
-top_builddir = ../..
+subdir = src/test/modules/test_parser
+top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
diff --git a/src/test/modules/test_parser/README b/src/test/modules/test_parser/README
new file mode 100644
index 00000000000..0a11ec85fbc
--- /dev/null
+++ b/src/test/modules/test_parser/README
@@ -0,0 +1,61 @@
+test_parser is an example of a custom parser for full-text
+search. It doesn't do anything especially useful, but can serve as
+a starting point for developing your own parser.
+
+test_parser recognizes words separated by white space,
+and returns just two token types:
+
+mydb=# SELECT * FROM ts_token_type('testparser');
+ tokid | alias | description
+-------+-------+---------------
+ 3 | word | Word
+ 12 | blank | Space symbols
+(2 rows)
+
+These token numbers have been chosen to be compatible with the default
+parser's numbering. This allows us to use its headline()
+function, thus keeping the example simple.
+
+Usage
+=====
+
+Installing the test_parser extension creates a text search
+parser testparser. It has no user-configurable parameters.
+
+You can test the parser with, for example,
+
+mydb=# SELECT * FROM ts_parse('testparser', 'That''s my first own parser');
+ tokid | token
+-------+--------
+ 3 | That's
+ 12 |
+ 3 | my
+ 12 |
+ 3 | first
+ 12 |
+ 3 | own
+ 12 |
+ 3 | parser
+
+Real-world use requires setting up a text search configuration
+that uses the parser. For example,
+
+mydb=# CREATE TEXT SEARCH CONFIGURATION testcfg ( PARSER = testparser );
+CREATE TEXT SEARCH CONFIGURATION
+
+mydb=# ALTER TEXT SEARCH CONFIGURATION testcfg
+mydb-# ADD MAPPING FOR word WITH english_stem;
+ALTER TEXT SEARCH CONFIGURATION
+
+mydb=# SELECT to_tsvector('testcfg', 'That''s my first own parser');
+ to_tsvector
+-------------------------------
+ 'that':1 'first':3 'parser':5
+(1 row)
+
+mydb=# SELECT ts_headline('testcfg', 'Supernovae stars are the brightest phenomena in galaxies',
+mydb(# to_tsquery('testcfg', 'star'));
+ ts_headline
+-----------------------------------------------------------------
+ Supernovae <b>stars</b> are the brightest phenomena in galaxies
+(1 row)
diff --git a/contrib/test_parser/expected/test_parser.out b/src/test/modules/test_parser/expected/test_parser.out
index 8a49bc01e32..8a49bc01e32 100644
--- a/contrib/test_parser/expected/test_parser.out
+++ b/src/test/modules/test_parser/expected/test_parser.out
diff --git a/contrib/test_parser/sql/test_parser.sql b/src/test/modules/test_parser/sql/test_parser.sql
index 1f21504602b..1f21504602b 100644
--- a/contrib/test_parser/sql/test_parser.sql
+++ b/src/test/modules/test_parser/sql/test_parser.sql
diff --git a/contrib/test_parser/test_parser--1.0.sql b/src/test/modules/test_parser/test_parser--1.0.sql
index 06c94d353be..56bb2442c3d 100644
--- a/contrib/test_parser/test_parser--1.0.sql
+++ b/src/test/modules/test_parser/test_parser--1.0.sql
@@ -1,4 +1,4 @@
-/* contrib/test_parser/test_parser--1.0.sql */
+/* src/test/modules/test_parser/test_parser--1.0.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION test_parser" to load this file. \quit
diff --git a/contrib/test_parser/test_parser--unpackaged--1.0.sql b/src/test/modules/test_parser/test_parser--unpackaged--1.0.sql
index 62458bd2c68..9ebc4b3fbee 100644
--- a/contrib/test_parser/test_parser--unpackaged--1.0.sql
+++ b/src/test/modules/test_parser/test_parser--unpackaged--1.0.sql
@@ -1,4 +1,4 @@
-/* contrib/test_parser/test_parser--unpackaged--1.0.sql */
+/* src/test/modules/test_parser/test_parser--unpackaged--1.0.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION test_parser FROM unpackaged" to load this file. \quit
diff --git a/contrib/test_parser/test_parser.c b/src/test/modules/test_parser/test_parser.c
index cbf77966ae5..68c0a93e3cd 100644
--- a/contrib/test_parser/test_parser.c
+++ b/src/test/modules/test_parser/test_parser.c
@@ -6,7 +6,7 @@
* Copyright (c) 2007-2014, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * contrib/test_parser/test_parser.c
+ * src/test/modules/test_parser/test_parser.c
*
*-------------------------------------------------------------------------
*/
diff --git a/contrib/test_parser/test_parser.control b/src/test/modules/test_parser/test_parser.control
index 36b26b2087c..36b26b2087c 100644
--- a/contrib/test_parser/test_parser.control
+++ b/src/test/modules/test_parser/test_parser.control
diff --git a/contrib/test_shm_mq/.gitignore b/src/test/modules/test_shm_mq/.gitignore
index 5dcb3ff9723..5dcb3ff9723 100644
--- a/contrib/test_shm_mq/.gitignore
+++ b/src/test/modules/test_shm_mq/.gitignore
diff --git a/contrib/test_shm_mq/Makefile b/src/test/modules/test_shm_mq/Makefile
index e3c405442c5..11c4e357202 100644
--- a/contrib/test_shm_mq/Makefile
+++ b/src/test/modules/test_shm_mq/Makefile
@@ -1,4 +1,4 @@
-# contrib/test_shm_mq/Makefile
+# src/test/modules/test_shm_mq/Makefile
MODULE_big = test_shm_mq
OBJS = test.o setup.o worker.o $(WIN32RES)
@@ -14,8 +14,8 @@ PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
-subdir = contrib/test_shm_mq
-top_builddir = ../..
+subdir = src/test/modules/test_shm_mq
+top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
diff --git a/src/test/modules/test_shm_mq/README b/src/test/modules/test_shm_mq/README
new file mode 100644
index 00000000000..641407bee03
--- /dev/null
+++ b/src/test/modules/test_shm_mq/README
@@ -0,0 +1,49 @@
+test_shm_mq is an example of how to use dynamic shared memory
+and the shared memory message queue facilities to coordinate a user backend
+with the efforts of one or more background workers. It is not intended to
+do anything useful on its own; rather, it is a demonstration of how these
+facilities can be used, and a unit test of those facilities.
+
+The function is this extension send the same message repeatedly through
+a loop of processes. The message payload, the size of the message queue
+through which it is sent, and the number of processes in the loop are
+configurable. At the end, the message may be verified to ensure that it
+has not been corrupted in transmission.
+
+Functions
+=========
+
+
+test_shm_mq(queue_size int8, message text,
+ repeat_count int4 default 1, num_workers int4 default 1)
+ RETURNS void
+
+This function sends and receives messages synchronously. The user
+backend sends the provided message to the first background worker using
+a message queue of the given size. The first background worker sends
+the message to the second background worker, if the number of workers
+is greater than one, and so forth. Eventually, the last background
+worker sends the message back to the user backend. If the repeat count
+is greater than one, the user backend then sends the message back to
+the first worker. Once the message has been sent and received by all
+the coordinating processes a number of times equal to the repeat count,
+the user backend verifies that the message finally received matches the
+one originally sent and throws an error if not.
+
+
+test_shm_mq_pipelined(queue_size int8, message text,
+ repeat_count int4 default 1, num_workers int4 default 1,
+ verify bool default true)
+ RETURNS void
+
+This function sends the same message multiple times, as specified by the
+repeat count, to the first background worker using a queue of the given
+size. These messages are then forwarded to each background worker in
+turn, in each case using a queue of the given size. Finally, the last
+background worker sends the messages back to the user backend. The user
+backend uses non-blocking sends and receives, so that it may begin receiving
+copies of the message before it has finished sending all copies of the
+message. The 'verify' argument controls whether or not the
+received copies are checked against the message that was sent. (This
+takes nontrivial time so it may be useful to disable it for benchmarking
+purposes.)
diff --git a/contrib/test_shm_mq/expected/test_shm_mq.out b/src/test/modules/test_shm_mq/expected/test_shm_mq.out
index c4858b0c205..c4858b0c205 100644
--- a/contrib/test_shm_mq/expected/test_shm_mq.out
+++ b/src/test/modules/test_shm_mq/expected/test_shm_mq.out
diff --git a/contrib/test_shm_mq/setup.c b/src/test/modules/test_shm_mq/setup.c
index 572cf8898f1..b049cff2d05 100644
--- a/contrib/test_shm_mq/setup.c
+++ b/src/test/modules/test_shm_mq/setup.c
@@ -5,10 +5,10 @@
* number of background workers for shared memory message queue
* testing.
*
- * Copyright (C) 2013, PostgreSQL Global Development Group
+ * Copyright (C) 2013-2014, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * contrib/test_shm_mq/setup.c
+ * src/test/modules/test_shm_mq/setup.c
*
* -------------------------------------------------------------------------
*/
diff --git a/contrib/test_shm_mq/sql/test_shm_mq.sql b/src/test/modules/test_shm_mq/sql/test_shm_mq.sql
index 9de19d304a2..9de19d304a2 100644
--- a/contrib/test_shm_mq/sql/test_shm_mq.sql
+++ b/src/test/modules/test_shm_mq/sql/test_shm_mq.sql
diff --git a/contrib/test_shm_mq/test.c b/src/test/modules/test_shm_mq/test.c
index 95d620f7569..6428fcf51c4 100644
--- a/contrib/test_shm_mq/test.c
+++ b/src/test/modules/test_shm_mq/test.c
@@ -3,10 +3,10 @@
* test.c
* Test harness code for shared memory message queues.
*
- * Copyright (C) 2013, PostgreSQL Global Development Group
+ * Copyright (C) 2013-2014, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * contrib/test_shm_mq/test.c
+ * src/test/modules/test_shm_mq/test.c
*
* -------------------------------------------------------------------------
*/
diff --git a/contrib/test_shm_mq/test_shm_mq--1.0.sql b/src/test/modules/test_shm_mq/test_shm_mq--1.0.sql
index 54b225e2ae0..56db05d93df 100644
--- a/contrib/test_shm_mq/test_shm_mq--1.0.sql
+++ b/src/test/modules/test_shm_mq/test_shm_mq--1.0.sql
@@ -1,4 +1,4 @@
-/* contrib/test_shm_mq/test_shm_mq--1.0.sql */
+/* src/test/modules/test_shm_mq/test_shm_mq--1.0.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION test_shm_mq" to load this file. \quit
diff --git a/contrib/test_shm_mq/test_shm_mq.control b/src/test/modules/test_shm_mq/test_shm_mq.control
index d9a74c7a323..d9a74c7a323 100644
--- a/contrib/test_shm_mq/test_shm_mq.control
+++ b/src/test/modules/test_shm_mq/test_shm_mq.control
diff --git a/contrib/test_shm_mq/test_shm_mq.h b/src/test/modules/test_shm_mq/test_shm_mq.h
index 04a7931fa94..144345b611b 100644
--- a/contrib/test_shm_mq/test_shm_mq.h
+++ b/src/test/modules/test_shm_mq/test_shm_mq.h
@@ -6,7 +6,7 @@
* Copyright (C) 2013, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * contrib/test_shm_mq/test_shm_mq.h
+ * src/test/modules/test_shm_mq/test_shm_mq.h
*
* -------------------------------------------------------------------------
*/
diff --git a/contrib/test_shm_mq/worker.c b/src/test/modules/test_shm_mq/worker.c
index 0d66c92ddb1..dec058b55ea 100644
--- a/contrib/test_shm_mq/worker.c
+++ b/src/test/modules/test_shm_mq/worker.c
@@ -9,10 +9,10 @@
* but it should be possible to use much of the control logic just
* as presented here.
*
- * Copyright (C) 2013, PostgreSQL Global Development Group
+ * Copyright (C) 2013-2014, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * contrib/test_shm_mq/worker.c
+ * src/test/modules/test_shm_mq/worker.c
*
* -------------------------------------------------------------------------
*/
diff --git a/contrib/worker_spi/Makefile b/src/test/modules/worker_spi/Makefile
index 5cce4d1ef9e..7cdb33c9dfc 100644
--- a/contrib/worker_spi/Makefile
+++ b/src/test/modules/worker_spi/Makefile
@@ -1,4 +1,4 @@
-# contrib/worker_spi/Makefile
+# src/test/modules/worker_spi/Makefile
MODULES = worker_spi
@@ -11,8 +11,8 @@ PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
-subdir = contrib/worker_spi
-top_builddir = ../..
+subdir = src/test/modules/worker_spi
+top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
diff --git a/contrib/worker_spi/worker_spi--1.0.sql b/src/test/modules/worker_spi/worker_spi--1.0.sql
index 09b7799f2c9..e9d5b07373a 100644
--- a/contrib/worker_spi/worker_spi--1.0.sql
+++ b/src/test/modules/worker_spi/worker_spi--1.0.sql
@@ -1,4 +1,4 @@
-/* contrib/worker_spi/worker_spi--1.0.sql */
+/* src/test/modules/worker_spi/worker_spi--1.0.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION worker_spi" to load this file. \quit
diff --git a/contrib/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c
index 328c722c359..ac0f59c9886 100644
--- a/contrib/worker_spi/worker_spi.c
+++ b/src/test/modules/worker_spi/worker_spi.c
@@ -13,10 +13,10 @@
* "delta" type. Delta rows will be deleted by this worker and their values
* aggregated into the total.
*
- * Copyright (C) 2013, PostgreSQL Global Development Group
+ * Copyright (C) 2013-2014, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * contrib/worker_spi/worker_spi.c
+ * src/test/modules/worker_spi/worker_spi.c
*
* -------------------------------------------------------------------------
*/
diff --git a/contrib/worker_spi/worker_spi.control b/src/test/modules/worker_spi/worker_spi.control
index 84d6294628a..84d6294628a 100644
--- a/contrib/worker_spi/worker_spi.control
+++ b/src/test/modules/worker_spi/worker_spi.control
diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile
index b40b37c0b74..77fe8b620d4 100644
--- a/src/test/regress/GNUmakefile
+++ b/src/test/regress/GNUmakefile
@@ -101,7 +101,7 @@ installdirs-tests: installdirs
$(MKDIR_P) $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files))))
-# Get some extra C modules from contrib/spi and contrib/dummy_seclabel...
+# Get some extra C modules from contrib/spi and src/test/modules/dummy_seclabel...
all: refint$(DLSUFFIX) autoinc$(DLSUFFIX) dummy_seclabel$(DLSUFFIX)
@@ -111,22 +111,22 @@ refint$(DLSUFFIX): $(top_builddir)/contrib/spi/refint$(DLSUFFIX)
autoinc$(DLSUFFIX): $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX)
cp $< $@
-dummy_seclabel$(DLSUFFIX): $(top_builddir)/contrib/dummy_seclabel/dummy_seclabel$(DLSUFFIX)
+dummy_seclabel$(DLSUFFIX): $(top_builddir)/src/test/modules/dummy_seclabel/dummy_seclabel$(DLSUFFIX)
cp $< $@
$(top_builddir)/contrib/spi/refint$(DLSUFFIX): | submake-contrib-spi ;
$(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): | submake-contrib-spi ;
-$(top_builddir)/contrib/dummy_seclabel/dummy_seclabel$(DLSUFFIX): | submake-contrib-dummy_seclabel ;
+$(top_builddir)/src/test/modules/dummy_seclabel/dummy_seclabel$(DLSUFFIX): | submake-dummy_seclabel ;
submake-contrib-spi:
$(MAKE) -C $(top_builddir)/contrib/spi
-submake-contrib-dummy_seclabel:
- $(MAKE) -C $(top_builddir)/contrib/dummy_seclabel
+submake-dummy_seclabel:
+ $(MAKE) -C $(top_builddir)/src/test/modules/dummy_seclabel
-.PHONY: submake-contrib-spi submake-contrib-dummy_seclabel
+.PHONY: submake-contrib-spi submake-dummy_seclabel
# Tablespace setup