Re: pg_upgrade automatic testing - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_upgrade automatic testing
Date
Msg-id 13764.1315094292@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_upgrade automatic testing  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: pg_upgrade automatic testing
Re: pg_upgrade automatic testing
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> On fre, 2011-09-02 at 19:49 -0400, Tom Lane wrote:
>> The only one that's problematic is pg_regress.so; contrib modules are
>> already installed in $libdir.  I still think that installing
>> pg_regress.so in $libdir may be the most reasonable solution, assuming
>> that the delta involved isn't too great.  Yeah, we would have to
>> back-patch the changes into every release branch we want to test
>> upgrading from, but how risky is that really?  The *only* thing it
>> affects is the regression tests.

> Or maybe make use of dynamic_library_path.

That seemed like a promising idea at first, but on reflection I thought
probably it's not such a great idea.  The problem is, where do you
inject the setting?  In a temp installation we could put it in
postgresql.conf, but for "make installcheck" the only way that seems
like it would work at all is to apply it as a database configuration
(ALTER DATABASE SET), and that seems problematic.  In particular, it
would not work for testing pg_dump, since pg_dump doesn't copy those
settings.  (I know we've talked about making it do so, but we'd
certainly not wish to back-patch such a change.)

(BTW, this also strikes me as a counterexample for the recently
proposed change to make pg_dumpall dump such settings at the end.
If you've got datatypes or indexes that depend on a shared library
that's found via "ALTER DATABASE SET dynamic_library_path", it will
absolutely not work to restore the database contents before that
setting is applied.)

Anyway, after giving up on that I went back to plan A, namely install
regress.so and friends into $libdir.  That turns out to be really quite
straightforward, though I had to hack pg_regress.c a bit to get its idea
of $libdir to match up exactly with the way the backend sees it.
(The only reason this matters is that there's one error report in the
regression tests where the full expansion of $libdir is reported.
Maybe we should just drop that one test case instead of maintaining
the infrastructure for replacing @libdir@ in pg_regress.c.)

Attached is a draft patch for HEAD.  It passes "make check" and "make
installcheck" on Unix, but I've not touched the MSVC scripts.
Comments?

            regards, tom lane

diff --git a/contrib/dummy_seclabel/Makefile b/contrib/dummy_seclabel/Makefile
index 105400f..3a5f968 100644
*** a/contrib/dummy_seclabel/Makefile
--- b/contrib/dummy_seclabel/Makefile
*************** top_builddir = ../..
*** 12,14 ****
--- 12,24 ----
  include $(top_builddir)/src/Makefile.global
  include $(top_srcdir)/contrib/contrib-global.mk
  endif
+
+ # Build/install only the files needed for regression test support
+ REGRESSION_MODULES = dummy_seclabel
+
+ .PHONY: regression-modules install-regression-modules
+
+ regression-modules: $(addsuffix $(DLSUFFIX), $(REGRESSION_MODULES))
+
+ install-regression-modules: $(addsuffix $(DLSUFFIX), $(REGRESSION_MODULES))
+     $(INSTALL_SHLIB) $(addsuffix $(DLSUFFIX), $(REGRESSION_MODULES)) '$(DESTDIR)$(pkglibdir)/'
diff --git a/contrib/spi/Makefile b/contrib/spi/Makefile
index 0c11bfc..83578fb 100644
*** a/contrib/spi/Makefile
--- b/contrib/spi/Makefile
*************** top_builddir = ../..
*** 28,30 ****
--- 28,40 ----
  include $(top_builddir)/src/Makefile.global
  include $(top_srcdir)/contrib/contrib-global.mk
  endif
+
+ # Build/install only the files needed for regression test support
+ REGRESSION_MODULES = autoinc refint
+
+ .PHONY: regression-modules install-regression-modules
+
+ regression-modules: $(addsuffix $(DLSUFFIX), $(REGRESSION_MODULES))
+
+ install-regression-modules: $(addsuffix $(DLSUFFIX), $(REGRESSION_MODULES))
+     $(INSTALL_SHLIB) $(addsuffix $(DLSUFFIX), $(REGRESSION_MODULES)) '$(DESTDIR)$(pkglibdir)/'
diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile
index 90aea6c..96839db 100644
*** a/src/test/regress/GNUmakefile
--- b/src/test/regress/GNUmakefile
*************** EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)
*** 41,47 ****

  # Build regression test driver

! all: pg_regress$(X)

  pg_regress$(X): pg_regress.o pg_regress_main.o | submake-libpgport
      $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
--- 41,47 ----

  # Build regression test driver

! all: pg_regress$(X) regression-modules

  pg_regress$(X): pg_regress.o pg_regress_main.o | submake-libpgport
      $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
*************** pg_regress.o: pg_regress.c $(top_builddi
*** 53,65 ****
  $(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
      $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h

! install: all installdirs
      $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'

  installdirs:
      $(MKDIR_P) '$(DESTDIR)$(pgxsdir)/$(subdir)'

! uninstall:
      rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'


--- 53,65 ----
  $(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
      $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h

! install: all install-lib install-regression-modules installdirs
      $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'

  installdirs:
      $(MKDIR_P) '$(DESTDIR)$(pgxsdir)/$(subdir)'

! uninstall: uninstall-lib
      rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'


*************** regress_data_files = \
*** 88,94 ****
      $(wildcard $(srcdir)/data/*.data) \
      $(srcdir)/parallel_schedule $(srcdir)/serial_schedule $(srcdir)/resultmap

! install-tests: all install install-lib installdirs-tests
      $(MAKE) -C $(top_builddir)/contrib/spi install
      for file in $(regress_data_files); do \
        $(INSTALL_DATA) $$file '$(DESTDIR)$(pkglibdir)/regress/'$$file || exit; \
--- 88,94 ----
      $(wildcard $(srcdir)/data/*.data) \
      $(srcdir)/parallel_schedule $(srcdir)/serial_schedule $(srcdir)/resultmap

! install-tests: all install installdirs-tests
      $(MAKE) -C $(top_builddir)/contrib/spi install
      for file in $(regress_data_files); do \
        $(INSTALL_DATA) $$file '$(DESTDIR)$(pkglibdir)/regress/'$$file || exit; \
*************** installdirs-tests: installdirs
*** 100,124 ****

  # Get some extra C modules from contrib/spi and contrib/dummy_seclabel...

! all: refint$(DLSUFFIX) autoinc$(DLSUFFIX) dummy_seclabel$(DLSUFFIX)
!
! refint$(DLSUFFIX): $(top_builddir)/contrib/spi/refint$(DLSUFFIX)
!     cp $< $@
!
! autoinc$(DLSUFFIX): $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX)
!     cp $< $@
!
! dummy_seclabel$(DLSUFFIX): $(top_builddir)/contrib/dummy_seclabel/dummy_seclabel$(DLSUFFIX)
!     cp $< $@
!
! $(top_builddir)/contrib/spi/refint$(DLSUFFIX): $(top_srcdir)/contrib/spi/refint.c
!     $(MAKE) -C $(top_builddir)/contrib/spi refint$(DLSUFFIX)

! $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): $(top_srcdir)/contrib/spi/autoinc.c
!     $(MAKE) -C $(top_builddir)/contrib/spi autoinc$(DLSUFFIX)

! $(top_builddir)/contrib/dummy_seclabel/dummy_seclabel$(DLSUFFIX):
$(top_builddir)/contrib/dummy_seclabel/dummy_seclabel.c
!     $(MAKE) -C $(top_builddir)/contrib/dummy_seclabel dummy_seclabel$(DLSUFFIX)

  # Tablespace setup

--- 100,114 ----

  # Get some extra C modules from contrib/spi and contrib/dummy_seclabel...

! .PHONY: regression-modules install-regression-modules

! regression-modules:
!     $(MAKE) -C $(top_builddir)/contrib/spi regression-modules
!     $(MAKE) -C $(top_builddir)/contrib/dummy_seclabel regression-modules

! install-regression-modules:
!     $(MAKE) -C $(top_builddir)/contrib/spi install-regression-modules
!     $(MAKE) -C $(top_builddir)/contrib/dummy_seclabel install-regression-modules

  # Tablespace setup

*************** tablespace-setup:
*** 132,139 ****
  ## Run tests
  ##

- REGRESS_OPTS = --dlpath=.
-
  check: all tablespace-setup
      $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF)
$(EXTRA_TESTS)

--- 122,127 ----
*************** bigcheck: all tablespace-setup
*** 165,171 ****

  clean distclean maintainer-clean: clean-lib
  # things built by `all' target
!     rm -f $(OBJS) refint$(DLSUFFIX) autoinc$(DLSUFFIX) dummy_seclabel$(DLSUFFIX)
      rm -f pg_regress_main.o pg_regress.o pg_regress$(X)
  # things created by various check targets
      rm -f $(output_files) $(input_files)
--- 153,159 ----

  clean distclean maintainer-clean: clean-lib
  # things built by `all' target
!     rm -f $(OBJS)
      rm -f pg_regress_main.o pg_regress.o pg_regress$(X)
  # things created by various check targets
      rm -f $(output_files) $(input_files)
diff --git a/src/test/regress/input/create_function_1.source b/src/test/regress/input/create_function_1.source
index a72dd98..0bebcdd 100644
*** a/src/test/regress/input/create_function_1.source
--- b/src/test/regress/input/create_function_1.source
***************
*** 4,55 ****

  CREATE FUNCTION widget_in(cstring)
     RETURNS widget
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C STRICT;

  CREATE FUNCTION widget_out(widget)
     RETURNS cstring
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C STRICT;

  CREATE FUNCTION int44in(cstring)
     RETURNS city_budget
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C STRICT;

  CREATE FUNCTION int44out(city_budget)
     RETURNS cstring
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C STRICT;

  CREATE FUNCTION check_primary_key ()
      RETURNS trigger
!     AS '@libdir@/refint@DLSUFFIX@'
      LANGUAGE C;

  CREATE FUNCTION check_foreign_key ()
      RETURNS trigger
!     AS '@libdir@/refint@DLSUFFIX@'
      LANGUAGE C;

  CREATE FUNCTION autoinc ()
      RETURNS trigger
!     AS '@libdir@/autoinc@DLSUFFIX@'
      LANGUAGE C;

  CREATE FUNCTION funny_dup17 ()
          RETURNS trigger
!         AS '@libdir@/regress@DLSUFFIX@'
          LANGUAGE C;

  CREATE FUNCTION ttdummy ()
          RETURNS trigger
!         AS '@libdir@/regress@DLSUFFIX@'
          LANGUAGE C;

  CREATE FUNCTION set_ttdummy (int4)
          RETURNS int4
!         AS '@libdir@/regress@DLSUFFIX@'
          LANGUAGE C STRICT;

  -- Things that shouldn't work:
--- 4,55 ----

  CREATE FUNCTION widget_in(cstring)
     RETURNS widget
!    AS '$libdir/regress'
     LANGUAGE C STRICT;

  CREATE FUNCTION widget_out(widget)
     RETURNS cstring
!    AS '$libdir/regress'
     LANGUAGE C STRICT;

  CREATE FUNCTION int44in(cstring)
     RETURNS city_budget
!    AS '$libdir/regress'
     LANGUAGE C STRICT;

  CREATE FUNCTION int44out(city_budget)
     RETURNS cstring
!    AS '$libdir/regress'
     LANGUAGE C STRICT;

  CREATE FUNCTION check_primary_key ()
      RETURNS trigger
!     AS '$libdir/refint'
      LANGUAGE C;

  CREATE FUNCTION check_foreign_key ()
      RETURNS trigger
!     AS '$libdir/refint'
      LANGUAGE C;

  CREATE FUNCTION autoinc ()
      RETURNS trigger
!     AS '$libdir/autoinc'
      LANGUAGE C;

  CREATE FUNCTION funny_dup17 ()
          RETURNS trigger
!         AS '$libdir/regress'
          LANGUAGE C;

  CREATE FUNCTION ttdummy ()
          RETURNS trigger
!         AS '$libdir/regress'
          LANGUAGE C;

  CREATE FUNCTION set_ttdummy (int4)
          RETURNS int4
!         AS '$libdir/regress'
          LANGUAGE C STRICT;

  -- Things that shouldn't work:
*************** CREATE FUNCTION test1 (int) RETURNS int
*** 73,79 ****
      AS 'nosuchfile';

  CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
!     AS '@libdir@/regress@DLSUFFIX@', 'nosuchsymbol';

  CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal
      AS 'nosuch';
--- 73,79 ----
      AS 'nosuchfile';

  CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
!     AS '$libdir/regress', 'nosuchsymbol';

  CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal
      AS 'nosuch';
diff --git a/src/test/regress/input/create_function_2.source b/src/test/regress/input/create_function_2.source
index 6aed5f0..3d077a1 100644
*** a/src/test/regress/input/create_function_2.source
--- b/src/test/regress/input/create_function_2.source
*************** CREATE FUNCTION user_relns()
*** 36,70 ****

  CREATE FUNCTION pt_in_widget(point, widget)
     RETURNS bool
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;

  CREATE FUNCTION overpaid(emp)
     RETURNS bool
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;

  CREATE FUNCTION boxarea(box)
     RETURNS float8
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;

  CREATE FUNCTION interpt_pp(path, path)
     RETURNS point
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;

  CREATE FUNCTION reverse_name(name)
     RETURNS name
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;

  CREATE FUNCTION oldstyle_length(int4, text)
     RETURNS int4
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;

  --
  -- Function dynamic loading
  --
! LOAD '@libdir@/regress@DLSUFFIX@';
--- 36,70 ----

  CREATE FUNCTION pt_in_widget(point, widget)
     RETURNS bool
!    AS '$libdir/regress'
     LANGUAGE C;

  CREATE FUNCTION overpaid(emp)
     RETURNS bool
!    AS '$libdir/regress'
     LANGUAGE C;

  CREATE FUNCTION boxarea(box)
     RETURNS float8
!    AS '$libdir/regress'
     LANGUAGE C;

  CREATE FUNCTION interpt_pp(path, path)
     RETURNS point
!    AS '$libdir/regress'
     LANGUAGE C;

  CREATE FUNCTION reverse_name(name)
     RETURNS name
!    AS '$libdir/regress'
     LANGUAGE C;

  CREATE FUNCTION oldstyle_length(int4, text)
     RETURNS int4
!    AS '$libdir/regress'
     LANGUAGE C;

  --
  -- Function dynamic loading
  --
! LOAD '$libdir/regress';
diff --git a/src/test/regress/input/security_label.source b/src/test/regress/input/security_label.source
index 70771d7..a77ff09 100644
*** a/src/test/regress/input/security_label.source
--- b/src/test/regress/input/security_label.source
*************** SECURITY LABEL ON ROLE seclabel_user1 IS
*** 40,46 ****
  SECURITY LABEL ON ROLE seclabel_user3 IS 'unclassified';            -- fail

  -- Load dummy external security provider
! LOAD '@libdir@/dummy_seclabel@DLSUFFIX@';

  --
  -- Test of SECURITY LABEL statement with a plugin
--- 40,46 ----
  SECURITY LABEL ON ROLE seclabel_user3 IS 'unclassified';            -- fail

  -- Load dummy external security provider
! LOAD '$libdir/dummy_seclabel';

  --
  -- Test of SECURITY LABEL statement with a plugin
diff --git a/src/test/regress/output/create_function_1.source b/src/test/regress/output/create_function_1.source
index 61b87ed..62d34d6 100644
*** a/src/test/regress/output/create_function_1.source
--- b/src/test/regress/output/create_function_1.source
***************
*** 3,51 ****
  --
  CREATE FUNCTION widget_in(cstring)
     RETURNS widget
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C STRICT;
  NOTICE:  type "widget" is not yet defined
  DETAIL:  Creating a shell type definition.
  CREATE FUNCTION widget_out(widget)
     RETURNS cstring
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C STRICT;
  NOTICE:  argument type widget is only a shell
  CREATE FUNCTION int44in(cstring)
     RETURNS city_budget
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C STRICT;
  NOTICE:  type "city_budget" is not yet defined
  DETAIL:  Creating a shell type definition.
  CREATE FUNCTION int44out(city_budget)
     RETURNS cstring
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C STRICT;
  NOTICE:  argument type city_budget is only a shell
  CREATE FUNCTION check_primary_key ()
      RETURNS trigger
!     AS '@libdir@/refint@DLSUFFIX@'
      LANGUAGE C;
  CREATE FUNCTION check_foreign_key ()
      RETURNS trigger
!     AS '@libdir@/refint@DLSUFFIX@'
      LANGUAGE C;
  CREATE FUNCTION autoinc ()
      RETURNS trigger
!     AS '@libdir@/autoinc@DLSUFFIX@'
      LANGUAGE C;
  CREATE FUNCTION funny_dup17 ()
          RETURNS trigger
!         AS '@libdir@/regress@DLSUFFIX@'
          LANGUAGE C;
  CREATE FUNCTION ttdummy ()
          RETURNS trigger
!         AS '@libdir@/regress@DLSUFFIX@'
          LANGUAGE C;
  CREATE FUNCTION set_ttdummy (int4)
          RETURNS int4
!         AS '@libdir@/regress@DLSUFFIX@'
          LANGUAGE C STRICT;
  -- Things that shouldn't work:
  CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
--- 3,51 ----
  --
  CREATE FUNCTION widget_in(cstring)
     RETURNS widget
!    AS '$libdir/regress'
     LANGUAGE C STRICT;
  NOTICE:  type "widget" is not yet defined
  DETAIL:  Creating a shell type definition.
  CREATE FUNCTION widget_out(widget)
     RETURNS cstring
!    AS '$libdir/regress'
     LANGUAGE C STRICT;
  NOTICE:  argument type widget is only a shell
  CREATE FUNCTION int44in(cstring)
     RETURNS city_budget
!    AS '$libdir/regress'
     LANGUAGE C STRICT;
  NOTICE:  type "city_budget" is not yet defined
  DETAIL:  Creating a shell type definition.
  CREATE FUNCTION int44out(city_budget)
     RETURNS cstring
!    AS '$libdir/regress'
     LANGUAGE C STRICT;
  NOTICE:  argument type city_budget is only a shell
  CREATE FUNCTION check_primary_key ()
      RETURNS trigger
!     AS '$libdir/refint'
      LANGUAGE C;
  CREATE FUNCTION check_foreign_key ()
      RETURNS trigger
!     AS '$libdir/refint'
      LANGUAGE C;
  CREATE FUNCTION autoinc ()
      RETURNS trigger
!     AS '$libdir/autoinc'
      LANGUAGE C;
  CREATE FUNCTION funny_dup17 ()
          RETURNS trigger
!         AS '$libdir/regress'
          LANGUAGE C;
  CREATE FUNCTION ttdummy ()
          RETURNS trigger
!         AS '$libdir/regress'
          LANGUAGE C;
  CREATE FUNCTION set_ttdummy (int4)
          RETURNS int4
!         AS '$libdir/regress'
          LANGUAGE C STRICT;
  -- Things that shouldn't work:
  CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
*************** CREATE FUNCTION test1 (int) RETURNS int
*** 75,81 ****
      AS 'nosuchfile';
  ERROR:  could not access file "nosuchfile": No such file or directory
  CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
!     AS '@libdir@/regress@DLSUFFIX@', 'nosuchsymbol';
  ERROR:  could not find function "nosuchsymbol" in file "@libdir@/regress@DLSUFFIX@"
  CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal
      AS 'nosuch';
--- 75,81 ----
      AS 'nosuchfile';
  ERROR:  could not access file "nosuchfile": No such file or directory
  CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
!     AS '$libdir/regress', 'nosuchsymbol';
  ERROR:  could not find function "nosuchsymbol" in file "@libdir@/regress@DLSUFFIX@"
  CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal
      AS 'nosuch';
diff --git a/src/test/regress/output/create_function_2.source b/src/test/regress/output/create_function_2.source
index 94ab7eb..8987c2a 100644
*** a/src/test/regress/output/create_function_2.source
--- b/src/test/regress/output/create_function_2.source
*************** CREATE FUNCTION user_relns()
*** 29,57 ****
     LANGUAGE SQL;
  CREATE FUNCTION pt_in_widget(point, widget)
     RETURNS bool
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;
  CREATE FUNCTION overpaid(emp)
     RETURNS bool
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;
  CREATE FUNCTION boxarea(box)
     RETURNS float8
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;
  CREATE FUNCTION interpt_pp(path, path)
     RETURNS point
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;
  CREATE FUNCTION reverse_name(name)
     RETURNS name
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;
  CREATE FUNCTION oldstyle_length(int4, text)
     RETURNS int4
!    AS '@libdir@/regress@DLSUFFIX@'
     LANGUAGE C;
  --
  -- Function dynamic loading
  --
! LOAD '@libdir@/regress@DLSUFFIX@';
--- 29,57 ----
     LANGUAGE SQL;
  CREATE FUNCTION pt_in_widget(point, widget)
     RETURNS bool
!    AS '$libdir/regress'
     LANGUAGE C;
  CREATE FUNCTION overpaid(emp)
     RETURNS bool
!    AS '$libdir/regress'
     LANGUAGE C;
  CREATE FUNCTION boxarea(box)
     RETURNS float8
!    AS '$libdir/regress'
     LANGUAGE C;
  CREATE FUNCTION interpt_pp(path, path)
     RETURNS point
!    AS '$libdir/regress'
     LANGUAGE C;
  CREATE FUNCTION reverse_name(name)
     RETURNS name
!    AS '$libdir/regress'
     LANGUAGE C;
  CREATE FUNCTION oldstyle_length(int4, text)
     RETURNS int4
!    AS '$libdir/regress'
     LANGUAGE C;
  --
  -- Function dynamic loading
  --
! LOAD '$libdir/regress';
diff --git a/src/test/regress/output/security_label.source b/src/test/regress/output/security_label.source
index 6994d19..b86b29b 100644
*** a/src/test/regress/output/security_label.source
--- b/src/test/regress/output/security_label.source
*************** ERROR:  no security label providers have
*** 38,44 ****
  SECURITY LABEL ON ROLE seclabel_user3 IS 'unclassified';            -- fail
  ERROR:  no security label providers have been loaded
  -- Load dummy external security provider
! LOAD '@abs_builddir@/dummy_seclabel@DLSUFFIX@';
  --
  -- Test of SECURITY LABEL statement with a plugin
  --
--- 38,44 ----
  SECURITY LABEL ON ROLE seclabel_user3 IS 'unclassified';            -- fail
  ERROR:  no security label providers have been loaded
  -- Load dummy external security provider
! LOAD '$libdir/dummy_seclabel';
  --
  -- Test of SECURITY LABEL statement with a plugin
  --
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index d9cd053..c4d56f2 100644
*** a/src/test/regress/pg_regress.c
--- b/src/test/regress/pg_regress.c
*************** typedef struct _resultmap
*** 54,59 ****
--- 54,60 ----
   */
  char       *bindir = PGBINDIR;
  char       *libdir = LIBDIR;
+ char       *pkglibdir = PKGLIBDIR;
  char       *datadir = PGSHAREDIR;
  char       *host_platform = HOST_TUPLE;

*************** static bool use_existing = false;
*** 99,105 ****
  static char *hostname = NULL;
  static int    port = -1;
  static bool port_specified_by_user = false;
! static char *dlpath = PKGLIBDIR;
  static char *user = NULL;
  static _stringlist *extraroles = NULL;
  static _stringlist *extra_install = NULL;
--- 100,106 ----
  static char *hostname = NULL;
  static int    port = -1;
  static bool port_specified_by_user = false;
! static char *dlpath = NULL;
  static char *user = NULL;
  static _stringlist *extraroles = NULL;
  static _stringlist *extra_install = NULL;
*************** convert_sourcefiles_in(char *source_subd
*** 507,513 ****
              replace_string(line, "@abs_srcdir@", inputdir);
              replace_string(line, "@abs_builddir@", outputdir);
              replace_string(line, "@testtablespace@", testtablespace);
!             replace_string(line, "@libdir@", dlpath);
              replace_string(line, "@DLSUFFIX@", DLSUFFIX);
              fputs(line, outfile);
          }
--- 508,514 ----
              replace_string(line, "@abs_srcdir@", inputdir);
              replace_string(line, "@abs_builddir@", outputdir);
              replace_string(line, "@testtablespace@", testtablespace);
!             replace_string(line, "@libdir@", dlpath ? dlpath : pkglibdir);
              replace_string(line, "@DLSUFFIX@", DLSUFFIX);
              fputs(line, outfile);
          }
*************** initialize_environment(void)
*** 795,808 ****
--- 796,817 ----
           */
          tmp = malloc(strlen(temp_install) + 32 + strlen(bindir));
          sprintf(tmp, "%s/install/%s", temp_install, bindir);
+         canonicalize_path(tmp);
          bindir = tmp;

          tmp = malloc(strlen(temp_install) + 32 + strlen(libdir));
          sprintf(tmp, "%s/install/%s", temp_install, libdir);
+         canonicalize_path(tmp);
          libdir = tmp;

+         tmp = malloc(strlen(temp_install) + 32 + strlen(pkglibdir));
+         sprintf(tmp, "%s/install/%s", temp_install, pkglibdir);
+         canonicalize_path(tmp);
+         pkglibdir = tmp;
+
          tmp = malloc(strlen(temp_install) + 32 + strlen(datadir));
          sprintf(tmp, "%s/install/%s", temp_install, datadir);
+         canonicalize_path(tmp);
          datadir = tmp;

          /* psql will be installed into temp-install bindir */
*************** make_absolute_path(const char *in)
*** 1857,1862 ****
--- 1866,1879 ----
              }
          }

+         /*
+          * We don't bother with fully normalizing the joined path, but at
+          * least get rid of "./" prefixed to the input.  (Probably
+          * canonicalize_path ought to handle that, but it doesn't.)
+          */
+         if (strncmp(in, "./", 2) == 0)
+             in += 2;
+
          result = malloc(strlen(cwdbuf) + strlen(in) + 2);
          sprintf(result, "%s/%s", cwdbuf, in);
      }
*************** regression_main(int argc, char *argv[],
*** 2076,2082 ****

      inputdir = make_absolute_path(inputdir);
      outputdir = make_absolute_path(outputdir);
!     dlpath = make_absolute_path(dlpath);

      /*
       * Initialization
--- 2093,2100 ----

      inputdir = make_absolute_path(inputdir);
      outputdir = make_absolute_path(outputdir);
!     if (dlpath)
!         dlpath = make_absolute_path(dlpath);

      /*
       * Initialization

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Large C files
Next
From: Bruce Momjian
Date:
Subject: Re: [COMMITTERS] pgsql: Remove "fmgr.h" include in cube contrib --- caused crash on a Ge