Testcases for reading system log
[gnucomo.git] / test / read_bad_messages
diff --git a/test/read_bad_messages b/test/read_bad_messages
new file mode 100755 (executable)
index 0000000..0abb454
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#
+#  Create an object 'example1.gnucomo.test' in the database and
+#  parse a piece of a syslog file with bad, short and empty lines.
+#  There should be warnings printed on the log
+
+rm -f gcm_input.log
+
+createdb gnucomo_test
+
+if psql gnucomo_test -q <../src/database/create.sql >/dev/null
+then
+   psql gnucomo_test -q -c "insert into object (objectname) values ('example1.gnucomo.test')"
+   ../src/gcm_input/gcm_input -c gnucomo_test -h example1.gnucomo.test -d 'Jun 9 2002 20:30:45' <messages.bad
+   psql gnucomo_test -q -t -c "select * from log" -o log.tbl
+   diff read_bad_messages.log.expect gcm_input.log
+   result=$?
+   psql gnucomo_test -f ../src/database/destroy.sql -q
+   dropdb gnucomo_test
+   exit $result
+else
+   echo Can not create test database
+   dropdb gnucomo_test
+   exit 1
+fi