Skip to content

Commit bcf4e23

Browse files
committed
twister: do not set case status on flash timeout
Status was set for testcases after a timeout on flash, which does not abort the process and continues with test execution and eventually passes the test. Setting status on the testcases was done too early and before we have executed the tests. Also increase the flash timeout to 60s. Fixes #45845 Signed-off-by: Anas Nashif <[email protected]>
1 parent eeffdc3 commit bcf4e23

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/pylib/twister/twisterlib.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ def handle(self):
915915
stdout = stderr = None
916916
with subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE) as proc:
917917
try:
918-
(stdout, stderr) = proc.communicate(timeout=30)
918+
(stdout, stderr) = proc.communicate(timeout=60)
919919
# ignore unencodable unicode chars
920920
logger.debug(stdout.decode(errors = "ignore"))
921921

@@ -926,6 +926,7 @@ def handle(self):
926926
dlog_fp.write(stderr.decode())
927927
os.write(write_pipe, b'x') # halt the thread
928928
except subprocess.TimeoutExpired:
929+
logger.warning("Flash operation timed out.")
929930
proc.kill()
930931
(stdout, stderr) = proc.communicate()
931932
self.instance.status = "error"
@@ -957,9 +958,6 @@ def handle(self):
957958

958959
handler_time = time.time() - start_time
959960

960-
if self.instance.status == "error":
961-
self.instance.add_missing_testscases("blocked", self.instance.reason)
962-
963961
if harness.is_pytest:
964962
harness.pytest_run(self.log)
965963

@@ -972,6 +970,9 @@ def handle(self):
972970
self.instance.status = "error"
973971
self.instance.reason = "No Console Output(Timeout)"
974972

973+
if self.instance.status == "error":
974+
self.instance.add_missing_testscases("blocked", self.instance.reason)
975+
975976
self._final_handle_actions(harness, handler_time)
976977

977978
if post_script:

0 commit comments

Comments
 (0)