ringtest: support test specific parameters
authorMichael S. Tsirkin <mst@redhat.com>
Fri, 7 Apr 2017 05:44:23 +0000 (08:44 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 9 May 2017 13:43:23 +0000 (16:43 +0300)
Add a new flag for passing test-specific parameters.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
tools/virtio/ringtest/main.c
tools/virtio/ringtest/main.h

index 2801ab7547e228a0a0bfd6b88febcc82fe62ce61..453ca3c211933d12a5b7933852043f7154434fe6 100644 (file)
@@ -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;
@@ -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,
@@ -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);
index 14142faf040b7e81a1c38a983aa76d9ae50ee4e1..90b0133004e17ddbc48b90a9eab2e6a489da13b0 100644 (file)
@@ -10,6 +10,8 @@
 
 #include <stdbool.h>
 
+extern int param;
+
 extern bool do_exit;
 
 #if defined(__x86_64__) || defined(__i386__)