source: trunk/test/testhash.sh@ 25

Last change on this file since 25 was 19, checked in by rainer, 19 years ago

Rewrite of test suite, checksum for growing logs, fix for minor bug with dead client detection.

File size: 2.2 KB
Line 
1#! /bin/sh
2
3RCFILE="$PW_DIR/testrc_1.dyn"; export RCFILE
4LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
5
6MAXTEST=1; export MAXTEST
7
8testhash ()
9{
10 log_start "HASH FUNCTION"
11 #
12 # test standalone compilation
13 #
14 TEST="${S}standalone agent${E}"
15 #
16 if test -r "Makefile"; then
17 $MAKE distclean
18 fi
19 #
20 ${TOP_SRCDIR}/configure --quiet $TRUST --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file --enable-debug
21 #
22 fail=0
23 #
24 if test x$? = x0; then
25 [ -z "$verbose" ] || log_msg_ok "configure...";
26 $MAKE > /dev/null 2>> test_log
27 if test x$? = x0; then
28 [ -z "$verbose" ] || log_msg_ok "make...";
29 else
30 [ -z "$quiet" ] && log_msg_fail "make...";
31 fail=1
32 fi
33 else
34 [ -z "$quiet" ] && log_msg_fail "configure...";
35 fail=1
36 fi
37 #
38 if [ $fail -eq 1 ]; then
39 [ -z "$quiet" ] && log_fail 1 ${MAXTEST};
40 return 1
41 fi
42 #
43 echo "Test results of the TIGER hash algorithm" > testhash.tmp
44 echo >> testhash.tmp
45 echo "(use samhain -H string to test)" >> testhash.tmp
46 echo >> testhash.tmp
47 ./samhain -H "" >> testhash.tmp
48 ./samhain -H "abc" >> testhash.tmp
49 ./samhain -H "Tiger" >> testhash.tmp
50 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" >> testhash.tmp
51 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789" >> testhash.tmp
52 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham" >> testhash.tmp
53 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge." >> testhash.tmp
54 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge, 1996." >> testhash.tmp
55 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" >> testhash.tmp
56 #
57 RESU=`diff testhash.tmp ${SCRIPTDIR}/testtiger.txt 2>/dev/null`
58 if test "x${RESU}" = "x"; then
59 [ -z "$quiet" ] && log_ok 1 ${MAXTEST};
60 else
61 [ -z "$quiet" ] && log_fail 1 ${MAXTEST};
62 return 1
63 fi
64 log_end "HASH FUNCTION"
65 return 0
66}
67
68
69
Note: See TracBrowser for help on using the repository browser.