source: trunk/test/testhash.sh@ 22

Last change on this file since 22 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
RevLine 
[1]1#! /bin/sh
2
[19]3RCFILE="$PW_DIR/testrc_1.dyn"; export RCFILE
4LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
[1]5
[19]6MAXTEST=1; export MAXTEST
[1]7
8testhash ()
9{
[19]10 log_start "HASH FUNCTION"
[1]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 #
[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
[1]21 #
[19]22 fail=0
23 #
[1]24 if test x$? = x0; then
[19]25 [ -z "$verbose" ] || log_msg_ok "configure...";
[1]26 $MAKE > /dev/null 2>> test_log
27 if test x$? = x0; then
[19]28 [ -z "$verbose" ] || log_msg_ok "make...";
[1]29 else
[19]30 [ -z "$quiet" ] && log_msg_fail "make...";
31 fail=1
[1]32 fi
33 else
[19]34 [ -z "$quiet" ] && log_msg_fail "configure...";
35 fail=1
[1]36 fi
[19]37 #
38 if [ $fail -eq 1 ]; then
39 [ -z "$quiet" ] && log_fail 1 ${MAXTEST};
40 return 1
41 fi
42 #
[1]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
[19]56 #
57 RESU=`diff testhash.tmp ${SCRIPTDIR}/testtiger.txt 2>/dev/null`
[1]58 if test "x${RESU}" = "x"; then
[19]59 [ -z "$quiet" ] && log_ok 1 ${MAXTEST};
[1]60 else
[19]61 [ -z "$quiet" ] && log_fail 1 ${MAXTEST};
62 return 1
[1]63 fi
[19]64 log_end "HASH FUNCTION"
65 return 0
[1]66}
67
68
69
Note: See TracBrowser for help on using the repository browser.