test_ofplatdata.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # SPDX-License-Identifier: GPL-2.0+
  2. # Copyright (c) 2016 Google, Inc
  3. import pytest
  4. import u_boot_utils as util
  5. OF_PLATDATA_OUTPUT = '''
  6. of-platdata probe:
  7. bool 1
  8. byte 05
  9. bytearray 06 00 00
  10. int 1
  11. intarray 2 3 4 0
  12. longbytearray 09 0a 0b 0c 0d 0e 0f 10 11
  13. string message
  14. stringarray "multi-word" "message" ""
  15. of-platdata probe:
  16. bool 0
  17. byte 08
  18. bytearray 01 23 34
  19. int 3
  20. intarray 5 0 0 0
  21. longbytearray 09 00 00 00 00 00 00 00 00
  22. string message2
  23. stringarray "another" "multi-word" "message"
  24. of-platdata probe:
  25. bool 0
  26. byte 00
  27. bytearray 00 00 00
  28. int 0
  29. intarray 0 0 0 0
  30. longbytearray 00 00 00 00 00 00 00 00 00
  31. string <NULL>
  32. stringarray "one" "" ""
  33. of-platdata probe:
  34. bool 0
  35. byte 00
  36. bytearray 00 00 00
  37. int 0
  38. intarray 0 0 0 0
  39. longbytearray 00 00 00 00 00 00 00 00 00
  40. string <NULL>
  41. stringarray "spl" "" ""
  42. '''
  43. @pytest.mark.buildconfigspec('spl_of_platdata')
  44. def test_ofplatdata(u_boot_console):
  45. """Test that of-platdata can be generated and used in sandbox"""
  46. cons = u_boot_console
  47. cons.restart_uboot_with_flags(['--show_of_platdata'])
  48. output = cons.get_spawn_output().replace('\r', '')
  49. assert OF_PLATDATA_OUTPUT in output
  50. @pytest.mark.buildconfigspec('spl_of_platdata')
  51. def test_spl_devicetree(u_boot_console):
  52. """Test content of spl device-tree"""
  53. cons = u_boot_console
  54. dtb = cons.config.build_dir + '/spl/u-boot-spl.dtb'
  55. fdtgrep = cons.config.build_dir + '/tools/fdtgrep'
  56. output = util.run_and_log(cons, [fdtgrep, '-l', dtb])
  57. assert "u-boot,dm-pre-reloc" not in output
  58. assert "u-boot,dm-pre-proper" not in output
  59. assert "u-boot,dm-spl" not in output
  60. assert "u-boot,dm-tpl" not in output
  61. assert "spl-test4" in output
  62. assert "spl-test5" not in output
  63. assert "spl-test6" not in output
  64. assert "spl-test7" in output