-
Notifications
You must be signed in to change notification settings - Fork 1.1k
added error when executable crashes #30341
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
base: next
Are you sure you want to change the base?
Conversation
Job Documentation, step Docs: sync website on e3eaf0b wanted to post the following: View the site here This comment will be updated on new commits. |
Job Coverage, step Generate coverage on e3eaf0b wanted to post the following: Framework coverage
Modules coverageCoverage did not change Full coverage reportsReports
This comment will be updated on new commits. |
python/TestHarness/util.py
Outdated
try: | ||
output = runCommand("%s --show-capabilities" % exe) | ||
except: | ||
print("Error! Executable crashed.") | ||
exit(1) | ||
|
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.
You could put this try
/catch
into runCommand
...
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.
I didn't know how to put a try catch on subprocess.Popen, I don't think it fails.
def runCommand(cmd, cwd=None):
# On Windows it is not allowed to close fds while redirecting output
should_close = platform.system() != "Windows"
p = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=should_close, shell=True)
output = p.communicate()[0].decode('utf-8')
if (p.returncode != 0):
output = 'ERROR: ' + output
return output
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.
I'm assuming what fails is the communicate()
. Something must be throwing the exception in there, otherwise there'd be nothing to catch in getCapabilities...
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.
I was wrong, I wasn't catching the exception. I pasted in the error messages below. I added some extra output to the exception that has always been raised.
This is was the old error message I got when the executable segfaults with --show-capabilities
With this change it will show any errors the executable might have produced and the exception:
I think this would have helped me find my error. |
7ad2b12
to
61de797
Compare
Job Python 3.11 on 61de797 : invalidated by @lynnmunday |
Job Modules parallel on 61de797 : invalidated by @lynnmunday navierstokes distributed failed |
Job Coverage, step Verify coverage on 61de797 wanted to post the following: The following coverage requirement(s) failed:
|
1 similar comment
Job Coverage, step Verify coverage on 61de797 wanted to post the following: The following coverage requirement(s) failed:
|
@dschwen Will you review and merge? |
The latest commit will only show:
|
61de797
to
e3eaf0b
Compare
if output.startswith("ERROR"): | ||
print("Error! Executable crashed running --show-capbilities.") | ||
exit(1) |
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.
No, that's not right. You might get a crash without the ERROR
string.
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.
This is right, you get an ERROR whenever the executable crashes.
line 226 appends ERROR when the executable crashes.
p = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=should_close, shell=True)
output = p.communicate()[0].decode('utf-8')
if (p.returncode != 0):
output = 'ERROR: ' + output
I can't change the code in the runCommand function because its called by the testHarness and shouldn't exit if it segfaults, it should return an ERROR.
closes #30340