]> xenbits.xensource.com Git - people/royger/osstest.git/commitdiff
TestSupport: substeps: work if steps in ad-hoc tests take >1s
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 30 May 2018 15:50:24 +0000 (16:50 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 12 Jun 2018 11:32:44 +0000 (12:32 +0100)
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 <Ian.Jackson@eu.citrix.com>
Osstest/TestSupport.pm

index 6de566ce427018a88b1ab0e61b459cc2a0d4af9b..7bc40f35102994ac13189656f048228f8242d6ee 100644 (file)
@@ -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;
 }