Skip to content

Commit 068c119

Browse files
committed
postgresqlPackages.postgis: enable tests
1 parent c55e290 commit 068c119

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

pkgs/servers/sql/postgresql/ext/postgis.nix

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
, perl
44
, libxml2
55
, postgresql
6+
, postgresqlTestHook
67
, geos
78
, proj
89
, gdalMinimal
@@ -11,6 +12,9 @@
1112
, file
1213
, protobufc
1314
, libiconv
15+
, libxslt
16+
, docbook_xml_dtd_45
17+
, cunit
1418
, pcre2
1519
, nixosTests
1620
, jitSupport
@@ -36,10 +40,14 @@ stdenv.mkDerivation rec {
3640
nativeBuildInputs = [ perl pkg-config ] ++ lib.optional jitSupport llvm;
3741
dontDisableStatic = true;
3842

43+
nativeCheckInputs = [ postgresqlTestHook cunit libxslt ];
44+
45+
postgresqlTestUserOptions = "LOGIN SUPERUSER";
46+
failureHook = "postgresqlStop";
47+
3948
# postgis config directory assumes /include /lib from the same root for json-c library
4049
env.NIX_LDFLAGS = "-L${lib.getLib json_c}/lib";
4150

42-
4351
preConfigure = ''
4452
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
4553
configureFlags="--datadir=$out/share/postgresql --datarootdir=$out/share/postgresql --bindir=$out/bin --docdir=$doc/share/doc/${pname} --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev} --disable-extension-upgrades-install"
@@ -61,6 +69,15 @@ stdenv.mkDerivation rec {
6169
ln -s ${postgresql}/bin/postgres $out/bin/postgres
6270
'';
6371

72+
doCheck = stdenv.isLinux;
73+
74+
preCheck = ''
75+
substituteInPlace regress/run_test.pl --replace-fail "/share/contrib/postgis" "$out/share/postgresql/contrib/postgis"
76+
substituteInPlace regress/Makefile --replace-fail 's,\$$libdir,$(REGRESS_INSTALLDIR)/lib,g' "s,\\$\$libdir,$PWD/regress/00-regress-install$out/lib,g" \
77+
--replace-fail '$(REGRESS_INSTALLDIR)/share/contrib/postgis/*.sql' "$PWD/regress/00-regress-install$out/share/postgresql/contrib/postgis/*.sql"
78+
substituteInPlace doc/postgis-out.xml --replace-fail "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" "${docbook_xml_dtd_45}/xml/dtd/docbook/docbookx.dtd"
79+
'';
80+
6481
# create aliases for all commands adding version information
6582
postInstall = ''
6683
# Teardown the illusory postgres used for building; see postConfigure.

0 commit comments

Comments
 (0)