-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scripts: twister: Add more Status assignment guards #82631
base: main
Are you sure you want to change the base?
scripts: twister: Add more Status assignment guards #82631
Conversation
d9204f8
to
bce5d6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #80866
sorry, but I don't see how this PR fixes #80866 still terminating Twister execution abruptly with a general exception.
What I've got trying this PR:
1
ERROR - General exception: Attempted access to nonexistent TwisterStatus.PASA. Please verify the status list.
ERROR - Process 13783 failed, aborting execution
diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py
index 1c9cc2f4f82..8d44a8a6ec6 100644
--- a/scripts/pylib/twister/twisterlib/runner.py
+++ b/scripts/pylib/twister/twisterlib/runner.py
@@ -1017,6 +1017,10 @@ class ProjectBuilder(FilterBuilder):
elif op == "build":
try:
logger.debug(f"build test: {self.instance.name}")
+
+ self.instance.status = TwisterStatus.PASA
+
ret = self.build()
if not ret:
self.instance.status = TwisterStatus.ERROR
2
ERROR - General exception: 'pass'
ERROR - Process 13947 failed, aborting execution
diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py
index 1c9cc2f4f82..0d9faedf130 100644
--- a/scripts/pylib/twister/twisterlib/runner.py
+++ b/scripts/pylib/twister/twisterlib/runner.py
@@ -1017,6 +1017,9 @@ class ProjectBuilder(FilterBuilder):
elif op == "build":
try:
logger.debug(f"build test: {self.instance.name}")
+
+ self.instance.status = TwisterStatus['pass']
+
ret = self.build()
if not ret:
self.instance.status = TwisterStatus.ERROR
3
ERROR - General exception: Attempted initialisation of status "pass", which could not be cast to a TwisterStatus.
ERROR - Process 14106 failed, aborting execution
diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py
index 1c9cc2f4f82..b3038706f0a 100644
--- a/scripts/pylib/twister/twisterlib/runner.py
+++ b/scripts/pylib/twister/twisterlib/runner.py
@@ -1017,6 +1017,9 @@ class ProjectBuilder(FilterBuilder):
elif op == "build":
try:
logger.debug(f"build test: {self.instance.name}")
+
+ self.instance.status = TwisterStatus('pass')
+
ret = self.build()
if not ret:
self.instance.status = TwisterStatus.ERROR
I didn't get General Exceptions during my testing, but the specific Errors. I'll need to investigate. How are you launching the code? Via |
bce5d6a
to
62fe985
Compare
Interesting case. |
a6780ae
to
90672b3
Compare
TwisterStatus now should not crash on wrong assignments of type: TwisterStatus.NONEXISTENT_STATUS, TwisterStatus['NONEXISTENT_STATUS'], and TwisterStatus('NONEXISTENT_STATUS') and instead fail the current test and go on. Added three new Exception types. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
90672b3
to
2fb0615
Compare
TwisterStatus now should not crash on wrong assignments of type: TwisterStatus.NONEXISTENT_STATUS and
TwisterStatus('NONEXISTENT_STATUS') and instead fail the current test and go on.
Two new errors were created in order to give users more information.
Fixes #80866
Further comparison:
Case 1 -
self.instance.status = "PASA"
Previously:
Now:
The same as above.
Case 2 -
self.instance.status = TwisterStatus.PASA
Previously:
Now:
Case 3 -
self.instance.status = TwisterStatus('pass')
Previously:
Now: