example_test.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. from __future__ import unicode_literals
  2. import os
  3. import ttfw_idf
  4. from tiny_test_fw import Utility
  5. def get_socket_msgs(i):
  6. msg = 'Socket message S{}'.format(i)
  7. return ['uart_select_example: {} bytes were written to socket: {}'.format(len(msg), msg),
  8. 'uart_select_example: {} bytes were received through socket: {}'.format(len(msg), msg)]
  9. def get_uart_msgs(i):
  10. msg = 'UART message U{}'.format(i)
  11. return ['uart_select_example: {} bytes were sent to UART1: {}'.format(len(msg), msg),
  12. 'uart_select_example: {} bytes were received through UART1: {}'.format(len(msg), msg)]
  13. @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3'])
  14. def test_examples_select(env, extra_data):
  15. dut = env.get_dut('select', 'examples/system/select')
  16. dut.start_app()
  17. dut.expect('cpu_start: Starting scheduler', timeout=30)
  18. exp_list = []
  19. for i in range(1, 10):
  20. exp_list += get_socket_msgs(i)
  21. exp_list += get_uart_msgs(i)
  22. Utility.console_log('Expecting:{}{}'.format(os.linesep, os.linesep.join(exp_list)))
  23. dut.expect_all(*exp_list, timeout=60)
  24. if __name__ == '__main__':
  25. test_examples_select()