From e8cc9254e038b59bb6cc5ec9ba7793f9a82ab150 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Fri, 27 Jun 2014 23:17:47 +0200 Subject: [PATCH] test: Avoid sleeps in the runner monitoring loop. --- test/lib/runner.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/lib/runner.cpp b/test/lib/runner.cpp index fde441bcc..1e61a6872 100644 --- a/test/lib/runner.cpp +++ b/test/lib/runner.cpp @@ -115,7 +115,7 @@ struct TestCase { bool timeout; pid_t pid; - time_t start, end, silent_start; + time_t start, end, silent_start, last_update; Options options; Journal *journal; @@ -175,13 +175,17 @@ struct TestCase { wait.tv_sec = 0; wait.tv_usec = 500000; /* timeout 0.5s */ - if ( !options.verbose && !options.interactive && !options.batch ) - progress( Update ) << tag( "running" ) << pretty() << " " << end - start << std::flush; + if ( !options.verbose && !options.interactive && !options.batch ) { + if ( end - last_update >= 1 ) { + progress( Update ) << tag( "running" ) << pretty() << " " + << end - start << std::flush; + last_update = end; + } + } if ( select( io.fd + 1, &set, NULL, NULL, &wait ) > 0 ) silent_start = end; /* something happened */ - usleep(500000); io.sync(); return true; -- 2.43.5