summaryrefslogtreecommitdiffstats
path: root/test/test.sh
blob: 701a114a9a46d1c5c2f83538c5c2e3c966e24e14 (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
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
#! /bin/sh

#
# Copyright Rainer Wichmann (2006)
#
# License Information:
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

# -----------------------------------------------------------------------
# Be Bourne compatible
# -----------------------------------------------------------------------

if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  emulate sh
  NULLCMD=:
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
  set -o posix
fi

# -----------------------------------------------------------------------
# Make sure we support functions (from the autoconf manual)
# -----------------------------------------------------------------------

TSHELL="${TSHELL-/bin/sh}"
if test x"$1" = "x--re-executed" 
then
    shift
elif "$TSHELL" -c 'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
then
    :
else
    for cmd in sh bash ash bsh ksh zsh sh5; do
	X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin";
	OLD_IFS=${IFS}
	IFS=':'; export IFS 
	for dir in $X; do
	    shell="$dir/$cmd"
	    if (test -f "$shell" || test -f "$shell.exe")
	    then
	        if "$shell" -c  'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
		then
		    TSHELL="$shell"; export TSHELL
		    IFS=${OLD_IFS}; export IFS
		    exec "$shell" "$0" --re-executed ${1+"$@"}
		fi
	    fi
	done
	IFS=${OLD_IFS}; export IFS
    done
    echo "-----------------------------------------------------------------"
    echo "ERROR: Unable to locate a shell interpreter with function support" >&2
    echo "-----------------------------------------------------------------"
    { (exit 1); exit 1; }
fi

# -----------------------------------------------------------------------
# Make sure we support 'let' (from the autoconf manual)
# -----------------------------------------------------------------------

TSHELL="${TSHELL-/bin/sh}"
if test x"$1" = "x--re-run" 
then
    shift
elif "$TSHELL" -c 'a=5; let "a = a + 5"' >/dev/null 2>&1
then
    :
else
    for cmd in sh bash ash bsh ksh zsh sh5; do
	X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin";
	OLD_IFS=${IFS}
	IFS=':'; export IFS 
	for dir in $X; do
	    shell="$dir/$cmd"
	    if (test -f "$shell" || test -f "$shell.exe")
	    then
	        if "$shell" -c  'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
		then
		    if "$shell" -c  'a=5; let "a = a + 5"' >/dev/null 2>&1
		    then
			TSHELL="$shell"; export TSHELL
			IFS=${OLD_IFS}; export IFS
			exec "$shell" "$0" --re-run ${1+"$@"}
		    fi
		fi
	    fi
	done
	IFS=${OLD_IFS}; export IFS
    done
    echo "-----------------------------------------------------------------"
    echo "ERROR: Unable to locate a shell interpreter with support for 'let'" >&2
    echo "-----------------------------------------------------------------"
    { (exit 1); exit 1; }
fi


umask 0022

isok=`test -t 1 2>&1 | wc -c`
if [ "$isok" -eq 0 ]; then
   test -t 1
   isok=$?
fi

# The following two are the ANSI sequences for start and end embolden
if [ x"$isok" = x0 ]; then
    case $TERM in
	vt*|ansi*|con*|xterm*|linux*|screen*|rxvt*)
	    S=''
	    R=
	    G=
	    B=
	    E=
	    ;;
	*)
	    S=
	    R=
	    G=
	    B=
	    E=
	    ;;
    esac
fi


usage() {
    echo "test.sh [options] <test_number> [hostname]"
    echo "        [-q|--quiet|-v|--verbose] [-s|--stoponerr] [-n|--no-cleanup]"
    echo "        [--srcdir=top_srcdir] [--color=always|never|auto]"
    echo
    echo "  ${S}test.sh  1${E}  -- Compile with many different options"
    echo "  ${S}test.sh  2${E}  -- Hash function            (testrc_1)"
    echo "  ${S}test.sh  3${E}  -- Standalone init/check"
    echo "  ${S}test.sh  4${E}  -- Microstealth init/check"
    echo "  ${S}test.sh  5${E}  -- External program call    (testrc_1ext.in)"
    echo "  ${S}test.sh  6${E}  -- Controlling the daemon"
    echo "  ${S}test.sh  7${E}  -- GnuPG signed files / prelude log"
    echo "  ${S}test.sh  8${E}  -- Suidcheck"
    echo "  ${S}test.sh  9${E}  -- Process check"
    echo "  ${S}test.sh 10${E}  -- Port check"
    echo "  ${S}test.sh 11${E}  -- CL verify option" 
    echo "  ${S}test.sh 12${E}  -- CL create DeltaDB" 
    echo "  ${S}test.sh 13${E}  -- CL create/verify partial DB" 

    echo "  ${S}test.sh 20${E}  -- Test c/s init/check      (testrc_2.in)"
    echo "  ${S}test.sh 21${E}  -- Test full c/s init/check (testrc_2.in)"
    echo "  ${S}test.sh 22${E}  -- Test full c/s w/gpg      (testrc_2.in)"
    echo "  ${S}test.sh 23${E}  -- Test full c/s w/mysql    (testrc_2.in)"
    echo "  ${S}test.sh 24${E}  -- Test full c/s w/postgres (testrc_2.in)"
    echo "  ${S}test.sh 25${E}  -- Test server w/yulectl    (testrc_2.in)"
    echo "  ${S}test.sh 26${E}  -- Test c/s case one        (testrc_2.in)"
    echo "  ${S}test.sh 27${E}  -- Test c/s case two        (testrc_2.in)"
    echo "  ${S}test.sh all${E} -- All tests"
}
scripts () {
    echo 
    echo "Scripts used by tests:"
    echo "  (1) testcompile.sh (2) testhash.sh     (3) testrun_1.sh   (4) testrun_1a.sh"
    echo "  (5) testext.sh     (6) testtimesrv.sh  (7) testrun_1b.sh  (8) testrun_1c.sh" 
    echo "  (9) testrun_1d.sh (10) testrun_1e.sh  (11) testrun_1f.sh (12) testrun_1g.sh" 
    echo " (13) testrun_1h.sh"
    echo " (20) testrun_2.sh  (21) testrun_2a.sh  (22) testrun_2b.sh (23) testrun_2c.sh"
    echo " (24) testrun_2d.sh (25) testrun_2e.sh  (26) testrun_2f.sh (27) testrun_2g.sh"
}

#
# Option parsing
#
verbose=
quiet=
stoponerr=
color=auto
cleanup=on
doall=
usevalgrind=

while [ $# -gt 0 ]
do
    case "$1" in
        -h|--help)     usage; exit 0;;
	--scripts)     usage; scripts; exit 0;;
        -v|--verbose)  verbose=on; quiet= ;;
        -q|--quiet)    quiet=on; verbose= ;;
        -s|--stoponerr)     stoponerr=on;;
	-n|--no-cleanup) cleanup= ;;
	--really-all) doall=on;;
	--valgrind) usevalgrind=on;;
	--srcdir=*)    TOP_SRCDIR=`echo $1 | sed s,--srcdir=,,`; export TOP_SRCDIR;;
	--color=*)     
	    arg=`echo $1 | sed s,--color=,,`
	    case $arg in
		auto) ;;
		never|none|no) 
		    S=
		    R=
		    G=
		    B=
		    E=
		    ;;
		always|yes)
		    S=''
		    R=
		    G=
		    G=
		    E=
		    ;;
		*) echo "Invalid argument $1"; exit 1;;
	    esac
	    ;;
        -*)  echo "Invalid argument $1"; exit 1;;
	*) break;;
    esac
    shift
done

export verbose
export quiet
export stoponerr
export cleanup
export doall
export S; export R; export G; export B; export E;

SCRIPTDIR=.

#
# 'make test' will copy the 'test' subdirectory and replace TEST_SRCDIR
#
TEST_SRCDIR="XXXSRCXXX";
if test "x${TOP_SRCDIR}" = x; then
    # not within source tree, and not called with 'make testN'
    if test -f "${TEST_SRCDIR}/src/samhain.c"; then
	TOP_SRCDIR="${TEST_SRCDIR}"; export TOP_SRCDIR
        if test -f test/testcompile.sh; then
            SCRIPTDIR=test
        fi
    # not within source tree, not called by 'make', and in 'test' subdir
    elif test -f "../${TEST_SRCDIR}/src/samhain.c"; then
	cd ..
	SCRIPTDIR=test
	TOP_SRCDIR="${TEST_SRCDIR}"; export TOP_SRCDIR
    # within source tree, and not called with 'make testN'
    else
	if test -f ../src/samhain.c; then
	    cd .. 
	    SCRIPTDIR=test
	    TOP_SRCDIR=. 
            export TOP_SRCDIR
	elif test -f ./src/samhain.c; then
	    SCRIPTDIR=test
	    TOP_SRCDIR=.
	    export TOP_SRCDIR
	else
	    echo "Please use --srcdir=DIR, where DIR should be the"
	    echo "top directory in the samhain source tree."
	    exit 1
	fi
    fi
else
    # called by make, or with --srcdir=TOP_SRCDIR
    if   test -f "${TOP_SRCDIR}/src/samhain.c"; then
	SCRIPTDIR="${TOP_SRCDIR}/test"
    elif test -f "../${TOP_SRCDIR}/src/samhain.c"; then
	cd ..; SCRIPTDIR="${TOP_SRCDIR}/test"
    else
	echo "Please use --srcdir=DIR, where DIR should be the"
	echo "top directory in the samhain source tree."
	exit 1
    fi
fi

export SCRIPTDIR

PW_DIR=`pwd`; export PW_DIR

#
# group/world writeable will cause problems
#
chmod go-w .
#
#
#
if test x$UID != x -a x$UID != x0; then
  TRUST="--with-trusted=0,2,$UID"
else
  TRUST="--with-trusted=0,2,1000"
fi
export TRUST
#
# find a good 'make'
#
MAKE=`which gmake`
if test "x$?" = x1 ; then
    MAKE="make -s -j 3"
else
    MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 
    if test "x$MAKE" = x; then
	MAKE="make -s"
    elif test "x$MAKE" = xno; then
	MAKE="make -s"
    else
	if test "x$MAKE" = "xwhich:"; then
		MAKE="make -s"
	else
		MAKE="gmake -s"
		gmake -v >/dev/null 2>&1 || MAKE="make -s"
	fi
    fi
fi
export MAKE

failcount=0
okcount=0
skipcount=0
global_count=0
last_count=0

# args: #test, #total, status, optional msg
log_msg ()
{
    if   [ x"$COLUMNS" != x ]; then
	TERMWIDTH=$COLUMNS
    elif [ x"$COLS" != x ]; then
	TERMWIDTH=$COLS
    else
	TERMWIDTH=80
    fi
    cols=66; 
    #
    if [ $1 -eq 0 ]; then
	msg=" ${4}"
    else
	if [ ${1} -eq 1 ]; then
	    global_count=${last_count}
	fi
	let "v = $1 + global_count" >/dev/null
	last_count=${v}
	dd=''; if [ $v -lt 10 ]; then dd=" "; fi
	dt=''; if [ $2 -lt 10 ]; then dt=" "; fi
	if [ -z "$4" ]; then
	    msg=" test ${dd}${v}/${dt}${2}"
	else
	    msg=" test ${dd}${v}/${dt}${2}    ${4}"
	fi
    fi
    #
    if   [ x"$3" = xfailure ]; then
	ccode=$R
    elif [ x"$3" = xsuccess ]; then
	ccode=$G
    else
	ccode=$B
    fi
    if [ -z "${R}" ]; then
	echo " [${3}] ${msg}"
    else
	# len=${#...} is not bourne shell
	# also, need to account for terminal control sequences
	len=`echo "$msg" | awk '/1;30m/ { print length()-10; }; !/1;30m/ { print length();}'`
	let "cols = cols - len" >/dev/null
	if [ $cols -ge 0 ]; then
	    moveto='['$cols'C'
	    echo "${msg}${moveto}${ccode}[${3}]${E}"
	else
	    echo "${msg}${ccode}[${3}]${E}"
	fi
    fi
}

log_fail () { 
    [ -z "$quiet" ] && log_msg "$1" "$2" failure "$3"; 
    let "failcount = failcount + 1" >/dev/null; 
    test -z "$stoponerr" || exit 1; 
}
log_ok ()   { 
    [ -z "$quiet" ] && log_msg "$1" "$2" success "$3"; 
    let "okcount = okcount + 1" >/dev/null; 
}
log_skip () { 
    [ -z "$quiet" ] && log_msg "$1" "$2" skipped "$3"; 
    let "skipcount = skipcount + 1" >/dev/null; 
}

log_msg_fail () { log_msg 0 0 failure "$1"; }
log_msg_ok ()   { log_msg 0 0 success "$1"; }
log_msg_skip () { log_msg 0 0 skipped "$1"; }

log_start () {
    if [ -z "$quiet" ]; then
	echo; 
	echo "${S}__ START TEST ${1} __${E}"; 
	echo; 
    fi
}
log_end () {
    if [ -n "$verbose" ]; then
	echo; 
	echo "${S}__ END   TEST ${1} __${E}"; 
	echo; 
    fi
}

# This looks silly, but with solaris10/i386 on vmware,
# 'sleep' occasionally does not sleep...

one_sec_sleep () {
    onesdate=`date`
    onestest=0
    while [ $onestest -eq 0 ]; do
	sleep 1
	twosdate=`date`
	if [ "x$twosdate" = "x$onesdate" ]; then 
	    onestest=0
	else
	    onestest=1
	fi
    done
}

five_sec_sleep () {
    for f in 1 2 3 4 5; do
	one_sec_sleep
    done
}

do_cleanup () {
    rm -f testrc_1.dyn
    rm -f testrc_2
    rm -f testrc_22
    rm -f testrc_1ext
    rm -f ./.samhain_file
    rm -f file.*.*-*-*-*-*
    rm -f ./.samhain_log*
    rm -f ./.samhain_lock*
    test -d testrun_testdata && chmod -f -R 0700 testrun_testdata
    test -d .quarantine && rm -rf .quarantine
    rm -rf testrun_testdata
    rm -f test_log_db
    rm -f test_log_prelude
    rm -f test_log_valgrind*
    rm -f test_log_yulectl
    rm -f yule.html
    rm -f yule.html2
    rm -f test_dnmalloc
    rm -f tmp_list_file
    rm -f test_filter.txt
}

print_summary ()
{
    # let "gcount = okcount + skipcount + failcount" >/dev/null;
    gcount=$MAXTEST;
    let "failcount = gcount - okcount - skipcount" >/dev/null;

    [ -z "$quiet" ] && { 
	echo
	echo "__ ${S}Tests: ${gcount}  Ok: ${okcount} Skipped: ${skipcount} Failed: ${failcount}${E}"
    }
    if [ $failcount -eq 0 ]; then
	[ -z "$quiet" ] && { echo "__ ${G}All tests passed successfully.${E}"; echo; }
    elif [ $failcount -eq 1 ]; then
	[ -z "$quiet" ] && { echo "__ ${R}There was 1 failure.${E}"; echo; }
    else
	[ -z "$quiet" ] && { echo "__ ${R}There were $failcount failures.${E}"; echo; }
    fi
    [ -z "$cleanup" ] || do_cleanup;
}

find_path () { (   
    save_IFS=$IFS; IFS=:

    for dir in $PATH; do
	IFS=$as_save_IFS
	test -z "$dir" && dir=.
	if test -f "$dir/$1"; then
	    echo "$dir/$1";
	    break;
	fi
    done
    IFS=${save_IFS};
); }

find_hostname () {

    uname -a | grep Linux >/dev/null
    if [ $? -eq 0 ]; then
	tmp=`hostname -f 2>/dev/null`
	if [ $? -ne 0 ]; then
	    tmp=`hostname 2>/dev/null`
	fi
    else
	tmp=`hostname 2>/dev/null`
    fi
    if [ -z "$tmp" ]; then
	tmp="localhost"
    fi
    #
    # first one is hostname, others are aliases
    #
    tmp2=`cat /etc/hosts | egrep "^ *[0123456789].* $tmp" | awk '{ print $2 }'`
    if [ -z "$tmp2" ]; then
	echo "$tmp"
    else
	echo "$tmp2"
    fi
}

rm -f ./test_log

# first one is hostname, others are aliases
#
hostname=`cat /etc/hosts | egrep "^ *127.0.0.1" | awk '{ print $2 }'`
if [ x"$hostname" = xlocalhost ]; then
    hostname="127.0.0.1"
fi

# Seems that 'valgrind' causes random hangs :-(
#
if [ -z "$usevalgrind" ]; then
    VALGRIND=
else
    VALGRIND=`find_path valgrind`;
fi
[ -z "$VALGRIND" ] || { 
    VALGRIND="$VALGRIND --quiet --tool=memcheck --suppressions=.test.supp"; 
    export VALGRIND;
    [ -z "$verbose" ] || log_msg_ok "using valgrind"
cat > ".test.supp" <<End-of-data
#
# there are unitialized bytes in the struct...
#
{
   pushdata_01
   Memcheck:Param
   write(buf)
   obj:/lib/ld-*.so
   fun:sh_hash_pushdata
   fun:sh_files_filecheck
   fun:sh_dirs_chk
}
{
   pushdata_02
   Memcheck:Param
   write(buf)
   obj:/lib/ld-*.so
   fun:sh_hash_pushdata
   fun:sh_files_filecheck
   fun:sh_files_checkdir
}
{
   pushdata_03
   Memcheck:Param
   write(buf)
   obj:/lib/ld-*.so
   fun:sh_hash_pushdata
   fun:sh_hash_writeout
   fun:main
}

End-of-data
}

if test x$1 = x1; then
    . ${SCRIPTDIR}/testcompile.sh
    testcompile
    print_summary
    exit $?
fi
if test x$1 = x2; then
    . ${SCRIPTDIR}/testhash.sh
    testhash
    print_summary
    exit $?
fi
if test x$1 = x3; then
    . ${SCRIPTDIR}/testrun_1.sh
    testrun1
    print_summary
    exit $?
fi
if test x$1 = x4; then
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1a.sh
    testrun1a
    print_summary
    exit $?
fi
if test x$1 = x5; then
    . ${SCRIPTDIR}/testext.sh
    testext0
    print_summary
    exit $?
fi
if test x$1 = x6; then
    . ${SCRIPTDIR}/testtimesrv.sh
    testtime0
    print_summary
    exit $?
fi
if test x$1 = x7; then
    . ${SCRIPTDIR}/testrun_1b.sh
    testrun1b
    print_summary
    exit $?
fi
if test x$1 = x8; then
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1c.sh
    testrun1c
    print_summary
    exit $?
fi
if test x$1 = x9; then
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1d.sh
    testrun1d
    print_summary
    exit $?
fi
if test x$1 = x10; then
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1e.sh
    testrun1e
    print_summary
    exit $?
fi
if test x$1 = x11; then
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1f.sh
    testrun1f
    print_summary
    exit $?
fi
if test x$1 = x12; then
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1g.sh
    testrun1g
    print_summary
    exit $?
fi
if test x$1 = x13; then
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1h.sh
    testrun1h
    print_summary
    exit $?
fi
if test x$1 = x20; then
    . ${SCRIPTDIR}/testrun_2.sh 
    testrun2 $hostname
    print_summary
    exit $?
fi
if test x$1 = x21; then
    . ${SCRIPTDIR}/testrun_2a.sh
    testrun2a $hostname
    print_summary
    exit $?
fi
if test x$1 = x22; then
    . ${SCRIPTDIR}/testrun_2a.sh
    . ${SCRIPTDIR}/testrun_2b.sh
    testrun2b $hostname
    print_summary
    exit $?
fi
if test x$1 = x23; then
    . ${SCRIPTDIR}/testrun_2a.sh
    . ${SCRIPTDIR}/testrun_2c.sh 
    testrun2c $hostname
    print_summary
    exit $?
fi
if test x$1 = x24; then
    . ${SCRIPTDIR}/testrun_2a.sh
    . ${SCRIPTDIR}/testrun_2d.sh
    testrun2d $hostname
    print_summary
    exit $?
fi
if test x$1 = x25; then
    . ${SCRIPTDIR}/testrun_2e.sh
    testrun2e $hostname
    print_summary
    exit $?
fi
if test x$1 = x26; then
    . ${SCRIPTDIR}/testrun_2f.sh
    testrun2f $hostname
    print_summary
    exit $?
fi
if test x$1 = x27; then
    . ${SCRIPTDIR}/testrun_2g.sh
    testrun2g $hostname
    print_summary
    exit $?
fi
if test x$1 = xall; then
    TEST_MAX=0
    . ${SCRIPTDIR}/testcompile.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testhash.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_1.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_1a.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testext.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testtimesrv.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_1b.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_1c.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_1d.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_1e.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_1f.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_1g.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_1h.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_2.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_2a.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_2b.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_2c.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_2d.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_2e.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_2f.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    . ${SCRIPTDIR}/testrun_2g.sh
    let "TEST_MAX = TEST_MAX + MAXTEST" >/dev/null
    #
    # ${SCRIPTDIR}/testtimesrv.sh
    # ${SCRIPTDIR}/testrun_1b.sh
    # ${SCRIPTDIR}/testrun_2.sh $2
    # ${SCRIPTDIR}/testrun_2a.sh $2
    #
    MAXTEST=${TEST_MAX}; export MAXTEST
    testcompile
    testhash
    #
    . ${SCRIPTDIR}/testrun_1.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun1
    #
    . ${SCRIPTDIR}/testrun_1a.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun1a
    #
    testext0
    #
    . ${SCRIPTDIR}/testtimesrv.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testtime0
    #
    . ${SCRIPTDIR}/testrun_1b.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun1b
    #
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1c.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun1c
    #
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1d.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun1d
    #
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1e.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun1e
    #
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1f.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun1f
    #
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1g.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun1g
    #
    . ${SCRIPTDIR}/testrun_1.sh
    . ${SCRIPTDIR}/testrun_1h.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun1h
    #
    . ${SCRIPTDIR}/testrun_2.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun2 $hostname
    #
    . ${SCRIPTDIR}/testrun_2a.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun2a $hostname
    #
    . ${SCRIPTDIR}/testrun_2b.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun2b $hostname
    #
    . ${SCRIPTDIR}/testrun_2c.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun2c $hostname
    #
    . ${SCRIPTDIR}/testrun_2d.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun2d $hostname
    #
    . ${SCRIPTDIR}/testrun_2e.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun2e $hostname
    #
    . ${SCRIPTDIR}/testrun_2f.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun2f $hostname
    #
    . ${SCRIPTDIR}/testrun_2g.sh
    MAXTEST=${TEST_MAX}; export MAXTEST
    testrun2g $hostname
    #
    print_summary
    exit 0
fi

usage;

exit 1;

# gpg -a --clearsign --not-dash-escaped testrc.gpg
# gpg -a --clearsign --not-dash-escaped .samhain_file
# tar czvf foo.tgz testrc.gpg.asc .samhain_file.asc
# cat foo.tgz >>test/test.sh

__ARCHIVE_FOLLOWS__
�p{U�=l�F���!s�-di�D&%�r#Q��֗نQ0҉b���d+Kеk��@75k塀l}!KaD��:�C=��Ղ��ؖRA
8M������w��;َ��(�#��R�1�ܜ[2?=^�0�@�b�~��^��R4�cX����3I�vdBʒUY������)7]nbD�11�QBpIH&yQ6�E��/��"��tB�&����p�,B�,�bL��	K�Rse��U�ȶe6xDZ�{Eٛ �j��EN�k�0h!Y��P3�ɾqG(k�i;P)ʖl8��:�Qml����J�T��1��6�Jj�cR��릓�.	%d8I�:�7���
�@s�9!1�R��eC+O�gM�޾�Q�B�i�I�b����5�ۖ-�\M��}.�T��T#g�+���c4l`g6���jg�x���υ�e[ӆ�b�z�p�9�ƒjg6AHF�i�nxV��+�G����#��Ү�@��e���4��Q�,;�4H��i9ᢦ����># �ڱ�z
�+nh�����&SN0�ZI�8��h8�‹Zb<^�~$J+�Q�(�|��ݎ���vzY��������w;����tŽ�|:}O�㟗Ҵ�^�_��J�to	,�R"���(�����|#�r"�z� ����_���ǖ�<Nm����%]��Ͼ:����,�3�v�?K�I������o?���c��`�{҇��;C]�eT��^^q��N��T�p�P�����7]=<�kPqj�
��?�/OP�ãӧ�&�|9=�������̨���0�k!�D�/��q��Me�2����t�[��f��k����n���4v[��~���oW�:m�7�z�Z
�z�"������&���墣�w_��S�n�h�8ui�����N���k�;�j��ݯ�tk��f�W�7v��^�^�v��ǻ�N���N��z������-�5�OA�_��j����V���(�������$���ﮢ�
��^HM�b[�y'��h�I��w5o2��b!f|81��|�o
�@ �@ �@ ��.�7�<̐(