qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Nicholas Piggin <npiggin@gmail.com>, qemu-ppc@nongnu.org
Cc: Cleber Rosa <crosa@redhat.com>,
	Wainer dos Santos Moschetta <wainersm@redhat.com>,
	Beraldo Leal <bleal@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [RFC PATCH 08/11] tests/avocado: Add ppc MacOS tests
Date: Tue, 10 Oct 2023 09:58:35 +0200	[thread overview]
Message-ID: <2d455bcf-f586-52df-eb85-136bc4362d5d@linaro.org> (raw)
In-Reply-To: <20231010075238.95646-9-npiggin@gmail.com>

Hi Nicholas,

On 10/10/23 09:52, Nicholas Piggin wrote:
> Similarly to the AIX test, this adds some tests that can boot MacOS9
> and OSX images that are provided.
> ---
>   tests/avocado/ppc/macos9.ppm | Bin 0 -> 921615 bytes
>   tests/avocado/ppc_macos.py   |  90 +++++++++++++++++++++++++++++++++++
>   2 files changed, 90 insertions(+)
>   create mode 100644 tests/avocado/ppc/macos9.ppm
>   create mode 100644 tests/avocado/ppc_macos.py


> diff --git a/tests/avocado/ppc_macos.py b/tests/avocado/ppc_macos.py
> new file mode 100644
> index 0000000000..055fc3aca4
> --- /dev/null
> +++ b/tests/avocado/ppc_macos.py
> @@ -0,0 +1,90 @@
> +# Functional test that boots MacOS on ppc mac99
> +#
> +# Copyright (c) 2023 IBM Corporation
> +#
> +# 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 time
> +import tempfile
> +import filecmp
> +import os
> +
> +from typing import List
> +from avocado.utils import archive
> +from avocado_qemu import QemuSystemTest
> +from avocado_qemu import wait_for_console_pattern
> +
> +class PPCMacOSTest(QemuSystemTest):
> +
> +    timeout = 240
> +
> +    def test_macos9(self):
> +        """
> +        :avocado: tags=arch:ppc
> +        :avocado: tags=machine:mac99
> +        :avocado: tags=device:framebuffer
> +        """
> +
> +        basedir = os.getenv('AVOCADO_TEST_BASEDIR')
> +        screenshot_path = os.path.join(basedir, 'ppc/macos9.ppm')
> +
> +        image = os.getenv('MACOS9_IMAGE')
> +        if not image:
> +            self.cancel('No MACOS9_IMAGE environment variable defined')
> +        drive_path = self.fetch_asset(image)
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-M', 'via=pmu')
> +        self.vm.add_args('-m', '1g')
> +        self.vm.add_args('-cpu', 'G4')
> +        self.vm.add_args('-drive', 'file=' + drive_path)
> +#        self.vm.add_args('-net', 'nic,model=rtl8139')
> +#        self.vm.add_args('-net', 'user,hostfwd=:127.0.0.1:2223-:22,hostname=qemu')
> +        self.vm.add_args('-vga', 'std')
> +        self.vm.add_args('-g', '640x480')
> +        self.vm.launch()
> +
> +        # This comes up after 60 seconds on a fast x86 CPU. Give it
> +        # 180s to be sure.
> +        time.sleep(180)
> +        with tempfile.NamedTemporaryFile(suffix='.ppm',
> +                                         prefix='screendump-', delete=False) as ppmfile:
> +            self.vm.command('screendump', filename=ppmfile.name)
> +            if not filecmp.cmp(ppmfile.name, screenshot_path):
> +                self.fail('Screenshot does not match')
> +

Nitpicking, I'd rather use:

        @skipUntil(os.getenv('MACOS10_IMAGE'),
                   'No MACOS10_IMAGE environment variable defined')

> +    def test_macos10(self):
> +        """
> +        :avocado: tags=arch:ppc
> +        :avocado: tags=machine:mac99
> +        :avocado: tags=device:framebuffer
> +        """
> +
> +        basedir = os.getenv('AVOCADO_TEST_BASEDIR')
> +        screenshot_path = os.path.join(basedir, 'ppc/macos10.ppm')
> +
> +        image = os.getenv('MACOS10_IMAGE')
> +        if not image:
> +            self.cancel('No MACOS10_IMAGE environment variable defined')
> +        drive_path = self.fetch_asset(image)

Please commit the hash if the image you used.

> +        self.vm.set_console()
> +        self.vm.add_args('-M', 'via=pmu')
> +        self.vm.add_args('-m', '1g')
> +        self.vm.add_args('-cpu', 'G4')
> +        self.vm.add_args('-drive', 'file=' + drive_path)
> +#        self.vm.add_args('-net', 'nic,model=rtl8139')
> +#        self.vm.add_args('-net', 'user,hostfwd=:127.0.0.1:2223-:22,hostname=qemu')

Why is that commented? If not needed, just drop, since your test
is already useful as it.

> +        self.vm.add_args('-vga', 'std')
> +        self.vm.add_args('-g', '640x480')
> +        self.vm.launch()
> +
> +        # This comes up after 60 seconds on a fast x86 CPU. Give it
> +        # 180s to be sure.
> +        time.sleep(180)
> +        with tempfile.NamedTemporaryFile(suffix='.ppm',
> +                                         prefix='screendump-', delete=False) as ppmfile:
> +            self.vm.command('screendump', filename=ppmfile.name)
> +            if not filecmp.cmp(ppmfile.name, screenshot_path):
> +                self.fail('Screenshot does not match')



  reply	other threads:[~2023-10-10  7:59 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10  7:52 [RFC PATCH 00/11] ppc: avocado test additions and new defaults Nicholas Piggin
2023-10-10  7:52 ` [RFC PATCH 01/11] tests/avocado: ppc add powernv10 boot_linux_console test Nicholas Piggin
2023-10-10  7:52 ` [RFC PATCH 02/11] tests/avocado: Add ppc pseries and powernv Hash MMU tests Nicholas Piggin
2023-10-16  8:40   ` Cédric Le Goater
2023-10-10  7:52 ` [RFC PATCH 03/11] tests/avocado: Add pseries KVM boot_linux test Nicholas Piggin
2023-10-10  7:52 ` [RFC PATCH 04/11] tests/avocado: ppc add hypervisor tests Nicholas Piggin
2023-10-16  6:39   ` Harsh Prateek Bora
2023-10-10  7:52 ` [RFC PATCH 05/11] testing/avocado: ppc add new BookE boot_linux_console.py tests Nicholas Piggin
2023-10-10  8:02   ` Philippe Mathieu-Daudé
2023-10-10 12:03   ` Joel Stanley
2023-10-10 20:53     ` Nicholas Piggin
2023-10-16  8:07       ` Cédric Le Goater
2023-10-16  8:32   ` Cédric Le Goater
2023-10-10  7:52 ` [RFC PATCH 06/11] tests/avocado: Add FreeBSD distro boot tests for ppc Nicholas Piggin
2023-10-10 21:55   ` Warner Losh
2023-10-11  0:36     ` Nicholas Piggin
2023-10-11  4:24       ` Warner Losh
2023-10-11  2:23     ` Nicholas Piggin
2023-10-11  4:25       ` Warner Losh
2023-10-10  7:52 ` [RFC PATCH 07/11] tests/avocado: Add ppc boot tests for non-free AIX images Nicholas Piggin
2023-10-10 12:43   ` Alex Bennée
2023-10-10 12:49     ` Philippe Mathieu-Daudé
2023-10-10 21:21       ` Nicholas Piggin
2023-10-10 13:01     ` Daniel P. Berrangé
2023-10-10 21:14       ` Nicholas Piggin
2023-10-10  7:52 ` [RFC PATCH 08/11] tests/avocado: Add ppc MacOS tests Nicholas Piggin
2023-10-10  7:58   ` Philippe Mathieu-Daudé [this message]
2023-10-11  0:25     ` Nicholas Piggin
2023-10-10  7:52 ` [RFC PATCH 09/11] tests/avocado: Use default CPU for pseries machine Nicholas Piggin
2023-10-10  7:52 ` [RFC PATCH 10/11] ppc/spapr: change pseries machine default to POWER10 CPU Nicholas Piggin
2023-10-10 12:08   ` Joel Stanley
2023-10-16  8:16   ` Cédric Le Goater
2023-10-10  7:52 ` [RFC PATCH 11/11] ppc/pnv: Change powernv default to powernv10 Nicholas Piggin
2023-10-10 12:05   ` Joel Stanley
2023-10-10 20:57     ` Nicholas Piggin
2023-10-16  1:59       ` Joel Stanley
2023-10-16  8:15   ` Cédric Le Goater
2023-10-10  7:59 ` [RFC PATCH 00/11] ppc: avocado test additions and new defaults Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d455bcf-f586-52df-eb85-136bc4362d5d@linaro.org \
    --to=philmd@linaro.org \
    --cc=bleal@redhat.com \
    --cc=crosa@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=wainersm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).