diff mbox series

[v2,1/6] tests/boot_linux_console: add microvm acceptance test

Message ID 1580914565-19675-2-git-send-email-liam.merwick@oracle.com (mailing list archive)
State New, archived
Headers show
Series tests/boot_linux_console: add extra boot acceptance tests | expand

Commit Message

Liam Merwick Feb. 5, 2020, 2:56 p.m. UTC
Refactor test_x86_64_pc() to test_x86_64_machine() so that separate
functions which specify the Avocado tag of ':avocado: tags=machine:'
as being either 'pc' or 'microvm' can be used to test booting a
compressed kernel using either machine class.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
---
 tests/acceptance/boot_linux_console.py | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 6, 2020, 1:57 p.m. UTC | #1
On 2/5/20 3:56 PM, Liam Merwick wrote:
> Refactor test_x86_64_pc() to test_x86_64_machine() so that separate
> functions which specify the Avocado tag of ':avocado: tags=machine:'
> as being either 'pc' or 'microvm' can be used to test booting a
> compressed kernel using either machine class.
> 
> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
>   tests/acceptance/boot_linux_console.py | 20 +++++++++++++++++---
>   1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index e40b84651b0b..233601b429bd 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -51,10 +51,10 @@ class BootLinuxConsole(Test):
>           os.chdir(cwd)
>           return self.workdir + path
>   
> -    def test_x86_64_pc(self):
> +    def do_test_x86_64_machine(self):
>           """
> -        :avocado: tags=arch:x86_64
> -        :avocado: tags=machine:pc
> +        Common routine to boot an x86_64 guest.
> +        Caller must specify tags=arch and tags=machine
>           """
>           kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
>                         '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
> @@ -70,6 +70,20 @@ class BootLinuxConsole(Test):
>           console_pattern = 'Kernel command line: %s' % kernel_command_line
>           self.wait_for_console_pattern(console_pattern)
>   
> +    def test_x86_64_pc(self):
> +        """
> +        :avocado: tags=arch:x86_64
> +        :avocado: tags=machine:pc
> +        """
> +        self.do_test_x86_64_machine()
> +
> +    def test_x86_64_microvm(self):
> +        """
> +        :avocado: tags=arch:x86_64
> +        :avocado: tags=machine:microvm
> +        """
> +        self.do_test_x86_64_machine()
> +
>       def test_mips_malta(self):
>           """
>           :avocado: tags=arch:mips
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Philippe Mathieu-Daudé Feb. 6, 2020, 2:09 p.m. UTC | #2
Hi Liam,

On 2/6/20 2:57 PM, Philippe Mathieu-Daudé wrote:
> On 2/5/20 3:56 PM, Liam Merwick wrote:
>> Refactor test_x86_64_pc() to test_x86_64_machine() so that separate
>> functions which specify the Avocado tag of ':avocado: tags=machine:'
>> as being either 'pc' or 'microvm' can be used to test booting a
>> compressed kernel using either machine class.
>>
>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>> ---
>>   tests/acceptance/boot_linux_console.py | 20 +++++++++++++++++---
>>   1 file changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/acceptance/boot_linux_console.py 
>> b/tests/acceptance/boot_linux_console.py
>> index e40b84651b0b..233601b429bd 100644
>> --- a/tests/acceptance/boot_linux_console.py
>> +++ b/tests/acceptance/boot_linux_console.py
>> @@ -51,10 +51,10 @@ class BootLinuxConsole(Test):
>>           os.chdir(cwd)
>>           return self.workdir + path
>> -    def test_x86_64_pc(self):
>> +    def do_test_x86_64_machine(self):
>>           """
>> -        :avocado: tags=arch:x86_64
>> -        :avocado: tags=machine:pc
>> +        Common routine to boot an x86_64 guest.
>> +        Caller must specify tags=arch and tags=machine
>>           """
>>           kernel_url = 
>> ('https://archives.fedoraproject.org/pub/archive/fedora'
>>                         
>> '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
>> @@ -70,6 +70,20 @@ class BootLinuxConsole(Test):
>>           console_pattern = 'Kernel command line: %s' % 
>> kernel_command_line
>>           self.wait_for_console_pattern(console_pattern)
>> +    def test_x86_64_pc(self):
>> +        """
>> +        :avocado: tags=arch:x86_64
>> +        :avocado: tags=machine:pc
>> +        """
>> +        self.do_test_x86_64_machine()
>> +
>> +    def test_x86_64_microvm(self):
>> +        """
>> +        :avocado: tags=arch:x86_64
>> +        :avocado: tags=machine:microvm
>> +        """
>> +        self.do_test_x86_64_machine()
>> +
>>       def test_mips_malta(self):
>>           """
>>           :avocado: tags=arch:mips
>>
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Actually this breaks testing the distrib QEMU:

  (1/2) 
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: 
PASS (2.58 s)
  (2/2) 
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_microvm:
Output: 'qemu-system-x86_64: -machine microvm: unsupported machine 
type\nUse -machine help to list supported machines\n'
ERROR: timed out (15.10 s)

Do you mind testing the series testing a machine is available?
https://www.mail-archive.com/qemu-devel@nongnu.org/msg675086.html
Liam Merwick Feb. 6, 2020, 3:05 p.m. UTC | #3
On 06/02/2020 14:09, Philippe Mathieu-Daudé wrote:
> Hi Liam,
> 
> On 2/6/20 2:57 PM, Philippe Mathieu-Daudé wrote:
>> On 2/5/20 3:56 PM, Liam Merwick wrote:
>>> Refactor test_x86_64_pc() to test_x86_64_machine() so that separate
>>> functions which specify the Avocado tag of ':avocado: tags=machine:'
>>> as being either 'pc' or 'microvm' can be used to test booting a
>>> compressed kernel using either machine class.
>>>
>>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>>> ---
>>>   tests/acceptance/boot_linux_console.py | 20 +++++++++++++++++---
>>>   1 file changed, 17 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/tests/acceptance/boot_linux_console.py 
>>> b/tests/acceptance/boot_linux_console.py
>>> index e40b84651b0b..233601b429bd 100644
>>> --- a/tests/acceptance/boot_linux_console.py
>>> +++ b/tests/acceptance/boot_linux_console.py
>>> @@ -51,10 +51,10 @@ class BootLinuxConsole(Test):
>>>           os.chdir(cwd)
>>>           return self.workdir + path
>>> -    def test_x86_64_pc(self):
>>> +    def do_test_x86_64_machine(self):
>>>           """
>>> -        :avocado: tags=arch:x86_64
>>> -        :avocado: tags=machine:pc
>>> +        Common routine to boot an x86_64 guest.
>>> +        Caller must specify tags=arch and tags=machine
>>>           """
>>>           kernel_url = 
>>> ('https://archives.fedoraproject.org/pub/archive/fedora'
>>> '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
>>> @@ -70,6 +70,20 @@ class BootLinuxConsole(Test):
>>>           console_pattern = 'Kernel command line: %s' % 
>>> kernel_command_line
>>>           self.wait_for_console_pattern(console_pattern)
>>> +    def test_x86_64_pc(self):
>>> +        """
>>> +        :avocado: tags=arch:x86_64
>>> +        :avocado: tags=machine:pc
>>> +        """
>>> +        self.do_test_x86_64_machine()
>>> +
>>> +    def test_x86_64_microvm(self):
>>> +        """
>>> +        :avocado: tags=arch:x86_64
>>> +        :avocado: tags=machine:microvm
>>> +        """
>>> +        self.do_test_x86_64_machine()
>>> +
>>>       def test_mips_malta(self):
>>>           """
>>>           :avocado: tags=arch:mips
>>>
>>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> Actually this breaks testing the distrib QEMU:


I happen to have a QEMU RPM installed - how do I override 'make 
check-acceptance' to pick up /usr/bin/qemu-system-x86_64 (and 
/usr/share/qemu/bios-microvm.bin - not sure that is a universal location 
for distros)?   Overriding QTEST_QEMU_BINARY didn't seem to work for me 
- doesn't appear to apply to the check-acceptance rule.

> 
>   (1/2) 
> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: 
> PASS (2.58 s)
>   (2/2) 
> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_microvm: 
> 
> Output: 'qemu-system-x86_64: -machine microvm: unsupported machine 
> type\nUse -machine help to list supported machines\n'
> ERROR: timed out (15.10 s)
> 
> Do you mind testing the series testing a machine is available?
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg675086.html


Sure. I'll test/review those.

Regards,
Liam
Wainer dos Santos Moschetta Feb. 19, 2020, 7:02 p.m. UTC | #4
Liam,

Sorry for the long time to reply it... comments below.

On 2/6/20 1:05 PM, Liam Merwick wrote:
> On 06/02/2020 14:09, Philippe Mathieu-Daudé wrote:
>> Hi Liam,
>>
>> On 2/6/20 2:57 PM, Philippe Mathieu-Daudé wrote:
>>> On 2/5/20 3:56 PM, Liam Merwick wrote:
>>>> Refactor test_x86_64_pc() to test_x86_64_machine() so that separate
>>>> functions which specify the Avocado tag of ':avocado: tags=machine:'
>>>> as being either 'pc' or 'microvm' can be used to test booting a
>>>> compressed kernel using either machine class.
>>>>
>>>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>>>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>>>> ---
>>>>   tests/acceptance/boot_linux_console.py | 20 +++++++++++++++++---
>>>>   1 file changed, 17 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/tests/acceptance/boot_linux_console.py 
>>>> b/tests/acceptance/boot_linux_console.py
>>>> index e40b84651b0b..233601b429bd 100644
>>>> --- a/tests/acceptance/boot_linux_console.py
>>>> +++ b/tests/acceptance/boot_linux_console.py
>>>> @@ -51,10 +51,10 @@ class BootLinuxConsole(Test):
>>>>           os.chdir(cwd)
>>>>           return self.workdir + path
>>>> -    def test_x86_64_pc(self):
>>>> +    def do_test_x86_64_machine(self):
>>>>           """
>>>> -        :avocado: tags=arch:x86_64
>>>> -        :avocado: tags=machine:pc
>>>> +        Common routine to boot an x86_64 guest.
>>>> +        Caller must specify tags=arch and tags=machine
>>>>           """
>>>>           kernel_url = 
>>>> ('https://archives.fedoraproject.org/pub/archive/fedora'
>>>> '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
>>>> @@ -70,6 +70,20 @@ class BootLinuxConsole(Test):
>>>>           console_pattern = 'Kernel command line: %s' % 
>>>> kernel_command_line
>>>>           self.wait_for_console_pattern(console_pattern)
>>>> +    def test_x86_64_pc(self):
>>>> +        """
>>>> +        :avocado: tags=arch:x86_64
>>>> +        :avocado: tags=machine:pc
>>>> +        """
>>>> +        self.do_test_x86_64_machine()
>>>> +
>>>> +    def test_x86_64_microvm(self):
>>>> +        """
>>>> +        :avocado: tags=arch:x86_64
>>>> +        :avocado: tags=machine:microvm
>>>> +        """
>>>> +        self.do_test_x86_64_machine()
>>>> +
>>>>       def test_mips_malta(self):
>>>>           """
>>>>           :avocado: tags=arch:mips
>>>>
>>>
>>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>
>> Actually this breaks testing the distrib QEMU:
>
>
> I happen to have a QEMU RPM installed - how do I override 'make 
> check-acceptance' to pick up /usr/bin/qemu-system-x86_64 (and 
> /usr/share/qemu/bios-microvm.bin - not sure that is a universal 
> location for distros)?   Overriding QTEST_QEMU_BINARY didn't seem to 
> work for me - doesn't appear to apply to the check-acceptance rule.

So far as I know you cannot override the QEMU path with `make 
check-acceptance`. If you still need to override then you need to evoke 
avocado manually. Suppose it is in the build directory, do:

$ make check-venv

$ ./tests/venv/bin/avocado run -p qemu_bin=/usr/bin/qemu-system-x86_64 
-t arch:x86_64 tests/acceptance/boot_linux_console.py

The -p option on the command above is used to pass a test parameter. The 
underlying avocado_qemu framework used on the acceptance tests 
recognizes the 'qemu_bin' parameter, which in case of its absence the 
test setup searches for a suitable QEMU built on the current directory. 
The avocado_qemu doesn't  have a parameter to indicate the path to the 
bios file, so there is no way to override it (well, not entirely true 
and I explain it on the patch 02 of this series).

Thanks!

- Wainer

>
>
>>
>>   (1/2) 
>> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: 
>> PASS (2.58 s)
>>   (2/2) 
>> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_microvm: 
>>
>> Output: 'qemu-system-x86_64: -machine microvm: unsupported machine 
>> type\nUse -machine help to list supported machines\n'
>> ERROR: timed out (15.10 s)
>>
>> Do you mind testing the series testing a machine is available?
>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg675086.html
>
>
> Sure. I'll test/review those.
>
> Regards,
> Liam
>
>
diff mbox series

Patch

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index e40b84651b0b..233601b429bd 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -51,10 +51,10 @@  class BootLinuxConsole(Test):
         os.chdir(cwd)
         return self.workdir + path
 
-    def test_x86_64_pc(self):
+    def do_test_x86_64_machine(self):
         """
-        :avocado: tags=arch:x86_64
-        :avocado: tags=machine:pc
+        Common routine to boot an x86_64 guest.
+        Caller must specify tags=arch and tags=machine
         """
         kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
                       '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
@@ -70,6 +70,20 @@  class BootLinuxConsole(Test):
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
+    def test_x86_64_pc(self):
+        """
+        :avocado: tags=arch:x86_64
+        :avocado: tags=machine:pc
+        """
+        self.do_test_x86_64_machine()
+
+    def test_x86_64_microvm(self):
+        """
+        :avocado: tags=arch:x86_64
+        :avocado: tags=machine:microvm
+        """
+        self.do_test_x86_64_machine()
+
     def test_mips_malta(self):
         """
         :avocado: tags=arch:mips