Simon Glass | c405fc4 | 2016-07-04 11:58:41 -0600 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 2 | # Copyright (c) 2016 Google, Inc |
Simon Glass | c405fc4 | 2016-07-04 11:58:41 -0600 | [diff] [blame] | 3 | |
| 4 | import pytest |
Patrick Delaunay | ae84ff1 | 2019-05-21 19:19:11 +0200 | [diff] [blame^] | 5 | import u_boot_utils as util |
Simon Glass | c405fc4 | 2016-07-04 11:58:41 -0600 | [diff] [blame] | 6 | |
Simon Glass | b5dfea8 | 2018-11-15 18:44:01 -0700 | [diff] [blame] | 7 | OF_PLATDATA_OUTPUT = ''' |
| 8 | of-platdata probe: |
| 9 | bool 1 |
| 10 | byte 05 |
| 11 | bytearray 06 00 00 |
| 12 | int 1 |
| 13 | intarray 2 3 4 0 |
| 14 | longbytearray 09 0a 0b 0c 0d 0e 0f 10 11 |
| 15 | string message |
| 16 | stringarray "multi-word" "message" "" |
| 17 | of-platdata probe: |
| 18 | bool 0 |
| 19 | byte 08 |
| 20 | bytearray 01 23 34 |
| 21 | int 3 |
| 22 | intarray 5 0 0 0 |
| 23 | longbytearray 09 00 00 00 00 00 00 00 00 |
| 24 | string message2 |
| 25 | stringarray "another" "multi-word" "message" |
| 26 | of-platdata probe: |
| 27 | bool 0 |
| 28 | byte 00 |
| 29 | bytearray 00 00 00 |
| 30 | int 0 |
| 31 | intarray 0 0 0 0 |
| 32 | longbytearray 00 00 00 00 00 00 00 00 00 |
| 33 | string <NULL> |
| 34 | stringarray "one" "" "" |
Patrick Delaunay | ae84ff1 | 2019-05-21 19:19:11 +0200 | [diff] [blame^] | 35 | of-platdata probe: |
| 36 | bool 0 |
| 37 | byte 00 |
| 38 | bytearray 00 00 00 |
| 39 | int 0 |
| 40 | intarray 0 0 0 0 |
| 41 | longbytearray 00 00 00 00 00 00 00 00 00 |
| 42 | string <NULL> |
| 43 | stringarray "spl" "" "" |
Simon Glass | b5dfea8 | 2018-11-15 18:44:01 -0700 | [diff] [blame] | 44 | ''' |
Simon Glass | c405fc4 | 2016-07-04 11:58:41 -0600 | [diff] [blame] | 45 | |
Simon Glass | e0b0274 | 2016-07-16 18:36:44 -0600 | [diff] [blame] | 46 | @pytest.mark.buildconfigspec('spl_of_platdata') |
Simon Glass | c405fc4 | 2016-07-04 11:58:41 -0600 | [diff] [blame] | 47 | def test_ofplatdata(u_boot_console): |
| 48 | """Test that of-platdata can be generated and used in sandbox""" |
| 49 | cons = u_boot_console |
Simon Glass | b5dfea8 | 2018-11-15 18:44:01 -0700 | [diff] [blame] | 50 | cons.restart_uboot_with_flags(['--show_of_platdata']) |
Simon Glass | c405fc4 | 2016-07-04 11:58:41 -0600 | [diff] [blame] | 51 | output = cons.get_spawn_output().replace('\r', '') |
| 52 | assert OF_PLATDATA_OUTPUT in output |
Patrick Delaunay | ae84ff1 | 2019-05-21 19:19:11 +0200 | [diff] [blame^] | 53 | |
| 54 | @pytest.mark.buildconfigspec('spl_of_platdata') |
| 55 | def 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 |