diff mbox series

[v2,2/6] tests/boot_linux_console: add BIOS acceptance test

Message ID 1580914565-19675-3-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
Add a test to use qboot with the 'pc' machine class and SeaBIOS with
the 'microvm' machine class (since microvm uses qboot by default) by
adding the '-bios' option via self.vm.add_args() before
calling do_test_x86_64_machine().

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

Comments

Philippe Mathieu-Daudé Feb. 6, 2020, 2:12 p.m. UTC | #1
On 2/5/20 3:56 PM, Liam Merwick wrote:
> Add a test to use qboot with the 'pc' machine class and SeaBIOS with
> the 'microvm' machine class (since microvm uses qboot by default) by
> adding the '-bios' option via self.vm.add_args() before
> calling do_test_x86_64_machine().
> 
> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
>   tests/acceptance/boot_linux_console.py | 17 ++++++++++++++++-
>   1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 233601b429bd..e9375590bc1c 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -61,7 +61,6 @@ class BootLinuxConsole(Test):
>                         '/vmlinuz')
>           kernel_hash = '23bebd2680757891cf7adedb033532163a792495'
>           kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
> -
>           self.vm.set_console()
>           kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
>           self.vm.add_args('-kernel', kernel_path,
> @@ -77,6 +76,14 @@ class BootLinuxConsole(Test):
>           """
>           self.do_test_x86_64_machine()
>   
> +    def test_x86_64_pc_qboot(self):
> +        """
> +        :avocado: tags=arch:x86_64
> +        :avocado: tags=machine:pc
> +        """
> +        self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')

This breaks running once QEMU is installed:

  (2/4) 
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc_qboot:
qemu: could not load PC BIOS 'pc-bios/bios-microvm.bin'
ERROR: [Errno 104] Connection reset by peer (0.08 s)

Cleber, Wainer, what path should we use?

> +        self.do_test_x86_64_machine()
> +
>       def test_x86_64_microvm(self):
>           """
>           :avocado: tags=arch:x86_64
> @@ -84,6 +91,14 @@ class BootLinuxConsole(Test):
>           """
>           self.do_test_x86_64_machine()
>   
> +    def test_x86_64_microvm_seabios(self):
> +        """
> +        :avocado: tags=arch:x86_64
> +        :avocado: tags=machine:microvm
> +        """
> +        self.vm.add_args('-bios', 'pc-bios/bios.bin')
> +        self.do_test_x86_64_machine()
> +
>       def test_mips_malta(self):
>           """
>           :avocado: tags=arch:mips
>
Wainer dos Santos Moschetta Feb. 19, 2020, 7:20 p.m. UTC | #2
On 2/6/20 12:12 PM, Philippe Mathieu-Daudé wrote:
> On 2/5/20 3:56 PM, Liam Merwick wrote:
>> Add a test to use qboot with the 'pc' machine class and SeaBIOS with
>> the 'microvm' machine class (since microvm uses qboot by default) by
>> adding the '-bios' option via self.vm.add_args() before
>> calling do_test_x86_64_machine().
>>
>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>> ---
>>   tests/acceptance/boot_linux_console.py | 17 ++++++++++++++++-
>>   1 file changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/acceptance/boot_linux_console.py 
>> b/tests/acceptance/boot_linux_console.py
>> index 233601b429bd..e9375590bc1c 100644
>> --- a/tests/acceptance/boot_linux_console.py
>> +++ b/tests/acceptance/boot_linux_console.py
>> @@ -61,7 +61,6 @@ class BootLinuxConsole(Test):
>>                         '/vmlinuz')
>>           kernel_hash = '23bebd2680757891cf7adedb033532163a792495'
>>           kernel_path = self.fetch_asset(kernel_url, 
>> asset_hash=kernel_hash)
>> -
>>           self.vm.set_console()
>>           kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 
>> 'console=ttyS0'
>>           self.vm.add_args('-kernel', kernel_path,
>> @@ -77,6 +76,14 @@ class BootLinuxConsole(Test):
>>           """
>>           self.do_test_x86_64_machine()
>>   +    def test_x86_64_pc_qboot(self):
>> +        """
>> +        :avocado: tags=arch:x86_64
>> +        :avocado: tags=machine:pc
>> +        """
>> +        self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')

The test boots QEMU with bios file from $PWD/pc-bios/bios-microvm.bin. 
If you want to get (optionally) the file from an installed QEMU you 
could use Avocado test parameters [1]. Here goes an example:

self.vm.add_args('-bios', self.params.get('bios_microvm', 
default='pc-bios/bios-microvm.bin'))

Then you evoke avocado as:

$ avocado run -p bios_microvm=/usr/share/qemu/bios-microvm.bin (...)

[1] 
https://avocado-framework.readthedocs.io/en/75.1/guides/writer/chapters/parameters.html


>>
>
> This breaks running once QEMU is installed:
>
>  (2/4) 
> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc_qboot:
> qemu: could not load PC BIOS 'pc-bios/bios-microvm.bin'
> ERROR: [Errno 104] Connection reset by peer (0.08 s)
>
> Cleber, Wainer, what path should we use?


Philippe, above answers your question?

Thanks,

- Wainer

>
>
>> +        self.do_test_x86_64_machine()
>> +
>>       def test_x86_64_microvm(self):
>>           """
>>           :avocado: tags=arch:x86_64
>> @@ -84,6 +91,14 @@ class BootLinuxConsole(Test):
>>           """
>>           self.do_test_x86_64_machine()
>>   +    def test_x86_64_microvm_seabios(self):
>> +        """
>> +        :avocado: tags=arch:x86_64
>> +        :avocado: tags=machine:microvm
>> +        """
>> +        self.vm.add_args('-bios', 'pc-bios/bios.bin')
>> +        self.do_test_x86_64_machine()
>> +
>>       def test_mips_malta(self):
>>           """
>>           :avocado: tags=arch:mips
>>
>
Liam Merwick Feb. 26, 2020, 5:36 p.m. UTC | #3
On 19/02/2020 19:20, Wainer dos Santos Moschetta wrote:
> 
> On 2/6/20 12:12 PM, Philippe Mathieu-Daudé wrote:
>> On 2/5/20 3:56 PM, Liam Merwick wrote:
>>> Add a test to use qboot with the 'pc' machine class and SeaBIOS with
>>> the 'microvm' machine class (since microvm uses qboot by default) by
>>> adding the '-bios' option via self.vm.add_args() before
>>> calling do_test_x86_64_machine().
>>>
>>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>>> ---
>>>   tests/acceptance/boot_linux_console.py | 17 ++++++++++++++++-
>>>   1 file changed, 16 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tests/acceptance/boot_linux_console.py 
>>> b/tests/acceptance/boot_linux_console.py
>>> index 233601b429bd..e9375590bc1c 100644
>>> --- a/tests/acceptance/boot_linux_console.py
>>> +++ b/tests/acceptance/boot_linux_console.py
>>> @@ -61,7 +61,6 @@ class BootLinuxConsole(Test):
>>>                         '/vmlinuz')
>>>           kernel_hash = '23bebd2680757891cf7adedb033532163a792495'
>>>           kernel_path = self.fetch_asset(kernel_url, 
>>> asset_hash=kernel_hash)
>>> -
>>>           self.vm.set_console()
>>>           kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 
>>> 'console=ttyS0'
>>>           self.vm.add_args('-kernel', kernel_path,
>>> @@ -77,6 +76,14 @@ class BootLinuxConsole(Test):
>>>           """
>>>           self.do_test_x86_64_machine()
>>>   +    def test_x86_64_pc_qboot(self):
>>> +        """
>>> +        :avocado: tags=arch:x86_64
>>> +        :avocado: tags=machine:pc
>>> +        """
>>> +        self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
> 
> The test boots QEMU with bios file from $PWD/pc-bios/bios-microvm.bin. 
> If you want to get (optionally) the file from an installed QEMU you 
> could use Avocado test parameters [1]. Here goes an example:
> 
> self.vm.add_args('-bios', self.params.get('bios_microvm', 
> default='pc-bios/bios-microvm.bin'))
> 
> Then you evoke avocado as:
> 
> $ avocado run -p bios_microvm=/usr/share/qemu/bios-microvm.bin (...)
> 
> [1] 
> https://avocado-framework.readthedocs.io/en/75.1/guides/writer/chapters/parameters.html 
> 
> 

Thanks Wainer - that works well for my patches.

Regards,
Liam


> 
>>>
>>
>> This breaks running once QEMU is installed:
>>
>>  (2/4) 
>> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc_qboot: 
>>
>> qemu: could not load PC BIOS 'pc-bios/bios-microvm.bin'
>> ERROR: [Errno 104] Connection reset by peer (0.08 s)
>>
>> Cleber, Wainer, what path should we use?
> 
> 
> Philippe, above answers your question?
> 
> Thanks,
> 
> - Wainer
> 
>>
>>
>>> +        self.do_test_x86_64_machine()
>>> +
>>>       def test_x86_64_microvm(self):
>>>           """
>>>           :avocado: tags=arch:x86_64
>>> @@ -84,6 +91,14 @@ class BootLinuxConsole(Test):
>>>           """
>>>           self.do_test_x86_64_machine()
>>>   +    def test_x86_64_microvm_seabios(self):
>>> +        """
>>> +        :avocado: tags=arch:x86_64
>>> +        :avocado: tags=machine:microvm
>>> +        """
>>> +        self.vm.add_args('-bios', 'pc-bios/bios.bin')
>>> +        self.do_test_x86_64_machine()
>>> +
>>>       def test_mips_malta(self):
>>>           """
>>>           :avocado: tags=arch:mips
>>>
>>
>
diff mbox series

Patch

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 233601b429bd..e9375590bc1c 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -61,7 +61,6 @@  class BootLinuxConsole(Test):
                       '/vmlinuz')
         kernel_hash = '23bebd2680757891cf7adedb033532163a792495'
         kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-
         self.vm.set_console()
         kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
         self.vm.add_args('-kernel', kernel_path,
@@ -77,6 +76,14 @@  class BootLinuxConsole(Test):
         """
         self.do_test_x86_64_machine()
 
+    def test_x86_64_pc_qboot(self):
+        """
+        :avocado: tags=arch:x86_64
+        :avocado: tags=machine:pc
+        """
+        self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
+        self.do_test_x86_64_machine()
+
     def test_x86_64_microvm(self):
         """
         :avocado: tags=arch:x86_64
@@ -84,6 +91,14 @@  class BootLinuxConsole(Test):
         """
         self.do_test_x86_64_machine()
 
+    def test_x86_64_microvm_seabios(self):
+        """
+        :avocado: tags=arch:x86_64
+        :avocado: tags=machine:microvm
+        """
+        self.vm.add_args('-bios', 'pc-bios/bios.bin')
+        self.do_test_x86_64_machine()
+
     def test_mips_malta(self):
         """
         :avocado: tags=arch:mips