kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v3 PATCH] KVM test: Add a helper to search the panic in the log
@ 2010-05-19  9:13 Jason Wang
  2010-05-20 10:00 ` [Autotest] " Michael Goldish
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Wang @ 2010-05-19  9:13 UTC (permalink / raw)
  To: lmr, autotest; +Cc: kvm

This checker serves as the post_command to find the panic information
in the file which contains the content of guest serial console.

Changes from v2:
- Put all things into __main__
- Fix some typos

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 client/tests/kvm/scripts/check_serial.py |   24 ++++++++++++++++++++++++
 client/tests/kvm/tests_base.cfg.sample   |    7 +++++--
 2 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 client/tests/kvm/scripts/check_serial.py

diff --git a/client/tests/kvm/scripts/check_serial.py b/client/tests/kvm/scripts/check_serial.py
new file mode 100644
index 0000000..6432c27
--- /dev/null
+++ b/client/tests/kvm/scripts/check_serial.py
@@ -0,0 +1,24 @@
+import os, sys, glob, re
+
+
+class SerialCheckerError(Exception):
+    """
+    Simple wrapper for the builtin Exception class.
+    """
+    pass
+
+
+if __name__ == "__main__":
+    client_dir =  os.environ['AUTODIR']
+    pattern = os.environ['KVM_TEST_search_pattern']
+    shortname = os.environ['KVM_TEST_shortname']
+    debugdir = os.path.join(client_dir, "results/default/kvm.%s/debug" 
+                            % shortname)
+    serial_files = glob.glob(os.path.join(debugdir, 'serial*'))
+    
+    fail = [ f for f in serial_files if
+             re.findall(pattern, file(f).read(), re.I) ]
+    if fail:
+        print "%s is found in %s" % (pattern, fail)
+        raise SerialCheckerError("Error found during the check, please " 
+                                 "check the log")
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index e85bb4a..c4e522a 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -52,6 +52,10 @@ address_index = 0
 # Misc
 profilers = kvm_stat
 
+# pattern to search in guest serial console
+search_pattern = panic
+post_command = "python scripts/check_serial.py"
+post_command_noncritical = no
 
 # Tests
 variants:
@@ -1324,10 +1328,9 @@ virtio|virtio_blk|e1000|balloon_check:
 variants:
     - @qcow2:
         image_format = qcow2
-        post_command = " python scripts/check_image.py;"
+        post_command += " && python scripts/check_image.py"
         remove_image = no
         post_command_timeout = 600
-        post_command_noncritical = yes
     - vmdk:
         only Fedora Ubuntu Windows
         only smp2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Autotest] [v3 PATCH] KVM test: Add a helper to search the panic in the log
  2010-05-19  9:13 [v3 PATCH] KVM test: Add a helper to search the panic in the log Jason Wang
@ 2010-05-20 10:00 ` Michael Goldish
  2010-05-24  7:38   ` Jason Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Goldish @ 2010-05-20 10:00 UTC (permalink / raw)
  To: Jason Wang; +Cc: lmr, autotest, kvm

On 05/19/2010 12:13 PM, Jason Wang wrote:
> This checker serves as the post_command to find the panic information
> in the file which contains the content of guest serial console.
> 
> Changes from v2:
> - Put all things into __main__
> - Fix some typos
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  client/tests/kvm/scripts/check_serial.py |   24 ++++++++++++++++++++++++
>  client/tests/kvm/tests_base.cfg.sample   |    7 +++++--
>  2 files changed, 29 insertions(+), 2 deletions(-)
>  create mode 100644 client/tests/kvm/scripts/check_serial.py
> 
> diff --git a/client/tests/kvm/scripts/check_serial.py b/client/tests/kvm/scripts/check_serial.py
> new file mode 100644
> index 0000000..6432c27
> --- /dev/null
> +++ b/client/tests/kvm/scripts/check_serial.py
> @@ -0,0 +1,24 @@
> +import os, sys, glob, re
> +
> +
> +class SerialCheckerError(Exception):
> +    """
> +    Simple wrapper for the builtin Exception class.
> +    """
> +    pass
> +
> +
> +if __name__ == "__main__":
> +    client_dir =  os.environ['AUTODIR']
> +    pattern = os.environ['KVM_TEST_search_pattern']
> +    shortname = os.environ['KVM_TEST_shortname']
> +    debugdir = os.path.join(client_dir, "results/default/kvm.%s/debug" 
> +                            % shortname)
> +    serial_files = glob.glob(os.path.join(debugdir, 'serial*'))
> +    
> +    fail = [ f for f in serial_files if
> +             re.findall(pattern, file(f).read(), re.I) ]
> +    if fail:
> +        print "%s is found in %s" % (pattern, fail)
> +        raise SerialCheckerError("Error found during the check, please " 
> +                                 "check the log")
> diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
> index e85bb4a..c4e522a 100644
> --- a/client/tests/kvm/tests_base.cfg.sample
> +++ b/client/tests/kvm/tests_base.cfg.sample
> @@ -52,6 +52,10 @@ address_index = 0
>  # Misc
>  profilers = kvm_stat
>  
> +# pattern to search in guest serial console
> +search_pattern = panic
> +post_command = "python scripts/check_serial.py"
> +post_command_noncritical = no
>  
>  # Tests
>  variants:
> @@ -1324,10 +1328,9 @@ virtio|virtio_blk|e1000|balloon_check:
>  variants:
>      - @qcow2:
>          image_format = qcow2
> -        post_command = " python scripts/check_image.py;"
> +        post_command += " && python scripts/check_image.py"

If post_command is empty before executing this line, it'll end up being
" && python scripts/..." and bash doesn't like that AFAIK.  I think this
line should be:

post_command += " python scripts/check_image.py;"

So if post_command is empty, it becomes " python ...;" which is OK, and
if it isn't empty, it becomes "previous command; python ...;" (assuming
the previous command ended with ';').

>          remove_image = no
>          post_command_timeout = 600
> -        post_command_noncritical = yes
>      - vmdk:
>          only Fedora Ubuntu Windows
>          only smp2
> 
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [v3 PATCH] KVM test: Add a helper to search the panic in the log
  2010-05-20 10:00 ` [Autotest] " Michael Goldish
@ 2010-05-24  7:38   ` Jason Wang
  2010-05-26  9:50     ` [Autotest] " Michael Goldish
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Wang @ 2010-05-24  7:38 UTC (permalink / raw)
  To: Michael Goldish; +Cc: autotest, kvm

Michael Goldish wrote:
> On 05/19/2010 12:13 PM, Jason Wang wrote:
>   
>> This checker serves as the post_command to find the panic information
>> in the file which contains the content of guest serial console.
>>
>> Changes from v2:
>> - Put all things into __main__
>> - Fix some typos
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>>  client/tests/kvm/scripts/check_serial.py |   24 ++++++++++++++++++++++++
>>  client/tests/kvm/tests_base.cfg.sample   |    7 +++++--
>>  2 files changed, 29 insertions(+), 2 deletions(-)
>>  create mode 100644 client/tests/kvm/scripts/check_serial.py
>>
>> diff --git a/client/tests/kvm/scripts/check_serial.py b/client/tests/kvm/scripts/check_serial.py
>> new file mode 100644
>> index 0000000..6432c27
>> --- /dev/null
>> +++ b/client/tests/kvm/scripts/check_serial.py
>> @@ -0,0 +1,24 @@
>> +import os, sys, glob, re
>> +
>> +
>> +class SerialCheckerError(Exception):
>> +    """
>> +    Simple wrapper for the builtin Exception class.
>> +    """
>> +    pass
>> +
>> +
>> +if __name__ == "__main__":
>> +    client_dir =  os.environ['AUTODIR']
>> +    pattern = os.environ['KVM_TEST_search_pattern']
>> +    shortname = os.environ['KVM_TEST_shortname']
>> +    debugdir = os.path.join(client_dir, "results/default/kvm.%s/debug" 
>> +                            % shortname)
>> +    serial_files = glob.glob(os.path.join(debugdir, 'serial*'))
>> +    
>> +    fail = [ f for f in serial_files if
>> +             re.findall(pattern, file(f).read(), re.I) ]
>> +    if fail:
>> +        print "%s is found in %s" % (pattern, fail)
>> +        raise SerialCheckerError("Error found during the check, please " 
>> +                                 "check the log")
>> diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
>> index e85bb4a..c4e522a 100644
>> --- a/client/tests/kvm/tests_base.cfg.sample
>> +++ b/client/tests/kvm/tests_base.cfg.sample
>> @@ -52,6 +52,10 @@ address_index = 0
>>  # Misc
>>  profilers = kvm_stat
>>  
>> +# pattern to search in guest serial console
>> +search_pattern = panic
>> +post_command = "python scripts/check_serial.py"
>> +post_command_noncritical = no
>>  
>>  # Tests
>>  variants:
>> @@ -1324,10 +1328,9 @@ virtio|virtio_blk|e1000|balloon_check:
>>  variants:
>>      - @qcow2:
>>          image_format = qcow2
>> -        post_command = " python scripts/check_image.py;"
>> +        post_command += " && python scripts/check_image.py"
>>     
>
> If post_command is empty before executing this line, it'll end up being
> " && python scripts/..." and bash doesn't like that AFAIK.  I think this
> line should be:
>
> post_command += " python scripts/check_image.py;"
>
> So if post_command is empty, it becomes " python ...;" which is OK, and
> if it isn't empty, it becomes "previous command; python ...;" (assuming
> the previous command ended with ';').
>
>   
What I want is to fail the case when panic was found, so how about use
<= like:
        post_command <= "python scripts/check_image.py;"
>>          remove_image = no
>>          post_command_timeout = 600
>> -        post_command_noncritical = yes
>>      - vmdk:
>>          only Fedora Ubuntu Windows
>>          only smp2
>>
>> _______________________________________________
>> Autotest mailing list
>> Autotest@test.kernel.org
>> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>>     
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Autotest] [v3 PATCH] KVM test: Add a helper to search the panic in the log
  2010-05-24  7:38   ` Jason Wang
@ 2010-05-26  9:50     ` Michael Goldish
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Goldish @ 2010-05-26  9:50 UTC (permalink / raw)
  To: Jason Wang; +Cc: lmr, autotest, kvm

On 05/24/2010 10:38 AM, Jason Wang wrote:
> Michael Goldish wrote:
>> On 05/19/2010 12:13 PM, Jason Wang wrote:
>>   
>>> This checker serves as the post_command to find the panic information
>>> in the file which contains the content of guest serial console.
>>>
>>> Changes from v2:
>>> - Put all things into __main__
>>> - Fix some typos
>>>
>>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>>> ---
>>>  client/tests/kvm/scripts/check_serial.py |   24 ++++++++++++++++++++++++
>>>  client/tests/kvm/tests_base.cfg.sample   |    7 +++++--
>>>  2 files changed, 29 insertions(+), 2 deletions(-)
>>>  create mode 100644 client/tests/kvm/scripts/check_serial.py
>>>
>>> diff --git a/client/tests/kvm/scripts/check_serial.py b/client/tests/kvm/scripts/check_serial.py
>>> new file mode 100644
>>> index 0000000..6432c27
>>> --- /dev/null
>>> +++ b/client/tests/kvm/scripts/check_serial.py
>>> @@ -0,0 +1,24 @@
>>> +import os, sys, glob, re
>>> +
>>> +
>>> +class SerialCheckerError(Exception):
>>> +    """
>>> +    Simple wrapper for the builtin Exception class.
>>> +    """
>>> +    pass
>>> +
>>> +
>>> +if __name__ == "__main__":
>>> +    client_dir =  os.environ['AUTODIR']
>>> +    pattern = os.environ['KVM_TEST_search_pattern']
>>> +    shortname = os.environ['KVM_TEST_shortname']
>>> +    debugdir = os.path.join(client_dir, "results/default/kvm.%s/debug" 
>>> +                            % shortname)
>>> +    serial_files = glob.glob(os.path.join(debugdir, 'serial*'))
>>> +    
>>> +    fail = [ f for f in serial_files if
>>> +             re.findall(pattern, file(f).read(), re.I) ]
>>> +    if fail:
>>> +        print "%s is found in %s" % (pattern, fail)
>>> +        raise SerialCheckerError("Error found during the check, please " 
>>> +                                 "check the log")
>>> diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
>>> index e85bb4a..c4e522a 100644
>>> --- a/client/tests/kvm/tests_base.cfg.sample
>>> +++ b/client/tests/kvm/tests_base.cfg.sample
>>> @@ -52,6 +52,10 @@ address_index = 0
>>>  # Misc
>>>  profilers = kvm_stat
>>>  
>>> +# pattern to search in guest serial console
>>> +search_pattern = panic
>>> +post_command = "python scripts/check_serial.py"
>>> +post_command_noncritical = no
>>>  
>>>  # Tests
>>>  variants:
>>> @@ -1324,10 +1328,9 @@ virtio|virtio_blk|e1000|balloon_check:
>>>  variants:
>>>      - @qcow2:
>>>          image_format = qcow2
>>> -        post_command = " python scripts/check_image.py;"
>>> +        post_command += " && python scripts/check_image.py"
>>>     
>>
>> If post_command is empty before executing this line, it'll end up being
>> " && python scripts/..." and bash doesn't like that AFAIK.  I think this
>> line should be:
>>
>> post_command += " python scripts/check_image.py;"
>>
>> So if post_command is empty, it becomes " python ...;" which is OK, and
>> if it isn't empty, it becomes "previous command; python ...;" (assuming
>> the previous command ended with ';').
>>
>>   
> What I want is to fail the case when panic was found, so how about use
> <= like:
>         post_command <= "python scripts/check_image.py;"

In that case I think it's best to use

post_command += " python scripts/check_image.py;"

because when commands are separated by ';', the returned exit status is
that of the last command (at least according to my little check).
However, check_image.py must be the last command in the series, so no
other commands should be appended to post_command after it.  If
additional commands are needed they should be pre-pended using <=.

The current way of defining post_command is a little limited.  If we
find out that we need to create complex combinations of commands, some
of which are critical and some of which are not, we may want to start
defining commands like we define VMs:

post_commands = cmd1
command_cmd1 = ls
command_critical_cmd1 = no
command_timeout_cmd1 = 10

...

post_commands += " check_image"
command_check_image = python scripts/check_image.py
command_critical_check_image = yes
command_timeout_check_image = 60

This offers a lot of flexibility but is also uglier.

>>>          remove_image = no
>>>          post_command_timeout = 600
>>> -        post_command_noncritical = yes
>>>      - vmdk:
>>>          only Fedora Ubuntu Windows
>>>          only smp2
>>>
>>> _______________________________________________
>>> Autotest mailing list
>>> Autotest@test.kernel.org
>>> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>>>     
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>   
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-26  9:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-19  9:13 [v3 PATCH] KVM test: Add a helper to search the panic in the log Jason Wang
2010-05-20 10:00 ` [Autotest] " Michael Goldish
2010-05-24  7:38   ` Jason Wang
2010-05-26  9:50     ` [Autotest] " Michael Goldish

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).