CI: Fix partition table detection if "partition" is in the project name
This commit is contained in:
parent
a41bcacf31
commit
f5645cc9d8
1 changed files with 27 additions and 10 deletions
|
@ -15,8 +15,9 @@
|
||||||
""" IDF Test Applications """
|
""" IDF Test Applications """
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from tiny_test_fw import App
|
from tiny_test_fw import App
|
||||||
from . import CIAssignExampleTest
|
from . import CIAssignExampleTest
|
||||||
|
@ -266,20 +267,36 @@ class IDFApp(App.BaseApp):
|
||||||
"gen_esp32part.py")
|
"gen_esp32part.py")
|
||||||
assert os.path.exists(partition_tool)
|
assert os.path.exists(partition_tool)
|
||||||
|
|
||||||
for (_, path) in self.flash_files:
|
errors = []
|
||||||
if "partition" in path:
|
# self.flash_files is sorted based on offset in order to have a consistent result with different versions of
|
||||||
|
# Python
|
||||||
|
for (_, path) in sorted(self.flash_files, key=lambda elem: elem[0]):
|
||||||
|
if 'partition' in os.path.split(path)[1]:
|
||||||
partition_file = os.path.join(self.binary_path, path)
|
partition_file = os.path.join(self.binary_path, path)
|
||||||
|
|
||||||
|
process = subprocess.Popen([sys.executable, partition_tool, partition_file],
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
(raw_data, raw_error) = process.communicate()
|
||||||
|
if isinstance(raw_error, bytes):
|
||||||
|
raw_error = raw_error.decode()
|
||||||
|
if 'Traceback' in raw_error:
|
||||||
|
# Some exception occured. It is possible that we've tried the wrong binary file.
|
||||||
|
errors.append((path, raw_error))
|
||||||
|
continue
|
||||||
|
|
||||||
|
if isinstance(raw_data, bytes):
|
||||||
|
raw_data = raw_data.decode()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise ValueError("No partition table found for IDF binary path: {}".format(self.binary_path))
|
traceback_msg = os.linesep.join(['{} {}:{}{}'.format(partition_tool,
|
||||||
|
p,
|
||||||
|
os.linesep,
|
||||||
|
msg) for p, msg in errors])
|
||||||
|
raise ValueError("No partition table found for IDF binary path: {}{}{}".format(self.binary_path,
|
||||||
|
os.linesep,
|
||||||
|
traceback_msg))
|
||||||
|
|
||||||
process = subprocess.Popen(["python", partition_tool, partition_file],
|
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
||||||
raw_data = process.stdout.read()
|
|
||||||
if isinstance(raw_data, bytes):
|
|
||||||
raw_data = raw_data.decode()
|
|
||||||
partition_table = dict()
|
partition_table = dict()
|
||||||
|
|
||||||
for line in raw_data.splitlines():
|
for line in raw_data.splitlines():
|
||||||
if line[0] != "#":
|
if line[0] != "#":
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue