From nobody Mon Feb 9 22:20:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636388312; cv=none; d=zohomail.com; s=zohoarc; b=ImVhuPojAhrvA76+Zni17bPlc7PEZBJmw7FRSRB0WEYLn09IFXYbk7xjxmnFkoi6zqBt/PUGKPtupR4Bwq4DAcdPQBJDpFWoPoOhli1fuampdKIpLPS+gPLj0niRalETjnLWEs/UmCa/A0EdMi6bORslMQz5Hp/myZmMJMZkVfI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636388312; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=HRNtpWns45KouVxWx+F2QK9RfjAkimgxL52hvvUyjt4=; b=I9IJSQQD/ywc7/pdbJXCZzyWxltAF9wx8fr8gc6oiblPW2CaOvy4nc/sJinXnEALrzLJrt8PQmfwTfvrtoz0hKTi2c7Wu3X9m6uQBw9tHqHHX4GXGctCkN5n+lHpQ48kelzZULpiGekpSAN1phooG2P36IsxQU9tuFmqXen8LG8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636388312748205.4393787759601; Mon, 8 Nov 2021 08:18:32 -0800 (PST) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-58-VrD3CxB9Nf6UZozweX6-Dw-1; Mon, 08 Nov 2021 11:18:20 -0500 Received: by mail-wr1-f70.google.com with SMTP id f3-20020a5d50c3000000b00183ce1379feso4194009wrt.5 for ; Mon, 08 Nov 2021 08:18:20 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (46.red-193-152-127.dynamicip.rima-tde.net. [193.152.127.46]) by smtp.gmail.com with ESMTPSA id o10sm7694081wri.15.2021.11.08.08.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Nov 2021 08:18:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636388311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HRNtpWns45KouVxWx+F2QK9RfjAkimgxL52hvvUyjt4=; b=de3LvIrloCsOkSQA53fFqY8312bMk5FJVvNcZ5h5RQB8fksSxttHV1LtDNmyu76wc3b/cI BYHZq2t8asC8ft8rydsB1ukfXTsz8B2cqkmm6fgs0yoiD2D+qlBZ6jipIy3uyE/Vm7o8WF S0KSZ2eJQTkPL0RQX78IcXVfMQB01Oc= X-MC-Unique: VrD3CxB9Nf6UZozweX6-Dw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HRNtpWns45KouVxWx+F2QK9RfjAkimgxL52hvvUyjt4=; b=I+wfCdEdwz9NkAh2lLRbqt0PYw4Q8Uh02HHDcOL1hKY5WntdO4M01ZoTQt63hHigyb JIvPINdibs7fU6xVrQx+/a+Aogh1jDVjPCgrUmVUW71eCvIh2JC7OpcCvPwCnKLbrBxS 3UgrrzWjVOXWJCVFk8XLBMxvsh7yBDG/mwt/i/zqf+xgxAUUJdTbWCuktcOYW5oVFwbU sp+iXy23nM0VdZ4SK/8fbrnRalIJ+B/P2ErsEXedInmeB6dOUOnpLUx5xLM7jZ6wLQGW Xl8T/HWr/78ena/JPpQ//pk+H9djosLRk3PIUs0cylHIXtGWrquPGFfY1vIng3FM085F lv3w== X-Gm-Message-State: AOAM533CBD12ABq5Jh7vRr38ZFEjLvtOCdVlvFHEoFUh6pHrkWPYaGSu 3UrBLhJpGW6A1HSQCCw8VPNnJijExakgti9yQkWiphgLFroxoSixLcKbTYxLMeF+bTCoVtBCeBf ZksarZDOy9XFrng== X-Received: by 2002:a1c:7f0c:: with SMTP id a12mr519713wmd.14.1636388299514; Mon, 08 Nov 2021 08:18:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyf6UIKMvlOcPb/WxgPWdga/4PFSVv/zknW5FmByjRxxaghC+j0fVTlqY4UX9AyLqY7Xf5wmw== X-Received: by 2002:a1c:7f0c:: with SMTP id a12mr519690wmd.14.1636388299361; Mon, 08 Nov 2021 08:18:19 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Cleber Rosa , Wainer dos Santos Moschetta , Willian Rampazzo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 7/9] tests/avocado: Add bFLT loader linux-user test Date: Mon, 8 Nov 2021 17:17:37 +0100 Message-Id: <20211108161739.1371503-8-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211108161739.1371503-1-philmd@redhat.com> References: <20211108161739.1371503-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636388313661100001 From: Philippe Mathieu-Daud=C3=A9 Add a very quick test that runs a busybox binary in bFLT format: $ AVOCADO_ALLOW_UNTRUSTED_CODE=3D1 \ avocado --show=3Dapp run -t linux_user tests/avocado/load_bflt.py JOB ID : db94d5960ce564c50904d666a7e259148c27e88f JOB LOG : ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log (1/1) tests/avocado/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 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20211105143416.148332-6-f4bug@amsat.org> --- tests/avocado/load_bflt.py | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/avocado/load_bflt.py diff --git a/tests/avocado/load_bflt.py b/tests/avocado/load_bflt.py new file mode 100644 index 00000000000..bb50cec1ee8 --- /dev/null +++ b/tests/avocado/load_bflt.py @@ -0,0 +1,54 @@ +# Test the bFLT loader 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 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 =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(*has_cmd('cpio')) + @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 os.path.join(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.31.1