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
Allow single test to be specified as an argument to run-nio-alloc-counter-tests.sh. #1214
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,25 +18,28 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
|
||
tmp_dir="/tmp" | ||
|
||
function die() { | ||
echo >&2 "ERROR: $*" | ||
exit 1 | ||
} | ||
|
||
while getopts "t:" opt; do | ||
case "$opt" in | ||
t) | ||
tmp_dir="$OPTARG" | ||
;; | ||
\?) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My thinking was most of the examples of With Compared to a list of flags and then a default I don't feel strongly about it though, happy to revert. |
||
die "unknown option $opt" | ||
*) | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
shift $((OPTIND-1)) | ||
|
||
tests_to_run=("$here"/test_*.swift) | ||
|
||
if [[ $# -gt 0 ]]; then | ||
tests_to_run=$@ | ||
fi | ||
|
||
"$here/../../allocation-counter-tests-framework/run-allocation-counter.sh" \ | ||
-p "$here/../../.." \ | ||
-m NIO -m NIOHTTP1 -m NIOWebSocket \ | ||
-s "$here/shared.swift" \ | ||
-t "$tmp_dir" \ | ||
"$here"/test_*.swift | ||
"${tests_to_run[@]}" |
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.
could we leave this in so we get better error messages?
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.
Yeah for sure. The reason I removed it is that it didn't seem like it was actually providing better error messages. For example, if you specify an unknown flag, you get the following output:
The
?
in this case is$opt
, which is always "?" because it doesn't know what the option is. All of the useful information is contained in the first line, which is the error message fromgetopts
.Removing the only call to
die
(and then thedie
function itself because it's no longer used) gives the following output, which seemed a bit cleaner and less confusing:Happy to revert back to the previous code if you prefer though!
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.
oh I see,
getopts
actually prints an error itself. I'm happy with that then.