Test case for apache error log
[gnucomo.git] / test / read_apache_error
1 #!/bin/sh
2
3 #
4 #  Create an object 'example1.gnucomo.test' in the database and
5 #  parse a piece of an apache error log file.
6 #  This tests normal operation in which gcm_input reads a error log file
7 #  directly.
8
9
10 rm -f gcm_input.log
11
12 createdb gnucomo_test
13
14 if psql gnucomo_test -q <../src/database/create.sql >/dev/null
15 then
16    psql gnucomo_test -q -c "insert into object (objectname) values ('example1.gnucomo.test')"
17    ../src/gcm_input/gcm_input -v -c gnucomo_test -h example1.gnucomo.test -d 'dec 5 2007 15:30:45' <apache_error.1.log
18    ../src/gcm_input/gcm_input -v -c gnucomo_test -h example1.gnucomo.test -d 'sep 5 2002 20:30:45' <apache_error.2.log
19    ../src/gcm_input/gcm_input -v -c gnucomo_test -h example1.gnucomo.test -d 'sep 9 2020 17:30:45' <apache_error.3.log
20    psql gnucomo_test -q -t -c "select * from log" -o log.tbl
21    diff read_apache_error.log.expect log.tbl
22    result=$?
23    psql gnucomo_test -f ../src/database/destroy.sql -q
24    dropdb gnucomo_test
25    exit $result
26 else
27    echo Can not create test database
28    dropdb gnucomo_test
29    exit 1
30 fi