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.
This commit is contained in:
Alvaro Herrera 2014-12-02 23:43:53 -03:00
parent 475aedd1ef
commit da34731bd3
9 changed files with 35 additions and 4 deletions

View File

@ -10,4 +10,9 @@ SUBDIRS = \
test_shm_mq \
test_parser
all: submake-errcodes
submake-errcodes:
$(MAKE) -C $(top_builddir)/src/backend submake-errcodes
$(recurse)

View File

@ -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

View File

@ -0,0 +1,9 @@
/* 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;

View File

@ -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();
}

View File

@ -0,0 +1,4 @@
comment = 'Test code for SECURITY LABEL feature'
default_version = '1.0'
module_pathname = '$libdir/dummy_seclabel'
relocatable = true

View File

@ -1 +0,0 @@
/dummy_seclabel.out

View File

@ -1,7 +1,7 @@
--
-- 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;

View File

@ -1 +0,0 @@
/dummy_seclabel.sql

View File

@ -1,7 +1,7 @@
--
-- Test for facilities of security label
--
LOAD '@libdir@/dummy_seclabel@DLSUFFIX@';
CREATE EXTENSION dummy_seclabel;
-- initial setups
SET client_min_messages TO 'warning';