On Sat, Jan 10, 2015 at 07:20:30PM +0300, Vadim Zhukov wrote: > So here is an improved version, after input from landry@. > Patch for port-modules(5) will be in a separate letter. > > Okay?
I really like this and would love to see something similar for mariadb. However, I am trying it with my p5-DBIx-Class update (which is in the archives from quite a while ago) which has tests that require both "mysql" and postgres. I'm was using the pre-test and post-test targets to setup and teardown the databases so I could do both. One issue I seem to have is that if tests fail, it doesn't run the post-test target, so the database doesn't get stopped. Not sure if there is a solution for that, but something to look for. My main question on this, if there were a similar solution for mariadb, how would I use both? Also, in order to run the postgres tests, I need to "Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS" and I'm not quite sure what to set those to, but I didn't have time to try very hard. l8rZ, > -- > WBR, > Vadim Zhukov > > > Index: databases/postgresql/postgresql.port.mk > =================================================================== > RCS file: databases/postgresql/postgresql.port.mk > diff -N databases/postgresql/postgresql.port.mk > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ databases/postgresql/postgresql.port.mk 10 Jan 2015 16:16:07 -0000 > @@ -0,0 +1,43 @@ > +# $OpenBSD$ > +# > +# Helps testing PostgreSQL-based software, no B/L/R-DEPS here. > + > +MODPOSTGRESQL_TEST_CMD ?= \ > + ${MAKE_PROGRAM} ${ALL_TEST_FLAGS} -f ${MAKE_FILE} ${TEST_TARGET} > + > +MODPOSTGRESQL_TEST_PGHOST ?= ${WRKDIR} > +_MODPOSTGRESQL_TEST_PGDATA = ${WRKDIR}/testdb > + > +TEST_DEPENDS += databases/postgresql,-server > +TEST_ENV += PGDATA=${_MODPOSTGRESQL_TEST_PGDATA} \ > + PGHOST=${MODPOSTGRESQL_TEST_PGHOST} > +.ifdef MODPOSTGRESQL_TEST_DBNAME > +TEST_ENV += PGDATABASE=${MODPOSTGRESQL_TEST_DBNAME} > +.endif > + > +MODPOSTGRESQL_TEST_TARGET = \ > + rm -Rf ${_MODPOSTGRESQL_TEST_PGDATA}; \ > + export ${ALL_TEST_ENV}; \ > + ${LOCALBASE}/bin/initdb -D ${_MODPOSTGRESQL_TEST_PGDATA} \ > + -A trust --locale=C; \ > + ${LOCALBASE}/bin/pg_ctl start -w -D ${_MODPOSTGRESQL_TEST_PGDATA} \ > + -l ${WRKDIR}/pg-test.log \ > + -o "-F -h '' -k ${MODPOSTGRESQL_TEST_PGHOST}"; > +.ifdef MODPOSTGRESQL_TEST_DBNAME > +MODPOSTGRESQL_TEST_TARGET += \ > + ${LOCALBASE}/bin/createdb ${MODPOSTGRESQL_TEST_DBNAME} || \ > + (${LOCALBASE}/bin/pg_ctl stop -D ${_MODPOSTGRESQL_TEST_PGDATA} \ > + -m i && exit 1); > +.endif > +MODPOSTGRESQL_TEST_TARGET += \ > + set +e; \ > + cd ${WRKBUILD}; \ > + ${MODPOSTGRESQL_TEST_CMD}; \ > + Q=$$?; \ > + ${LOCALBASE}/bin/pg_ctl stop -D ${_MODPOSTGRESQL_TEST_PGDATA} -m i; \ > + exit $$Q > + > +.if !target(do-test) > +do-test: > + ${MODPOSTGRESQL_TEST_TARGET} > +.endif -- andrew - http://afresh1.com Beta. Software undergoes beta testing shortly before it's released. Beta is Latin for "still doesn't work."