1#!/bin/sh
2
3GPSBABEL_FREEZE_TIME=y
4export GPSBABEL_FREEZE_TIME
5
6# Turn on GNU libc instrumentation.
7MALLOC_CHECK_=2
8export MALLOC_CHECK_
9
10PNAME=${PNAME:-./gpsbabel}
11DIFF=${DIFF:-diff}
12BASEPATH=`dirname $0`
13REFERENCE=${BASEPATH}/reference
14# OD=${OD:-od -Ax -txC -v}
15if [ -x /usr/bin/hexdump ] ; then
16	OD=${OD:-hexdump -v -C}
17else
18	OD=${OD:-od -Ax -txC -v}
19fi
20
21TMPDIR=${GBTEMP:-/tmp}/gpsbabel.$$
22mkdir -p $TMPDIR
23trap "rm -fr $TMPDIR" 0 1 2 3 15
24
25bincompare()
26{
27	rm -f ${TMPDIR}/bc1
28        rm -f ${TMPDIR}/bc2
29        ${OD} $1 >${TMPDIR}/bc1
30        ${OD} $2 >${TMPDIR}/bc2
31        ${DIFF} ${TMPDIR}/bc1 ${TMPDIR}/bc2 || {
32		echo ERROR binary comparing $*
33                #exit 1
34	}
35}
36
37compare()
38{
39	${DIFF} -u -b $* ||  {
40		echo ERROR comparing $*
41		#exit 1
42	}
43}
44
45sort_and_compare()
46{
47	sort $1 > $TMPDIR/s1
48	sort $2 > $TMPDIR/s2
49	compare $TMPDIR/s1 $TMPDIR/s2
50}
51
52gpsbabel()
53{
54	${PNAME} $* || {
55		echo "$PNAME returned error $?"
56		echo "($PNAME $*)"
57		#exit 1
58	}
59}
60
61# Some formats are just too boring to test.   The ones that
62# are xcsv include
63# garmin301
64# garmin_poi
65# gpsdrivetrack
66# nima
67# mapconverter
68# geonet
69# saplus
70# s_and_t
71# xmap2006
72# cambridge
73# cup
74
75if [ $# -ge 1 ];
76then
77  while [ $# -ge 1 ];
78  do
79    t=testo.d/$1.test
80    echo Running $t
81    . $t
82    shift;
83  done
84  exit 0
85fi
86
87for i in testo.d/*.test
88do
89  echo Running $i
90  . $i
91done
92
93exit 0
94