[Gdal-dev] Raster data test suite

Frank Warmerdam warmerdam at pobox.com
Thu May 18 20:21:07 EDT 2006


Ray Gardener wrote:
>>> What do you mean as automated fashion?
> 
> Say I built GDAL and wanted a script that would exercise all the 
> drivers. Given a standard set of data files, the test program emits 
> certain things (attribute lists, images, dems) that can then be compared 
> (again by machine) against a reference set. For the Lev and Terragen 
> drivers, for example, I'm going to add sample data, along with a small 
> console app (or maybe use an existing GDAL util) and the reference 
> transformed data, and then a (windows) test script could add these lines 
> to itself:
> 
> testapp -lev frmts/leveller/sample.ter -gtiff out.tif
> fc /b out.tif frmts/leveller/out.tif
> testapp -gtiff sample.tif -lev out.ter
> fc /b out.ter frmts/leveller/out.ter

Ray,

The python test suite is the preferred mechanism to provide for automated
testing.  There are simple mechanisms to check image checksum values for
test images, and for verifying that checksums don't change when data
is translated between formats.  The script can also capture other more
idiosyncratic behaviors of particular formats.

The simple script I wrote for leveller format looks like this, just
verifying that the image checksum of band 1 of data/ter6test.ter is 9093.

import os
import sys
import gdal

sys.path.append( '../pymod' )

import gdaltest

###############################################################################
# Perform simple read test.

def leveller_1():

     tst = gdaltest.GDALTest( 'Leveller', 'ter6test.ter', 1, 9093 )
     return tst.testOpen()


gdaltest_list = [
     leveller_1 ]


if __name__ == '__main__':

     gdaltest.setup_run( 'leveller' )

     gdaltest.run_tests( gdaltest_list )

     gdaltest.summarize()

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list