Commit b979d3d4c55def30cd0eb1e2c82beefb30fc8e87
1 parent
a811779b17
Exists in
v2017.01-smarct4x
and in
28 other branches
dm: Add a test for of-platdata
Add a simple test which checks that the of-platdata system is working correctly. The sequence is as follows: - SPL starts up and probes all the UCLASS_MISC drivers - There are 3 of these in sandbox.dts - Therefore there should be 3 U_BOOT_DEVICE() declarations in dt-platdata.c - These should produce 3 sandbox_spl_test devices - Each device prints out its platform data when probed - This test checks for this output and compares it against expectations Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 1 changed file with 42 additions and 0 deletions Side-by-side Diff
test/py/tests/test_ofplatdata.py
| 1 | +# Copyright (c) 2016 Google, Inc | |
| 2 | +# | |
| 3 | +# SPDX-License-Identifier: GPL-2.0+ | |
| 4 | + | |
| 5 | +import pytest | |
| 6 | + | |
| 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" "" "" | |
| 35 | +''' | |
| 36 | + | |
| 37 | +@pytest.mark.buildconfigspec('spl') | |
| 38 | +def test_ofplatdata(u_boot_console): | |
| 39 | + """Test that of-platdata can be generated and used in sandbox""" | |
| 40 | + cons = u_boot_console | |
| 41 | + output = cons.get_spawn_output().replace('\r', '') | |
| 42 | + assert OF_PLATDATA_OUTPUT in output |