[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH OSSTEST v4 2/7] cs-adjust-flight: Add job-status to report job stats
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. Add a get-job-status command to the standalone helper script. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- v4: Don't both capturing status into a variable just to echo it. v3: Some incidental docs stuff moved to a more appropriate (new) patch. Only print the job if there might be multiple (i.e. the jobs argument is some sort of regex) v2: Replaces "standalone: Add get-job-status to pick status out of standalone.db" with a variant using cs-adjust-flight --- cs-adjust-flight | 19 +++++++++++++++++++ standalone | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/cs-adjust-flight b/cs-adjust-flight index a94ed5f..4bfef48 100755 --- a/cs-adjust-flight +++ b/cs-adjust-flight @@ -17,6 +17,7 @@ # recipe-set <job-spec> <new-value> # intended-blessing <intended-blessing> # branch-set <new-branch> +# job-status <job-spec> # # <foo-spec>: # <foo-name> @@ -342,6 +343,24 @@ sub change__branch_set { verbose "$dstflight branch set to $branch\n"; } +sub change__job_status { + die unless @changes >= 1; + my $jobs = shift @changes; + + my $q = $dbh_tests->prepare(<<END); + SELECT status + FROM jobs + WHERE flight = ? AND job = ? +END + for_jobs($dstflight, $jobs, sub { + my ($job) = @_; + $q->execute($dstflight, $job); + my ($s) = $q->fetchrow_array(); + print "$job " or die $! if defined spec_re($jobs); + print "$s\n" or die $!; + }); +} + sub changes () { debug("CHANGES...\n"); diff --git a/standalone b/standalone index f64462e..98a323f 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 @@ -199,6 +205,14 @@ with_logging() { fi } +job_status() { + flight=$1; shift + job=$1; shift + + OSSTEST_CONFIG=$config \ + ./cs-adjust-flight $flight job-status $job +} + # other potential ops: # - run standalone reset @@ -304,6 +318,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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |