Changeset 19 for trunk/test/testhash.sh
- Timestamp:
- Feb 12, 2006, 10:49:56 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/testhash.sh
r1 r19 1 1 #! /bin/sh 2 2 3 RCFILE="$PW_DIR/testrc_1.dyn"; export RCFILE 4 LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE 3 5 4 # The following two are the ANSI sequences for start and end embolden 5 case $TERM in 6 vt*|ansi*|con*|xterm*|linux*|screen*) 7 S=[1m 8 E=[m 9 ;; 10 *) 11 S= 12 E= 13 ;; 14 esac 15 16 PW_DIR=`pwd` 17 18 if test x$UID != x; then 19 TRUST="--with-trusted=0,2,$UID" 20 else 21 TRUST="--with-trusted=0,2" 22 fi 23 24 #echo; echo "${S}__ STARTING TEST HASH FUNCTION __${E}"; echo; 25 #echo Working directory: $PW_DIR 26 27 MAKE=`which gmake` 28 if test "x$?" = x1 ; then 29 MAKE="make -s" 30 else 31 MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"` 32 if test "x$MAKE" = x; then 33 MAKE="make -s" 34 elif test "x$MAKE" = xno; then 35 MAKE="make -s" 36 else 37 if test "x$MAKE" = "xwhich:"; then 38 MAKE="make -s" 39 else 40 MAKE="gmake -s" 41 gmake -v >/dev/null 2>&1 || MAKE="make -s" 42 fi 43 fi 44 fi 45 46 6 MAXTEST=1; export MAXTEST 47 7 48 8 testhash () 49 9 { 10 log_start "HASH FUNCTION" 50 11 # 51 12 # test standalone compilation … … 57 18 fi 58 19 # 59 ${TOP_SRCDIR}/configure --quiet --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log 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 60 23 # 61 24 if test x$? = x0; then 62 echo "PASS: configure ${TEST}";25 [ -z "$verbose" ] || log_msg_ok "configure..."; 63 26 $MAKE > /dev/null 2>> test_log 64 27 if test x$? = x0; then 65 echo "PASS: $MAKE ${TEST}";28 [ -z "$verbose" ] || log_msg_ok "make..."; 66 29 else 67 echo "FAIL: $MAKE ${TEST} (see ./test_log)"; 30 [ -z "$quiet" ] && log_msg_fail "make..."; 31 fail=1 68 32 fi 69 33 else 70 echo "FAIL: configure ${TEST} (see ./test_log)"; 34 [ -z "$quiet" ] && log_msg_fail "configure..."; 35 fail=1 71 36 fi 72 37 # 38 if [ $fail -eq 1 ]; then 39 [ -z "$quiet" ] && log_fail 1 ${MAXTEST}; 40 return 1 41 fi 42 # 73 43 echo "Test results of the TIGER hash algorithm" > testhash.tmp 74 44 echo >> testhash.tmp … … 84 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 85 55 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" >> testhash.tmp 86 87 # echo 88 # echo "${S}diff testhash.tmp testtiger.txt (empty == success):${E}" 89 # echo 90 RESU=`diff testhash.tmp ${SCRIPTDIR}/testtiger.txt` 56 # 57 RESU=`diff testhash.tmp ${SCRIPTDIR}/testtiger.txt 2>/dev/null` 91 58 if test "x${RESU}" = "x"; then 92 echo "PASS: test_hash"59 [ -z "$quiet" ] && log_ok 1 ${MAXTEST}; 93 60 else 94 echo "FAIL: test_hash" 61 [ -z "$quiet" ] && log_fail 1 ${MAXTEST}; 62 return 1 95 63 fi 64 log_end "HASH FUNCTION" 65 return 0 96 66 } 97 67 98 68 99 69 100 testhash101 102 103 #echo; echo "${S}__ END TEST HASH FUNCTION __${E}"; echo;104 105 exit106
Note:
See TracChangeset
for help on using the changeset viewer.