|Version 4 (modified by robe, 4 years ago)|
PostGIS Garden Test
The PostGIS Garden Test is a suite of SQL statements designed to stress test the PostGIS library within the PostgreSQL environment. It is a test generated from the reference.xml that tries to test every documented function against every kind of geometry supported by PostGIS. The main objectives of the tests is to try to catch bugs that will crash the server. It is also useful for monitoring odd behavior as well as as a regression test against prior versions of the software. To test against prior versions, build a test from the prior version reference.xml and build against both the old and the new version on the same server. With postgis-1.4 and postgis-1.5 this is much easier to do as you can run both versions on the same server in differen dbs.
To build the garden test you need an xsltproc (the same that is used to build the docs or some other .xsl processor). On windows you can download precompiled binaries from http://www.zlatkovic.com/pub/libxml/ and its part of the libxslt package.
The reference.xml and postgis_gardentest.sql.xsl located in the doc and doc/xsl folders are both needed to build the tests. Note that these tests are equivalent to a monkey testing the software so a lot of tests fail. Its good in a sense as a monkey will stuff a geometry in any function that takes that and as such will test the system as human monkeys are bound to do.
Below is a basic script to build the tests and run them (if you are running from dos, change the slashes or just run everything from same folder:
xsltproc -o torturetest.sql trunk/doc/xsl/postgis_gardentest.sql.xsl trunk/doc/reference.xml psql -p 5432 -U postgres -d postgres -c "CREATE DATABASE testpostgis;" psql -p 5432 -U postgres -d testpostgis -f postgis.sql psql -p 5432 -U postgres -d testpostgis -f geography.sql psql -p 5432 -U postgres -d testpostgis -f spatial_ref_sys.sql psql -p 5432 -U postgres -d testpostgis -f torturetest.sql > torturetest_results.txt psql -p 5432 -U postgres -d postgres -c "DROP DATABASE testpostgis;"