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