summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Rockai <prockai@redhat.com>2014-10-01 11:27:44 +0200
committerPetr Rockai <prockai@redhat.com>2014-11-20 12:36:48 +0100
commitbd3535c0a47e3e5b7f910dbbca1ee8b948c70cf3 (patch)
treeee6cd599c14e104f06bd66b8c1c02675528c425e
parent909584a437da1b12e46b056983ebe460891f66e6 (diff)
downloadlvm2-bd3535c0a47e3e5b7f910dbbca1ee8b948c70cf3.tar.gz
test: Only force an IO sync when the testcase has finished.
-rw-r--r--test/lib/brick-shelltest.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/lib/brick-shelltest.h b/test/lib/brick-shelltest.h
index 7c6a0219b..71194cfc3 100644
--- a/test/lib/brick-shelltest.h
+++ b/test/lib/brick-shelltest.h
@@ -339,7 +339,7 @@ struct TimedBuffer {
struct Sink {
virtual void outline( bool ) {}
virtual void push( std::string x ) = 0;
- virtual void sync() {}
+ virtual void sync( bool ) {}
virtual ~Sink() {}
};
@@ -410,11 +410,11 @@ struct FdSink : Sink {
write( fd, out.c_str(), out.length() );
}
- virtual void sync() {
+ virtual void sync( bool force ) {
if ( killed )
return;
- while ( !stream.empty( true ) )
- outline( true );
+ while ( !stream.empty( force ) )
+ outline( force );
}
virtual void push( std::string x ) {
@@ -429,13 +429,13 @@ struct FileSink : FdSink {
std::string file;
FileSink( std::string n ) : FdSink( -1 ), file( n ) {}
- void sync() {
+ void sync( bool force ) {
if ( fd < 0 && !killed ) {
fd = open( file.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644 );
if ( fd < 0 )
killed = true;
}
- FdSink::sync();
+ FdSink::sync( force );
}
~FileSink() {
@@ -561,12 +561,12 @@ struct IO : Sink {
(*i)->push( x );
}
- void sync() {
+ void sync( bool force ) {
for ( Sources::iterator i = sources.begin(); i != sources.end(); ++i )
(*i)->sync( this );
for ( Sinks::iterator i = sinks.begin(); i != sinks.end(); ++i )
- (*i)->sync();
+ (*i)->sync( force );
}
void close() {
@@ -717,7 +717,7 @@ struct TestCase {
}
if ( wait4(pid, &status, WNOHANG, &usage) != 0 ) {
- io.sync();
+ io.sync( true );
return false;
}
@@ -732,7 +732,7 @@ struct TestCase {
waitpid( pid, &status, 0 );
}
timeout = true;
- io.sync();
+ io.sync( true );
return false;
}
@@ -755,7 +755,7 @@ struct TestCase {
if ( select( nfds, &set, NULL, NULL, &wait ) > 0 )
silent_start = end; /* something happened */
- io.sync();
+ io.sync( false );
return true;
}