All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cleber Rosa <crosa@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Magnus Damm" <magnus.damm@gmail.com>
Cc: qemu-devel@nongnu.org, "Lukáš Doktor" <ldoktor@redhat.com>,
	"Fam Zheng" <famz@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH v3 6/6] tests/acceptance: Add test_sh4_r2d in BootLinuxTracing
Date: Fri, 19 Oct 2018 20:02:55 -0400	[thread overview]
Message-ID: <e2703556-b61d-f8f8-3d31-bc5cac5c7ac9@redhat.com> (raw)
In-Reply-To: <20181013151545.3731-7-f4bug@amsat.org>



On 10/13/18 11:15 AM, Philippe Mathieu-Daudé wrote:
> Similar to the test_x86_64_pc test, this boots a Linux kernel on a
> R2D board (SH4 little-endian) and verify the usb is working by looking
> at the usb trace events. Thus this test requires the QEMU binary to be
> compiled with:
> 
>   $ configure ... --enable-trace-backends=log
> 
> This test also requires the dpkg-deb tool (apt/dnf install dpkg) to
> extract the kernel from the Debian package.
> 
>   $ avocado --show=app,trace run -p arch=sh4 tests/acceptance/boot_linux_console.py
>   JOB ID     : dc45be27f5d1edb8289a1ede139e107bbc55b045
>   JOB LOG    : /home/phil/avocado/job-results/job-2018-10-13T14.46-dc45be2/job.log
>    (1/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: CANCEL: Currently specific to the x86_64 target arch (0.00 s)
>    (2/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta: CANCEL: Currently specific to the sh4 target arch (0.00 s)
>    (3/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mipsel_5kc_malta: CANCEL: Currently specific to the sh4 target arch (0.00 s)
>    (4/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_sh4_r2d: SKIP: console not working on r2d machine
>    (5/5) tests/acceptance/boot_linux_console.py:BootLinuxTracing.test_sh4_r2d:  /
>   trace: 22770@1539434809.450006:usb_ohci_init_time usb_bit_time=1000000 usb_frame_time=83
>   trace: 22770@1539434809.453017:usb_ohci_port_attach port #0
>   trace: 22770@1539434809.454827:usb_ohci_reset sysbus-ohci
>   trace: 22770@1539434809.454833:usb_ohci_stop sysbus-ohci: USB Suspended
>   trace: 22770@1539434809.454835:usb_ohci_stop sysbus-ohci: USB Suspended
>   trace: 22770@1539434809.454837:usb_ohci_port_detach port #0
>   trace: 22770@1539434809.454839:usb_ohci_port_attach port #0
>   trace: 22770@1539434811.588702:usb_ohci_reset sysbus-ohci
>   trace: 22770@1539434811.588711:usb_ohci_stop sysbus-ohci: USB Suspended
>   trace: 22770@1539434811.589062:usb_ohci_set_ctl sysbus-ohci: new state 0x80
>   trace: 22770@1539434811.589067:usb_ohci_start sysbus-ohci: USB Operational
>   trace: 22770@1539434811.589253:usb_ohci_hub_power_up powered up all ports
>   PASS (2.43 s)
>   RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 3
>   JOB TIME   : 2.67 s
> 

And with similar changes, on this point of this series:

$ avocado run tests/acceptance/boot_linux_console.py
JOB ID     : 857fef1b8c0ce59a79d452f27e996ed2743404b1
JOB LOG    :
/home/cleber/avocado/job-results/job-2018-10-19T19.58-857fef1/job.log
 (1/5)
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc:
PASS (2.04 s)
 (2/5)
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_4kc_malta:
PASS (0.57 s)
 (3/5)
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mipsel_5kc_malta:
PASS (0.59 s)
 (4/5)
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_sh4_r2d:
SKIP: console not working on r2d machine
 (5/5)
tests/acceptance/boot_linux_console.py:BootLinuxTracing.test_sh4_r2d:
PASS (1.01 s)
RESULTS    : PASS 4 | ERROR 0 | FAIL 0 | SKIP 1 | WARN 0 | INTERRUPT 0 |
CANCEL 0
JOB TIME   : 4.57 s

- Cleber.

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  tests/acceptance/boot_linux_console.py | 64 ++++++++++++++++++++++++++
>  1 file changed, 64 insertions(+)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 8f99cc0d7c..e11993bf98 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -8,11 +8,22 @@
>  # 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
>  import subprocess
>  
>  from avocado import skip
>  from avocado_qemu import Test
> +from avocado.utils.wait import wait_for
> +
> +
> +def read_stream_for_string(stream, expected_string, logger=None):
> +    msg = stream.readline()
> +    if len(msg) == 0:
> +        return False
> +    if logger:
> +        logger.debug(msg.strip())
> +    return expected_string in msg
>  
>  
>  class BootLinuxConsole(Test):
> @@ -185,3 +196,56 @@ class BootLinuxConsole(Test):
>                  break
>              if 'Kernel panic - not syncing' in msg:
>                  self.fail("Kernel panic reached")
> +
> +class BootLinuxTracing(Test):
> +    """
> +    Boots a Linux kernel and checks that via the Tracing framework that
> +    a specific trace events occured, demostrating the kernel is operational.
> +
> +    :avocado: enable
> +    """
> +
> +    timeout = 60
> +
> +    def test_sh4_r2d(self):
> +        """
> +        This test requires the dpkg-deb tool (apt/dnf install dpkg) to extract
> +        the kernel from the Debian package.
> +        This test also requires the QEMU binary to be compiled with:
> +
> +          $ configure ... --enable-trace-backends=log
> +
> +        The kernel can be rebuilt using this Debian kernel source [1] and
> +        following the instructions on [2].
> +
> +        [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official
> +        [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-30/#linux-source-2.6.32_2.6.32-30
> +
> +        :avocado: tags=arch:sh4
> +        """
> +        if self.arch != 'sh4':
> +            self.cancel('Currently specific to the %s target arch' % self.arch)
> +
> +        deb_url = ('http://snapshot.debian.org/archive/'
> +                   'debian-ports/20110116T065852Z/pool-sh4/main/l/'
> +                   'linux-2.6/linux-image-2.6.32-5-sh7751r_2.6.32-30_sh4.deb')
> +        deb_hash = '8025e503319dc8ad786756e3afaa8eb868e9ef59'
> +        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> +        subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.workdir])
> +        kernel_path = self.workdir + '/boot/vmlinuz-2.6.32-5-sh7751r'
> +        trace_path = os.path.join(self.workdir, 'trace.log')
> +        trace_logger = logging.getLogger('trace')
> +
> +        self.vm.set_arch(self.arch)
> +        self.vm.set_machine('r2d')
> +        kernel_command_line = 'noiotrap'
> +        self.vm.add_args('-trace', "enable=usb_ohci_*,file=" + trace_path,
> +                         '-kernel', kernel_path,
> +                         '-append', kernel_command_line)
> +
> +        self.vm.launch()
> +        if not wait_for(read_stream_for_string, timeout=15, step=0,
> +                        args=(open(trace_path),
> +                              'usb_ohci_hub_power_up powered up all ports',
> +                              trace_logger)):
> +            self.fail("Machine failed to boot")
> 

-- 
Cleber Rosa
[ Sr Software Engineer - Virtualization Team - Red Hat ]
[ Avocado Test Framework - avocado-framework.github.io ]
[  7ABB 96EB 8B46 B94D 5E0F  E9BB 657E 8D33 A5F2 09F3  ]

  reply	other threads:[~2018-10-20  0:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-13 15:15 [Qemu-devel] [PATCH v3 0/6] Avocado: more multi-arch tests Philippe Mathieu-Daudé
2018-10-13 15:15 ` [Qemu-devel] [PATCH v3 1/6] tests/acceptance: Rename the generic BootLinuxConsole test as test_x86_64_pc Philippe Mathieu-Daudé
2018-10-19 18:15   ` Cleber Rosa
2018-10-13 15:15 ` [Qemu-devel] [RFC PATCH v3 2/6] tests/acceptance: Add a kludge to not use the default console Philippe Mathieu-Daudé
2018-10-19 17:37   ` Cleber Rosa
2018-10-19 17:45     ` Philippe Mathieu-Daudé
2018-10-13 15:15 ` [Qemu-devel] [PATCH v3 3/6] tests/acceptance: Add test_mips_4kc_malta in BootLinuxConsole Philippe Mathieu-Daudé
2018-10-19 17:42   ` Cleber Rosa
2018-10-19 18:41     ` Philippe Mathieu-Daudé
2018-10-19 21:17       ` Cleber Rosa
2018-10-19 22:51         ` Cleber Rosa
2018-10-20  9:57           ` Philippe Mathieu-Daudé
2018-10-13 15:15 ` [Qemu-devel] [PATCH v3 4/6] tests/acceptance: Add test_mipsel_5kc_malta " Philippe Mathieu-Daudé
2018-10-13 15:15 ` [Qemu-devel] [PATCH v3 5/6] tests/acceptance: Add test_sh4_r2d " Philippe Mathieu-Daudé
2018-10-13 15:56   ` Philippe Mathieu-Daudé
2018-10-13 15:15 ` [Qemu-devel] [RFC PATCH v3 6/6] tests/acceptance: Add test_sh4_r2d in BootLinuxTracing Philippe Mathieu-Daudé
2018-10-20  0:02   ` Cleber Rosa [this message]
2018-10-15  6:41 ` [Qemu-devel] [PATCH v3 0/6] Avocado: more multi-arch tests Thomas Huth
2018-10-19  5:13 ` 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=e2703556-b61d-f8f8-3d31-bc5cac5c7ac9@redhat.com \
    --to=crosa@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=balaton@eik.bme.hu \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=famz@redhat.com \
    --cc=ldoktor@redhat.com \
    --cc=magnus.damm@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.