example_test.py 864 B

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