From patchwork Mon Aug 15 22:57:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jae Hyun Yoo X-Patchwork-Id: 1666616 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=NXtKMSc5; dkim-atps=neutral Received: from legolas.ozlabs.org (legolas.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee2:8c49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M68qm3n7Rz9s07 for ; Tue, 16 Aug 2022 08:59:48 +1000 (AEST) Received: by legolas.ozlabs.org (Postfix) id 4M68ql6ZNJz1ygS; Tue, 16 Aug 2022 08:59:47 +1000 (AEST) Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=NXtKMSc5; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4M68ql2Ng3z1ygF for ; Tue, 16 Aug 2022 08:59:47 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ADD52849BB; Tue, 16 Aug 2022 00:58:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=quicinc.com 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=quicinc.com header.i=@quicinc.com header.b="NXtKMSc5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 65CBB8487C; Tue, 16 Aug 2022 00:58:40 +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 mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 89C11848C0 for ; Tue, 16 Aug 2022 00:58:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=quic_jaehyoo@quicinc.com Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27FMwHjl011427; Mon, 15 Aug 2022 22:58:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=kS0B90BWyg1MEH+Py7tpaZCBnv2Fix1HK63lkGsVoqg=; b=NXtKMSc5ChJsyUcP8QYoeyiKr/rmhzMjsTFbxSNW7A/BNB0jawsAjWZnMuENVxa1bk6G iz7ZM+2vMkvVx0Qux49P9VXGgqaSj4LI7lu/F0NazzK16df6sza8Aq0q/gewFkPcL3Gd 7qUCTncgMgthEX+rYH5tXuobS4NnKo9euavFqoLd3cScyRAM11noXgBnjAMNGqYceNBQ Ze4EqN6PNuR4wzkOxACziDWjnIV1SE0hC+2J08Z68RqYvHe3jYCfYu3V9YCMJVYj+Arh 33V6TwRxmRJec/qCOMqLvdmppqj4cW2vxeNgFyn6V3dfeSEEz2qx4fu7Ydj67angUrC+ UA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3hx1aueymu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Aug 2022 22:58:17 +0000 Received: from pps.filterd (NALASPPMTA03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 27FMwG4T005970; Mon, 15 Aug 2022 22:58:16 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3hxnb4579c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Aug 2022 22:58:16 +0000 Received: from NALASPPMTA03.qualcomm.com (NALASPPMTA03.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 27FMwFuY005965; Mon, 15 Aug 2022 22:58:15 GMT Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 27FMwFuO005963 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Aug 2022 22:58:15 +0000 Received: from maru.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 15 Aug 2022 15:58:14 -0700 From: Jae Hyun Yoo To: Michal Simek , Ovidiu Panait , Simon Glass , Mario Six , Masahisa Kojima , =?utf-8?q?Pali_Roh=C3=A1r?= , Heinrich Schuchardt , Ashok Reddy Soma , "Thomas Huth" , Huang Jianan , Chris Morgan , Roland Gaudig , Patrick Delaunay , Alexandru Gagniuc CC: Jamie Iles , Graeme Gregory , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Jae Hyun Yoo , Subject: [PATCH v2 6/6] test: py: fru: add a test for the fru command Date: Mon, 15 Aug 2022 15:57:38 -0700 Message-ID: <20220815225738.413344-7-quic_jaehyoo@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815225738.413344-1-quic_jaehyoo@quicinc.com> References: <20220815225738.413344-1-quic_jaehyoo@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: AZ9uqs7iAhtNhYL-oXfjg307gOUTdejL X-Proofpoint-ORIG-GUID: AZ9uqs7iAhtNhYL-oXfjg307gOUTdejL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-15_08,2022-08-15_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 bulkscore=0 adultscore=0 spamscore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 suspectscore=0 priorityscore=1501 clxscore=1015 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208150089 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.6 at phobos.denx.de X-Virus-Status: Clean Add a simple test for the 'fru' command. Signed-off-by: Jae Hyun Yoo --- Changes from v1: * Newly added in v2. (Heinrich) configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + configs/sandbox_noinst_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + configs/sandbox_vpl_defconfig | 1 + test/py/tests/test_fru.py | 47 ++++++++++++++++++++++++++++++ 7 files changed, 53 insertions(+) create mode 100644 test/py/tests/test_fru.py diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 6553568e7684..9059e3c1c91d 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -83,6 +83,7 @@ CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_MTDPARTS=y +CONFIG_CMD_FRU=y CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index eba7bcbb483b..293e39706cf2 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -115,6 +115,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_SQUASHFS=y CONFIG_CMD_MTDPARTS=y CONFIG_CMD_STACKPROTECTOR_TEST=y +CONFIG_CMD_FRU=y CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 6d62feeb08a9..e71379599140 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -66,6 +66,7 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_TPM=y CONFIG_CMD_TPM_TEST=y CONFIG_CMD_EXT4_WRITE=y +CONFIG_CMD_FRU=y CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig index 9ee70c29c1a5..0b7f8bd9b3cc 100644 --- a/configs/sandbox_noinst_defconfig +++ b/configs/sandbox_noinst_defconfig @@ -84,6 +84,7 @@ CONFIG_CMD_TPM_TEST=y CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y +CONFIG_CMD_FRU=y CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index ec2d26d4436b..05235ec1c493 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -84,6 +84,7 @@ CONFIG_CMD_TPM_TEST=y CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y +CONFIG_CMD_FRU=y CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y diff --git a/configs/sandbox_vpl_defconfig b/configs/sandbox_vpl_defconfig index 0d946b4ad779..7d4b808a5b49 100644 --- a/configs/sandbox_vpl_defconfig +++ b/configs/sandbox_vpl_defconfig @@ -96,6 +96,7 @@ CONFIG_CMD_TPM_TEST=y CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y +CONFIG_CMD_FRU=y CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y diff --git a/test/py/tests/test_fru.py b/test/py/tests/test_fru.py new file mode 100644 index 000000000000..e5e1d7d00639 --- /dev/null +++ b/test/py/tests/test_fru.py @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + +import pytest +import u_boot_utils + +@pytest.mark.buildconfigspec('cmd_fru') +def test_fru_board(u_boot_console): + """Test that fru command generates and captures board FRU information as + expected.""" + + ram_base = u_boot_utils.find_ram_base(u_boot_console) + addr = '0x%x' % ram_base + expected_response = 'rc:0' + response = u_boot_console.run_command('fru generate -b ' + addr + ' abcd efgh ijkl mnop qrst uvwx; echo rc:$?') + assert(expected_response in response) + response = u_boot_console.run_command('fru capture ' + addr + '; echo rc:$?') + assert(expected_response in response) + response = u_boot_console.run_command('fru display') + assert('Manufacturer Name: abcd' in response) + assert('Product Name: efgh' in response) + assert('Serial Number: ijkl' in response) + assert('Part Number: mnop' in response) + assert('File ID: qrst' in response) + assert('Custom Type/Length: 0xc4' in response) + +@pytest.mark.buildconfigspec('cmd_fru') +def test_fru_product(u_boot_console): + """Test that fru command generates and captures product FRU information as + expected.""" + + ram_base = u_boot_utils.find_ram_base(u_boot_console) + addr = '0x%x' % ram_base + expected_response = 'rc:0' + response = u_boot_console.run_command('fru generate -p ' + addr + ' abcd efgh ijkl mnop qrst uvwx yz01 2345; echo rc:$?') + assert(expected_response in response) + response = u_boot_console.run_command('fru capture ' + addr + '; echo rc:$?') + assert(expected_response in response) + response = u_boot_console.run_command('fru display') + assert('Manufacturer Name: abcd' in response) + assert('Product Name: efgh' in response) + assert('Part Number: ijkl' in response) + assert('Version Number: mnop' in response) + assert('Serial Number: qrst' in response) + assert('Asset Number: uvwx' in response) + assert('File ID: yz01' in response) + assert('Custom Type/Length: 0xc4' in response)