]> Git Repo - J-u-boot.git/blob - test/py/tests/test_extension.py
Merge tag 'u-boot-imx-master-20250127' of https://gitlab.denx.de/u-boot/custodians...
[J-u-boot.git] / test / py / tests / test_extension.py
1 # SPDX-License-Identifier:  GPL-2.0+
2 # Copyright (c) 2020
3 # Author: Kory Maincent <[email protected]>
4
5 # Test U-Boot's "extension" commands.
6
7 import os
8 import pytest
9 import u_boot_utils
10
11 overlay_addr = 0x1000
12
13 SANDBOX_DTB='arch/sandbox/dts/sandbox.dtb'
14 OVERLAY_DIR='arch/sandbox/dts/'
15
16 def load_dtb(u_boot_console):
17     u_boot_console.log.action('Loading devicetree to RAM...')
18     u_boot_console.run_command('host load hostfs - $fdt_addr_r %s' % (os.path.join(u_boot_console.config.build_dir, SANDBOX_DTB)))
19     u_boot_console.run_command('fdt addr $fdt_addr_r')
20
21 @pytest.mark.buildconfigspec('cmd_fdt')
22 @pytest.mark.boardspec('sandbox')
23 def test_extension(u_boot_console):
24     """Test the 'extension' command."""
25
26     load_dtb(u_boot_console)
27
28     output = u_boot_console.run_command('extension list')
29     # extension_bootdev_hunt may have already run.
30     # Without reboot we cannot make any assumption here.
31     # assert('No extension' in output)
32
33     output = u_boot_console.run_command('extension scan')
34     assert output == 'Found 2 extension board(s).'
35
36     output = u_boot_console.run_command('extension list')
37     assert('overlay0.dtbo' in output)
38     assert('overlay1.dtbo' in output)
39
40     u_boot_console.run_command_list([
41         'setenv extension_overlay_addr %s' % (overlay_addr),
42         'setenv extension_overlay_cmd \'host load hostfs - ${extension_overlay_addr} %s${extension_overlay_name}\'' % (os.path.join(u_boot_console.config.build_dir, OVERLAY_DIR))])
43
44     output = u_boot_console.run_command('extension apply 0')
45     assert('bytes read' in output)
46
47     output = u_boot_console.run_command('fdt print')
48     assert('button3' in output)
49
50     output = u_boot_console.run_command('extension apply all')
51     assert('bytes read' in output)
52
53     output = u_boot_console.run_command('fdt print')
54     assert('button4' in output)
55
This page took 0.033751 seconds and 4 git commands to generate.