rhts-db-submit-result: improve dmesg error extraction

This patch improves the error extraction code earlier
committed in f3fa813 by:

- Not using 'awk' and 'grep'
- Adds a test for the dmesg extraction code

Bug: 1026670
Change-Id: Id0931140d6cc2b94c30f312a31dde5879510dcfa