summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Rockai <prockai@redhat.com>2014-10-01 11:28:15 +0200
committerPetr Rockai <prockai@redhat.com>2014-11-20 12:36:48 +0100
commitb3dfd947d21ce6f8570bf26eb1796b9780998798 (patch)
tree342b952e93be7380b7267f8b06423e1ec9bc7f4e
parentbd3535c0a47e3e5b7f910dbbca1ee8b948c70cf3 (diff)
downloadlvm2-b3dfd947d21ce6f8570bf26eb1796b9780998798.tar.gz
test: Properly detect warnings from testcases.
-rw-r--r--test/lib/brick-shelltest.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/test/lib/brick-shelltest.h b/test/lib/brick-shelltest.h
index 71194cfc3..7a2b8f0db 100644
--- a/test/lib/brick-shelltest.h
+++ b/test/lib/brick-shelltest.h
@@ -543,8 +543,22 @@ struct KMsg : Source {
};
struct Observer : Sink {
- Observer() {}
- void push( std::string ) {}
+ TimedBuffer stream;
+
+ bool warnings;
+ Observer() : warnings( false ) {}
+
+ void push( std::string s ) {
+ stream.push( s );
+ }
+
+ void sync( bool force ) {
+ while ( !stream.empty( force ) ) {
+ TimedBuffer::Line line = stream.shift( force );
+ if ( line.second.find( "TEST WARNING" ) != std::string::npos )
+ warnings = true;
+ }
+ }
};
struct IO : Sink {
@@ -850,6 +864,9 @@ struct TestCase {
else
r = Journal::FAILED;
+ if ( r == Journal::PASSED && io.observer().warnings )
+ r = Journal::WARNED;
+
io.close();
if ( iobuf && ( r == Journal::FAILED || r == Journal::TIMEOUT ) )