File: test_projinfo.sh

package info (click to toggle)
proj 9.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 44,620 kB
  • sloc: sh: 219,086; cpp: 173,769; sql: 85,586; python: 8,577; ansic: 6,274; yacc: 1,349; javascript: 228; makefile: 33
file content (54 lines) | stat: -rwxr-xr-x 1,334 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash

# Test projinfo using specific sh commands
# See test_projinfo.yaml for general CLI testing.

set -e

TEST_CLI_DIR=$(dirname $0)
EXE=$1
if test -z "${EXE}"; then
    echo "Usage: ${0} <path to 'projinfo' program>"
    exit 1
fi
if test ! -x ${EXE}; then
    echo "*** ERROR: Can not find '${EXE}' program!"
    exit 1
fi

echo "============================================"
echo "Running ${0} using ${EXE}:"
echo "============================================"

OUT=$(basename $0 .sh)_out

echo "doing tests into file ${OUT}, please wait"
rm -f ${OUT}
#
echo "##############################################################" >> ${OUT}
echo "Testing PROJ_AUX_DB environment variable" >> ${OUT}
rm -f tmp_projinfo_aux.db
$EXE --dump-db-structure --output-id HOBU:XXXX EPSG:4326 | sqlite3 tmp_projinfo_aux.db
export PROJ_AUX_DB=tmp_projinfo_aux.db
$EXE HOBU:XXXX >>${OUT}
unset PROJ_AUX_DB
rm -f tmp_projinfo_aux.db
echo "" >>${OUT}


##############################################################################
# Done!
# do 'diff' with distribution results
echo "diff ${OUT} with ${OUT}.dist"
diff -u -b ${OUT} ${TEST_CLI_DIR}/${OUT}.dist
if [ $? -ne 0 ] ; then
	echo  ""
	echo "PROBLEMS HAVE OCCURRED"
	echo "test file ${OUT} saved"
	exit 100
else
	echo "TEST OK"
	echo "test file ${OUT} removed"
	rm -f ${OUT}
	exit 0
fi