1 # SPDX-License-Identifier: GPL-2.0+
2 # Copyright (c) 2016 Google, Inc
5 import u_boot_utils as util
7 OF_PLATDATA_OUTPUT = '''
14 longbytearray 09 0a 0b 0c 0d 0e 0f 10 11
16 stringarray "multi-word" "message" ""
23 longbytearray 09 00 00 00 00 00 00 00 00
25 stringarray "another" "multi-word" "message"
32 longbytearray 00 00 00 00 00 00 00 00 00
34 stringarray "one" "" ""
41 longbytearray 00 00 00 00 00 00 00 00 00
43 stringarray "spl" "" ""
46 @pytest.mark.buildconfigspec('spl_of_platdata')
47 def test_ofplatdata(u_boot_console):
48 """Test that of-platdata can be generated and used in sandbox"""
50 cons.restart_uboot_with_flags(['--show_of_platdata'])
51 output = cons.get_spawn_output().replace('\r', '')
52 assert OF_PLATDATA_OUTPUT in output
54 @pytest.mark.buildconfigspec('spl_of_platdata')
55 def test_spl_devicetree(u_boot_console):
56 """Test content of spl device-tree"""
58 dtb = cons.config.build_dir + '/spl/u-boot-spl.dtb'
59 fdtgrep = cons.config.build_dir + '/tools/fdtgrep'
60 output = util.run_and_log(cons, [fdtgrep, '-l', dtb])
62 assert "u-boot,dm-pre-reloc" not in output
63 assert "u-boot,dm-pre-proper" not in output
64 assert "u-boot,dm-spl" not in output
65 assert "u-boot,dm-tpl" not in output
67 assert "spl-test4" in output
68 assert "spl-test5" not in output
69 assert "spl-test6" not in output
70 assert "spl-test7" in output