blob: 263334b0743b849b04e4ac3296e6854520da7542 [file] [log] [blame]
Simon Glassb979d3d2016-07-04 11:58:41 -06001# SPDX-License-Identifier: GPL-2.0+
Tom Rini83d290c2018-05-06 17:58:06 -04002# Copyright (c) 2016 Google, Inc
Simon Glassb979d3d2016-07-04 11:58:41 -06003
4import pytest
Patrick Delaunay099ed452019-05-21 19:19:11 +02005import u_boot_utils as util
Simon Glassb979d3d2016-07-04 11:58:41 -06006
Simon Glass1ca910b2018-11-15 18:44:01 -07007OF_PLATDATA_OUTPUT = '''
8of-platdata probe:
9bool 1
10byte 05
11bytearray 06 00 00
12int 1
13intarray 2 3 4 0
14longbytearray 09 0a 0b 0c 0d 0e 0f 10 11
15string message
16stringarray "multi-word" "message" ""
17of-platdata probe:
18bool 0
19byte 08
20bytearray 01 23 34
21int 3
22intarray 5 0 0 0
23longbytearray 09 00 00 00 00 00 00 00 00
24string message2
25stringarray "another" "multi-word" "message"
26of-platdata probe:
27bool 0
28byte 00
29bytearray 00 00 00
30int 0
31intarray 0 0 0 0
32longbytearray 00 00 00 00 00 00 00 00 00
33string <NULL>
34stringarray "one" "" ""
Patrick Delaunay099ed452019-05-21 19:19:11 +020035of-platdata probe:
36bool 0
37byte 00
38bytearray 00 00 00
39int 0
40intarray 0 0 0 0
41longbytearray 00 00 00 00 00 00 00 00 00
42string <NULL>
43stringarray "spl" "" ""
Simon Glass1ca910b2018-11-15 18:44:01 -070044'''
Simon Glassb979d3d2016-07-04 11:58:41 -060045
Simon Glassf60d0602016-07-16 18:36:44 -060046@pytest.mark.buildconfigspec('spl_of_platdata')
Simon Glassb979d3d2016-07-04 11:58:41 -060047def test_ofplatdata(u_boot_console):
48 """Test that of-platdata can be generated and used in sandbox"""
49 cons = u_boot_console
Simon Glass1ca910b2018-11-15 18:44:01 -070050 cons.restart_uboot_with_flags(['--show_of_platdata'])
Simon Glassb979d3d2016-07-04 11:58:41 -060051 output = cons.get_spawn_output().replace('\r', '')
52 assert OF_PLATDATA_OUTPUT in output
Patrick Delaunay099ed452019-05-21 19:19:11 +020053
54@pytest.mark.buildconfigspec('spl_of_platdata')
55def test_spl_devicetree(u_boot_console):
56 """Test content of spl device-tree"""
57 cons = u_boot_console
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])
61
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
66
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