1: 2# Test geotifcp 3 4TEST_CLI_DIR=`dirname $0` 5DATA_DIR=`dirname $0`/data 6 7EXE=$1 8LISTGEO_EXE=$2 9 10usage() 11{ 12 echo "Usage: ${0} <path to 'geotifcp' program> <path to 'listgeo' program>" 13 echo 14 exit 1 15} 16 17if test -z "${EXE}"; then 18 EXE=../bin/geotifcp 19 LISTGEO_EXE=../bin/listgeo 20fi 21 22if test ! -x ${EXE}; then 23 echo "*** ERROR: Can not find '${EXE}' program!" 24 exit 1 25fi 26 27if test ! -x ${LISTGEO_EXE}; then 28 echo "*** ERROR: Can not find '${LISTGEO_EXE}' program!" 29 exit 1 30fi 31 32echo "============================================" 33echo "Running ${0} using ${EXE}:" 34echo "============================================" 35 36 37OUT=testgeotifcp_out 38 39rm -f ${OUT} 40 41$LISTGEO_EXE ${DATA_DIR}/albers_equal_area.tif > tmp_albers_equal_area.txt 42$EXE -g tmp_albers_equal_area.txt ${DATA_DIR}/byte.tif tmp_albers_equal_area.tif 43$LISTGEO_EXE tmp_albers_equal_area.tif >> ${OUT} 44rm -f tmp_albers_equal_area.txt 45rm -f tmp_albers_equal_area.tif 46echo "" >> ${OUT} 47 48$LISTGEO_EXE ${DATA_DIR}/ProjectedCSTypeGeoKey_3083_albers_equal_area.tif > tmp_ProjectedCSTypeGeoKey_3083_albers_equal_area.txt 49$EXE -g tmp_ProjectedCSTypeGeoKey_3083_albers_equal_area.txt ${DATA_DIR}/byte.tif tmp_ProjectedCSTypeGeoKey_3083_albers_equal_area.tif 50$LISTGEO_EXE tmp_ProjectedCSTypeGeoKey_3083_albers_equal_area.tif >> ${OUT} 51rm -f tmp_ProjectedCSTypeGeoKey_3083_albers_equal_area.txt 52rm -f tmp_ProjectedCSTypeGeoKey_3083_albers_equal_area.tif 53echo "" >> ${OUT} 54 55# Test copying a GeoTIFF v1.1 file 56$LISTGEO_EXE ${DATA_DIR}/byte_v11.tif > tmp_byte_v11.txt 57$EXE -g tmp_byte_v11.txt ${DATA_DIR}/byte.tif tmp_byte_v11.tif 58$LISTGEO_EXE tmp_byte_v11.tif >> ${OUT} 59rm -f tmp_byte_v11.txt 60rm -f tmp_byte_v11.tif 61echo "" >> ${OUT} 62 63# Test changing the version number 64$EXE -v 1:1:1 ${DATA_DIR}/byte.tif tmp_byte_v11.tif 65$LISTGEO_EXE tmp_byte_v11.tif >> ${OUT} 66rm -f tmp_byte_v11.tif 67echo "" >> ${OUT} 68 69# do 'diff' with distribution results 70echo "diff ${OUT} with testgeotifcp_out.dist" 71diff -u ${OUT} ${TEST_CLI_DIR}/testgeotifcp_out.dist 72if [ $? -ne 0 ] ; then 73 echo "" 74 echo "PROBLEMS HAVE OCCURRED" 75 echo "test file ${OUT} saved" 76 echo 77 exit 100 78else 79 echo "TEST OK" 80 echo "test file ${OUT} removed" 81 echo 82 /bin/rm -f ${OUT} 83 exit 0 84fi 85