example_test.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import os
  2. import re
  3. import ttfw_idf
  4. @ttfw_idf.idf_example_test(env_tag="Example_WIFI", ignore=True)
  5. def test_examples_protocol_https_x509_bundle(env, extra_data):
  6. """
  7. steps: |
  8. 1. join AP
  9. 2. connect to multiple URLs
  10. 3. send http request
  11. """
  12. dut1 = env.get_dut("https_x509_bundle", "examples/protocols/https_x509_bundle")
  13. # check and log bin size
  14. binary_file = os.path.join(dut1.app.binary_path, "https_x509_bundle.bin")
  15. bin_size = os.path.getsize(binary_file)
  16. ttfw_idf.log_performance("https_x509_bundle_bin_size", "{}KB".format(bin_size // 1024))
  17. # start test
  18. dut1.start_app()
  19. num_URLS = dut1.expect(re.compile(r"Connecting to (\d+) URLs"), timeout=30)
  20. dut1.expect(re.compile(r"Connection established to ([\s\S]*)"), timeout=30)
  21. dut1.expect("Completed {} connections".format(num_URLS[0]), timeout=60)
  22. # test mbedtls dynamic resource
  23. dut1 = env.get_dut("https_x509_bundle", "examples/protocols/https_x509_bundle", app_config_name='ssldyn')
  24. # check and log bin size
  25. binary_file = os.path.join(dut1.app.binary_path, "https_x509_bundle.bin")
  26. bin_size = os.path.getsize(binary_file)
  27. ttfw_idf.log_performance("https_x509_bundle_bin_size", "{}KB".format(bin_size // 1024))
  28. # start test
  29. dut1.start_app()
  30. num_URLS = dut1.expect(re.compile(r"Connecting to (\d+) URLs"), timeout=30)
  31. dut1.expect(re.compile(r"Connection established to ([\s\S]*)"), timeout=30)
  32. dut1.expect("Completed {} connections".format(num_URLS[0]), timeout=60)
  33. if __name__ == '__main__':
  34. test_examples_protocol_https_x509_bundle()