Testcases for reading system log
[gnucomo.git] / test / read_bad_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 with bad, short and empty lines.
6 #  There should be warnings printed on the log
7
8 rm -f gcm_input.log
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 'Jun 9 2002 20:30:45' <messages.bad
16    psql gnucomo_test -q -t -c "select * from log" -o log.tbl
17    diff read_bad_messages.log.expect gcm_input.log
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