From patchwork Thu May 12 02:29:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 571794 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp258806mal; Wed, 11 May 2022 19:30:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiLsRWvHrpTooUh//bIgnQKvjDhucpMKCxuUEkSAQbtLcZucQDHfLlXE762Ij+oDhg5RaD X-Received: by 2002:a17:907:948d:b0:6fa:7f00:ed57 with SMTP id dm13-20020a170907948d00b006fa7f00ed57mr16304409ejc.761.1652322636615; Wed, 11 May 2022 19:30:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652322636; cv=none; d=google.com; s=arc-20160816; b=bWhukaiFCBjgpPFLj//PCLmFiYxOGkhOhzraRY4PEO73xYNwP1Rq4iwvbcwW/ZlweO 4a4jArolHCDFF6vEZff2a1Tv9FSEIeF/CtZBNH7HdVrw4sdIeFJl/MUWANMg1vfYCHI9 /8oWrkibJ1sRDi1Y3c60IjKZ6BlxmBtGwgZLD/htsrwyzuT7Ts9lXBkYvvnwkc3j/vkH v4sd8i/pgFO+TRP/X0I5STWjrN1OGje2V/zKnSbka3CKvxVdtlW0qS03ii/Vlr298mYl wUFefG/kh0xRqdeMEdCT7tVrvsU9FhwybP4r6zK9BVSUqJVTZkJMUYxMYBu2fkuOLmNo gBKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YPOFOE3NvbBxeFM2xBwqWvtaayvQyGUKm3Se3idq6Ps=; b=OW2Q8iKVPXO475tDW4qM4ExEWFlcsr0VJMKEnu06/q6ssx+/biJe0PmQcAEo2Ybw0l Vwu0rWnRzfA5sgM8K1sP9d1Al1VLr+zXTO4egxNAFItm9PbK8knSRlU1P1N/fpuGz4Ec KfkFExiufOyCnBOS2xatxI/prfNFo0pooaf9I1GQe5y3YxzL6xuv7Z061fG+v5u0CdUm GJe26Ao/PvCBbfY5OWc8TlTP9uLW51HUx5lK7MsEZkqz0oCtFpEOmJWDnmVVqZLRdWL0 hnblkPrewUGo1a24LYcgvw/9hBhaLhKz4hs81a3M6ax6j8fRFxcK19QLU9nViVu5tJCI rZAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SsmFlNOD; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id hs3-20020a1709073e8300b006e89e2b6fffsi5636979ejc.479.2022.05.11.19.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 19:30:36 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SsmFlNOD; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 000A1843A0; Thu, 12 May 2022 04:30:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="SsmFlNOD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A83FB8434B; Thu, 12 May 2022 04:29:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CED818435B for ; Thu, 12 May 2022 04:29:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x42d.google.com with SMTP id x52so3522838pfu.11 for ; Wed, 11 May 2022 19:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YPOFOE3NvbBxeFM2xBwqWvtaayvQyGUKm3Se3idq6Ps=; b=SsmFlNODfJSlGg1/GzfrjpowU+g+L77tVd42+uncQjxlSaDLvpE/MykYvuE0ogwIPn bPckli3bSMqHw0aThII8f8RuGmnRAk0kYnAAN7T8uZzYOUFEVYGOdrL9fcPMVMjPik44 YGv7m4DOUcnhY4N74zi8CGWPxHk9UTwf8zS4xoM/XYs3PKsjYQWVRyxyqh3oKJqDb/dD 04nRHPKEfvsRP3wG/9ZFzL8MEttTq1BfBoKPirhueQVpnt9i4c3ovXacwfch8zt44X63 HwcZxuhzeORy8J0e+s/0AyknMuESmDiekps30+ahn+v+9xkfFxLv8O6Fe+7A1tbizFFB vKvw== 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=YPOFOE3NvbBxeFM2xBwqWvtaayvQyGUKm3Se3idq6Ps=; b=L3ZHDVPkxXbR1sDcXe9mRP8+gIHZDihILlrMNJxIaHd/14Fx1aPPIiPX76HbYwurML ytaN7D9OwpO2Jw2ZrvJhagaIq+BV4QDLxOZ919BUsqxwOsKYGsL8Q/EIN5/hDUG1uRMf BOA5CRhKw6tpyjDx3GfD+pP1YD8Eg7ouYdt61f/SBrmPPqUK88A45A1MnLwbFSTh9G/D GwCbfnjba2V5ZKXwLaRV90Net9F4tMwaxVWetExw7tMfe6oTR7hNeiH3DANC5yvbNK+a +CyQns/YKZrxg+pcw/qEQs9iR7sgaGb0MoJ3WhcYxl6abT7IpGzmZrdpVTFmtYY3xwgd KUww== X-Gm-Message-State: AOAM532qEQrDb5l8zrOre1bKjvtNAWDBz0fjkt59gokFoBN15lhXzGQt hX1GmIO7OofCjbNzEm2SR9PiZA== X-Received: by 2002:a63:286:0:b0:3ab:971a:eb4c with SMTP id 128-20020a630286000000b003ab971aeb4cmr23456016pgc.105.1652322588096; Wed, 11 May 2022 19:29:48 -0700 (PDT) Received: from localhost.localdomain (p914133-ipoe.ipoe.ocn.ne.jp. [153.243.15.132]) by smtp.gmail.com with ESMTPSA id i4-20020aa78b44000000b0050dc7628190sm2445314pfd.106.2022.05.11.19.29.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 19:29:47 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de Cc: mark.kettenis@xs4all.nl, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v2 3/3] test: efi_bootmgr: add a test case for a short-form path Date: Thu, 12 May 2022 11:29:03 +0900 Message-Id: <20220512022903.65346-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220512022903.65346-1-takahiro.akashi@linaro.org> References: <20220512022903.65346-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean A short-form path starting with a file device path will be tested in a new test case. This type of short-form path will be created with "efidebug boot add -b", in particular, when a file system has no partition table. Signed-off-by: AKASHI Takahiro --- test/py/tests/test_efi_bootmgr/conftest.py | 25 +++++++++++++++++++ .../test_efi_bootmgr/test_efi_bootmgr.py | 25 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/test/py/tests/test_efi_bootmgr/conftest.py b/test/py/tests/test_efi_bootmgr/conftest.py index a0a754afbe1b..5cd7252671fa 100644 --- a/test/py/tests/test_efi_bootmgr/conftest.py +++ b/test/py/tests/test_efi_bootmgr/conftest.py @@ -38,3 +38,28 @@ def efi_bootmgr_data(u_boot_config): shell=True) return image_path + +@pytest.fixture(scope='session') +def efi_bootmgr_data2(u_boot_config): + """Set up a file system without a partition table to be used + in UEFI bootmanager tests + + Args: + u_boot_config -- U-boot configuration. + + Return: + A path to disk image to be used for testing + """ + mnt_point = u_boot_config.persistent_data_dir + '/test_efi_bootmgr' + image_path = u_boot_config.persistent_data_dir + '/efi_bootmgr_data2.img' + + shutil.rmtree(mnt_point, ignore_errors=True) + os.mkdir(mnt_point, mode = 0o755) + + shutil.copyfile(u_boot_config.build_dir + '/lib/efi_loader/helloworld.efi', + mnt_point + '/helloworld.efi') + + check_call(f'virt-make-fs --size=+1M --type=vfat {mnt_point} {image_path}', + shell=True) + + return image_path diff --git a/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py b/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py index 75a6e7c96296..ab3d53a2dc95 100644 --- a/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py +++ b/test/py/tests/test_efi_bootmgr/test_efi_bootmgr.py @@ -41,3 +41,28 @@ def test_efi_bootmgr(u_boot_console, efi_bootmgr_data): u_boot_console.run_command(cmd = 'efidebug boot rm 0001') u_boot_console.run_command(cmd = 'efidebug boot rm 0002') + +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('cmd_efidebug') +@pytest.mark.buildconfigspec('cmd_bootefi_bootmgr') +def test_efi_bootmgr_short(u_boot_console, efi_bootmgr_data2): + """ Unit test for UEFI bootmanager with a short-form path + In this test case, + - File system has no partition table + - UEFI load option has a short-form path starting with a file device path + + Args: + u_boot_console -- U-Boot console + efi_bootmgr_data2 -- Path to the disk image used for testing. + """ + u_boot_console.run_command(cmd = f'host bind 0 {efi_bootmgr_data2}') + + u_boot_console.run_command(cmd = 'efidebug boot add ' \ + '-b 0001 TEST2 host 0:0 helloworld.efi') + response = u_boot_console.run_command(cmd = 'efidebug boot dump') + assert 'file_path: /helloworld.efi' in response + u_boot_console.run_command(cmd = 'efidebug boot next 0001') + response = u_boot_console.run_command(cmd = 'bootefi bootmgr') + assert 'Hello, world!' in response + + u_boot_console.run_command(cmd = 'efidebug boot rm 0001')