[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] | 22 | SERVER_BUILDOPTS="--quiet $TRUST --enable-xml-log --enable-debug --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST} --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-database=mysql"; export SERVER_BUILDOPTS
|
---|
[1] | 23 |
|
---|
[30] | 24 | CLIENT_BUILDOPTS="--quiet $TRUST --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
|
---|
[1] | 25 |
|
---|
[19] | 26 | check_mysql_log () {
|
---|
| 27 | DATE="$1"
|
---|
[1] | 28 |
|
---|
[19] | 29 | rm -f test_log_db
|
---|
| 30 | echo "SELECT * FROM log WHERE entry_status = 'NEW' and log_time > '"${DATE}"';" | mysql --password=samhain -u samhain samhain >test_log_db
|
---|
| 31 | #
|
---|
| 32 | egrep "START.*Yule" test_log_db >/dev/null 2>&1
|
---|
| 33 | if [ $? -ne 0 ]; then
|
---|
| 34 | [ -z "$verbose" ] || log_msg_fail "Server start";
|
---|
| 35 | return 1
|
---|
[1] | 36 | fi
|
---|
[19] | 37 | egrep "NEW CLIENT" test_log_db >/dev/null 2>&1
|
---|
| 38 | if [ $? -ne 0 ]; then
|
---|
| 39 | [ -z "$verbose" ] || log_msg_fail "Client connect";
|
---|
| 40 | return 1
|
---|
| 41 | fi
|
---|
| 42 | egrep "Checking.*/bin" test_log_db >/dev/null 2>&1
|
---|
| 43 | if [ $? -ne 0 ]; then
|
---|
| 44 | [ -z "$verbose" ] || log_msg_fail "Client file check";
|
---|
| 45 | return 1
|
---|
| 46 | fi
|
---|
| 47 | egrep "EXIT.*Samhain" test_log_db >/dev/null 2>&1
|
---|
| 48 | if [ $? -ne 0 ]; then
|
---|
| 49 | [ -z "$verbose" ] || log_msg_fail "Client exit";
|
---|
| 50 | return 1
|
---|
| 51 | fi
|
---|
| 52 | egrep "EXIT.*Yule.*SIGTERM" test_log_db >/dev/null 2>&1
|
---|
| 53 | if [ $? -ne 0 ]; then
|
---|
| 54 | [ -z "$verbose" ] || log_msg_fail "Server exit";
|
---|
| 55 | return 1
|
---|
| 56 | fi
|
---|
| 57 | return 0
|
---|
| 58 | }
|
---|
[1] | 59 |
|
---|
[19] | 60 | MAXTEST=1; export MAXTEST
|
---|
[1] | 61 |
|
---|
| 62 | testrun2c ()
|
---|
| 63 | {
|
---|
[19] | 64 | log_start "RUN FULL CLIENT/SERVER W/MYSQL"
|
---|
| 65 | #
|
---|
| 66 | if [ -z "$doall" ]; then
|
---|
| 67 | log_skip 1 $MAXTEST 'Client/server w/mysql (or use --really-all)'
|
---|
| 68 | return 0
|
---|
| 69 | fi
|
---|
| 70 | if [ x"$1" = x ]; then
|
---|
| 71 | [ -z "$quiet" ] && log_msg_fail "Missing hostname"
|
---|
| 72 | fi
|
---|
| 73 | MYSQL=`find_path mysql`
|
---|
| 74 | if [ -z "$MYSQL" ]; then
|
---|
| 75 | log_skip 1 $MAXTEST "mysql not found";
|
---|
| 76 | return 1
|
---|
| 77 | else
|
---|
| 78 | TEST=`echo "DESCRIBE log;" | mysql --password=samhain -u samhain samhain 2>/dev/null`
|
---|
| 79 | if [ $? -ne 0 -o -z "$TEST" ]; then
|
---|
| 80 | log_skip 1 $MAXTEST "mysql not default setup"
|
---|
| 81 | return 1
|
---|
[1] | 82 | fi
|
---|
[19] | 83 | fi
|
---|
| 84 | #
|
---|
| 85 | SH_LOCALHOST=$1; export SH_LOCALHOST
|
---|
| 86 | #
|
---|
| 87 | DATE=`date '+%Y-%m-%d %T'`
|
---|
| 88 | #
|
---|
| 89 | testrun2a_internal
|
---|
| 90 | #
|
---|
| 91 | ORIGINAL="DatabaseSeverity=none"
|
---|
| 92 | REPLACEMENT="DatabaseSeverity=info"
|
---|
[51] | 93 | ex -s $RCFILE <<EOF
|
---|
[30] | 94 | %s/$ORIGINAL/$REPLACEMENT/g
|
---|
| 95 | wq
|
---|
[19] | 96 | EOF
|
---|
| 97 | #
|
---|
| 98 | do_test_1_a
|
---|
| 99 | if [ $? -ne 0 ]; then
|
---|
| 100 | [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client/server w/mysql";
|
---|
| 101 | else
|
---|
| 102 | #
|
---|
| 103 | check_mysql_log "${DATE}"
|
---|
| 104 | if [ $? -ne 0 ]; then
|
---|
| 105 | [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client/server w/mysql";
|
---|
[1] | 106 | else
|
---|
[19] | 107 | [ -z "$quiet" ] && log_ok 1 ${MAXTEST} "Client/server w/mysql";
|
---|
[1] | 108 | fi
|
---|
[19] | 109 | fi
|
---|
| 110 | #
|
---|
| 111 | if [ -n "$cleanup" ]; then
|
---|
[1] | 112 | rm -f ./rc.${SH_LOCALHOST}
|
---|
| 113 | rm -f ./file.${SH_LOCALHOST}
|
---|
[19] | 114 | ALTHOST=`find_hostname`
|
---|
| 115 | rm -f "./file.${ALTHOST}"
|
---|
| 116 | rm -f "./rc.${ALTHOST}"
|
---|
| 117 | fi
|
---|
| 118 | #
|
---|
| 119 | log_end "RUN FULL CLIENT/SERVER W/MYSQL"
|
---|
[1] | 120 | }
|
---|
| 121 |
|
---|