[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 12/17] substep logfiles: Set logfile and step columns correctly for substeps



If we are running under sg-run-job, OSSTEST_TESTID will be set to the
testid of the parent step (ie, the step created by sg-run-job which
relates to the execution of the whole script).

Unless the caller has specified otherwise, the log and script are
the same as for the parent step.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 Osstest/JobDB/Executive.pm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm
index e1e2052..a7a6696 100644
--- a/Osstest/JobDB/Executive.pm
+++ b/Osstest/JobDB/Executive.pm
@@ -254,6 +254,19 @@ END
                            status,testid,started)
             VALUES (?,?,?,?, ?, 'running',?,?)
 END
+    my $parent_testid = $ENV{OSSTEST_TESTID};
+    if ((!defined $logfile || !defined $script) && defined $parent_testid) {
+       my $parentq = $dbh_tests->prepare(<<END);
+            SELECT logfile, step FROM steps
+             WHERE flight=? AND job=? AND testid=?
+END
+       db_retry($flight,[qw(running)], $dbh_tests,[],sub {
+            $parentq->execute($flight,$job,$parent_testid);
+            my $row = $parentq->fetchrow_hashref();
+           $logfile //= $row->{logfile};
+           $script //= $row->{script};
+       });
+    }
     if (!defined $script) {
        $script = $0;
        $script =~ s{^.*/}{};
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.