From patchwork Wed Aug 7 17:12:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 817427 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp494714wrt; Wed, 7 Aug 2024 10:16:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV9Wqnwv9O0pcMmB6MJZoS1cj8wb7AXi+FOYszMqxizS8uQBMfrWdp+KSGZ+iN/GHsbwAuI+FitNq8Hz1rIiRnO X-Google-Smtp-Source: AGHT+IFpykQvWsAmwu+6SCavAJhduw/vyknqC/WB8tKTSoy9gSf2lOn3YjK/3cZTJMaAC+gRTott X-Received: by 2002:aa7:c50e:0:b0:5a2:87d3:6ee6 with SMTP id 4fb4d7f45d1cf-5b7f57f41f4mr13237840a12.32.1723050979891; Wed, 07 Aug 2024 10:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723050979; cv=none; d=google.com; s=arc-20160816; b=rE07qfrtWJQIq81kCZeba5bfW39E4MCQu3LrqYk8aNUFSkFVP1zvpHYgMWMUW1bDa6 9psjJoq6l4z1X3BM+LnA65wF/UysQcuev+Ror+bcoeES/hvhg85spQHNkOt4pyNcpJFf uSweumq1PdM9gcVZiWRPPgyauCiin9ijBYqMV+3bJE+N/4TBK1ONBQtVp6hTgqHsHK1u 21hXfoEdFjFvNosINW+SdU9bvfV0nAfBvcm1rihj90UTNFWwA+ZIPb6tGvcoX1WghbPH 1YgwQixhusU9p6PBtlF4k+1d62cEtkK5EGfR1USE5A/MLEmpa3wQT6ldBP73gaDcgGlc 8AdQ== 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=OwXVSacIGJrOmt+KdZz2TtbXdcfdbD4gAE3Ma3mZxA0=; fh=1LQMKMQBGxvp4lpqP7zp9UQFaNNddJaWAGry1xT9OPM=; b=0SHXsm/QIW9KI3KjwLRwZqHHuwRCAMHSd0/5egJEWgn1PdfAceMtX/KN+0KmHbJ/rw vv0tytCGlesT9WQcL0FC9Sw+d2q6h8S4PThPaGELkS76uIFmaiGczC7zIsKx4tXDNEF0 p61tWuAU1TExtrSNF+bxnIHjmFSwM0V6JeoQ2TOJEHHeKAcJmmf5Wccdcxq27gMNx3Nc /F1a0ZgUs4u4htpEsOgRMPXIGDbWsQJbWSpx3EuaZ+tC8URXJdEvkBAVLeiHCb3ToePB 9K75U7VI/dw7xa95qT/wU+AfsmWAsK8Cdb/2N1SPkqDU+jmGNMk+5k3PO8uH+zDQcrNp F4MA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n652Febd; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5b83c61931fsi6838771a12.481.2024.08.07.10.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 10:16:19 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n652Febd; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ABF2F88D7E; Wed, 7 Aug 2024 19:13:31 +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="n652Febd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E34BD88D7C; Wed, 7 Aug 2024 19:13:29 +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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 DDBED88D53 for ; Wed, 7 Aug 2024 19:13:27 +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=jerome.forissier@linaro.org Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42812945633so885115e9.0 for ; Wed, 07 Aug 2024 10:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723050807; x=1723655607; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OwXVSacIGJrOmt+KdZz2TtbXdcfdbD4gAE3Ma3mZxA0=; b=n652Febd/CdB0anBvZiYMn355aPvSJLFUXVcbss38g3KDji5reZCj5on99YUdAyTCg NUX516OWyUPjID9wSQWfzNzHPT3jbGqcplokUGxVK5fOnU8oRaF14GFiqXi7YUp+0yi4 zaJtxSad3QfP9NyIbE0fAufDh6P+DigmSbt8aP1Gl3gJuFEnZmpvyHcuL2riZdWgO0EX sr12P+yrhqPX+nM6oyNOu73l4MgCxQ0siTjuyl41JLZFvwL/xyXTPNn2RmYSOM2GfYrW 25jS9BUDy7qQ8TgaTvaw6ZJjqLPi84AsQMKigkQ3J4QfzL1r1YKvKcU70P4j6df62v7B FqdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723050807; x=1723655607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OwXVSacIGJrOmt+KdZz2TtbXdcfdbD4gAE3Ma3mZxA0=; b=mhl21PB3/MhuDKC3/YtCsI4Rw7y2J1Su1ZZRipmrrL/PBiYMNhuUkRnv50tzys1Jkg tN4MWgEQS2wWBFT8CaiV8mfrsRz6X7UYx1uAfBd4p9gFzCR33rVdzDdrPmYSqrR00irO Kd+OUxmMRxjKQshsze87fF/W1iBIKpMftmLU2bE5RHvuBYwoRMWP1/Vyl8ZkJlsLzCBD 6fa5shdg08COoD54S6R3Q6OnXLOeWkPO316eq5BVfFb5A1mZ6PAcFSKIqNJ5GBCgwaFB 1JigzfQLFpMsFqzLUqM7IfCXq+KuPCvsWdTPufSjE6AiiB96DwsggHdbSdm2FJ2GqPqm xvKg== X-Gm-Message-State: AOJu0YxtsQ7wN7+iaeydXTQ+//EZb1NBnu0ot+6aKd9TPFC2UMshv3rY koGSxcrygH18VJzQEzfyn05VUJCRC7QzrB/uDG1Lf4fxjFn7Dc7HzooVtPllO2df3kz7ZRiB5G4 XcmFKcJXx X-Received: by 2002:a05:6000:c03:b0:367:923b:656b with SMTP id ffacd0b85a97d-36bbc1d2019mr11915729f8f.54.1723050807023; Wed, 07 Aug 2024 10:13:27 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:bb3d:43b8:4780:757c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbd0597b2sm16623781f8f.81.2024.08.07.10.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 10:13:26 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Jerome Forissier , Tom Rini , Heinrich Schuchardt Subject: [PATCH v8 22/23] test/py: add HTTP (wget) test for the EFI loader Date: Wed, 7 Aug 2024 19:12:06 +0200 Message-Id: <9b055b18f84755d775bf0cf4064e66801608839c.1723050310.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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.8 at phobos.denx.de X-Virus-Status: Clean Add a test to test_efi_loader.py similar to the TFTP test but for HTTP with the wget command. Suggested-by: Tom Rini Signed-off-by: Jerome Forissier Tested-by: Tom Rini --- test/py/tests/test_efi_loader.py | 52 +++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py index 85473a9049b..64c994fdf95 100644 --- a/test/py/tests/test_efi_loader.py +++ b/test/py/tests/test_efi_loader.py @@ -50,6 +50,8 @@ env__efi_loader_helloworld_file = { import pytest import u_boot_utils +PROTO_TFTP, PROTO_HTTP = range(0, 2) + net_set_up = False def test_efi_pre_commands(u_boot_console): @@ -110,10 +112,10 @@ def test_efi_setup_static(u_boot_console): global net_set_up net_set_up = True -def fetch_tftp_file(u_boot_console, env_conf): - """Grab an env described file via TFTP and return its address +def fetch_file(u_boot_console, env_conf, proto): + """Grab an env described file via TFTP or HTTP and return its address - A file as described by an env config is downloaded from the TFTP + A file as described by an env config is downloaded from the server. The address to that file is returned. """ if not net_set_up: @@ -128,7 +130,13 @@ def fetch_tftp_file(u_boot_console, env_conf): addr = u_boot_utils.find_ram_base(u_boot_console) fn = f['fn'] - output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn)) + if proto == PROTO_TFTP: + cmd = 'tftpboot' + elif proto == PROTO_HTTP: + cmd = 'wget' + else: + assert False + output = u_boot_console.run_command('%s %x %s' % (cmd, addr, fn)) expected_text = 'Bytes transferred = ' sz = f.get('size', None) if sz: @@ -147,16 +155,8 @@ def fetch_tftp_file(u_boot_console, env_conf): return addr -@pytest.mark.buildconfigspec('of_control') -@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile') -def test_efi_helloworld_net(u_boot_console): - """Run the helloworld.efi binary via TFTP. - - The helloworld.efi file is downloaded from the TFTP server and is executed - using the fallback device tree at $fdtcontroladdr. - """ - - addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_helloworld_file') +def do_test_efi_helloworld_net(u_boot_console, proto): + addr = fetch_file(u_boot_console, 'env__efi_loader_helloworld_file', proto) output = u_boot_console.run_command('bootefi %x' % addr) expected_text = 'Hello, world' @@ -164,6 +164,28 @@ def test_efi_helloworld_net(u_boot_console): expected_text = '## Application failed' assert expected_text not in output +@pytest.mark.buildconfigspec('of_control') +@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile') +def test_efi_helloworld_net_tftp(u_boot_console): + """Run the helloworld.efi binary via TFTP. + + The helloworld.efi file is downloaded from the TFTP server and is executed + using the fallback device tree at $fdtcontroladdr. + """ + + do_test_efi_helloworld_net(u_boot_console, PROTO_TFTP); + +@pytest.mark.buildconfigspec('of_control') +@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile') +def test_efi_helloworld_net_http(u_boot_console): + """Run the helloworld.efi binary via HTTP. + + The helloworld.efi file is downloaded from the HTTP server and is executed + using the fallback device tree at $fdtcontroladdr. + """ + + do_test_efi_helloworld_net(u_boot_console, PROTO_HTTP); + @pytest.mark.buildconfigspec('cmd_bootefi_hello') def test_efi_helloworld_builtin(u_boot_console): """Run the builtin helloworld.efi binary. @@ -185,7 +207,7 @@ def test_efi_grub_net(u_boot_console): executed. """ - addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_grub_file') + addr = fetch_file(u_boot_console, 'env__efi_loader_grub_file', PROTO_TFTP) u_boot_console.run_command('bootefi %x' % addr, wait_for_prompt=False)