Skip to content
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

usr.sbin/pmcstat: return non-zero if the launched command fails #1508

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

arichardson
Copy link
Member

Previously pmcstat would return a success return code even if the process that it launched crashed or returned a failure code. Returning a non-zero exit code means that we can more easily detect if a benchmark did not run as expected even when running it under pmcstat.

While it might make sense to propagate the exit code/signal via pmcstat, simply returning 1 if the child process fails should be sufficient.

Previously pmcstat would return a success return code even if the process
that it launched crashed or returned a failure code. Returning a non-zero
exit code means that we can more easily detect if a benchmark did not
run as expected even when running it under pmcstat.

While it might make sense to propagate the exit code/signal via pmcstat,
simply returning 1 if the child process fails should be sufficient.
@arichardson
Copy link
Member Author

If you think this looks reasonable, I'll also send this for review upstream.

Use calloc().

Walk the class list we get from kernel, so we will not add something
the kernel does not know about.

Avoid picking headers from /usr/include.

Differential Revision:	https://reviews.freebsd.org/D36401

(cherry picked from commit 1f56795)
@@ -1516,5 +1520,5 @@ main(int argc, char **argv)
);
}

exit(EX_OK);
exit(exitcode);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pmcstat(1) already uses <sysexits.h> values in various other places, so using EXIT_* is not consistent. I can see arguments for both behaviors here as you might be profiling a failing command on purpose and the profiling didn't fail, just the executed command (which is what the current behavior tailors towards). The other error returns in pmcstat (of which they are many) all deal with the profiling failing, not the status of the child process. Arguably in our use case of SPEC we should really be running the tests without pmcstat initially to validate that they succeed (including validating output if necessary, not just if it cores) before trying to run them under pmcstat.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think propagating the error would be nice - how about EX_OSERR? I'm not sure any of the sysexits really match, that one just seemed somewhat appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants