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

[Xen-devel] [PATCH OSSTEST 1/3] standalone: Add get-job-status to pick status out of standalone.db



The return code of sg-run-job does not reflect the state of the job,
which is instead written to the database. For the benefit of running
tests in a loop until failure add a command to retrieve the status to
stdout.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 standalone | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/standalone b/standalone
index 60b6666..0a5d96f 100755
--- a/standalone
+++ b/standalone
@@ -35,6 +35,11 @@ Operations:
   hosts next time. Otherwise osstest will complain if you change the
   host(s) which a job is running on on successive runs.
 
+* get-job-status [cf] [JOB]
+
+  Prints the status (pass, fail, running, etc) of the given job to
+  stdout.
+
 Options:
 
 -c FILE, --config=FILE        Use FILE as configuration file
@@ -140,8 +145,9 @@ if [ $reuse -eq 0 ]; then
     read
 fi
 
-if [ ! -f standalone.db ] ; then
-    echo "No standalone.db? Run standalone-reset." >&2
+db="standalone.db"
+if [ ! -f $db ] ; then
+    echo "No $db? Run standalone-reset." >&2
     exit 1
 fi
 
@@ -198,6 +204,14 @@ with_logging() {
     fi
 }
 
+job_status() {
+    flight=$1; shift
+    job=$1; shift
+
+    sqlite3 $db \
+        "SELECT status FROM jobs WHERE flight='$flight' AND job='$job'"
+}
+
 # other potential ops:
 # - run standalone reset
 
@@ -303,6 +317,20 @@ case $op in
        OSSTEST_JOB=$job \
            with_logging logs/$flight/$job.$ts.log ./$ts $hosts $@
        ;;
+
+    get-job-status)
+       need_flight;
+
+       if [ $# -ne 1 ] ; then
+           echo "get-job-status: Need job" >&2
+           exit 1
+       fi
+
+       job=$1; shift
+
+       job_status $flight $job
+
+       ;;
     *)
        echo "Unknown op $op" ; exit 1 ;;
 esac
-- 
2.5.3


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


 


Rackspace

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