From patchwork Fri Aug 23 13:48:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 821718 Delivered-To: patch@linaro.org Received: by 2002:adf:e044:0:b0:367:895a:4699 with SMTP id w4csp387071wrh; Fri, 23 Aug 2024 06:51:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXwv6LWwXAZsSUNQlLVU6hhhj64/SbW2JUyaJ8+axrF1gZkG/u7vbcLKAHZ5W6cfMcnvO2kkw==@linaro.org X-Google-Smtp-Source: AGHT+IE6uwTNsDEJtrjpet60BqrJ9rQ8GcLyWGnkx8QvyxXaQXHZi190C/ddMe45gojTObJf2Fpi X-Received: by 2002:a05:600c:3152:b0:427:ee01:ebf0 with SMTP id 5b1f17b1804b1-42ac389b58cmr40151535e9.8.1724421088882; Fri, 23 Aug 2024 06:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724421088; cv=none; d=google.com; s=arc-20240605; b=h9jPAgV6tKzpt9hD6GjONwmxo1XTZIXs5eEeWCPZ0LGOQtVvRk0WekbkZhL9yEJ6ZQ C7i5pQHVnmoqQkBq+4vGIFWOhlf731zzD/qqjbKLA9uOaCscMMHCqpm7v9cdyM27xwHZ 4DfdTFbaOy/xVx357H9kCRIHpFHziC/VxS0pY7Qq6IbFjNXFs8TnYJzwNSAozrueew5e bzNuQJeFi/5N5bZqhgxgYmsppBIWuoTWJW9ml3Zz32ZmfC0ynPRCQOfsrL3u9OcxZoPs JcAj7pTWJaX2H9YPb3Z09P0exMvA/AIP8AD9waySB4gO9iLhdefEfCUvVpKIedTTgPch G2Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=RmknMyAEHfs1JMtP1FJ6M3yqq1Eqt8h9Sbcy1PINCR8=; fh=qIjE2ZQOwsHaLhmnxwBLf+kkJk4WcUy6Cvmh2QOspmY=; b=l3pAmXkS8uA0quXfujIxLL9T4LWRnnhZ0OQxPRQZS2nJrPop4kRlwI2g2wG6U3gWJd tuFr3JF3emMWJWan80JXHXehR1aZpz+pEIHF7Ww5y3Oojp6xI+24lJFYrL7RH2lmZ6ec IV7vTOAqgbMsGezGkMRjR62GU/M4W2ezRGg77CpmRYN1qlXW0njb/QybTJELm4qtQLU6 cch1kLzWA+XncXonD5pf+ZILpl8msVHfsiG/CyEUCaR5CDcknmSlyQEZrN50MDDLl/SU I51uZFJbOzumtm+5ftVw+xWas0TAUh959oJVJ97WrSXc726eXryU3qZZ5fQwIWY5igE6 TUNw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iXB6v/76"; 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; dara=neutral header.i=@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 5b1f17b1804b1-42abefdba1csi29474235e9.171.2024.08.23.06.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 06:51:28 -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="iXB6v/76"; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D035488B9C; Fri, 23 Aug 2024 15:49:28 +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="iXB6v/76"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 622A7886E7; Fri, 23 Aug 2024 15:49:26 +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-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (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 608C188ABF for ; Fri, 23 Aug 2024 15:49:24 +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-wr1-x42f.google.com with SMTP id ffacd0b85a97d-371a13c7c80so1738729f8f.0 for ; Fri, 23 Aug 2024 06:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724420964; x=1725025764; 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=RmknMyAEHfs1JMtP1FJ6M3yqq1Eqt8h9Sbcy1PINCR8=; b=iXB6v/764QzMXbCDmNkR5IlwHnCXvFqFd6xV+Ryoqh/JezzUbh4U71TY5/GgG6XICi rVJ0LUHP7Rwj9jXOK2p6B3iK6HBArH9wo49LUu1ZMCfcbYDMsQ43hm2OocAqJBluhXo+ FUT1lOeLogROsAOzv5S76t7pO519+sLZx/2ra3NTFn32eGR34ct22ReVSsitFkCCyMct dkx4udxgbkV/UX0IJQXcxs3AHJH+9tu/OJo+99kYkizNMR4hoeHFEXYY9zvf/bynMhuH +TUdAhupXji7KScyCzp7osBBzxDdSTmoArddjCVhqeaJQEPA87LlEIfbmXSG+LC202+r bIDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724420964; x=1725025764; 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=RmknMyAEHfs1JMtP1FJ6M3yqq1Eqt8h9Sbcy1PINCR8=; b=dDD6/Kh9XkVev4GMH/WpxZ8FjDH096KU7wQuBqHprkHMMCPELVWw0ijEftK7lLr04w 1LXBKB8TJ9M4rMRocZoAa2XiEXgmu7BSTMzV4XR45FbnMnqv7+Sa781Z3QqqySrFR987 4lccy0M0t64h1xjx5+1WETKfX0omfMhBRgz6qInJteeuvsX8ElWNIXuwWLn31SfrkXHs +o2wO3poO1Fpi80KuREtlHu5f2AklGM7DR+EXKMHt3M4xI7/bFjutRKyq79MjW8ZsC6m +4k69fV79FFdn1QJtW+9WXQvjmb1uIug2Em5V8yPDnm+focswQQ9aABO8U+vFZ/oOMNo f59Q== X-Gm-Message-State: AOJu0Yx4fmjfdRHWS+FDVBxM1KC+r+ix16Dhdl2XHyv9qIjFMkOOAZSm rTISLyJyXKDfypPjOhNDhTiOOEhQyu9MPYnMbbwOrdULqXIeKgiTIwePuihm1u/fcWlcWjzWksc h6tnVyOFC X-Received: by 2002:adf:f8ce:0:b0:368:6bb:f79e with SMTP id ffacd0b85a97d-37310eb3921mr1502688f8f.4.1724420963540; Fri, 23 Aug 2024 06:49:23 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:e668:dc94:35c7:8064]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-373081ffb40sm4201665f8f.76.2024.08.23.06.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 06:49:23 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Heinrich Schuchardt Subject: [PATCH v9 13/37] test/py: test_efi_loader: add HTTP (wget) test for the EFI loader Date: Fri, 23 Aug 2024 15:48:17 +0200 Message-Id: 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 | 62 +++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py index 7c1e0ffa594..5f3b448a066 100644 --- a/test/py/tests/test_efi_loader.py +++ b/test/py/tests/test_efi_loader.py @@ -45,11 +45,18 @@ env__efi_loader_helloworld_file = { 'crc32': 'c2244b26', # CRC32 check sum 'addr': 0x40400000, # load address } + +# False if the helloworld EFI over HTTP boot test should be performed. +# If HTTP boot testing is not possible or desired, set this variable to True or +# ommit it. +env__efi_helloworld_net_http_test_skip = True """ 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 +117,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 +135,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,17 +160,8 @@ def fetch_tftp_file(u_boot_console, env_conf): return addr -@pytest.mark.buildconfigspec('of_control') -@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile') -@pytest.mark.buildconfigspec('cmd_tftpboot') -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' @@ -165,6 +169,32 @@ 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') +@pytest.mark.buildconfigspec('cmd_tftpboot') +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') +@pytest.mark.buildconfigspec('cmd_wget') +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. + """ + if u_boot_console.config.env.get('env__efi_helloworld_net_http_test_skip', True): + pytest.skip('helloworld.efi HTTP test is not enabled!') + + 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. @@ -187,7 +217,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)