source: WAeUP_SysConf/logging/trunk/tests/TEST.sh @ 3586

Last change on this file since 3586 was 2827, checked in by uli, 17 years ago

Added test script to check logfile parser functionality.

  • Property svn:executable set to *
File size: 2.8 KB
RevLine 
[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
39PYZ2=../usr/local/lib/z2log.py
40PYACCESS=../usr/local/lib/zaccess-nginx.py
41AWKZEVENTS=../usr/local/lib/zevents.awk
42
43Z2LOG=Z2.log
44ACCESSLOG1=access.log
45ACCESSLOG2=access-staff.log
46EVENTLOG1=event.log
47EVENTLOG2=event-staff.log
48
49
50echo "CHECKING EVENTLOG-PARSER OUTPUT 1"
51cat $EVENTLOG1 | gawk -v SQL=1 -f $AWKZEVENTS > $EVENTLOG1.result
52diff $EVENTLOG1.test $EVENTLOG1.result
53RESULT=$?
54if [ $RESULT -ne 0 ]; then
55    echo "FAILED"
56    echo "Expected output in "$EVENTLOG1.test
57    echo "Wrong output in "$EVENTLOG1.result
58else
59    echo "OK"
60fi
61
62echo "CHECKING EVENTLOG-PARSER OUTPUT 2"
63cat $EVENTLOG2 | gawk -v SQL=1 -f $AWKZEVENTS > $EVENTLOG2.result
64diff $EVENTLOG2.test $EVENTLOG2.result
65RESULT=$?
66if [ $RESULT -ne 0 ]; then
67    echo "FAILED"
68    echo "Expected output in "$EVENTLOG2.test
69    echo "Wrong output in "$EVENTLOG2.result
70else
71    echo "OK"
72fi
73
74
75echo "CHECKING Z2-LOG-PARSER OUTPUT"
76cat $Z2LOG | python $PYZ2 > $Z2LOG.result
77diff $Z2LOG.test $Z2LOG.result
78RESULT=$?
79if [ $RESULT -ne 0 ]; then
80    echo "FAILED"
81    echo "Expected output in "$Z2LOG.test
82    echo "Wrong output in "$Z2LOG.result
83else
84    echo "OK"
85fi
86
87echo "CHECKING ACCESSPARSER OUTPUT 1"
88cat $ACCESSLOG1 | python $PYACCESS > $ACCESSLOG1.result
89diff $ACCESSLOG1.test $ACCESSLOG1.result
90RESULT=$?
91if [ $RESULT -ne 0 ]; then
92    echo "FAILED"
93    echo "Expected output in "$ACCESSLOG1.test
94    echo "Wrong output in "$ACCESSLOG1.result
95else
96    echo "OK"
97fi
98
99echo "CHECKING ACCESSPARSER OUTPUT 2"
100cat $ACCESSLOG2 | python $PYACCESS > $ACCESSLOG2.result
101diff $ACCESSLOG2.test $ACCESSLOG2.result
102RESULT=$?
103if [ $RESULT -ne 0 ]; then
104    echo "FAILED"
105else
106    echo "OK"
107fi
108
109
Note: See TracBrowser for help on using the repository browser.