Changes between Version 27 and Version 28 of DevWikiGardenTest
- Timestamp:
- 12/03/10 05:13:26 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DevWikiGardenTest
v27 v28 15 15 columns are: logid- an autonumber, log_label - a short description, spatial_class - (will contain geometry or geography), func - name of function being tested, g1 - type of geometry of first geometry, g2 - type of geometry of second or null if a single geometry function, log_start - start time (timestamp), log_end - end time (timestamp), log_sql - the SQL statement that was run. 16 16 17 If the test crashes before completion, the record with the largest logid will tell you the query that crashed the server. .17 If the test crashes before completion, the record with the largest logid will tell you the query that crashed the server. 18 18 19 19 * postgis_garden_log_output -- this outputs the query results for queries that return something in xml format. It uses the built-in query_to_xml function that has existed since PostgreSQL 8.3 to do that. … … 22 22 * log_output - an xml field that contains the query_to_xml output of the query. 23 23 24 The really nice benefit about logging the query and the output to a table, is that it's easier to inspect and you can also rerun a subset of the queries for closer inspection by just writing an sql statement something like below -- which will test all tests for the ST_Distance function that involve points and linestrings 24 * There is also a companion for raster testing: raster_gardentest.sql.xsl .The raster one doesn't 25 currently create logging labels but will soon. 26 27 -- to run: 28 -- create the tests 29 There is an unfortunate dependency on postgis_agg_mm.xml which is really not needed 30 just create a dummy blank file called postgis_agg_mm.xml in the trunk/doc to get around this 31 Then: 32 {{{ 33 xsltproc -o geo_torturetest.sql trunk/doc/xsl/postgis_gardentest.sql.xsl trunk/doc/postgis.xml 34 xsltproc -o rast_torturetest.sql trunk/doc/xsl/raster_gardentest.sql.xsl trunk/doc/postgis.xml 35 }}} 36 37 -- run them 38 {{{ 39 psql -p 5432 -U postgres -d postgres -c "DROP DATABASE testpostgis;" 40 psql -p 5432 -U postgres -d postgres -c "CREATE DATABASE testpostgis;" 41 psql -p 5432 -U postgres -d testpostgis -c "CREATE LANGUAGE plpgsql;" 42 psql -p 5432 -U postgres -d testpostgis -f postgis.sql 43 psql -p 5432 -U postgres -d testpostgis -f spatial_ref_sys.sql 44 psql -p 5432 -U postgres -d testpostgis -f rtpostgis.sql 45 psql -p 5432 -U postgres -d testpostgis -f geo_torturetest.sql > geo_torturetest_results.txt 46 psql -p 5432 -U postgres -d testpostgis -f rast_torturetest.sql > rast_torturetest_results.txt 47 48 }}} 49 50 One nice benefit about logging the query and the output to a table, is that it's easier to inspect (and you can conceivably do a join between too logging tables to compare results from test to test) and you can also rerun a subset of the queries for closer inspection by just writing an sql statement something like below -- which will test all tests for the ST_Distance function that involve points and linestrings 25 51 26 52 {{{ … … 33 59 }}} 34 60 61 You can even do even more cool things like use [http://developer.postgresql.org/pgdocs/postgres/pgbench.html pgbench] to simulate users with a transaction script that 62 looks something like the below script that will run 10 function queries on functions that 63 start with ST_ that have succeeded in the past. 35 64 36 There is an unfortunate dependency on postgis_agg_mm.xml which is really not needed 37 just create a dummy blank file called postgis_agg_mm.xml in the trunk/doc to get around this 38 Then: 39 {{{ 40 xsltproc -o torturetest.sql trunk/doc/xsl/postgis_gardentest.sql.xsl trunk/doc/postgis.xml 65 {{{BEGIN; 66 SELECT query_to_xml(log_sql) FROM postgis_garden_log WHERE func LIKE 'ST_%' 67 and log_end IS NOT NULL ORDER BY random() LIMIT 10; 68 END; 41 69 }}} 70 42 71 43 72 == Version PostGIS 1.5+ ==