[2827] | 1 | #!/bin/sh |
---|
| 2 | ## |
---|
| 3 | ## TEST.sh |
---|
| 4 | ## Login : <uli@pu.smp.net> |
---|
| 5 | ## Started on Thu Nov 29 22:59:10 2007 Uli Fouquet |
---|
| 6 | ## $Id$ |
---|
| 7 | ## |
---|
| 8 | ## Copyright (C) 2007 Uli Fouquet |
---|
| 9 | ## This program is free software; you can redistribute it and/or modify |
---|
| 10 | ## it under the terms of the GNU General Public License as published by |
---|
| 11 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 12 | ## (at your option) any later version. |
---|
| 13 | ## |
---|
| 14 | ## This program is distributed in the hope that it will be useful, |
---|
| 15 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | ## GNU General Public License for more details. |
---|
| 18 | ## |
---|
| 19 | ## You should have received a copy of the GNU General Public License |
---|
| 20 | ## along with this program; if not, write to the Free Software |
---|
| 21 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 22 | ## |
---|
| 23 | |
---|
| 24 | ## |
---|
| 25 | ## This is a test script, to check the scripts, that generate SQL |
---|
| 26 | ## compatible output from logfiles. The output can be feeded to PostGres DB. |
---|
| 27 | ## |
---|
| 28 | |
---|
| 29 | ## Simply run |
---|
| 30 | ## |
---|
| 31 | ## ./TEST.sh |
---|
| 32 | ## |
---|
| 33 | ## and hope that everything works. |
---|
| 34 | ## |
---|
| 35 | ## This scipt tests only the output format of scripts. It does not send |
---|
| 36 | ## data to the database or similar. |
---|
| 37 | ## |
---|
| 38 | |
---|
| 39 | PYZ2=../usr/local/lib/z2log.py |
---|
| 40 | PYACCESS=../usr/local/lib/zaccess-nginx.py |
---|
| 41 | AWKZEVENTS=../usr/local/lib/zevents.awk |
---|
| 42 | |
---|
| 43 | Z2LOG=Z2.log |
---|
| 44 | ACCESSLOG1=access.log |
---|
| 45 | ACCESSLOG2=access-staff.log |
---|
| 46 | EVENTLOG1=event.log |
---|
| 47 | EVENTLOG2=event-staff.log |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | echo "CHECKING EVENTLOG-PARSER OUTPUT 1" |
---|
| 51 | cat $EVENTLOG1 | gawk -v SQL=1 -f $AWKZEVENTS > $EVENTLOG1.result |
---|
| 52 | diff $EVENTLOG1.test $EVENTLOG1.result |
---|
| 53 | RESULT=$? |
---|
| 54 | if [ $RESULT -ne 0 ]; then |
---|
| 55 | echo "FAILED" |
---|
| 56 | echo "Expected output in "$EVENTLOG1.test |
---|
| 57 | echo "Wrong output in "$EVENTLOG1.result |
---|
| 58 | else |
---|
| 59 | echo "OK" |
---|
| 60 | fi |
---|
| 61 | |
---|
| 62 | echo "CHECKING EVENTLOG-PARSER OUTPUT 2" |
---|
| 63 | cat $EVENTLOG2 | gawk -v SQL=1 -f $AWKZEVENTS > $EVENTLOG2.result |
---|
| 64 | diff $EVENTLOG2.test $EVENTLOG2.result |
---|
| 65 | RESULT=$? |
---|
| 66 | if [ $RESULT -ne 0 ]; then |
---|
| 67 | echo "FAILED" |
---|
| 68 | echo "Expected output in "$EVENTLOG2.test |
---|
| 69 | echo "Wrong output in "$EVENTLOG2.result |
---|
| 70 | else |
---|
| 71 | echo "OK" |
---|
| 72 | fi |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | echo "CHECKING Z2-LOG-PARSER OUTPUT" |
---|
| 76 | cat $Z2LOG | python $PYZ2 > $Z2LOG.result |
---|
| 77 | diff $Z2LOG.test $Z2LOG.result |
---|
| 78 | RESULT=$? |
---|
| 79 | if [ $RESULT -ne 0 ]; then |
---|
| 80 | echo "FAILED" |
---|
| 81 | echo "Expected output in "$Z2LOG.test |
---|
| 82 | echo "Wrong output in "$Z2LOG.result |
---|
| 83 | else |
---|
| 84 | echo "OK" |
---|
| 85 | fi |
---|
| 86 | |
---|
| 87 | echo "CHECKING ACCESSPARSER OUTPUT 1" |
---|
| 88 | cat $ACCESSLOG1 | python $PYACCESS > $ACCESSLOG1.result |
---|
| 89 | diff $ACCESSLOG1.test $ACCESSLOG1.result |
---|
| 90 | RESULT=$? |
---|
| 91 | if [ $RESULT -ne 0 ]; then |
---|
| 92 | echo "FAILED" |
---|
| 93 | echo "Expected output in "$ACCESSLOG1.test |
---|
| 94 | echo "Wrong output in "$ACCESSLOG1.result |
---|
| 95 | else |
---|
| 96 | echo "OK" |
---|
| 97 | fi |
---|
| 98 | |
---|
| 99 | echo "CHECKING ACCESSPARSER OUTPUT 2" |
---|
| 100 | cat $ACCESSLOG2 | python $PYACCESS > $ACCESSLOG2.result |
---|
| 101 | diff $ACCESSLOG2.test $ACCESSLOG2.result |
---|
| 102 | RESULT=$? |
---|
| 103 | if [ $RESULT -ne 0 ]; then |
---|
| 104 | echo "FAILED" |
---|
| 105 | else |
---|
| 106 | echo "OK" |
---|
| 107 | fi |
---|
| 108 | |
---|
| 109 | |
---|