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>
sub complete_testid ($) {
my ($testidr) = @_;
$$testidr =~ s{^(?=/)}{
- $ENV{OSSTEST_TESTID} // sprintf('SUBSTEP-%s-%s', time, $$)
+ $ENV{OSSTEST_TESTID} //= sprintf('SUBSTEP-%s-%s', time, $$)
}e;
}