Skip to content

Commit

Permalink
ringtest: support test specific parameters
Browse files Browse the repository at this point in the history
Add a new flag for passing test-specific parameters.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Michael S. Tsirkin committed May 9, 2017
1 parent fb9de97 commit a497950
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tools/virtio/ringtest/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
int runcycles = 10000000;
int max_outstanding = INT_MAX;
int batch = 1;
int param = 0;

bool do_sleep = false;
bool do_relax = false;
Expand Down Expand Up @@ -246,6 +247,11 @@ static const struct option longopts[] = {
.has_arg = required_argument,
.val = 'b',
},
{
.name = "param",
.has_arg = required_argument,
.val = 'p',
},
{
.name = "sleep",
.has_arg = no_argument,
Expand Down Expand Up @@ -274,6 +280,7 @@ static void help(void)
" [--run-cycles C (default: %d)]"
" [--batch b]"
" [--outstanding o]"
" [--param p]"
" [--sleep]"
" [--relax]"
" [--exit]"
Expand Down Expand Up @@ -328,6 +335,12 @@ int main(int argc, char **argv)
assert(c > 0 && c < INT_MAX);
max_outstanding = c;
break;
case 'p':
c = strtol(optarg, &endptr, 0);
assert(!*endptr);
assert(c > 0 && c < INT_MAX);
param = c;
break;
case 'b':
c = strtol(optarg, &endptr, 0);
assert(!*endptr);
Expand Down
2 changes: 2 additions & 0 deletions tools/virtio/ringtest/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include <stdbool.h>

extern int param;

extern bool do_exit;

#if defined(__x86_64__) || defined(__i386__)
Expand Down

0 comments on commit a497950

Please sign in to comment.