example_test.py 920 B

1234567891011121314151617181920212223242526272829303132
  1. from __future__ import print_function
  2. import os
  3. import sys
  4. try:
  5. import IDF
  6. from IDF.IDFDUT import ESP32DUT
  7. except ImportError:
  8. test_fw_path = os.getenv('TEST_FW_PATH')
  9. if test_fw_path and test_fw_path not in sys.path:
  10. sys.path.insert(0, test_fw_path)
  11. import IDF
  12. @IDF.idf_example_test(env_tag='Example_WIFI')
  13. def test_examples_system_cpp_exceptions(env, extra_data):
  14. dut = env.get_dut('cpp_exceptions_example', 'examples/system/cpp_exceptions', dut_class=ESP32DUT)
  15. # start test
  16. dut.start_app()
  17. lines = ['app_main starting',
  18. 'In constructor, arg=42',
  19. 'In constructor, arg=0',
  20. 'In destructor, m_arg=42',
  21. 'Exception caught: Exception in constructor',
  22. 'app_main done'
  23. ]
  24. for line in lines:
  25. dut.expect(line, timeout=2)
  26. if __name__ == '__main__':
  27. test_examples_system_cpp_exceptions()