1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-08 08:58:50 +03:00

test: Properly detect warnings from testcases.

This commit is contained in:
Petr Rockai 2014-10-01 11:28:15 +02:00
parent c96e42006d
commit d8983d4bd4

View File

@ -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 ) )