summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2017-04-07 08:44:23 +0300
committerMichael S. Tsirkin <mst@redhat.com>2017-05-09 16:43:23 +0300
commita49795054a0b2034ac50a2a894864fdb353addb5 (patch)
tree7c38e5fac2f35d3d72978b91e13ab78f75438ed6
parentfb9de9704775d6190c204f4ddf8da4cfdac26be1 (diff)
ringtest: support test specific parameters
Add a new flag for passing test-specific parameters. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--tools/virtio/ringtest/main.c13
-rw-r--r--tools/virtio/ringtest/main.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/tools/virtio/ringtest/main.c b/tools/virtio/ringtest/main.c
index 2801ab7547e2..453ca3c21193 100644
--- a/tools/virtio/ringtest/main.c
+++ b/tools/virtio/ringtest/main.c
@@ -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;
@@ -247,6 +248,11 @@ static const struct option longopts[] = {
.val = 'b',
},
{
+ .name = "param",
+ .has_arg = required_argument,
+ .val = 'p',
+ },
+ {
.name = "sleep",
.has_arg = no_argument,
.val = 's',
@@ -274,6 +280,7 @@ static void help(void)
" [--run-cycles C (default: %d)]"
" [--batch b]"
" [--outstanding o]"
+ " [--param p]"
" [--sleep]"
" [--relax]"
" [--exit]"
@@ -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);
diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h
index 14142faf040b..90b0133004e1 100644
--- a/tools/virtio/ringtest/main.h
+++ b/tools/virtio/ringtest/main.h
@@ -10,6 +10,8 @@
#include <stdbool.h>
+extern int param;
+
extern bool do_exit;
#if defined(__x86_64__) || defined(__i386__)