summaryrefslogtreecommitdiffstats
path: root/systemtest/testcenter.sh
blob: 71ec49ecfd10f2de74b2cc9f784cc375cd7e84d4 (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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
#!/bin/ksh
#
# This file is part of rasdaman community.
#
# Rasdaman community is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Rasdaman community is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with rasdaman community.  If not, see <http://www.gnu.org/licenses/>.
#
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
# rasdaman GmbH.
#
# For more information please see <http://www.rasdaman.org>
# or contact Peter Baumann via <baumann@rasdaman.com>.
######################### testcenter.sh header ###################
#
# testcenter.sh FOR:
#   Release of RASDAMAN
#
# COMMENTS:
#
#
##################################################################

TESTER=$USER
CLIENT=$HOSTNAME
SERVER=$HOSTNAME
BASENAME=RASBASE
USERNAME=rasguest
USERPASSWD=rasguest
TRANSFER=Array
TRANSFERPARAMS=""
STORAGE=Array
STORAGEPARAMS=""
TILING=""
TILINGPARAMS=""
LOGFILE=testcenter.log
TESTINTERACTIVE="off"
DIFFINTERACTIVE="on"
UPDATEINTERACTIVE="on"
RESETDB="on"
SCRIPTS="off"
QUERIES="on"
TESTDIR="testdata"
returnValue="EXECUTION OK"
DEBUG="off"

if (test -n "$1"); then
 if (test -d $1 -o -f $1); then
   TESTDIR=$1
 else
   SERVER=$1
   if (test -n "$2"); then
     TESTDIR=$2
   fi
 fi
fi

showOptions()
{
    echo "===================================================================="
    echo "                TEST CENTER OPTIONS:"
    echo "===================================================================="
    echo "  Date...........................: " `date`
    echo "  (T)ester.......................: " $TESTER
    echo "  (C)lient name..................: " $CLIENT
    echo "  (S)erver name..................: " $SERVER
    echo "  (B)ase name....................: " $BASENAME
    echo "  (U)ser name....................: " $USERNAME
    echo "  User (p)assword................: " $USERPASSWD
    echo "  T(r)ansfer format..............: " $TRANSFER
    echo "  Tra(n)sfer format params.......: " $TRANSFERPARAMS
    echo "  Stora(g)e format...............: " $STORAGE
    echo "  Stor(a)ge format params........: " $STORAGEPARAMS
    echo "  Tiling sc(h)eme................: " $TILING
    echo "  Tiling sche(m)e params.........: " $TILINGPARAMS
    echo "  (L)og file.....................: " $LOGFILE
    echo "  (Q)uery dir....................: " $TESTDIR
    echo ""
    echo "  Tests (i)nteractive............: " $TESTINTERACTIVE
    echo "  Show dif(f) interactive........: " $DIFFINTERACTIVE
    echo "  Update testbe(d) interactive...: " $UPDATEINTERACTIVE
    echo "  R(e)set test database..........: " $RESETDB
    echo "  Debug c(o)mmands...............: " $DEBUG
    echo ""
    echo "  Phase (1) Test queries.........: " $QUERIES
    echo "  Phase (2) Test scripts.........: " $SCRIPTS
    echo ""
}

setParameters()
{
  option="*"

  while [[ $option != "" ]]; do

    clear
    showOptions
    
    echo "  \nEnter option to change setting or <return> to continue! \c"
    read option
    echo "\n" 

    if   [[ $option = t ]]; then
      echo "  Enter new name for tester: \c"
      read TESTER
      echo 
    elif [[ $option = c ]]; then
      echo "  Enter new client name: \c"
      read CLIENT
      echo 
    elif [[ $option = u ]]; then
      echo "  Enter new user name: \c"
      read USERNAME
      echo 
    elif [[ $option = p ]]; then
      echo "  Enter new user password: \c"
      read USERPASSWD
      echo 
    elif [[ $option = r ]]; then
      echo "  Enter new transfer format: \c"
      read TRANSFER
      echo 
    elif [[ $option = n ]]; then
      echo "  Enter new transfer format params: \c"
      read TRANSFERPARAMS
      echo 
    elif [[ $option = g ]]; then
      echo "  Enter new storage format: \c"
      read STORAGE
      echo 
    elif [[ $option = a ]]; then
      echo "  Enter new storage format params: \c"
      read STORAGEPARAMS
      echo 
    elif [[ $option = h ]]; then
      echo "  Enter new tiling scheme: \c"
      read TILING
      echo 
    elif [[ $option = m ]]; then
      echo "  Enter new tiling scheme params: \c"
      read TILINGPARAMS
      echo 
    elif [[ $option = s ]]; then
      echo "  Enter new server name: \c"
      read SERVER
      echo 
    elif [[ $option = b ]]; then
      echo "  Enter new base name: \c"
      read BASENAME
      echo 
    elif [[ $option = l ]]; then
      echo "  Enter new name for the log file: \c"
      read LOGFILE
      echo 
    elif [[ $option = q ]]; then
      echo "  Enter new name for the query data directory: \c"
      read TESTDIR
      echo 
    elif [[ $option = i ]]; then
      if [[ $TESTINTERACTIVE = "off" ]]; then
        TESTINTERACTIVE="on"
      else
        TESTINTERACTIVE="off"
      fi
    elif [[ $option = f ]]; then
      if [[ $DIFFINTERACTIVE = "off" ]]; then
        DIFFINTERACTIVE="on"
      else
        DIFFINTERACTIVE="off"
      fi
    elif [[ $option = d ]]; then
      if [[ $UPDATEINTERACTIVE = "off" ]]; then
        UPDATEINTERACTIVE="on"
      else
        UPDATEINTERACTIVE="off"
      fi
    elif [[ $option = o ]]; then
      if [[ $DEBUG = "off" ]]; then
        DEBUG="on"
      else
        DEBUG="off"
      fi
    elif [[ $option = e ]]; then
      if [[ $RESETDB = "off" ]]; then
        RESETDB="on"
      else
        RESETDB="off"
      fi
    elif [[ $option = 1 ]]; then
      if [[ $QUERIES = "off" ]]; then
        QUERIES="on"
      else
        QUERIES="off"
      fi
    elif [[ $option = 2 ]]; then
      if [[ $SCRIPTS = "off" ]]; then
        SCRIPTS="on"
      else
        SCRIPTS="off"
      fi
    fi

  done
}



testQuery() 
{
  testFile=$1


  echo $testCnt ". Test query: " $testFile "\c"

  if [[ $DEBUG = "on" ]]; then
     echo "shell command:"
     echo $query -file $testFile -testbed
  else

	  YesNo="y"
	  if [[ $TESTINTERACTIVE = "on" ]]; then
	    echo "  Test it (y/n) ? \c"
	    read YesNo
	  fi
	
	  if [[ $YesNo = "y" ]]; then
	    $query -file $testFile -testbed > testbedOutput
	    checkTestImage $testFile;
	  fi
  fi
}



testScript() 
{
  testFile=$1

  echo $testCnt ". Test script: " $testFile "\c"

  if [[ $DEBUG = "on" ]]; then
     echo "shell command:"
     echo $testFile $SERVER $BASENAME > testbedOutput
  else
	  YesNo="y"
	  if [[ $TESTINTERACTIVE = "on" ]]; then
	    echo "  Test it (y/n) ? \c"
	    read YesNo
	  fi

	  if [[ $YesNo = "y" ]]; then
	    $testFile $SERVER $BASENAME > testbedOutput
	    checkTestImage $testFile;
	  fi
  fi
}



checkTestImage()
{
  returnValue="EXECUTION OK"

  # create info file
  gawk -f testOutputGen.awk testbedOutput > testbedOutputInfo

  # check for verification file
  verificationFile=$testFile".out"

  if [[ ! -a $verificationFile ]]; then
    echo FAILED
    echo "  ERROR: verification file $verificationFile does not exist"

    YesNo="n"
    if [[ $DIFFINTERACTIVE = "on" ]]; then
	    echo "  Do you want to see the output (y/n) ? \c"
	    read YesNo__
    fi

    if [[ $YesNo = "y" ]]; then
      echo "\n\nI. TEST FILE"
      cat $testFile 
      echo "\n\nII. OUTPUT"
      cat testbedOutputInfo
      echo "\n\n"
    fi

    YesNo="n"
    if [[ $UPDATEINTERACTIVE = "on" ]]; then
	    echo "  Do you want to create a verification file (y/n) ? \c"
	    read YesNo
    fi
    if [[ $YesNo = "y" ]]; then
      cp testbedOutputInfo $verificationFile
      echo "  CREATED\n"
      returnValue=$returnValue" VERIFICATION FILE NOT FOUND, CREATED AS NEW"
      cvs add -m "testcenter verificationf file for query $testFile" $verificationFile
      cvs commit -m "testcenter verification file created as new by TESTER=$TESTER" $verificationFile
    else
      cp testbedOutputInfo $testFile".tmp"
      echo "  NOT CREATED\n"
      returnValue=$returnValue" VERIFICATION FILE NOT FOUND, NOT CREATED"
    fi

  else


    diff -c testbedOutputInfo $verificationFile 2>&1 1> /tmp/diff.out

    if [[ $? != 0 ]]; then
      echo "FAILED"
      returnValue="EXECUTION FAILED"

      YesNo="n"
      if [[ $DIFFINTERACTIVE = "on" ]]; then
	      echo "  Do you want to see the diff output (y/n) ? \c"
	      read YesNo
      fi


      if [[ $YesNo = "y" ]]; then
	      echo "\n\nI. TEST FILE"
	      cat $testFile 
	      echo "\n\n DIFF OUTPUT:"
	      cat /tmp/diff.out
	      echo "\n\n"
      fi

      YesNo="n"
      if [[ $UPDATEINTERACTIVE = "on" ]]; then
      	echo "  Do you want to update the verification file (y/n) ? \c"
	read YesNo
      fi
      if [[ $YesNo = "y" ]]; then
	if(cvs status $verificationFile); then
	   cvs edit $verificationFile
           cp testbedOutputInfo $verificationFile
           echo "  UPDATED\n"
           cvs commit -m "testcenter verification file updated by TESTER=$TESTER" $verificationFile
           returnValue=$returnValue" VERIFICATION FILE UPDATED"
	else
           cp testbedOutputInfo $verificationFile
           echo "  CREATED\n"
	   cvs add -m "testcenter verificationf file for query $testFile" $verificationFile
      	   cvs commit -m "testcenter verification file created as new by TESTER=$TESTER" $verificationFile
           returnValue=$returnValue" VERIFICATION FILE NOT IN REPOSITORY, CHECKED AS NEW"
	fi
      else
	cp testbedOutputInfo $testFile".tmp"
      fi

    else
      echo "OK"
    fi

  fi

  rm testbedOutput testbedOutputInfo /tmp/diff.out
}

checkBinaries()
{
 # test programs
 insert="$RMANBASE/bin/test_insert3"
 query="$RMANBASE/bin/test_query"
 insertppm="$RMANBASE/insertutils/insertppm"
 images="$RMANBASE/systemtest/images"

 if [[ ! -a $insertppm ]]; then
  echo "\nTest program $insertppm not found"
  echo "Please build the program and try again."
  exit 1 
 fi

 if [[ ! -a $insert ]]; then
  echo "\nTest program $insert not found"
  echo "Please build the program and try again."
  exit 1 
 fi

 if [[ ! -a $query ]]; then
  echo "\nTest program $query not found"
  echo "Please build the program and try again."
  exit 1 
 fi
}

setBinariesParams()
{
# server and database required
if(test -z "$SERVER"); then
  echo "Server name is not set!"
  exit 1
fi
if(test -z "$BASENAME"); then
  echo "Base name is not set!"
  exit 1
fi

if(test -z "$USERNAME"); then
  echo "User name is not set!"
  exit 1
fi

if(test -z "$USERPASSWD"); then
  echo "User password is not set!"
  exit 1
fi

#test_insert3 params
insert="$insert -server $SERVER -base $BASENAME -user $USERNAME -passwd $USERPASSWD"
if(test -n "$TRANSFER"); then
  insert="$insert -transferformat $TRANSFER"
fi
if(test -n "$TRANSFERPARAMS"); then
  insert="$insert -transferformatparams $TRANSFERPARAMS"
fi
if(test -n "$STORAGE"); then
  insert="$insert -storageformat $STORAGE"
fi
if(test -n "$STORAGEPARAMS"); then
  insert="$insert -storageformatparams $STORAGEPARAMS"
fi
if(test -n "$TILING"); then
  insert="$insert -tiling $TILING"
fi
if(test -n "$TILINGPARAMS"); then
  insert="$insert -tilingparams $TILINGPARAMS"
fi

#insertppm params
insertppm="$insertppm -server $SERVER -base $BASENAME -user $USERNAME -passwd $USERPASSWD"
if(test -n "$TRANSFER"); then
insertppm="$insertppm -transferformat $TRANSFER"
fi
if(test -n "$TRANSFERPARAMS"); then
insertppm="$insertppm -transferformatparams $TRANSFERPARAMS"
fi
if(test -n "$STORAGE"); then
insertppm="$insertppm -storageformat $STORAGE"
fi
if(test -n "$STORAGEPARAMS"); then
insertppm="$insertppm -storageformatparams $STORAGEPARAMS"
fi

#test_query params 
query="$query -server $SERVER -base $BASENAME -user $USERNAME -passwd $USERPASSWD"
if(test -n "$TRANSFER"); then
  query="$query -transferformat $TRANSFER"
fi
if(test -n "$TRANSFERPARAMS"); then
  query="$query -transferformatparams $TRANSFERPARAMS"
fi
if(test -n "$STORAGE"); then
  query="$query -storageformat $STORAGE"
fi
if(test -n "$STORAGEPARAMS"); then
  query="$query -storageformatparams $STORAGEPARAMS"
fi
if(test -n "$TILING"); then
  query="$query -tiling $TILING"
fi
if(test -n "$TILINGPARAMS"); then
  query="$query -tilingparams $TILINGPARAMS"
fi
}

resetLog()
{
YesNo="n"
if [[ $UPDATEINTERACTIVE = "on" ]]; then
 if [[ -a $LOGFILE ]]; then
  echo "Delete log file $LOGFILE (y/n) ? \c"
  read YesNo
  echo "\n"
 fi
fi
if [[ $YesNo = y ]]; then
    rm -f $LOGFILE
fi
}

resetDB()
{
if [[ $RESETDB = "on" ]]; then
   echo "Reset demo data in db (y/n) ? \c"
   read YesNo
   echo "\n"

   if [[ $YesNo = y ]]; then

	# delete collections
	echo "Delete test collections of $BASENAME...\c" ;
	echo "=============================================================================" >> $LOGFILE
	echo "Delete test collections of $BASENAME" >> $LOGFILE ;
	echo "=============================================================================\n" >> $LOGFILE

	if [[ $DEBUG = "on" ]]; then
		echo "shell command:"
		echo "10\n" $insert -setname ImgCharA     
		echo "10\n" $insert -setname ImgCharB     
		echo "10\n" $insert -setname ImgCharC     
		echo "10\n" $insert -setname ImgCharD     
		echo "10\n" $insert -setname ImgCharMask  
		echo "10\n" $insert -setname OvlCharA     
		echo "10\n" $insert -setname OvlCharB     	
		echo "10\n" $insert -setname OvlCharC     

		echo "10\n" $insert -setname ImgRGBA      
		echo "10\n" $insert -setname ImgULongC    
		echo "10\n" $insert -setname OlapCharA    
		echo "10\n" $insert -setname StringCharA  
		echo "10\n" $insert -setname CubeCharA    
		echo "10\n" $insert -setname OvlRGBA      
		echo "10\n" $insert -setname OvlRGBB      
		echo "10\n" $insert -setname OvlRGBC
	else
		echo "10\n" | $insert -setname ImgCharA     >> $LOGFILE ;
		echo "10\n" | $insert -setname ImgCharB     >> $LOGFILE ;
		echo "10\n" | $insert -setname ImgCharC     >> $LOGFILE ;
		echo "10\n" | $insert -setname ImgCharD     >> $LOGFILE ;
		echo "10\n" | $insert -setname ImgCharMask  >> $LOGFILE ;
		echo "10\n" | $insert -setname OvlCharA     >> $LOGFILE ;
		echo "10\n" | $insert -setname OvlCharB     >> $LOGFILE ;	
		echo "10\n" | $insert -setname OvlCharC     >> $LOGFILE ;

		echo "10\n" | $insert -setname ImgRGBA      >> $LOGFILE ;
		echo "10\n" | $insert -setname ImgULongC    >> $LOGFILE ;
		echo "10\n" | $insert -setname OlapCharA    >> $LOGFILE ;
		echo "10\n" | $insert -setname StringCharA  >> $LOGFILE ;
		echo "10\n" | $insert -setname CubeCharA    >> $LOGFILE ;
		echo "10\n" | $insert -setname OvlRGBA      >> $LOGFILE ;
		echo "10\n" | $insert -setname OvlRGBB      >> $LOGFILE ;
		echo "10\n" | $insert -setname OvlRGBC      >> $LOGFILE ;	
        fi


	echo "OK" ;

	echo "\n\nCreate demo data in db (y/n) ? \c"
	read YesNo
	echo "\n"

	if [[ $YesNo = y ]]; then
		  #create collections
		  echo "Insert test collections into $BASENAME...\c" ;
		  echo "=============================================================================" >> $LOGFILE
		  echo "Insert test collections into $BASENAME" >> $LOGFILE ;
		  echo "=============================================================================\n" >> $LOGFILE

		if [[ $DEBUG = "on" ]]; then	 
		  echo "shell command:"
		  echo "5\n   0\n 2\n 0\n 10\n 0\n 10\n" $insert -setname ImgCharA  
		  echo "5\n   1\n 2\n 0\n 10\n 0\n 10\n" $insert -setname ImgCharA  
	
		  echo "5\n  10\n 2\n 0\n 10\n 0\n 10\n" $insert -setname ImgCharB  
		  echo "5\n  20\n 2\n 0\n 10\n 0\n 10\n" $insert -setname ImgCharB  
	
		  echo "5\n 100\n 2\n 0\n 10\n 0\n 10\n" $insert -setname ImgCharC  
		  echo "5\n 200\n 2\n 0\n 10\n 0\n 10\n" $insert -setname ImgCharC  

		  echo "13\n      2\n 0\n 10\n 0\n 10\n" $insert -setname ImgCharD  

		  echo "5\n   2\n 2\n-2\n  2\n-1\n  1\n" $insert -setname ImgCharMask

		  echo "1\n       2\n 0\n 9\n  0\n  9\n" $insert -setname ImgULongC

		  echo "6\n       2\n 0\n 10\n 0\n 10\n" $insert -setname ImgRGBA   
		  echo "6\n       2\n 0\n 10\n 0\n 10\n" $insert -setname ImgRGBA   

		  echo "13\n      2\n 0\n 13\n 0\n  1\n" $insert -setname OlapCharA 

		  echo "13\n      1\n 0\n 99\n         " $insert -setname StringCharA -settype GreySet1 -mddtype GreyString 
		  echo "5\n   0\n 3\n 0\n 10\n 0\n 10\n 0\n 10\n" $insert -setname CubeCharA -settype GreySet3 -mddtype GreyCube 
			
		  echo $insertppm -collection OvlRGBA $images/ovl1.ppm 
		  echo $insertppm -collection OvlRGBB $images/ovl2.ppm 
		  echo $insertppm -collection OvlRGBC $images/ovl3.ppm 
		  echo $insertppm -grey -collection OvlCharA $images/ovl1.ppm  
		  echo $insertppm -grey -collection OvlCharB $images/ovl2.ppm 
		  echo $insertppm -grey -collection OvlCharC $images/ovl3.ppm 
		else
		  echo "5\n   0\n 2\n 0\n 10\n 0\n 10\n" | $insert -setname ImgCharA  >> $LOGFILE ;
		  echo "5\n   1\n 2\n 0\n 10\n 0\n 10\n" | $insert -setname ImgCharA  >> $LOGFILE ;
	
		  echo "5\n  10\n 2\n 0\n 10\n 0\n 10\n" | $insert -setname ImgCharB  >> $LOGFILE ;
		  echo "5\n  20\n 2\n 0\n 10\n 0\n 10\n" | $insert -setname ImgCharB  >> $LOGFILE ;
	
		  echo "5\n 100\n 2\n 0\n 10\n 0\n 10\n" | $insert -setname ImgCharC  >> $LOGFILE ;
		  echo "5\n 200\n 2\n 0\n 10\n 0\n 10\n" | $insert -setname ImgCharC  >> $LOGFILE ;

		  echo "13\n      2\n 0\n 10\n 0\n 10\n" | $insert -setname ImgCharD  >> $LOGFILE ;

		  echo "5\n   2\n 2\n-2\n  2\n-1\n  1\n" | $insert -setname ImgCharMask >> $LOGFILE;

		  echo "1\n       2\n 0\n 9\n  0\n  9\n" | $insert -setname ImgULongC >> $LOGFILE;

		  echo "6\n       2\n 0\n 10\n 0\n 10\n" | $insert -setname ImgRGBA   >> $LOGFILE ;
		  echo "6\n       2\n 0\n 10\n 0\n 10\n" | $insert -setname ImgRGBA   >> $LOGFILE ;

		  echo "13\n      2\n 0\n 13\n 0\n  1\n" | $insert -setname OlapCharA >> $LOGFILE ;

		  echo "13\n      1\n 0\n 99\n         " | $insert -setname StringCharA -settype GreySet1 -mddtype GreyString >> $LOGFILE ;
		  echo "5\n   0\n 3\n 0\n 10\n 0\n 10\n 0\n 10\n" | $insert -setname CubeCharA -settype GreySet3 -mddtype GreyCube >> $LOGFILE ;
			
		  $insertppm -collection OvlRGBA $images/ovl1.ppm >> $LOGFILE
		  $insertppm -collection OvlRGBB $images/ovl2.ppm >> $LOGFILE
		  $insertppm -collection OvlRGBC $images/ovl3.ppm >> $LOGFILE
		  $insertppm -grey -collection OvlCharA $images/ovl1.ppm >> $LOGFILE 
		  $insertppm -grey -collection OvlCharB $images/ovl2.ppm >> $LOGFILE
		  $insertppm -grey -collection OvlCharC $images/ovl3.ppm >> $LOGFILE
		fi

		echo "OK" ;
  	fi
   fi
fi
}

#
# main
#

checkBinaries;

setParameters;

setBinariesParams;

resetLog;

showOptions >> $LOGFILE

resetDB;

#
# test query files
#

if [[ $QUERIES = "on" ]]; then

  echo "\nPhase 1: Testing Query Files\n"
  echo "\n=============================================================================" >> $LOGFILE
  echo "Phase 1: Testing Query Files..." >> $LOGFILE ;
  echo "=============================================================================\n" >> $LOGFILE

  testCnt=1
  queryFiles=`find $TESTDIR -name '*.ql' | sort`

  for queryFile in $queryFiles; do

    testQuery $queryFile

    echo "Query " $testCnt $queryFile":" $returnValue >> $LOGFILE

    testCnt=$(($testCnt+1))
  done
fi


#
# test scripts
#

if [[ $SCRIPTS = "on" ]]; then
  echo "\nPhase 2: Testing Scripts\n"
  echo "\n=============================================================================" >> $LOGFILE
  echo "Phase 2: Testing Scripts" >> $LOGFILE
  echo "=============================================================================\n" >> $LOGFILE

  testCnt=1
  scriptFiles=`find scripts -name '*.sh' | sort`

  for scriptFile in $scriptFiles; do

    testScript $scriptFile

    echo "Script " $testCnt $scriptFile":" $returnValue >> $LOGFILE

    testCnt=$(($testCnt+1))
  done
fi

echo "\nTesting finnished at " `date`
echo "\n===================================================================" >> $LOGFILE
echo "Test finnished at " `date` >> $LOGFILE
echo "===================================================================\n" >> $LOGFILE


YesNo="n"
if [[ $UPDATEINTERACTIVE = "on" ]]; then
  echo "\nDo you want to check in the log file (y/n) ? \c"
  read YesNo
  echo "\n\n"
fi
if [[ $YesNo = y ]]; then
  cvs edit session.log
  cp $LOGFILE session.log
  cvs commit -m "updated by testcenter runned by TESTER=$TESTER" session.log
fi
exit 0