On 08/28/2012 08:12 PM, DeFolo, Daniel (MC Linux) wrote:

At this point, the overall status of my job returned "END GOOD", I am
confused by this, it should be "Fail" also, did anyone meet this
similar case before? and how to reflect the whole job status.

A job comprises a number of operations on a test machine. It doesn't matter
whether the individual tests PASSed or FAILed, the important thing job-wise is
that the autotest client was installed and executed on a test client, that's 
all.
There are actual job failures, that are:

1) Exceptions thrown outside a test context (Autotest client died)
2) Exceptions thrown outside the client context (Autotest server died)
2) Machine died (kernel crash)

So autotest is functioning as designed here. You're supposed to look at job
results to see whether tests passed or failed, we even have functionality to
send emails informing such results to users.

Lucas,

I suspected that checking the job results results might be the answer, but that 
leads to a follow-up question:

What is the best way to check the status of the job result programmatically?  
We have some jobs running via cron jobs and need to be able to confirm they 
didn't have any failures.

 From the CLI (autoest_rpc_client) I don't think that information is available 
unless I'm missing something.  We could query the DB directly; however I would 
prefer to avoid doing that.

We could parse the status.log file (e.g. grep for FAIL/ERROR/etc), but that 
seems like a less official method for doing this than I hoped.

Is there some simple API we are missing?

There are some ways one could do it:

1) job.run_test() returns a bool, so you could track this result on a variable, and at the end of the job, throw a JobError, or maybe even a sys.exit(1) or similar

2) There's a tool called scan_results, in client/tools, that one could import such as

from autotest.client.tools import scan_results
...
results = scan_results.parse_results(contents_of_a_status_log_file)
...
bad_results = [r[0] for r in results if r[1] == "FAIL"]
bad_results += [r[0] for r in results if r[1] == "ERROR"]
bad_results += [r[0] for r in results if r[1] == "ABORT"]

And then again throw a JobError, or sys.exit(1) or similar

3) Maybe hack the client to make it return with exit code != 0 on test failures, if we pass the right flag to client.

You might think about it.

Cheers,

Lucas

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to