From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Tue, 07 Oct 2025 11:10:33 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v63iL-005Byh-1I for lore@lore.pengutronix.de; Tue, 07 Oct 2025 11:10:33 +0200 Received: from bombadil.infradead.org ([2607:7c80:54:3::133]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1v63iK-0000yw-MA for lore@pengutronix.de; Tue, 07 Oct 2025 11:10:33 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=A0Yd5clRnx0t/H/hQ8/75WyPkfjh9iZn0UKxeRHGDew=; b=FeARs9YFjn9XwR9plGD/r8u27T GImvsTjSUA0wf+58T34OnQrNhEShL2F63MJcJIQ3vb1pkWsoLYlnbfRZ7Uk6vQQjjWJfXJ6t/EKdM BrmW0XjJKumIyNq0BKG9+8RwaW9ZiZusICMiD/NWEmEi+HTFH0WOfF90h2iyAuN25IZUefJrI1Q+t 4ITr0Ddbd258kIcjVigqxvuuWZ9FMnlbGMmzN28cKv9GFRe2iIBbLcnm85WqEdZ55lbAXkAYXmcWx GlE9KOVgkCBKHP8tDPwF3Sm0e1WUrdNYdKX+ddOpwGIrdEwq3uapKhe5EutgNL0ejWSUr0xstCB1h 8xzaVcng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v63ht-00000001fxG-3OGJ; Tue, 07 Oct 2025 09:10:05 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v63hp-00000001fte-0jGn for barebox@lists.infradead.org; Tue, 07 Oct 2025 09:10:03 +0000 Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1v63hn-0000oE-N7; Tue, 07 Oct 2025 11:09:59 +0200 Message-ID: Date: Tue, 7 Oct 2025 11:09:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Jonas Rebmann , Sascha Hauer , BAREBOX Cc: Tobias Waldekranz References: <20250929-tlv-integration-v2-0-55f75da7e670@pengutronix.de> <20250929-tlv-integration-v2-4-55f75da7e670@pengutronix.de> Content-Language: en-US, de-DE, de-BE From: Ahmad Fatoum In-Reply-To: <20250929-tlv-integration-v2-4-55f75da7e670@pengutronix.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251007_021001_328878_739DE6E7 X-CRM114-Status: GOOD ( 20.77 ) X-BeenThere: barebox@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "barebox" X-SA-Exim-Connect-IP: 2607:7c80:54:3::133 X-SA-Exim-Mail-From: barebox-bounces+lore=pengutronix.de@lists.infradead.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-4.3 required=4.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Subject: Re: [PATCH v2 4/9] test: move fitimage testdata generation to fixture and drop script X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on metis.whiteo.stw.pengutronix.de) On 9/29/25 10:03 AM, Jonas Rebmann wrote: > Get rid of scripts/generate_testfs.sh and the logic around it. Test data > generation should happen within pytest. > > Move test data (its config for fitimages) from .github/testfs to > test/testdata for good measure. > > Signed-off-by: Jonas Rebmann Acked-by: Ahmad Fatoum > --- > .github/workflows/test-labgrid-pytest.yml | 10 ----- > scripts/generate_testfs.sh | 33 ----------------- > test/py/test_fit.py | 43 +++++++++++++++++++++- > .../testdata}/multi_v7_defconfig-gzipped.its | 0 > .../testdata}/multi_v8_defconfig-gzipped.its | 0 > 5 files changed, 42 insertions(+), 44 deletions(-) > > diff --git a/.github/workflows/test-labgrid-pytest.yml b/.github/workflows/test-labgrid-pytest.yml > index 604f1db2fb..4569e475bc 100644 > --- a/.github/workflows/test-labgrid-pytest.yml > +++ b/.github/workflows/test-labgrid-pytest.yml > @@ -97,16 +97,6 @@ jobs: > cp /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.bin ${KBUILD_OUTPUT}/ > fi > > - - name: Populate testfs > - if: steps.used-features.outputs.testfs == 'true' > - run: | > - export KBUILD_OUTPUT=build-${{matrix.arch}}-${{matrix.defconfig}} > - export KBUILD_DEFCONFIG=${{matrix.defconfig}} > - > - # Just use already built dtc > - export PATH="$PATH:${KBUILD_OUTPUT}/scripts/dtc/" > - exec scripts/generate_testfs.sh > - > - name: labgrid-pytest > if: steps.build.outcome == 'success' > run: | > diff --git a/scripts/generate_testfs.sh b/scripts/generate_testfs.sh > deleted file mode 100755 > index d52772e6bf..0000000000 > --- a/scripts/generate_testfs.sh > +++ /dev/null > @@ -1,33 +0,0 @@ > -#!/bin/sh > - > -MKIMAGE=${MKIMAGE:-mkimage} > -KGZIP=${KGZIP:-gzip} > - > -set -e > - > -if [ -z "${KBUILD_OUTPUT}" ] || [ -z "${KBUILD_DEFCONFIG}" ] ; then > - 2>&1 echo "KBUILD_OUTPUT and KBUILD_DEFCONFIG must be set" > - exit 1 > -fi > - > -rm -rf "${KBUILD_OUTPUT}/testfs/" > -mkdir -p ${KBUILD_OUTPUT}/testfs > - > -generate_fit() > -{ > - cat ${KBUILD_OUTPUT}/images/barebox-dt-2nd.img | \ > - ${KGZIP} -n -f -9 >${KBUILD_OUTPUT}/barebox-dt-2nd.img.gz > - > - cp .github/testfs/${KBUILD_DEFCONFIG}-gzipped.its ${KBUILD_OUTPUT}/ > - > - find COPYING LICENSES/ | cpio -o -H newc | ${KGZIP} \ > - > ${KBUILD_OUTPUT}/ramdisk.cpio.gz > - > - ${MKIMAGE} -G $PWD/test/self/development_rsa2048.pem -r \ > - -f ${KBUILD_OUTPUT}/${KBUILD_DEFCONFIG}-gzipped.its \ > - ${KBUILD_OUTPUT}/testfs/barebox-gzipped.fit > -} > - > -if [ -f .github/testfs/${KBUILD_DEFCONFIG}-gzipped.its ]; then > - generate_fit > -fi > diff --git a/test/py/test_fit.py b/test/py/test_fit.py > index 3b2b8ff871..5620996e9d 100644 > --- a/test/py/test_fit.py > +++ b/test/py/test_fit.py > @@ -1,7 +1,11 @@ > # SPDX-License-Identifier: GPL-2.0-or-later > > import re > +import os > import pytest > +import shutil > +import subprocess > +from pathlib import Path > from .helper import of_get_property > > > @@ -15,7 +19,44 @@ def generate_bootscript(barebox, image, name="test"): > return name > > > -def test_fit(barebox, env, target, barebox_config, testfs): > +def run(cmd, **kwargs): > + subprocess.run(cmd, check=True, **kwargs) > + > + > +@pytest.fixture(scope="module") > +def fit_testdata(barebox_config, testfs): > + its_name = f"{barebox_config['CONFIG_NAME']}-gzipped.its" > + its_location = Path("test/testdata") > + builddir = Path(os.environ['LG_BUILDDIR']) > + outdir = Path(testfs) > + outfile = outdir / "barebox-gzipped.fit" > + > + if not os.path.isfile(its_location / its_name): > + pytest.skip(f"no fitimage testdata found at {its_location}") > + > + shutil.copy(its_location / its_name, builddir) > + > + try: > + run(["gzip", "-n", "-f", "-9"], > + input=(builddir / "images" / "barebox-dt-2nd.img").read_bytes(), > + stdout=open(builddir / "barebox-dt-2nd.img.gz", "wb")) > + > + find = subprocess.Popen(["find", "COPYING", "LICENSES/"], stdout=subprocess.PIPE) > + cpio = subprocess.Popen(["cpio", "-o", "-H", "newc"], stdin=find.stdout, stdout=subprocess.PIPE) > + gzip = subprocess.Popen(["gzip"], stdin=cpio.stdout, > + stdout=open(builddir / "ramdisk.cpio.gz", "wb")) > + find.wait(); cpio.wait(); gzip.wait() > + > + run([ "mkimage", "-G", "test/self/development_rsa2048.pem", "-r", "-f", > + str(builddir / its_name), str(outfile) ]) > + except FileNotFoundError as e: > + pytest.skip(f"Skip dm tests due to missing dependency: {e}") > + > + yield > + > + os.remove(outfile) > + > +def test_fit(barebox, target, testfs, fit_testdata): > _, _, returncode = barebox.run(f"ls {fit_name('gzipped')}") > if returncode != 0: > pytest.xfail("skipping test due to missing FIT image") > diff --git a/.github/testfs/multi_v7_defconfig-gzipped.its b/test/testdata/multi_v7_defconfig-gzipped.its > similarity index 100% > rename from .github/testfs/multi_v7_defconfig-gzipped.its > rename to test/testdata/multi_v7_defconfig-gzipped.its > diff --git a/.github/testfs/multi_v8_defconfig-gzipped.its b/test/testdata/multi_v8_defconfig-gzipped.its > similarity index 100% > rename from .github/testfs/multi_v8_defconfig-gzipped.its > rename to test/testdata/multi_v8_defconfig-gzipped.its > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |