summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author Alice Ryhl <aliceryhl@google.com> 2024-01-09 10:07:29 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-01-09 10:07:29 +0000
commitffb9779721cc5418b4df0dc8ac527f3227b35b6b (patch)
tree03da636434be7903755e7809ce876c8b7cc7d5d0 /libs
parent8d3b50ebb5a527f89cff0aca655c03cff62f5268 (diff)
parentb39f05a60c4bd0fa3f71999dc259128eeb19fc08 (diff)
Merge "binderThroughputTest: fail when flag is missing argument" into main
Diffstat (limited to 'libs')
-rw-r--r--libs/binder/tests/binderThroughputTest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/binder/tests/binderThroughputTest.cpp b/libs/binder/tests/binderThroughputTest.cpp
index e4c6fa406e..8f9929585f 100644
--- a/libs/binder/tests/binderThroughputTest.cpp
+++ b/libs/binder/tests/binderThroughputTest.cpp
@@ -352,16 +352,28 @@ int main(int argc, char *argv[])
return 0;
}
if (string(argv[i]) == "-w") {
+ if (i + 1 == argc) {
+ cout << "-w requires an argument\n" << endl;
+ exit(EXIT_FAILURE);
+ }
workers = atoi(argv[i+1]);
i++;
continue;
}
if (string(argv[i]) == "-i") {
+ if (i + 1 == argc) {
+ cout << "-i requires an argument\n" << endl;
+ exit(EXIT_FAILURE);
+ }
iterations = atoi(argv[i+1]);
i++;
continue;
}
if (string(argv[i]) == "-s") {
+ if (i + 1 == argc) {
+ cout << "-s requires an argument\n" << endl;
+ exit(EXIT_FAILURE);
+ }
payload_size = atoi(argv[i+1]);
i++;
continue;
@@ -380,6 +392,10 @@ int main(int argc, char *argv[])
continue;
}
if (string(argv[i]) == "-m") {
+ if (i + 1 == argc) {
+ cout << "-m requires an argument\n" << endl;
+ exit(EXIT_FAILURE);
+ }
// Caller specified the max latency in microseconds.
// No need to run training round in this case.
max_time_us = atoi(argv[i+1]);