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

[Xen-devel] [OSSTEST PATCH 13/24] TestSupport, Executive: Provide intended_blessing



This will be used by a ts script which permanently saves some logs in
a host-specific rather than flight-specific directory.  Non-real
flights ought not to mess up real data.

The function is not provided for Standalone mode, so a test step that
tries to use it will fail.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 Osstest/JobDB/Executive.pm |  8 ++++++++
 Osstest/TestSupport.pm     | 11 ++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm
index 83e19e4..45aabd4 100644
--- a/Osstest/JobDB/Executive.pm
+++ b/Osstest/JobDB/Executive.pm
@@ -196,6 +196,14 @@ END
     }
 }
 
+sub dbfl_intended ($) { #method
+    my ($jd, $fl) = @_;
+    my ($intended) = $dbh_tests->selectrow_array(<<END, {}, $fl);
+        SELECT intended FROM flights WHERE flight=?
+END
+    return $intended;
+}
+
 sub flight_create ($$$) { #method
     my ($jd,$intended,$branch) = @_;
     die "OSSTEST_FLIGHT set on entry to JobDB::Executive::flight_create\n"
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index b947a0c..c23ac13 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -43,7 +43,7 @@ BEGIN {
                       ts_get_host_guest ts_check_done
 
                       fail broken logm $logm_handle $logm_prefix
-                      substep_start substep_finish
+                      substep_start substep_finish intended_blessing
                       get_filecontents
                       report_once
 
@@ -245,6 +245,15 @@ sub substep_finish ($$) {
     $mjobdb->step_finish($testid,$stepstatus);
 }
 
+sub intended_blessing () {
+    # must be run outside transaction
+    my $intended;
+    db_retry($flight,'running',$dbh_tests,[], sub {
+        $intended = $mjobdb->dbfl_intended($flight);
+    });
+    return $intended;
+}
+
 sub get_filecontents ($;$) {
     my ($path, $ifnoent) = @_;  # $ifnoent=undef => is error
     my $data= get_filecontents_core_quiet($path);
-- 
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®.