wiki:DevWikiPGRegress

Version 2 (modified by robe, 13 years ago) ( diff )

Preparing PostgreSQL / PostGIS specific regress tests

In addition to C-Unit tests, we also need a test that tests the function in the PostgreSQL environment. These tests are kept in svn in the /regress folder.

Basic steps:

  • Create a .sql file listing key preferably corner cases of your function and name it some variant of your function name e.g myfunc.sql. Examples of these are in the /regress folder e.g. dumppoints.sql
  • Run this sql file in a PostGIS enabled db using psql and save the output in myfunc_expected — e.g.

{ psql -tXA -h localhost -U postgres -d postgis_reg -f myfunc.sql -o myfunc_expected }

  • Add this .sql script to the Makefile.in in trunk/regress (NOTE: we can do this if you are submitting the patch). Also note that if your function relies on a particular version of GEOS that is not the minimum version for the PostGIS release, you need to wrap it in a conditional of the form:
ifeq ($(shell expr $(POSTGIS_GEOS_VERSION) ">=" 32),1)
	TESTS += regress_buffer_params
endif

Note: See TracWiki for help on using the wiki.