mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
tests: update runner
Avoid busy-looping on CPU while reading socket pipe and always call read only when select tells there is something for read. Change the batch output to old nicer output.
This commit is contained in:
parent
1ad9677cb3
commit
26f5ec0e98
@ -461,7 +461,7 @@ struct Source {
|
|||||||
virtual void sync( Sink *sink ) {
|
virtual void sync( Sink *sink ) {
|
||||||
ssize_t sz;
|
ssize_t sz;
|
||||||
char buf[ 128 * 1024 ];
|
char buf[ 128 * 1024 ];
|
||||||
while ( (sz = read(fd, buf, sizeof(buf) - 1)) > 0 )
|
if ( (sz = read(fd, buf, sizeof(buf) - 1)) > 0 )
|
||||||
sink->push( std::string( buf, sz ) );
|
sink->push( std::string( buf, sz ) );
|
||||||
if ( sz < 0 && errno != EAGAIN )
|
if ( sz < 0 && errno != EAGAIN )
|
||||||
throw syserr( "reading pipe" );
|
throw syserr( "reading pipe" );
|
||||||
@ -720,10 +720,12 @@ struct TestCase {
|
|||||||
exit(201);
|
exit(201);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (fcntl( fds[0], F_SETFL, O_NONBLOCK ) == -1) {
|
if (fcntl( fds[0], F_SETFL, O_NONBLOCK ) == -1) {
|
||||||
perror("fcntl on socket");
|
perror("fcntl on socket");
|
||||||
exit(202);
|
exit(202);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
io.sources.push_back( new Source( fds[0] ) );
|
io.sources.push_back( new Source( fds[0] ) );
|
||||||
child.fd = fds[1];
|
child.fd = fds[1];
|
||||||
@ -747,7 +749,7 @@ struct TestCase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* kill off tests after a minute of silence */
|
/* kill off tests after a timeout silence */
|
||||||
if ( !options.interactive )
|
if ( !options.interactive )
|
||||||
if ( end - silent_start > options.timeout ) {
|
if ( end - silent_start > options.timeout ) {
|
||||||
kill( pid, SIGINT );
|
kill( pid, SIGINT );
|
||||||
@ -777,11 +779,10 @@ struct TestCase {
|
|||||||
last_update = end;
|
last_update = end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( select( nfds, &set, NULL, NULL, &wait ) > 0 ) {
|
||||||
if ( select( nfds, &set, NULL, NULL, &wait ) > 0 )
|
|
||||||
silent_start = end; /* something happened */
|
silent_start = end; /* something happened */
|
||||||
|
io.sync( false );
|
||||||
io.sync( false );
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -890,9 +891,10 @@ struct TestCase {
|
|||||||
|
|
||||||
if ( options.batch ) {
|
if ( options.batch ) {
|
||||||
int spaces = std::max( 64 - int(pretty().length()), 0 );
|
int spaces = std::max( 64 - int(pretty().length()), 0 );
|
||||||
progress( Last ) << " " << std::string( spaces, '.' ) << " " << r << std::endl;
|
progress( Last ) << " " << std::string( spaces, '.' ) << " " << r;
|
||||||
if ( r == Journal::PASSED )
|
if ( r == Journal::PASSED )
|
||||||
progress( First ) << " " << rusage() << std::endl;
|
progress( First ) << " " << rusage();
|
||||||
|
progress( Last ) << std::endl;
|
||||||
} else
|
} else
|
||||||
progress( Last ) << tag( r ) << pretty() << std::endl;
|
progress( Last ) << tag( r ) << pretty() << std::endl;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user