Commit da34731b authored by Alvaro Herrera's avatar Alvaro Herrera

Install kludges to fix check-world for src/test/modules

check-world failed in a completely clean tree, because src/test/modules
fail to build unless errcodes.h is generated first.  To fix this,
install a dependency in src/test/modules' Makefile so that the necessary
file is generated.  Even with this, running "make check" within
individual module subdirs will still fail because the dependency is not
considered there, but this case is less interesting and would be messier
to fix.

check-world still failed with the above fix in place, this time because
dummy_seclabel used LOAD to load the dynamic library, which doesn't work
because the @libdir@ (expanded by the makefile) is expanded to the final
install path, not the temporary installation directory used by make
check.  To fix, tweak things so that CREATE EXTENSION can be used
instead, which solves the problem because the library path is expanded
by the backend, which is aware of the true libdir.
parent 475aedd1
......@@ -10,4 +10,9 @@ SUBDIRS = \
test_shm_mq \
test_parser
all: submake-errcodes
submake-errcodes:
$(MAKE) -C $(top_builddir)/src/backend submake-errcodes
$(recurse)
......@@ -3,6 +3,9 @@
MODULES = dummy_seclabel
PGFILEDESC = "dummy_seclabel - regression testing of the SECURITY LABEL statement"
EXTENSION = dummy_seclabel
DATA = dummy_seclabel--1.0.sql
REGRESS = dummy_seclabel
EXTRA_CLEAN = sql/dummy_seclabel.sql expected/dummy_seclabel.out
......
/* src/test/modules/dummy_seclabel/dummy_seclabel--1.0.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION dummy_seclabel" to load this file. \quit
CREATE FUNCTION dummy_seclabel_dummy()
RETURNS pg_catalog.void
AS 'MODULE_PATHNAME' LANGUAGE C;
......@@ -21,6 +21,8 @@ PG_MODULE_MAGIC;
/* Entrypoint of the module */
void _PG_init(void);
PG_FUNCTION_INFO_V1(dummy_seclabel_dummy);
static void
dummy_object_relabel(const ObjectAddress *object, const char *seclabel)
{
......@@ -48,3 +50,13 @@ _PG_init(void)
{
register_label_provider("dummy", dummy_object_relabel);
}
/*
* This function is here just so that the extension is not completely empty
* and the dynamic library is loaded when CREATE EXTENSION runs.
*/
Datum
dummy_seclabel_dummy(PG_FUNCTION_ARGS)
{
PG_RETURN_VOID();
}
comment = 'Test code for SECURITY LABEL feature'
default_version = '1.0'
module_pathname = '$libdir/dummy_seclabel'
relocatable = true
--
-- Test for facilities of security label
--
LOAD '@libdir@/dummy_seclabel@DLSUFFIX@';
CREATE EXTENSION dummy_seclabel;
-- initial setups
SET client_min_messages TO 'warning';
DROP ROLE IF EXISTS dummy_seclabel_user1;
......
--
-- Test for facilities of security label
--
LOAD '@libdir@/dummy_seclabel@DLSUFFIX@';
CREATE EXTENSION dummy_seclabel;
-- initial setups
SET client_min_messages TO 'warning';
......
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