From nobody Tue Nov 18 22:49:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) client-ip=209.85.128.47; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f47.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1613331929; cv=none; d=zohomail.com; s=zohoarc; b=ezQnnufoZHV/H37dY5XMt4MYJLZsSvNt1GWaJFdmy6KkpnzEwtYnFRyjdAvRCbPs8bFqO2EWeu/AseL4ht013a5qGgQnuuEoFjK9NeHJrnmYUgemT1cQ9c4p0vluB9MshetABgMRu8ItFIJkdn4RU0UL2EUgQW8iUTf4s3o8FH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613331929; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Sender:Subject:To; bh=jJRdV1ZLz9Wc3UruihO3ipliHXOgtCfriX4mx0iNut0=; b=CNvfSxX/ppurr6AGUVpF87z+BlGt4eB7tk2hUW4G4mET4YplkH91/hPljmf0yKim2mibkWWFGRSyEZgVeMNhaAOKrIdVbg6mxBkzP9/wlg7bRgSFL0PBPuqj6U/OhUA9ud8Ovaaw+woUBkXtQBARTg6Slj0WETtsqjynWKL/F6s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mx.zohomail.com with SMTPS id 1613331929313839.477814934897; Sun, 14 Feb 2021 11:45:29 -0800 (PST) Received: by mail-wm1-f47.google.com with SMTP id l17so4362777wmq.2 for ; Sun, 14 Feb 2021 11:45:28 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id a17sm25907907wrx.63.2021.02.14.11.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Feb 2021 11:45:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jJRdV1ZLz9Wc3UruihO3ipliHXOgtCfriX4mx0iNut0=; b=M4dkOy/Vk2vtelSOG7LuO7nQ1Uuk09qnnbcPbyJcmDF7UZO/xZvknn/b+g2VZwE8et LksrBUjNFXdpHK1BTKd7IGLXRC2wt4JmqZfYwhjHrbiZzwQsqBhaUKr0Dv3PUHr0TibH es6hSOb1kF1CmF5PXmCypFrx18vaNoiB13hIXMMbV0W4rcL68k7cPK8rpd1JzLFraDPY A28+X31olZ/yRtDxaGjxcLdqdk1gBEhBoHfUdhHyml8z+9zar5IEJnS4Qju/Y3zpyvWz BJECL7hUIG0TtPupgzJf5As8P4DG0AvtfSa+rbrRF6dC1ciknGiF3akQFzPBBy5M3hcH Hkuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=jJRdV1ZLz9Wc3UruihO3ipliHXOgtCfriX4mx0iNut0=; b=WHFkDW8/pg9foi64MA3IM5vaM+rHCGCwTauK2ZGOKl6XaQeFCj8Xn3bLq3H9B91xFW Epx/fNk4I+W1WpxgVAdVeV8l4g1B0QFOkCxLM4RfsxQyGU9phomHasEfXWkzDr/B4UKv fdUsblbMlzRjVmaYxvRDvKOleKwb/ENdW5YswYFNfOJhHg8mGomas6kpurJziIJU298S 63N9DB8+Gkev9pYW3i/BHS0Bh2jKl7KsUdfwg1NdE7BgMGOlN9nCEg6W4wl96yxVe7GU flgjOYp9aP1a1qYGkMYTLCUD7ziaQiZbgspOmfLg2YDv2r73dm4QYzUi6fXAJyw+RtSz RfWg== X-Gm-Message-State: AOAM532LyOKxkGy3Vh9fDFQSRPmfadVaHzerlgaP68LvD+RShP4LUph+ u6btC+CFhK4y6if28ve6wR1rXKCId+I= X-Google-Smtp-Source: ABdhPJzPLoP4DSgZdLqamRgO6TVOkbb7yXLDtdc5GHxaytfL8vpOUqJY6zLuKBG2inoGbmduzPbcXw== X-Received: by 2002:a05:600c:1552:: with SMTP id f18mr11411321wmg.149.1613331927791; Sun, 14 Feb 2021 11:45:27 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Willian Rampazzo , Wainer dos Santos Moschetta , Laurent Vivier , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2] tests/acceptance: Add bFLT loader linux-user test Date: Sun, 14 Feb 2021 20:45:24 +0100 Message-Id: <20210214194524.768660-1-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Add a very quick test that runs a busybox binary in bFLT format: $ avocado --show=3Dapp 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 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Willian Rampazzo --- Based-on: <20210214175912.732946-1-f4bug@amsat.org> tests/acceptance: Extract QemuBaseTest from Test tests/acceptance: Make pick_default_qemu_bin() more generic tests/acceptance: Introduce QemuUserTest base class --- tests/acceptance/load_bflt.py | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 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..4b7796d0775 --- /dev/null +++ b/tests/acceptance/load_bflt.py @@ -0,0 +1,51 @@ +# Test the bFLT format +# +# Copyright (C) 2019 Philippe Mathieu-Daud=C3=A9 +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os +import bz2 +import subprocess + +from avocado_qemu import QemuUserTest + + +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 =3D os.getcwd() + os.chdir(self.workdir) + with bz2.open(cpio_path, 'rb') as archive_cpio: + subprocess.run(['cpio', '-i'], input=3Darchive_cpio.read(), + stderr=3Dsubprocess.DEVNULL) + os.chdir(cwd) + + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') + def test_stm32(self): + """ + :avocado: tags=3Darch:arm + :avocado: tags=3Dlinux_user + :avocado: tags=3Dquick + """ + # See https://elinux.org/STM32#User_Space + rootfs_url =3D ('https://elinux.org/images/5/51/' + 'Stm32_mini_rootfs.cpio.bz2') + rootfs_hash =3D '9f065e6ba40cce7411ba757f924f30fcc57951e6' + rootfs_path_bz2 =3D self.fetch_asset(rootfs_url, asset_hash=3Droot= fs_hash) + busybox_path =3D self.workdir + "/bin/busybox" + + self.extract_cpio(rootfs_path_bz2) + + res =3D self.run(busybox_path) + ver =3D 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call = binary.' + self.assertIn(ver, res.stdout_text) + + res =3D self.run(busybox_path, ['uname', '-a']) + unm =3D 'armv7l GNU/Linux' + self.assertIn(unm, res.stdout_text) --=20 2.26.2