[libvirt] [test-API PATCH] Fix a bug in the case that clean flag is used

Osier Yang jyang at redhat.com
Mon Apr 23 09:23:21 UTC 2012


On 2012年04月23日 16:22, Guannan Ren wrote:
>      When clean flag is used in testcase, the framework

"clean"

>      reports 'KeyError'.
>      The bug is caused is by getting mod_case earlier

"mode_case"

>      than checking whether the 'clean' flag is present or not.

I'd think it doesn't explain the bug well, though I'm
not sure how to give a good explaination too. Perhaps
an example will be good. (It looks to me there is wrong
order of the string manipulation, and thus got a unknown
key?)

>      The testcases without flag set doesn't be affected.

without 'clean' flag set are not affected.

BTW, could you destroy the "4 leading spaces" in commit
message, though it's fine, but nobody uses it. :-)

> ---
>   src/generator.py |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/generator.py b/src/generator.py
> index 6a46889..2e4ae07 100644
> --- a/src/generator.py
> +++ b/src/generator.py
> @@ -115,11 +115,11 @@ class FuncGen(object):
>               clean_flag = False
>
>               mod_case_func = self.case_name_list[i]
> -            mod_case = mod_case_func.rsplit(":", 1)[0]
>               if mod_case_func.endswith(':clean'):
>                   mod_case_func = mod_case_func[:-6]
>                   clean_flag = True
>
> +            mod_case = mod_case_func.rsplit(":", 1)[0]
>               self.fmt.print_start(mod_case, env_logger)
>
>               case_params = self.case_params_list[i]

Anyway, it looks right fix, ACK with the nits fixed.

Osier




More information about the libvir-list mailing list