qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Willian Rampazzo <wrampazz@redhat.com>
Cc: Laurent Vivier <laurent@vivier.eu>,
	qemu-arm <qemu-arm@nongnu.org>,
	qemu-devel <qemu-devel@nongnu.org>, Warner Losh <imp@bsdimp.com>,
	Wainer dos Santos Moschetta <wainersm@redhat.com>
Subject: Re: [PATCH v4 5/6] tests/acceptance: Add bFLT loader linux-user test
Date: Mon, 1 Nov 2021 23:41:57 +0100	[thread overview]
Message-ID: <243f4bb4-7d74-635d-de5c-6485e558c09f@amsat.org> (raw)
In-Reply-To: <CAKJDGDb81ST8YyYw-8KV+jx0mjaqdd9siKL2sFM4yaFwG5769w@mail.gmail.com>

On 11/1/21 18:51, Willian Rampazzo wrote:
> Hi, Phill,
> 
> On Mon, Sep 27, 2021 at 1:31 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>>
>> Add a very quick test that runs a busybox binary in bFLT format:
>>
>>   $ AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>>     avocado --show=app run -t linux_user tests/acceptance/load_bflt.py
>>   JOB ID     : db94d5960ce564c50904d666a7e259148c27e88f
>>   JOB LOG    : ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log
>>    (1/1) tests/acceptance/load_bflt.py:LoadBFLT.test_stm32: PASS (0.15 s)
>>   RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>>   JOB TIME   : 0.54 s
>>
>> Reviewed-by: Willian Rampazzo <willianr@redhat.com>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  tests/acceptance/load_bflt.py | 54 +++++++++++++++++++++++++++++++++++
>>  1 file changed, 54 insertions(+)
>>  create mode 100644 tests/acceptance/load_bflt.py
>>
>> diff --git a/tests/acceptance/load_bflt.py b/tests/acceptance/load_bflt.py
>> new file mode 100644
>> index 00000000000..f071a979d8e
>> --- /dev/null
>> +++ b/tests/acceptance/load_bflt.py
>> @@ -0,0 +1,54 @@
>> +# Test the bFLT loader format
>> +#
>> +# Copyright (C) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
>> +#
>> +# SPDX-License-Identifier: GPL-2.0-or-later
>> +
>> +import os
>> +import bz2
>> +import subprocess
>> +
>> +from avocado import skipUnless
>> +from avocado_qemu import QemuUserTest
>> +from avocado_qemu import has_cmd
>> +
>> +
>> +class LoadBFLT(QemuUserTest):
>> +
>> +    def extract_cpio(self, cpio_path):
>> +        """
>> +        Extracts a cpio archive into the test workdir
>> +
>> +        :param cpio_path: path to the cpio archive
>> +        """
>> +        cwd = os.getcwd()
>> +        os.chdir(self.workdir)
>> +        with bz2.open(cpio_path, 'rb') as archive_cpio:
>> +            subprocess.run(['cpio', '-i'], input=archive_cpio.read(),
>> +                           stderr=subprocess.DEVNULL)
>> +        os.chdir(cwd)
>> +
>> +    @skipUnless(*has_cmd('cpio'))
>> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
>> +    def test_stm32(self):
>> +        """
>> +        :avocado: tags=arch:arm
>> +        :avocado: tags=linux_user
>> +        :avocado: tags=quick
>> +        """
>> +        # See https://elinux.org/STM32#User_Space
>> +        rootfs_url = ('https://elinux.org/images/5/51/'
>> +                      'Stm32_mini_rootfs.cpio.bz2')
>> +        rootfs_hash = '9f065e6ba40cce7411ba757f924f30fcc57951e6'
>> +        rootfs_path_bz2 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
>> +        busybox_path = self.workdir + "/bin/busybox"
> 
> If there are other changes to this patch, also, change this to use the
> `os` library:
> 
> busybox_path = os.path.join(self.workdir, "/bin/busybox")

OK, I'll update.


  reply	other threads:[~2021-11-01 22:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27 16:31 [PATCH v4 0/6] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2021-09-27 16:31 ` [PATCH v4 1/6] tests/acceptance: Extract QemuBaseTest from Test Philippe Mathieu-Daudé
2021-11-01 18:01   ` Willian Rampazzo
2021-11-01 22:41     ` Philippe Mathieu-Daudé
2021-09-27 16:31 ` [PATCH v4 2/6] tests/acceptance: Make pick_default_qemu_bin() more generic Philippe Mathieu-Daudé
2021-11-01 18:52   ` Willian Rampazzo
2021-09-27 16:31 ` [PATCH v4 3/6] tests/acceptance: Introduce QemuUserTest base class Philippe Mathieu-Daudé
2021-11-01 18:59   ` Willian Rampazzo
2021-09-27 16:31 ` [PATCH v4 4/6] tests/acceptance: Share useful helpers from virtiofs_submounts test Philippe Mathieu-Daudé
2021-11-01 19:07   ` Willian Rampazzo
2021-09-27 16:31 ` [PATCH v4 5/6] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2021-11-01 17:51   ` Willian Rampazzo
2021-11-01 22:41     ` Philippe Mathieu-Daudé [this message]
2021-09-27 16:31 ` [PATCH v4 6/6] tests/acceptance: Rename avocado_qemu.Test -> QemuSystemTest Philippe Mathieu-Daudé
2021-11-01 19:11   ` Willian Rampazzo
2021-11-01 22:42     ` Philippe Mathieu-Daudé
2021-10-25 13:44 ` [PATCH v4 0/6] tests/acceptance: Add bFLT loader linux-user test 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=243f4bb4-7d74-635d-de5c-6485e558c09f@amsat.org \
    --to=f4bug@amsat.org \
    --cc=imp@bsdimp.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wainersm@redhat.com \
    --cc=wrampazz@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).