From: Ian Jackson Date: Wed, 30 May 2018 15:50:24 +0000 (+0100) Subject: TestSupport: substeps: work if steps in ad-hoc tests take >1s X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=665a927bee4723f74cb2cd708c5d7d9acf068dae;p=people%2Froyger%2Fosstest.git TestSupport: substeps: work if steps in ad-hoc tests take >1s When running by hand, OSSTEST_TESTID is not set. We provide a value with the time and the pid in it, so that rerunning the script by hand works, even though in production this would result in multiple identically-named substeps. But we need to fix this value for the duration of the script. Otherwise when it calls substep_finish, if the time has moved on, it computes a different OSSTEST_TESTID and therefore a different substep name, and then the substep machinery smells a rat and bombs out. Signed-off-by: Ian Jackson --- diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 6de566c..7bc40f3 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -245,7 +245,7 @@ END sub complete_testid ($) { my ($testidr) = @_; $$testidr =~ s{^(?=/)}{ - $ENV{OSSTEST_TESTID} // sprintf('SUBSTEP-%s-%s', time, $$) + $ENV{OSSTEST_TESTID} //= sprintf('SUBSTEP-%s-%s', time, $$) }e; }