tree: 0738c4af3d5a31c15d02b78fd4b6840ac8e24780 [path history] [tgz]
  1. autogen/
  2. json/
  3. test_framework/
  4. test_rom/
  5. aes_testutils.c
  6. aes_testutils.h
  7. alert_handler_testutils.c
  8. alert_handler_testutils.h
  9. aon_timer_testutils.c
  10. aon_timer_testutils.h
  11. BUILD
  12. clkmgr_testutils.c
  13. clkmgr_testutils.h
  14. csrng_testutils.c
  15. csrng_testutils.h
  16. entropy_testutils.c
  17. entropy_testutils.h
  18. flash_ctrl_testutils.c
  19. flash_ctrl_testutils.h
  20. hmac_testutils.c
  21. hmac_testutils.h
  22. i2c_testutils.c
  23. i2c_testutils.h
  24. keymgr_testutils.c
  25. keymgr_testutils.h
  26. kmac_testutils.c
  27. kmac_testutils.h
  28. lc_ctrl_testutils.c
  29. lc_ctrl_testutils.h
  30. otbn_testutils.c
  31. otbn_testutils.h
  32. otp_ctrl_testutils.c
  33. otp_ctrl_testutils.h
  34. pinmux_testutils.c
  35. pinmux_testutils.h
  36. pwrmgr_testutils.c
  37. pwrmgr_testutils.h
  38. rand_testutils.c
  39. rand_testutils.h
  40. README.md
  41. rstmgr_testutils.c
  42. rstmgr_testutils.h
  43. rv_core_ibex_testutils.c
  44. rv_core_ibex_testutils.h
  45. rv_plic_testutils.c
  46. rv_plic_testutils.h
  47. sensor_ctrl_testutils.c
  48. sensor_ctrl_testutils.h
  49. spi_device_testutils.c
  50. spi_device_testutils.h
  51. spi_flash_testutils.c
  52. spi_flash_testutils.h
  53. sram_ctrl_testutils.c
  54. sram_ctrl_testutils.h
  55. usb_testutils.c
  56. usb_testutils.h
  57. usb_testutils_controlep.c
  58. usb_testutils_controlep.h
  59. usb_testutils_diags.h
  60. usb_testutils_simpleserial.c
  61. usb_testutils_simpleserial.h
sw/device/lib/testing/README.md

Chip-Level Test Libraries

Overview

This subtree contains test library code that could aid in the writing of chip-level tests. Test library code consists of two components:

  1. testutils libraries, and
  2. the on-device test framework.

Functions in testutils libraries are designed to wrap several DIF invocations that are commonly used together across many chip-level tests. They are not designed to wrap a single DIF call.

The on-device test framework provides a generic platform for writing chip-level tests.

Style Guide

  • All testutils libraries should be placed in sw/device/lib/testing/*
  • The on-device test framework code will live in: sw/device/lib/testing/test\_framework.
  • testutils libraries will be named: <IP or functionality name>_testutils.<h,c>
  • All testutils function names should take on the following format: <IP or functionality name>_testutils_<function name>(). This corresponds to the format: <filename>_<function name>().
  • There is no strict return typing required, though ideally most testutils functions should return void or bool. This is because test errors should be checked in testutils functions themselves using the CHECK() macros defined in sw/device/lib/testing/check.h.
    • Functions that return bool to represent an error should be marked with OT_WARN_UNUSED_RESULT to avoid mistakenly ignoring errors. Return false to represent an error.
  • Try to keep testutils libraries toplevel agnostic (e.g., don’t include hw/top_earlgrey/sw/autogen/top_earlgrey.h if you can avoid it). This means dif_<ip>_init() DIFs should be invoked in chip-level tests, not testutils, and the DIF handles should be passed in as parameters to testutils functions.
  • Pass-through sw/device/lib/dif_base.h types where appropriate. This allows testutils functions to easily mix with DIFs within chip-level tests.
  • Avoid defining testutils that call a single DIF, and use the DIF directly. If a DIF does not exist for your needs, create one by following the DIF development guide.

{{% sectionContent %}}