diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2015-04-13 16:31:02 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2015-04-13 16:38:32 +0200 |
commit | e4261ba03784f122759670cc2022a2dcb5f5a3ef (patch) | |
tree | 86acaf650eae88f2f9086843b44c81d55368a431 | |
parent | 0aef2b719f17bddfe8afeaa4d38447975c192f50 (diff) | |
download | lvm2-e4261ba03784f122759670cc2022a2dcb5f5a3ef.tar.gz |
tests: update runner
Reenable TESTDIR & PREFIX replacement.
Since we need to replace string in proper order (1st. @TESTDIR@,
2nd. @PREFIX@), drop map and use plain string.
Drop timestamp logging when 'stacktracing'
-rw-r--r-- | test/lib/brick-shelltest.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/test/lib/brick-shelltest.h b/test/lib/brick-shelltest.h index 60aab203a..00f161691 100644 --- a/test/lib/brick-shelltest.h +++ b/test/lib/brick-shelltest.h @@ -345,18 +345,23 @@ struct Sink { struct Substitute { typedef std::map< std::string, std::string > Map; - Map _map; + std::string testdir; // replace testdir first + std::string prefix; std::string map( std::string line ) { if ( std::string( line, 0, 9 ) == "@TESTDIR=" ) - _map[ "@TESTDIR@" ] = std::string( line, 9, std::string::npos ); + testdir = std::string( line, 9, line.length() - 10 ); // skip \n else if ( std::string( line, 0, 8 ) == "@PREFIX=" ) - _map[ "@PREFIX@" ] = std::string( line, 8, std::string::npos ); + prefix = std::string( line, 8, line.length() - 9 ); // skip \n else { size_t off; - for ( Map::iterator s = _map.begin(); s != _map.end(); ++s ) - while ( (off = line.find( s->first )) != std::string::npos ) - line.replace( off, s->first.length(), s->second ); + if (!testdir.empty()) + while ( (off = line.find( testdir )) != std::string::npos ) + line.replace( off, testdir.length(), "@TESTDIR@" ); + + if (!prefix.empty()) + while ( (off = line.find( prefix )) != std::string::npos ) + line.replace( off, prefix.length(), "@PREFIX@" ); } return line; } @@ -406,6 +411,13 @@ struct FdSink : Sink { virtual void outline( bool force ) { TimedBuffer::Line line = stream.shift( force ); + if (line.second.c_str()[0] == '#') { + /* Disable timing between STACKTRACE & teardown keywords */ + if (strstr(line.second.c_str() + 1, "# 0 STACKTRACE")) + fmt.stamp = false; + else if (strstr(line.second.c_str() + 1, "# teardown")) + fmt.stamp = true; + } std::string out = fmt.format( line ); write( fd, out.c_str(), out.length() ); } |