Commit 81a1e9d6 authored by Anas Nashif's avatar Anas Nashif Committed by Carles Cufi
Browse files

twister: marked tests causing timeout as fail



When a test start, mark it as such, if we do not get any results due to
a timeout, it will be finally marked as failed. Previously such tests
causing a freeze were marked as blocked (or not run), which is not
exactly right.

Signed-off-by: default avatarAnas Nashif <anas.nashif@intel.com>
parent 65b483bd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -633,7 +633,7 @@ class DeviceHandler(Handler):
            self.instance.status = "failed"
            self.instance.reason = "Timeout"

        if self.instance.status == "error":
        if self.instance.status in ["error", "failed"]:
            self.instance.add_missing_case_status("blocked", self.instance.reason)

        if not flash_error:
+10 −2
Original line number Diff line number Diff line
@@ -268,6 +268,14 @@ class Test(Harness):
            self.detected_suite_names.append(suite_name)

        testcase_match = re.search(self.ZTEST_START_PATTERN, line)
        if testcase_match:
            name = "{}.{}".format(self.id, testcase_match.group(2))
            tc = self.instance.get_case_or_create(name)
            # Mark the test as started, if something happens here, it is mostly
            # due to this tests, for example timeout. This should in this case
            # be marked as failed and not blocked (not run).
            tc.status = "started"

        if testcase_match or self._match:
            self.testcase_output += line + "\n"
            self._match = True
@@ -275,10 +283,9 @@ class Test(Harness):
        result_match = result_re.match(line)

        if result_match and result_match.group(2):
            matched_status = result_match.group(1)
            name = "{}.{}".format(self.id, result_match.group(3))
            tc = self.instance.get_case_or_create(name)

            matched_status = result_match.group(1)
            tc.status = self.ztest_to_status[matched_status]
            if tc.status == "skipped":
                tc.reason = "ztest skip"
@@ -292,6 +299,7 @@ class Test(Harness):
        self.process_test(line)

        if not self.ztest and self.state:
            logger.debug(f"not a ztest and no state for  {self.id}")
            tc = self.instance.get_case_or_create(self.id)
            if self.state == "passed":
                tc.status = "passed"
+3 −1
Original line number Diff line number Diff line
@@ -73,7 +73,9 @@ class TestInstance:

    def add_missing_case_status(self, status, reason=None):
        for case in self.testcases:
            if not case.status:
            if case.status == 'started':
                case.status = "failed"
            elif not case.status:
                case.status = status
                if reason:
                    case.reason = reason