example_test.py 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. import http.server
  2. import os
  3. import re
  4. import socket
  5. import ssl
  6. import sys
  7. from threading import Thread
  8. import ttfw_idf
  9. from tiny_test_fw import DUT, Utility
  10. server_cert = '-----BEGIN CERTIFICATE-----\n' \
  11. 'MIIDWDCCAkACCQCbF4+gVh/MLjANBgkqhkiG9w0BAQsFADBuMQswCQYDVQQGEwJJ\n'\
  12. 'TjELMAkGA1UECAwCTUgxDDAKBgNVBAcMA1BVTjEMMAoGA1UECgwDRVNQMQwwCgYD\n'\
  13. 'VQQLDANFU1AxDDAKBgNVBAMMA0VTUDEaMBgGCSqGSIb3DQEJARYLZXNwQGVzcC5j\n'\
  14. 'b20wHhcNMjEwNzEyMTIzNjI3WhcNNDEwNzA3MTIzNjI3WjBuMQswCQYDVQQGEwJJ\n'\
  15. 'TjELMAkGA1UECAwCTUgxDDAKBgNVBAcMA1BVTjEMMAoGA1UECgwDRVNQMQwwCgYD\n'\
  16. 'VQQLDANFU1AxDDAKBgNVBAMMA0VTUDEaMBgGCSqGSIb3DQEJARYLZXNwQGVzcC5j\n'\
  17. 'b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDhxF/y7bygndxPwiWL\n'\
  18. 'SwS9LY3uBMaJgup0ufNKVhx+FhGQOu44SghuJAaH3KkPUnt6SOM8jC97/yQuc32W\n'\
  19. 'ukI7eBZoA12kargSnzdv5m5rZZpd+NznSSpoDArOAONKVlzr25A1+aZbix2mKRbQ\n'\
  20. 'S5w9o1N2BriQuSzd8gL0Y0zEk3VkOWXEL+0yFUT144HnErnD+xnJtHe11yPO2fEz\n'\
  21. 'YaGiilh0ddL26PXTugXMZN/8fRVHP50P2OG0SvFpC7vghlLp4VFM1/r3UJnvL6Oz\n'\
  22. '3ALc6dhxZEKQucqlpj8l1UegszQToopemtIj0qXTHw2+uUnkUyWIPjPC+wdOAoap\n'\
  23. 'rFTRAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAItw24y565k3C/zENZlxyzto44ud\n'\
  24. 'IYPQXN8Fa2pBlLe1zlSIyuaA/rWQ+i1daS8nPotkCbWZyf5N8DYaTE4B0OfvoUPk\n'\
  25. 'B5uGDmbuk6akvlB5BGiYLfQjWHRsK9/4xjtIqN1H58yf3QNROuKsPAeywWS3Fn32\n'\
  26. '3//OpbWaClQePx6udRYMqAitKR+QxL7/BKZQsX+UyShuq8hjphvXvk0BW8ONzuw9\n'\
  27. 'RcoORxM0FzySYjeQvm4LhzC/P3ZBhEq0xs55aL2a76SJhq5hJy7T/Xz6NFByvlrN\n'\
  28. 'lFJJey33KFrAf5vnV9qcyWFIo7PYy2VsaaEjFeefr7q3sTFSMlJeadexW2Y=\n'\
  29. '-----END CERTIFICATE-----\n'
  30. server_key = '-----BEGIN PRIVATE KEY-----\n'\
  31. 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDhxF/y7bygndxP\n'\
  32. 'wiWLSwS9LY3uBMaJgup0ufNKVhx+FhGQOu44SghuJAaH3KkPUnt6SOM8jC97/yQu\n'\
  33. 'c32WukI7eBZoA12kargSnzdv5m5rZZpd+NznSSpoDArOAONKVlzr25A1+aZbix2m\n'\
  34. 'KRbQS5w9o1N2BriQuSzd8gL0Y0zEk3VkOWXEL+0yFUT144HnErnD+xnJtHe11yPO\n'\
  35. '2fEzYaGiilh0ddL26PXTugXMZN/8fRVHP50P2OG0SvFpC7vghlLp4VFM1/r3UJnv\n'\
  36. 'L6Oz3ALc6dhxZEKQucqlpj8l1UegszQToopemtIj0qXTHw2+uUnkUyWIPjPC+wdO\n'\
  37. 'AoaprFTRAgMBAAECggEAE0HCxV/N1Q1h+1OeDDGL5+74yjKSFKyb/vTVcaPCrmaH\n'\
  38. 'fPvp0ddOvMZJ4FDMAsiQS6/n4gQ7EKKEnYmwTqj4eUYW8yxGUn3f0YbPHbZT+Mkj\n'\
  39. 'z5woi3nMKi/MxCGDQZX4Ow3xUQlITUqibsfWcFHis8c4mTqdh4qj7xJzehD2PVYF\n'\
  40. 'gNHZsvVj6MltjBDAVwV1IlGoHjuElm6vuzkfX7phxcA1B4ZqdYY17yCXUnvui46z\n'\
  41. 'Xn2kUTOOUCEgfgvGa9E+l4OtdXi5IxjaSraU+dlg2KsE4TpCuN2MEVkeR5Ms3Y7Q\n'\
  42. 'jgJl8vlNFJDQpbFukLcYwG7rO5N5dQ6WWfVia/5XgQKBgQD74at/bXAPrh9NxPmz\n'\
  43. 'i1oqCHMDoM9sz8xIMZLF9YVu3Jf8ux4xVpRSnNy5RU1gl7ZXbpdgeIQ4v04zy5aw\n'\
  44. '8T4tu9K3XnR3UXOy25AK0q+cnnxZg3kFQm+PhtOCKEFjPHrgo2MUfnj+EDddod7N\n'\
  45. 'JQr9q5rEFbqHupFPpWlqCa3QmQKBgQDldWUGokNaEpmgHDMnHxiibXV5LQhzf8Rq\n'\
  46. 'gJIQXb7R9EsTSXEvsDyqTBb7PHp2Ko7rZ5YQfyf8OogGGjGElnPoU/a+Jij1gVFv\n'\
  47. 'kZ064uXAAISBkwHdcuobqc5EbG3ceyH46F+FBFhqM8KcbxJxx08objmh58+83InN\n'\
  48. 'P9Qr25Xw+QKBgEGXMHuMWgQbSZeM1aFFhoMvlBO7yogBTKb4Ecpu9wI5e3Kan3Al\n'\
  49. 'pZYltuyf+VhP6XG3IMBEYdoNJyYhu+nzyEdMg8CwXg+8LC7FMis/Ve+o7aS5scgG\n'\
  50. '1to/N9DK/swCsdTRdzmc/ZDbVC+TuVsebFBGYZTyO5KgqLpezqaIQrTxAoGALFCU\n'\
  51. '10glO9MVyl9H3clap5v+MQ3qcOv/EhaMnw6L2N6WVT481tnxjW4ujgzrFcE4YuxZ\n'\
  52. 'hgwYu9TOCmeqopGwBvGYWLbj+C4mfSahOAs0FfXDoYazuIIGBpuv03UhbpB1Si4O\n'\
  53. 'rJDfRnuCnVWyOTkl54gKJ2OusinhjztBjcrV1XkCgYEA3qNi4uBsPdyz9BZGb/3G\n'\
  54. 'rOMSw0CaT4pEMTLZqURmDP/0hxvTk1polP7O/FYwxVuJnBb6mzDa0xpLFPTpIAnJ\n'\
  55. 'YXB8xpXU69QVh+EBbemdJWOd+zp5UCfXvb2shAeG3Tn/Dz4cBBMEUutbzP+or0nG\n'\
  56. 'vSXnRLaxQhooWm+IuX9SuBQ=\n'\
  57. '-----END PRIVATE KEY-----\n'
  58. def get_my_ip():
  59. s1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  60. s1.connect(('8.8.8.8', 80))
  61. my_ip = s1.getsockname()[0]
  62. s1.close()
  63. return my_ip
  64. def start_https_server(ota_image_dir, server_ip, server_port, server_file=None, key_file=None):
  65. os.chdir(ota_image_dir)
  66. if server_file is None:
  67. server_file = os.path.join(ota_image_dir, 'server_cert.pem')
  68. cert_file_handle = open(server_file, 'w+')
  69. cert_file_handle.write(server_cert)
  70. cert_file_handle.close()
  71. if key_file is None:
  72. key_file = os.path.join(ota_image_dir, 'server_key.pem')
  73. key_file_handle = open('server_key.pem', 'w+')
  74. key_file_handle.write(server_key)
  75. key_file_handle.close()
  76. httpd = http.server.HTTPServer((server_ip, server_port), http.server.SimpleHTTPRequestHandler)
  77. httpd.socket = ssl.wrap_socket(httpd.socket,
  78. keyfile=key_file,
  79. certfile=server_file, server_side=True)
  80. httpd.serve_forever()
  81. def check_sha256(sha256_expected, sha256_reported):
  82. Utility.console_log('sha256_expected: %s' % (sha256_expected))
  83. Utility.console_log('sha256_reported: %s' % (sha256_reported))
  84. if sha256_reported not in sha256_expected:
  85. raise ValueError('SHA256 mismatch')
  86. else:
  87. Utility.console_log('SHA256 expected and reported are the same')
  88. def calc_all_sha256(dut):
  89. bootloader_path = os.path.join(dut.app.binary_path, 'bootloader', 'bootloader.bin')
  90. output = dut.image_info(bootloader_path)
  91. sha256_bootloader = re.search(r'Validation Hash:\s+([a-f0-9]+)', output).group(1)
  92. Utility.console_log('bootloader SHA256: %s' % sha256_bootloader)
  93. app_path = os.path.join(dut.app.binary_path, 'simple_ota.bin')
  94. output = dut.image_info(app_path)
  95. sha256_app = re.search(r'Validation Hash:\s+([a-f0-9]+)', output).group(1)
  96. Utility.console_log('app SHA256: %s' % sha256_app)
  97. return sha256_bootloader, sha256_app
  98. @ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA')
  99. def test_examples_protocol_simple_ota_example(env, extra_data):
  100. """
  101. steps: |
  102. 1. join AP
  103. 2. Fetch OTA image over HTTPS
  104. 3. Reboot with the new OTA image
  105. """
  106. dut1 = env.get_dut('simple_ota_example', 'examples/system/ota/simple_ota_example', dut_class=ttfw_idf.ESP32DUT)
  107. # check and log bin size
  108. binary_file = os.path.join(dut1.app.binary_path, 'simple_ota.bin')
  109. bin_size = os.path.getsize(binary_file)
  110. ttfw_idf.log_performance('simple_ota_bin_size', '{}KB'.format(bin_size // 1024))
  111. sha256_bootloader, sha256_app = calc_all_sha256(dut1)
  112. # start test
  113. host_ip = get_my_ip()
  114. thread1 = Thread(target=start_https_server, args=(dut1.app.binary_path, host_ip, 8000))
  115. thread1.daemon = True
  116. thread1.start()
  117. dut1.start_app()
  118. dut1.expect('Loaded app from partition at offset 0x10000', timeout=30)
  119. check_sha256(sha256_bootloader, dut1.expect(re.compile(r'SHA-256 for bootloader:\s+([a-f0-9]+)'))[0])
  120. check_sha256(sha256_app, dut1.expect(re.compile(r'SHA-256 for current firmware:\s+([a-f0-9]+)'))[0])
  121. try:
  122. ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30)
  123. print('Connected to AP with IP: {}'.format(ip_address))
  124. except DUT.ExpectTimeout:
  125. raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP')
  126. dut1.expect('Starting OTA example', timeout=30)
  127. print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))
  128. dut1.write('https://' + host_ip + ':8000/simple_ota.bin')
  129. dut1.expect('Loaded app from partition at offset 0x110000', timeout=60)
  130. dut1.expect('Starting OTA example', timeout=30)
  131. @ttfw_idf.idf_example_test(env_tag='Example_EthKitV1')
  132. def test_examples_protocol_simple_ota_example_ethernet_with_spiram_config(env, extra_data):
  133. """
  134. steps: |
  135. 1. join AP
  136. 2. Fetch OTA image over HTTPS
  137. 3. Reboot with the new OTA image
  138. """
  139. dut1 = env.get_dut('simple_ota_example', 'examples/system/ota/simple_ota_example', dut_class=ttfw_idf.ESP32DUT, app_config_name='spiram')
  140. # check and log bin size
  141. binary_file = os.path.join(dut1.app.binary_path, 'simple_ota.bin')
  142. bin_size = os.path.getsize(binary_file)
  143. ttfw_idf.log_performance('simple_ota_bin_size', '{}KB'.format(bin_size // 1024))
  144. # start test
  145. host_ip = get_my_ip()
  146. thread1 = Thread(target=start_https_server, args=(dut1.app.binary_path, host_ip, 8000))
  147. thread1.daemon = True
  148. thread1.start()
  149. dut1.start_app()
  150. dut1.expect('Loaded app from partition at offset 0x10000', timeout=30)
  151. try:
  152. ip_address = dut1.expect(re.compile(r' eth ip: ([^,]+),'), timeout=30)
  153. print('Connected to AP with IP: {}'.format(ip_address))
  154. except DUT.ExpectTimeout:
  155. raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP')
  156. dut1.expect('Starting OTA example', timeout=30)
  157. print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))
  158. dut1.write('https://' + host_ip + ':8000/simple_ota.bin')
  159. dut1.expect('Loaded app from partition at offset 0x110000', timeout=60)
  160. dut1.expect('Starting OTA example', timeout=30)
  161. @ttfw_idf.idf_example_test(env_tag='Example_Flash_Encryption_OTA')
  162. def test_examples_protocol_simple_ota_example_with_flash_encryption(env, extra_data):
  163. """
  164. steps: |
  165. 1. join AP
  166. 2. Fetch OTA image over HTTPS
  167. 3. Reboot with the new OTA image
  168. """
  169. dut1 = env.get_dut('simple_ota_example', 'examples/system/ota/simple_ota_example', dut_class=ttfw_idf.ESP32DUT, app_config_name='flash_enc')
  170. # check and log bin size
  171. binary_file = os.path.join(dut1.app.binary_path, 'simple_ota.bin')
  172. bin_size = os.path.getsize(binary_file)
  173. ttfw_idf.log_performance('simple_ota_bin_size', '{}KB'.format(bin_size // 1024))
  174. # erase flash on the device
  175. print('Erasing the flash in order to have an empty NVS key partiton')
  176. dut1.erase_flash()
  177. # start test
  178. host_ip = get_my_ip()
  179. thread1 = Thread(target=start_https_server, args=(dut1.app.binary_path, host_ip, 8000))
  180. thread1.daemon = True
  181. thread1.start()
  182. dut1.start_app()
  183. dut1.expect('Loaded app from partition at offset 0x20000', timeout=30)
  184. dut1.expect('Flash encryption mode is DEVELOPMENT (not secure)', timeout=10)
  185. try:
  186. ip_address = dut1.expect(re.compile(r' eth ip: ([^,]+),'), timeout=30)
  187. print('Connected to AP with IP: {}'.format(ip_address))
  188. except DUT.ExpectTimeout:
  189. raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP')
  190. dut1.expect('Starting OTA example', timeout=30)
  191. print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))
  192. dut1.write('https://' + host_ip + ':8000/simple_ota.bin')
  193. dut1.expect('Loaded app from partition at offset 0x120000', timeout=60)
  194. dut1.expect('Flash encryption mode is DEVELOPMENT (not secure)', timeout=10)
  195. dut1.expect('Starting OTA example', timeout=30)
  196. @ttfw_idf.idf_example_test(env_tag='Example_Flash_Encryption_OTA_WiFi', target=['esp32c3'])
  197. def test_examples_protocol_simple_ota_example_with_flash_encryption_wifi(env, extra_data):
  198. """
  199. steps: |
  200. 1. join AP
  201. 2. Fetch OTA image over HTTPS
  202. 3. Reboot with the new OTA image
  203. """
  204. dut1 = env.get_dut('simple_ota_example', 'examples/system/ota/simple_ota_example', app_config_name='flash_enc_wifi')
  205. # check and log bin size
  206. binary_file = os.path.join(dut1.app.binary_path, 'simple_ota.bin')
  207. bin_size = os.path.getsize(binary_file)
  208. ttfw_idf.log_performance('simple_ota_bin_size', '{}KB'.format(bin_size // 1024))
  209. # erase flash on the device
  210. print('Erasing the flash in order to have an empty NVS key partiton')
  211. dut1.erase_flash()
  212. # start test
  213. host_ip = get_my_ip()
  214. thread1 = Thread(target=start_https_server, args=(dut1.app.binary_path, host_ip, 8000))
  215. thread1.daemon = True
  216. thread1.start()
  217. dut1.start_app()
  218. dut1.expect('Loaded app from partition at offset 0x20000', timeout=30)
  219. dut1.expect('Flash encryption mode is DEVELOPMENT (not secure)', timeout=10)
  220. try:
  221. ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30)
  222. print('Connected to AP with IP: {}'.format(ip_address))
  223. except DUT.ExpectTimeout:
  224. raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP')
  225. dut1.expect('Starting OTA example', timeout=30)
  226. print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))
  227. dut1.write('https://' + host_ip + ':8000/simple_ota.bin')
  228. dut1.expect('Loaded app from partition at offset 0x120000', timeout=60)
  229. dut1.expect('Flash encryption mode is DEVELOPMENT (not secure)', timeout=10)
  230. dut1.expect('Starting OTA example', timeout=30)
  231. @ttfw_idf.idf_example_test(env_tag='Example_EthKitV1')
  232. def test_examples_protocol_simple_ota_example_with_verify_app_signature_on_update_no_secure_boot_ecdsa(env, extra_data):
  233. """
  234. steps: |
  235. 1. join AP
  236. 2. Fetch OTA image over HTTPS
  237. 3. Reboot with the new OTA image
  238. """
  239. dut1 = env.get_dut('simple_ota_example', 'examples/system/ota/simple_ota_example', dut_class=ttfw_idf.ESP32DUT,
  240. app_config_name='on_update_no_sb_ecdsa')
  241. # check and log bin size
  242. binary_file = os.path.join(dut1.app.binary_path, 'simple_ota.bin')
  243. bin_size = os.path.getsize(binary_file)
  244. ttfw_idf.log_performance('simple_ota_bin_size', '{}KB'.format(bin_size // 1024))
  245. sha256_bootloader, sha256_app = calc_all_sha256(dut1)
  246. # start test
  247. host_ip = get_my_ip()
  248. thread1 = Thread(target=start_https_server, args=(dut1.app.binary_path, host_ip, 8000))
  249. thread1.daemon = True
  250. thread1.start()
  251. dut1.start_app()
  252. dut1.expect('Loaded app from partition at offset 0x20000', timeout=30)
  253. check_sha256(sha256_bootloader, dut1.expect(re.compile(r'SHA-256 for bootloader:\s+([a-f0-9]+)'))[0])
  254. check_sha256(sha256_app, dut1.expect(re.compile(r'SHA-256 for current firmware:\s+([a-f0-9]+)'))[0])
  255. try:
  256. ip_address = dut1.expect(re.compile(r' eth ip: ([^,]+),'), timeout=30)
  257. print('Connected to AP with IP: {}'.format(ip_address))
  258. except DUT.ExpectTimeout:
  259. raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP')
  260. dut1.expect('Starting OTA example', timeout=30)
  261. print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))
  262. dut1.write('https://' + host_ip + ':8000/simple_ota.bin')
  263. dut1.expect('Writing to partition subtype 16 at offset 0x120000', timeout=20)
  264. dut1.expect('Verifying image signature...', timeout=60)
  265. dut1.expect('Loaded app from partition at offset 0x120000', timeout=20)
  266. dut1.expect('Starting OTA example', timeout=30)
  267. @ttfw_idf.idf_example_test(env_tag='Example_EthKitV12')
  268. def test_examples_protocol_simple_ota_example_with_verify_app_signature_on_update_no_secure_boot_rsa(env, extra_data):
  269. """
  270. steps: |
  271. 1. join AP
  272. 2. Fetch OTA image over HTTPS
  273. 3. Reboot with the new OTA image
  274. """
  275. dut1 = env.get_dut('simple_ota_example', 'examples/system/ota/simple_ota_example', dut_class=ttfw_idf.ESP32DUT,
  276. app_config_name='on_update_no_sb_rsa')
  277. # check and log bin size
  278. binary_file = os.path.join(dut1.app.binary_path, 'simple_ota.bin')
  279. bin_size = os.path.getsize(binary_file)
  280. ttfw_idf.log_performance('simple_ota_bin_size', '{}KB'.format(bin_size // 1024))
  281. sha256_bootloader, sha256_app = calc_all_sha256(dut1)
  282. # start test
  283. host_ip = get_my_ip()
  284. thread1 = Thread(target=start_https_server, args=(dut1.app.binary_path, host_ip, 8000))
  285. thread1.daemon = True
  286. thread1.start()
  287. dut1.start_app()
  288. dut1.expect('Loaded app from partition at offset 0x20000', timeout=30)
  289. check_sha256(sha256_bootloader, dut1.expect(re.compile(r'SHA-256 for bootloader:\s+([a-f0-9]+)'))[0])
  290. check_sha256(sha256_app, dut1.expect(re.compile(r'SHA-256 for current firmware:\s+([a-f0-9]+)'))[0])
  291. try:
  292. ip_address = dut1.expect(re.compile(r' eth ip: ([^,]+),'), timeout=30)
  293. print('Connected to AP with IP: {}'.format(ip_address))
  294. except DUT.ExpectTimeout:
  295. raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP')
  296. dut1.expect('Starting OTA example', timeout=30)
  297. print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))
  298. dut1.write('https://' + host_ip + ':8000/simple_ota.bin')
  299. dut1.expect('Writing to partition subtype 16 at offset 0x120000', timeout=20)
  300. dut1.expect('Verifying image signature...', timeout=60)
  301. dut1.expect('#0 app key digest == #0 trusted key digest', timeout=10)
  302. dut1.expect('Verifying with RSA-PSS...', timeout=10)
  303. dut1.expect('Signature verified successfully!', timeout=10)
  304. dut1.expect('Loaded app from partition at offset 0x120000', timeout=20)
  305. dut1.expect('Starting OTA example', timeout=30)
  306. if __name__ == '__main__':
  307. if sys.argv[2:]: # if two or more arguments provided:
  308. # Usage: example_test.py <image_dir> <server_port> [cert_di>]
  309. this_dir = os.path.dirname(os.path.realpath(__file__))
  310. bin_dir = os.path.join(this_dir, sys.argv[1])
  311. port = int(sys.argv[2])
  312. cert_dir = bin_dir if not sys.argv[3:] else os.path.join(this_dir, sys.argv[3]) # optional argument
  313. print('Starting HTTPS server at "https://:{}"'.format(port))
  314. start_https_server(bin_dir, '', port,
  315. server_file=os.path.join(cert_dir, 'ca_cert.pem'),
  316. key_file=os.path.join(cert_dir, 'ca_key.pem'))
  317. else:
  318. test_examples_protocol_simple_ota_example()
  319. test_examples_protocol_simple_ota_example_ethernet_with_spiram_config()
  320. test_examples_protocol_simple_ota_example_with_flash_encryption()
  321. test_examples_protocol_simple_ota_example_with_flash_encryption_wifi()
  322. test_examples_protocol_simple_ota_example_with_verify_app_signature_on_update_no_secure_boot_ecdsa()
  323. test_examples_protocol_simple_ota_example_with_verify_app_signature_on_update_no_secure_boot_rsa()