From 09c62d03b9bccb19c019185c2306e95a136a5399 Mon Sep 17 00:00:00 2001 From: danj Date: Sun, 1 May 2016 20:23:54 +0000 Subject: [PATCH] fix the test now out of 40 tests, only 1 fails ok landry@ --- geo/osm2pgsql/Makefile | 20 ++++++++---- .../patches/patch-tests_regression-test_py | 31 +++++++++++++++++++ 2 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 geo/osm2pgsql/patches/patch-tests_regression-test_py diff --git a/geo/osm2pgsql/Makefile b/geo/osm2pgsql/Makefile index a0201f6d1b8..5bc63f0c06b 100644 --- a/geo/osm2pgsql/Makefile +++ b/geo/osm2pgsql/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2016/04/27 17:02:34 danj Exp $ +# $OpenBSD: Makefile,v 1.5 2016/05/01 20:23:54 danj Exp $ COMMENT = OSM data to PostgreSQL converter @@ -18,9 +18,9 @@ USE_GMAKE = Yes WANTLIB += boost_system-mt boost_filesystem-mt bz2 c expat WANTLIB += geos m pthread pq proj z ${MODLUA_WANTLIB} - -MODULES = devel/cmake \ - databases/postgresql \ +# postgresql needs to be first otherwise tests are done by cmake module +MODULES = databases/postgresql \ + devel/cmake \ gcc4 \ lang/python \ lang/lua @@ -32,8 +32,10 @@ LIB_DEPENDS = databases/postgresql \ BUILD_DEPENDS = devel/libtool -TEST_DEPENDS = databases/py-psycopg2 \ - geo/postgis +# postgresql,-contrib is needed for hstore extension +TEST_DEPENDS = databases/py-psycopg2 \ + geo/postgis \ + databases/postgresql,-contrib MODGCC4_ARCHS = * MODGCC4_LANGS += c++ @@ -45,6 +47,12 @@ MODLUA_SA = Yes CONFIGURE_ARGS = -DBUILD_TESTS=ON +# bump postgresql,-server limits according to its README otherwise some +# tests fail +MODPOSTGRESQL_TEST_DBNAME = osm2pgsql-test +MODPOSTGRESQL_TEST_CMD = cd ${WRKSRC} && ${MODPY_BIN} tests/regression-test.py \ + -x ${WRKBUILD}/osm2pgsql + pre-configure: ${SUBST_CMD} ${WRKSRC}/CMakeLists.txt rm -f ${WRKSRC}/cmake/FindLua.cmake diff --git a/geo/osm2pgsql/patches/patch-tests_regression-test_py b/geo/osm2pgsql/patches/patch-tests_regression-test_py new file mode 100644 index 00000000000..a79e664ec8d --- /dev/null +++ b/geo/osm2pgsql/patches/patch-tests_regression-test_py @@ -0,0 +1,31 @@ +$OpenBSD: patch-tests_regression-test_py,v 1.1 2016/05/01 20:23:54 danj Exp $ +--- tests/regression-test.py.orig Wed Mar 2 15:06:44 2016 ++++ tests/regression-test.py Sun May 1 19:58:24 2016 +@@ -490,7 +490,7 @@ def findContribSql(filename): + + # Try to get base dir for postgres contrib + try: +- postgis_base_dir = os.popen('pg_config | grep -m 1 "^INCLUDEDIR ="').read().strip().split(' ')[2].split('/include')[0] ++ postgis_base_dir = os.popen('pg_config | grep "^INCLUDEDIR =" |head -n1').read().strip().split(' ')[2].split('/include')[0] + except: + postgis_base_dir = '/usr' + +@@ -550,6 +550,9 @@ def setupDB(): + global created_tablespace + created_tablespace = 0 + ++ subprocess.call(["/bin/rm", "-rf", "/tmp/psql-tablespace"]) ++ os.makedirs("/tmp/psql-tablespace") ++ test_cur.execute("""CREATE TABLESPACE tablespacetest LOCATION '/tmp/psql-tablespace'""") + test_cur.execute("""SELECT spcname FROM pg_tablespace WHERE spcname = 'tablespacetest'""") + if test_cur.fetchone(): + print "We already have a tablespace, can use that" +@@ -609,7 +612,7 @@ def tearDownDB(): + gen_cur.close() + gen_conn.close() + if (created_tablespace == 1): +- returncode = subprocess.call(["/usr/bin/sudo", "/bin/rmdir", "/tmp/psql-tablespace"]) ++ returncode = subprocess.call(["/bin/rm", "-rf", "/tmp/psql-tablespace"]) + + + if __name__ == "__main__":