Commit 6b27cd84 authored by Rong Tao's avatar Rong Tao Committed by Michael S. Tsirkin

tools/virtio: virtio_test -h,--help should return directly

When we get help information, we should return directly, and we should not
execute test cases. Move the exit() directly into the help() function and
remove it from case '?'.
Signed-off-by: default avatarRong Tao <rongtao@cestc.cn>
Message-Id: <tencent_822CEBEB925205EA1573541CD1C2604F4805@qq.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 9b2b3de6
...@@ -327,7 +327,7 @@ const struct option longopts[] = { ...@@ -327,7 +327,7 @@ const struct option longopts[] = {
} }
}; };
static void help(void) static void help(int status)
{ {
fprintf(stderr, "Usage: virtio_test [--help]" fprintf(stderr, "Usage: virtio_test [--help]"
" [--no-indirect]" " [--no-indirect]"
...@@ -337,6 +337,8 @@ static void help(void) ...@@ -337,6 +337,8 @@ static void help(void)
" [--batch=random/N]" " [--batch=random/N]"
" [--reset=N]" " [--reset=N]"
"\n"); "\n");
exit(status);
} }
int main(int argc, char **argv) int main(int argc, char **argv)
...@@ -354,14 +356,12 @@ int main(int argc, char **argv) ...@@ -354,14 +356,12 @@ int main(int argc, char **argv)
case -1: case -1:
goto done; goto done;
case '?': case '?':
help(); help(2);
exit(2);
case 'e': case 'e':
features &= ~(1ULL << VIRTIO_RING_F_EVENT_IDX); features &= ~(1ULL << VIRTIO_RING_F_EVENT_IDX);
break; break;
case 'h': case 'h':
help(); help(0);
goto done;
case 'i': case 'i':
features &= ~(1ULL << VIRTIO_RING_F_INDIRECT_DESC); features &= ~(1ULL << VIRTIO_RING_F_INDIRECT_DESC);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment