@@ -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
new file mode 100644
@@ -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)
Add a simple test for the 'fru' command. Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com> --- Changes from v2: * Added CONFIG_CMD_FRU=y only into the sandbox_defconfig. (Simon) Changes from v1: * Newly added in v2. (Heinrich) configs/sandbox_defconfig | 1 + test/py/tests/test_fru.py | 47 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 test/py/tests/test_fru.py