summaryrefslogtreecommitdiffstats
path: root/insertutils/test/test_insertppm.sh
blob: 5250a4828fcdd09fe40e9636e91611f3a9320b4d (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash
####################### Makefile header ##########################
#
# test_insertppm: test insertppm, rasgeo ppm import utility 
#
# TEST CANDIDATE:
# insertppm
#
# TEST MODE:
# automatic
#
# PREREQUISITES:
# - rasdaman server (RNP, RPC) running, any base DBMS
# - ~rasdaman/images accessible with standard imagery
#
# CHANGE HISTORY (append further entries):
# when:       who:      what:
# ----------------------------------------------------------------
# 2005-dec-02 PB        created
#
# COMMENTS:
# - exit -1 if "ERROR" found in log file or in diff to canonical log file
# - test program must be in cwd
# - old log is saved to <logfile>.save
# - todo:
# 	test storage and transfer parameters
#
# Copyright (C) 2005 Dr. Peter Baumann
#
##################################################################

# --- declarations -----------------------------------------------

# shorthands and orga stuff
IPPM=../insertppm

PROG=`basename $0`
INDENT="+++ "

# ERROR keyword, should be standardised across all rasdaman tests
ERROR=ERROR

# log file output
LOG=`basename $0 .sh`.log

# reference log file
REFLOG=$LOG.reference

# save old log here if it exists
SAVELOG=$LOG.save

# test defaults:
COLL_RGB=rgb
COLL_GREY=mr
COLL_3D=mr3d
FILEPATH=~rasdaman/images
FILE_RGB=$FILEPATH/anthur.ppm
FILE_GREY=$FILEPATH/mr_1.pgm
FILE_LIST=$FILEPATH/mr_?.pgm
TYPE_GREY=grey
TYPE_RGB=color
TILED_3D=[1:2,3:4,5:6]

SERVER=`hostname`
PORT=7001
DATABASE=RASBASE
USER=rasadmin
PASSWD=rasadmin

TRANSFERFORMAT=TIFF
TRANSFERFORMATPARAMS=TIFF_PARAMS
STORAGEFORMAT=RLE
STORAGEFORMATPARAMS=RLE_PARAMS

# --- action -----------------------------------------------

# save old log if present
if [ -f $LOG ]
then
	echo found old log file, shifting it to $SAVELOG
	mv $LOG $SAVELOG
fi
echo "$0: testing insertppm start" | tee $LOG

echo $INDENT $INDENT starting softly
echo $INDENT no params
( $IPPM  || (export RC=$?; echo exit code $RC) ) | tee -a $LOG

echo $INDENT call help
( $IPPM -h  || (export RC=$?; echo exit code $RC) ) | tee -a $LOG

echo $INDENT call help
( $IPPM --help  || (export RC=$?; echo exit code $RC) ) | tee -a $LOG

echo $INDENT all correct
echo $INDENT $INDENT all mandatory syntactically correct
# ( $IPPM -c $COLL_RGB $FILE_RGB || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG

echo $INDENT $INDENT all syntactically correct, long version,
# ( $IPPM --collection $COLL_3D --type $TYPE_GREY --rescale --tiled $TILED_3D --verbose \
# 	--server $SERVER --port $PORT --database $DATABASE --user $USER --passwd $PASSWD \
# 	`ls $FILE_LIST` || (export RC=$?; echo Fatal $ERROR, exit code $RC) ) | tee -a $LOG

echo collection param missing:
( $IPPM $FILE_RGB \
	|| (export RC=$?; echo exit code $RC) ) | tee -a $LOG
echo file param missing:
( $IPPM --collection $COLL_RGB \
	|| (export RC=$?; echo exit code $RC) ) | tee -a $LOG

echo $INDENT $INDENT starting softly done
echo $INDENT $INDENT illegal cmd line options start

echo $INDENT $INDENT mdd domain parameter syntax mismatch

echo tbd.

echo $INDENT $INDENT illegal cmd line options done
echo
echo $INDENT $INDENT image type bool
echo $INDENT $INDENT $INDENT nontiled
echo tbd.
echo $INDENT $INDENT $INDENT tiled
echo tbd.
echo $INDENT $INDENT image type grey
echo $INDENT $INDENT $INDENT nontiled
echo tbd.
echo $INDENT $INDENT $INDENT tiled
echo tbd.
echo $INDENT $INDENT image type rgb
echo $INDENT $INDENT $INDENT nontiled
echo tbd.
echo $INDENT $INDENT $INDENT tiled
echo tbd.

echo $INDENT $INDENT transfer and storage parameters
echo tbd.

# --- now compare result with canonical log:

if [ `diff $LOG $REFLOG | wc -l` -ne "0" ]
then
	echo $0: $ERROR: log file differes from reference log file, please examine!
	exit -1
else
	echo $0: no difference found between log and reference log
fi

echo "$0: testing insertppm done" >>$LOG
echo "$0: done."