simple_ota_example: Adds sha256 check for app images

This commit is contained in:
KonstantinKondrashov
2021-04-27 18:56:02 +08:00
parent ca481e18e1
commit 2e4b625f59
3 changed files with 91 additions and 1 deletions

View File

@@ -14,6 +14,7 @@
""" DUT for IDF applications """
import functools
import io
import os
import os.path
import re
@@ -309,6 +310,32 @@ class IDFDUT(DUT.SerialDUT):
else:
raise last_error
def image_info(self, path_to_file):
"""
get hash256 of app
:param: path: path to file
:return: sha256 appended to app
"""
old_stdout = sys.stdout
new_stdout = io.StringIO()
sys.stdout = new_stdout
class Args(object):
def __init__(self, attributes):
for key, value in attributes.items():
self.__setattr__(key, value)
args = Args({
'chip': self.TARGET,
'filename': path_to_file,
})
esptool.image_info(args)
output = new_stdout.getvalue()
sys.stdout = old_stdout
return output
@_uses_esptool
def reset(self, esp):
"""