source: trunk/test/testhash.sh@ 467

Last change on this file since 467 was 378, checked in by katerina, 13 years ago

Fix for tickets #273 (deadlock), #274 (compile errors), #275 (makefile), #276 (config.sub, config.guess).

File size: 4.4 KB
RevLine 
[1]1#! /bin/sh
2
[27]3#
4# Copyright Rainer Wichmann (2006)
5#
6# License Information:
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20#
21
[19]22RCFILE="$PW_DIR/testrc_1.dyn"; export RCFILE
23LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
[1]24
[159]25MAXTEST=2; export MAXTEST
[1]26
27testhash ()
28{
[19]29 log_start "HASH FUNCTION"
[257]30
31 C_LOGFILE=""
32
33 ls /lib/libpcre* >/dev/null 2>&1
34 if [ $? -eq 0 ]; then
35 C_LOGFILE=" --enable-logfile-monitor "
36 else
37 ls /usr/lib/libpcre* >/dev/null 2>&1
38 if [ $? -eq 0 ]; then
39 C_LOGFILE=" --enable-logfile-monitor "
40 else
[378]41 ls /usr/lib/*/libpcre* >/dev/null 2>&1
42 if [ $? -eq 0 ]; then
43 C_LOGFILE=" --enable-logfile-monitor "
44 else
45 ls /usr/local/lib/libpcre* >/dev/null 2>&1
46 if [ $? -eq 0 ]; then
47 C_LOGFILE=" --enable-logfile-monitor "
48 fi
49 fi
[257]50 fi
51 fi
52 if [ x"${C_LOGFILE}" = x ]; then
53 log_msg_ok "Not testing --enable-logfile-monitor";
54 fi
55
[1]56 #
57 # test standalone compilation
58 #
59 TEST="${S}standalone agent${E}"
60 #
61 if test -r "Makefile"; then
62 $MAKE distclean
63 fi
64 #
[371]65 ${TOP_SRCDIR}/configure --enable-debug=gdb --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-db-reload '--enable-login-watch' '--enable-mounts-check' ${C_LOGFILE} '--enable-port-check' '--enable-suidcheck' '--with-rnd=unix'
[1]66 #
[19]67 fail=0
68 #
[1]69 if test x$? = x0; then
[19]70 [ -z "$verbose" ] || log_msg_ok "configure...";
[1]71 $MAKE > /dev/null 2>> test_log
72 if test x$? = x0; then
[19]73 [ -z "$verbose" ] || log_msg_ok "make...";
[1]74 else
[19]75 [ -z "$quiet" ] && log_msg_fail "make...";
76 fail=1
[1]77 fi
78 else
[19]79 [ -z "$quiet" ] && log_msg_fail "configure...";
80 fail=1
[1]81 fi
[19]82 #
83 if [ $fail -eq 1 ]; then
84 [ -z "$quiet" ] && log_fail 1 ${MAXTEST};
85 return 1
86 fi
87 #
[1]88 echo "Test results of the TIGER hash algorithm" > testhash.tmp
89 echo >> testhash.tmp
90 echo "(use samhain -H string to test)" >> testhash.tmp
91 echo >> testhash.tmp
92 ./samhain -H "" >> testhash.tmp
93 ./samhain -H "abc" >> testhash.tmp
94 ./samhain -H "Tiger" >> testhash.tmp
95 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" >> testhash.tmp
96 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789" >> testhash.tmp
97 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham" >> testhash.tmp
98 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge." >> testhash.tmp
99 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge, 1996." >> testhash.tmp
100 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" >> testhash.tmp
[19]101 #
102 RESU=`diff testhash.tmp ${SCRIPTDIR}/testtiger.txt 2>/dev/null`
[1]103 if test "x${RESU}" = "x"; then
[19]104 [ -z "$quiet" ] && log_ok 1 ${MAXTEST};
[1]105 else
[19]106 [ -z "$quiet" ] && log_fail 1 ${MAXTEST};
107 return 1
[1]108 fi
[159]109 #
110 #
111 #
112 TEST="${S}files${E}"
113 #
114 case $SCRIPTDIR in
115 /*)
116 testpath="${SCRIPTDIR}/testtiger.txt";;
117 *)
118 testpath="`pwd`/${SCRIPTDIR}/testtiger.txt";;
119 esac
120 #
121 RESU=`./samhain -H ${testpath}`
122 #
123 if test x"$RESU" = x"${testpath}: 8125E439 4E7E20F9 24FD8E37 BC4D90C7 FC67F40C 1681F05D"; then
124 [ -z "$quiet" ] && log_ok 2 ${MAXTEST};
125 else
126 [ -z "$quiet" ] && log_fail 2 ${MAXTEST};
127 return 1
128 fi
129 #
[19]130 log_end "HASH FUNCTION"
131 return 0
[1]132}
133
134
135
Note: See TracBrowser for help on using the repository browser.