On Tue, 2012-08-07 at 17:25 +0800, Mike Qiu wrote:
> Currently, the exception handling in run_once is really bad enough,
> In other words, it may take errors. For example, when an exception
> occurred by run(itest_cmd), itest will still hold the str value,
> which is not the result of the run(itest_cmd). So the exception will
> cause an error that "str" object use the stdout.
> 
> And another question is when the exception happens, this test in
> test_list should be ended.
> 
> To fix the above two issues, this patch does two modifications:
> 1.Correct the exception handling by using "e" for error information.
> 2.Terminate the subtest when exception is catched.

^ when exception is caught.

Other than that, patch also looks good to me. I'm going to apply this
before fixing the commit message.

Thanks again Mike!

> 
> Signed-off-by: Mike Qiu <[email protected]>
> ---
>  client/tests/npb/npb.py |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/client/tests/npb/npb.py b/client/tests/npb/npb.py
> index fd22e12..c18ae09 100644
> --- a/client/tests/npb/npb.py
> +++ b/client/tests/npb/npb.py
> @@ -58,10 +58,11 @@ class npb(test.test):
>              itest_cmd = os.path.join('NPB3.3-OMP/bin/', itest)
>              try:
>                  itest = utils.run(itest_cmd)
> -            except Exception:
> +            except Exception, e :
>                  logging.error('NPB benchmark %s has failed. Output: %s',
> -                              itest_cmd, itest.stdout)
> +                              itest_cmd, e)
>                  self.n_fail += 1
> +                continue
>              logging.debug(itest.stdout)
>  
>              # Get the number of threads that the test ran
> @@ -106,12 +107,11 @@ class npb(test.test):
>              itest_single_cmd = ''.join(['OMP_NUM_THREADS=1 ', itest_cmd])
>              try:
>                  itest_single = utils.run(itest_single_cmd)
> -            except Exception:
> +            except Exception, e :
>                  logging.error('NPB benchmark single thread %s has failed. '
> -                              'Output: %s',
> -                              itest_single_cmd,
> -                              itest_single.stdout)
> +                              'Output: %s', itest_single_cmd, e)
>                  self.n_fail += 1
> +                continue
>  
>              m = re.search('Time in seconds\s*=\s*(.*)\n', 
> itest_single.stdout)
>              time_one_thrd = float(m.groups()[0])


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

Reply via email to