diff mbox series

[1/5] tests/acceptance: Add test that runs NetBSD installer on PRep/40p

Message ID 20190627110201.1999-2-f4bug@amsat.org
State New
Headers show
Series tests/acceptance: Add tests for the PReP/40p machine | expand

Commit Message

Philippe Mathieu-Daudé June 27, 2019, 11:01 a.m. UTC
User case from:
http://mail-index.netbsd.org/port-prep/2017/04/11/msg000112.html

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/ppc_prep_40p.py | 63 ++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 tests/acceptance/ppc_prep_40p.py

Comments

Philippe Mathieu-Daudé June 27, 2019, noon UTC | #1
typo "PRep" -> "PReP" in patch subject

On 6/27/19 1:01 PM, Philippe Mathieu-Daudé wrote:
> User case from:
> http://mail-index.netbsd.org/port-prep/2017/04/11/msg000112.html
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  tests/acceptance/ppc_prep_40p.py | 63 ++++++++++++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
>  create mode 100644 tests/acceptance/ppc_prep_40p.py

Hervé, in v2 I plan to rename it machine_ppc_prep_40p.py and add an
entry in MAINTAINERS:

-- >8 --
diff --git a/MAINTAINERS b/MAINTAINERS
@@ -1051,6 +1051,7 @@ F: hw/timer/m48t59-isa.c
 F: include/hw/isa/pc87312.h
 F: include/hw/timer/m48t59.h
 F: pc-bios/ppc_rom.bin
+F: tests/acceptance/machine_ppc_prep_40p.py

---

> 
> diff --git a/tests/acceptance/ppc_prep_40p.py b/tests/acceptance/ppc_prep_40p.py
> new file mode 100644
> index 0000000000..53f2d2ecf0
> --- /dev/null
> +++ b/tests/acceptance/ppc_prep_40p.py
> @@ -0,0 +1,63 @@
> +# Functional test that boots a PReP/40p machine and checks its serial console.
> +#
> +# Copyright (c) Philippe Mathieu-Daudé <f4bug@amsat.org>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2 or
> +# later. See the COPYING file in the top-level directory.
> +
> +import os
> +import logging
> +
> +from avocado import skipIf
> +from avocado_qemu import Test
> +
> +
> +class IbmPrep40pMachine(Test):
> +
> +    timeout = 60
> +
> +    # TODO refactor to MachineTest
> +    def wait_for_console_pattern(self, success_message, failure_message=None):
> +        """
> +        Waits for messages to appear on the console, while logging the content
> +
> +        :param success_message: if this message appears, test succeeds
> +        :param failure_message: if this message appears, test fails
> +        """
> +        console = self.vm.console_socket.makefile()
> +        console_logger = logging.getLogger('console')
> +        while True:
> +            msg = console.readline().strip()
> +            if not msg:
> +                continue
> +            console_logger.debug(msg)
> +            if success_message in msg:
> +                break
> +            if failure_message and failure_message in msg:
> +                fail = 'Failure message found in console: %s' % failure_message
> +                self.fail(fail)
> +
> +    @skipIf(os.getenv('CONTINUOUS_INTEGRATION'), 'Running on Travis-CI')
> +    def test_factory_firmware_and_netbsd(self):
> +        """
> +        :avocado: tags=arch:ppc
> +        :avocado: tags=machine:40p
> +        :avocado: tags=slowness:high
> +        """
> +        bios_url = ('ftp://ftp.boulder.ibm.com/rs6000/firmware/'
> +                    '7020-40p/P12H0456.IMG')
> +        bios_hash = '1775face4e6dc27f3a6ed955ef6eb331bf817f03'
> +        bios_path = self.fetch_asset(bios_url, asset_hash=bios_hash)
> +        drive_url = ('https://ftp.netbsd.org/pub/NetBSD/NetBSD-archive/'
> +                     'NetBSD-4.0/prep/installation/floppy/generic_com0.fs')
> +        drive_hash = 'dbcfc09912e71bd5f0d82c7c1ee43082fb596ceb'
> +        drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash)
> +
> +        self.vm.set_machine('40p')
> +        self.vm.set_console()
> +        self.vm.add_args('-bios', bios_path,
> +                         '-fda', drive_path)
> +        self.vm.launch()
> +        os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007'
> +        self.wait_for_console_pattern(os_banner)
> +        self.wait_for_console_pattern('Model: IBM PPS Model 6015')
>
Kamil Rytarowski June 27, 2019, 9:47 p.m. UTC | #2
On 27.06.2019 13:01, Philippe Mathieu-Daudé wrote:
> +        bios_url = ('ftp://ftp.boulder.ibm.com/rs6000/firmware/'
> +                    '7020-40p/P12H0456.IMG')
> +        bios_hash = '1775face4e6dc27f3a6ed955ef6eb331bf817f03'
> +        bios_path = self.fetch_asset(bios_url, asset_hash=bios_hash)
> +        drive_url = ('https://ftp.netbsd.org/pub/NetBSD/NetBSD-archive/'
> +                     'NetBSD-4.0/prep/installation/floppy/generic_com0.fs')
> +        drive_hash = 'dbcfc09912e71bd5f0d82c7c1ee43082fb596ceb'
> +        drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash)
> +
> +        self.vm.set_machine('40p')
> +        self.vm.set_console()
> +        self.vm.add_args('-bios', bios_path,
> +                         '-fda', drive_path)
> +        self.vm.launch()
> +        os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007'

Is there a specific reason to use NetBSD 4.0? It's a very old release,
the newest one is 8.1.
Hervé Poussineau July 1, 2019, 8:51 p.m. UTC | #3
Le 27/06/2019 à 14:00, Philippe Mathieu-Daudé a écrit :
> typo "PRep" -> "PReP" in patch subject
> 
> On 6/27/19 1:01 PM, Philippe Mathieu-Daudé wrote:
>> User case from:
>> http://mail-index.netbsd.org/port-prep/2017/04/11/msg000112.html
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>   tests/acceptance/ppc_prep_40p.py | 63 ++++++++++++++++++++++++++++++++
>>   1 file changed, 63 insertions(+)
>>   create mode 100644 tests/acceptance/ppc_prep_40p.py
> 
> Hervé, in v2 I plan to rename it machine_ppc_prep_40p.py and add an
> entry in MAINTAINERS:

With the change you want to do:
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>

> 
> -- >8 --
> diff --git a/MAINTAINERS b/MAINTAINERS
> @@ -1051,6 +1051,7 @@ F: hw/timer/m48t59-isa.c
>   F: include/hw/isa/pc87312.h
>   F: include/hw/timer/m48t59.h
>   F: pc-bios/ppc_rom.bin
> +F: tests/acceptance/machine_ppc_prep_40p.py
> 
> ---
> 
>>
>> diff --git a/tests/acceptance/ppc_prep_40p.py b/tests/acceptance/ppc_prep_40p.py
>> new file mode 100644
>> index 0000000000..53f2d2ecf0
>> --- /dev/null
>> +++ b/tests/acceptance/ppc_prep_40p.py
>> @@ -0,0 +1,63 @@
>> +# Functional test that boots a PReP/40p machine and checks its serial console.
>> +#
>> +# Copyright (c) Philippe Mathieu-Daudé <f4bug@amsat.org>
>> +#
>> +# This work is licensed under the terms of the GNU GPL, version 2 or
>> +# later. See the COPYING file in the top-level directory.
>> +
>> +import os
>> +import logging
>> +
>> +from avocado import skipIf
>> +from avocado_qemu import Test
>> +
>> +
>> +class IbmPrep40pMachine(Test):
>> +
>> +    timeout = 60
>> +
>> +    # TODO refactor to MachineTest
>> +    def wait_for_console_pattern(self, success_message, failure_message=None):
>> +        """
>> +        Waits for messages to appear on the console, while logging the content
>> +
>> +        :param success_message: if this message appears, test succeeds
>> +        :param failure_message: if this message appears, test fails
>> +        """
>> +        console = self.vm.console_socket.makefile()
>> +        console_logger = logging.getLogger('console')
>> +        while True:
>> +            msg = console.readline().strip()
>> +            if not msg:
>> +                continue
>> +            console_logger.debug(msg)
>> +            if success_message in msg:
>> +                break
>> +            if failure_message and failure_message in msg:
>> +                fail = 'Failure message found in console: %s' % failure_message
>> +                self.fail(fail)
>> +
>> +    @skipIf(os.getenv('CONTINUOUS_INTEGRATION'), 'Running on Travis-CI')
>> +    def test_factory_firmware_and_netbsd(self):
>> +        """
>> +        :avocado: tags=arch:ppc
>> +        :avocado: tags=machine:40p
>> +        :avocado: tags=slowness:high
>> +        """
>> +        bios_url = ('ftp://ftp.boulder.ibm.com/rs6000/firmware/'
>> +                    '7020-40p/P12H0456.IMG')
>> +        bios_hash = '1775face4e6dc27f3a6ed955ef6eb331bf817f03'
>> +        bios_path = self.fetch_asset(bios_url, asset_hash=bios_hash)
>> +        drive_url = ('https://ftp.netbsd.org/pub/NetBSD/NetBSD-archive/'
>> +                     'NetBSD-4.0/prep/installation/floppy/generic_com0.fs')
>> +        drive_hash = 'dbcfc09912e71bd5f0d82c7c1ee43082fb596ceb'
>> +        drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash)
>> +
>> +        self.vm.set_machine('40p')
>> +        self.vm.set_console()
>> +        self.vm.add_args('-bios', bios_path,
>> +                         '-fda', drive_path)
>> +        self.vm.launch()
>> +        os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007'
>> +        self.wait_for_console_pattern(os_banner)
>> +        self.wait_for_console_pattern('Model: IBM PPS Model 6015')
>>
>
Philippe Mathieu-Daudé July 5, 2019, 6 p.m. UTC | #4
Hi Kamil,

On 6/27/19 11:47 PM, Kamil Rytarowski wrote:
> On 27.06.2019 13:01, Philippe Mathieu-Daudé wrote:
>> +        bios_url = ('ftp://ftp.boulder.ibm.com/rs6000/firmware/'
>> +                    '7020-40p/P12H0456.IMG')
>> +        bios_hash = '1775face4e6dc27f3a6ed955ef6eb331bf817f03'
>> +        bios_path = self.fetch_asset(bios_url, asset_hash=bios_hash)
>> +        drive_url = ('https://ftp.netbsd.org/pub/NetBSD/NetBSD-archive/'
>> +                     'NetBSD-4.0/prep/installation/floppy/generic_com0.fs')
>> +        drive_hash = 'dbcfc09912e71bd5f0d82c7c1ee43082fb596ceb'
>> +        drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash)
>> +
>> +        self.vm.set_machine('40p')
>> +        self.vm.set_console()
>> +        self.vm.add_args('-bios', bios_path,
>> +                         '-fda', drive_path)
>> +        self.vm.launch()
>> +        os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007'
> 
> Is there a specific reason to use NetBSD 4.0? It's a very old release,
> the newest one is 8.1.

The goal of these integration tests is to verify a specific
configuration that worked in the past still works with today codebase.

It is particularly useful for machines that have not a big quantity of
users.

This test does not intent to test NetBSD, but that the PReP/40p machine
is still working, as it used to work in the post saved in the commit
description:

http://mail-index.netbsd.org/port-prep/2017/04/11/msg000112.html

So this test is useful to avoid the PReP machine code to bitrot.

I'd like to know what other from the QEMU community think/expect about
these tests.

FWIW I tested newer versions and they don't boot.

Regards,

Phil.
Kamil Rytarowski July 6, 2019, 6:39 a.m. UTC | #5
On 05.07.2019 20:00, Philippe Mathieu-Daudé wrote:
> Hi Kamil,
> 
> On 6/27/19 11:47 PM, Kamil Rytarowski wrote:
>> On 27.06.2019 13:01, Philippe Mathieu-Daudé wrote:
>>> +        bios_url = ('ftp://ftp.boulder.ibm.com/rs6000/firmware/'
>>> +                    '7020-40p/P12H0456.IMG')
>>> +        bios_hash = '1775face4e6dc27f3a6ed955ef6eb331bf817f03'
>>> +        bios_path = self.fetch_asset(bios_url, asset_hash=bios_hash)
>>> +        drive_url = ('https://ftp.netbsd.org/pub/NetBSD/NetBSD-archive/'
>>> +                     'NetBSD-4.0/prep/installation/floppy/generic_com0.fs')
>>> +        drive_hash = 'dbcfc09912e71bd5f0d82c7c1ee43082fb596ceb'
>>> +        drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash)
>>> +
>>> +        self.vm.set_machine('40p')
>>> +        self.vm.set_console()
>>> +        self.vm.add_args('-bios', bios_path,
>>> +                         '-fda', drive_path)
>>> +        self.vm.launch()
>>> +        os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007'
>>
>> Is there a specific reason to use NetBSD 4.0? It's a very old release,
>> the newest one is 8.1.
> 
> The goal of these integration tests is to verify a specific
> configuration that worked in the past still works with today codebase.
> 
> It is particularly useful for machines that have not a big quantity of
> users.
> 
> This test does not intent to test NetBSD, but that the PReP/40p machine
> is still working, as it used to work in the post saved in the commit
> description:
> 
> http://mail-index.netbsd.org/port-prep/2017/04/11/msg000112.html
> 
> So this test is useful to avoid the PReP machine code to bitrot.
> 
> I'd like to know what other from the QEMU community think/expect about
> these tests.
> 

This is understood and appreciated as NetBSD still formally supports the
prep port.

> FWIW I tested newer versions and they don't boot.
> 

This is what I wanted to know, whether this was an accident in using an
older version or not. I will try to report it to other developers and
maybe someone could debug and fix it.

> Regards,
> 
> Phil.
>
diff mbox series

Patch

diff --git a/tests/acceptance/ppc_prep_40p.py b/tests/acceptance/ppc_prep_40p.py
new file mode 100644
index 0000000000..53f2d2ecf0
--- /dev/null
+++ b/tests/acceptance/ppc_prep_40p.py
@@ -0,0 +1,63 @@ 
+# Functional test that boots a PReP/40p machine and checks its serial console.
+#
+# Copyright (c) Philippe Mathieu-Daudé <f4bug@amsat.org>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+import os
+import logging
+
+from avocado import skipIf
+from avocado_qemu import Test
+
+
+class IbmPrep40pMachine(Test):
+
+    timeout = 60
+
+    # TODO refactor to MachineTest
+    def wait_for_console_pattern(self, success_message, failure_message=None):
+        """
+        Waits for messages to appear on the console, while logging the content
+
+        :param success_message: if this message appears, test succeeds
+        :param failure_message: if this message appears, test fails
+        """
+        console = self.vm.console_socket.makefile()
+        console_logger = logging.getLogger('console')
+        while True:
+            msg = console.readline().strip()
+            if not msg:
+                continue
+            console_logger.debug(msg)
+            if success_message in msg:
+                break
+            if failure_message and failure_message in msg:
+                fail = 'Failure message found in console: %s' % failure_message
+                self.fail(fail)
+
+    @skipIf(os.getenv('CONTINUOUS_INTEGRATION'), 'Running on Travis-CI')
+    def test_factory_firmware_and_netbsd(self):
+        """
+        :avocado: tags=arch:ppc
+        :avocado: tags=machine:40p
+        :avocado: tags=slowness:high
+        """
+        bios_url = ('ftp://ftp.boulder.ibm.com/rs6000/firmware/'
+                    '7020-40p/P12H0456.IMG')
+        bios_hash = '1775face4e6dc27f3a6ed955ef6eb331bf817f03'
+        bios_path = self.fetch_asset(bios_url, asset_hash=bios_hash)
+        drive_url = ('https://ftp.netbsd.org/pub/NetBSD/NetBSD-archive/'
+                     'NetBSD-4.0/prep/installation/floppy/generic_com0.fs')
+        drive_hash = 'dbcfc09912e71bd5f0d82c7c1ee43082fb596ceb'
+        drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash)
+
+        self.vm.set_machine('40p')
+        self.vm.set_console()
+        self.vm.add_args('-bios', bios_path,
+                         '-fda', drive_path)
+        self.vm.launch()
+        os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007'
+        self.wait_for_console_pattern(os_banner)
+        self.wait_for_console_pattern('Model: IBM PPS Model 6015')