Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp55111ybi; Thu, 1 Aug 2019 14:31:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmWEZhj4O99IriMVekp1uB3MQtrMoLMXDeR10F447SQKswRG5bse4Wd14RMW6VLkTINbLz X-Received: by 2002:a65:5082:: with SMTP id r2mr94575874pgp.170.1564695072464; Thu, 01 Aug 2019 14:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564695072; cv=none; d=google.com; s=arc-20160816; b=ATRl6ZIjV1hLzHcH9PXOBhWy4wH/Uj0oR9mCCOJKSfNJKEXczvTZHZlGUQkvfXs+yO E66RRK9rLfsB4C3XoO3MVOoEw8ATrm1/4YB8eopjRtkJST3FiqJ6IRHyCKKzT5hBq7t8 rF+X+yZjM5E/fNTnqGXqsXCCsIShblEzHse3XEZ8mv3yaIvxfix6A+rUi4JNoMfWk7kY m6acrb3rqW9iEOkqj+2jn7llhn/voMQ5PjrSnaKvcNNNqfUmgcsrvACJYsGJql7uiGTo htTcPmos/5L/5kTm7EyMLQL0XXm2ZiAw3+lC06jwlq4KHsflTcQVJa0goKgOAN8bY0vi T8kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=SsMPAO+juNJGQtzL/NHbBMURlcjoFWfKFMZ63pkSdyo=; b=X0QTeLnDd9O9FoxrwLafj/HT0goXs5nr/zJs67MFMM+xx14jexk4kRO/Me1gFnSJiY IgaylT2JbLRWXbvdglHUx9KQ27429dYCtgH9zkjnAZlmQ+XRK0H0ARPYagL2gcpmkT2n nVC+vbMN8Gp79TlxPoV304mZ6xM1vwNRyuOyzss1Ietmrn+7MrVXRcc+ABBj1hscjUHj cNBSXq6wsg/aKlMkjWC+N5woHlQYyiVPF8uSTNfg33hMduLDU7DJ2gEyBEn5sDsD5I5e w3WV1JyeUlpfa5tQHZ5g5VF4yY9wL6YToQv2XdLpMo0ubD14K3kxXEpovRGV/ui5qcf+ P+vA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si35185128pgr.321.2019.08.01.14.30.54; Thu, 01 Aug 2019 14:31:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732732AbfHAP0Q (ORCPT + 99 others); Thu, 1 Aug 2019 11:26:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43856 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731484AbfHAP0O (ORCPT ); Thu, 1 Aug 2019 11:26:14 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6CC9514AFB8; Thu, 1 Aug 2019 15:26:14 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-117-63.ams2.redhat.com [10.36.117.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 794ED600D1; Thu, 1 Aug 2019 15:26:12 +0000 (UTC) From: Stefano Garzarella To: netdev@vger.kernel.org Cc: kvm@vger.kernel.org, Stefan Hajnoczi , Dexuan Cui , virtualization@lists.linux-foundation.org, "David S. Miller" , Jorgen Hansen , linux-kernel@vger.kernel.org Subject: [PATCH v2 09/11] vsock_test: add --transport parameter Date: Thu, 1 Aug 2019 17:25:39 +0200 Message-Id: <20190801152541.245833-10-sgarzare@redhat.com> In-Reply-To: <20190801152541.245833-1-sgarzare@redhat.com> References: <20190801152541.245833-1-sgarzare@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 01 Aug 2019 15:26:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add new --transport parameter to skip some tests or checks not supported by a specific transport. Suggested-by: Jorgen Hansen Signed-off-by: Stefano Garzarella --- tools/testing/vsock/util.h | 8 ++++++++ tools/testing/vsock/vsock_test.c | 20 +++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/testing/vsock/util.h b/tools/testing/vsock/util.h index 379e02ab59bb..7fdb8100f035 100644 --- a/tools/testing/vsock/util.h +++ b/tools/testing/vsock/util.h @@ -12,9 +12,17 @@ enum test_mode { TEST_MODE_SERVER }; +enum test_transport { + TEST_TRANSPORT_UNSET, + TEST_TRANSPORT_VMCI, + TEST_TRANSPORT_VIRTIO, + TEST_TRANSPORT_HYPERV +}; + /* Test runner options */ struct test_opts { enum test_mode mode; + enum test_transport transport; unsigned int peer_cid; }; diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c index 06099d037405..cb606091489f 100644 --- a/tools/testing/vsock/vsock_test.c +++ b/tools/testing/vsock/vsock_test.c @@ -218,6 +218,11 @@ static const struct option longopts[] = { .has_arg = required_argument, .val = 'p', }, + { + .name = "transport", + .has_arg = required_argument, + .val = 't', + }, { .name = "help", .has_arg = no_argument, @@ -228,7 +233,7 @@ static const struct option longopts[] = { static void usage(void) { - fprintf(stderr, "Usage: vsock_test [--help] [--control-host=] --control-port= --mode=client|server --peer-cid=\n" + fprintf(stderr, "Usage: vsock_test [--help] [--control-host=] --control-port= --mode=client|server --peer-cid= [--transport=vmci|virtio|hyperv]\n" "\n" " Server: vsock_test --control-port=1234 --mode=server --peer-cid=3\n" " Client: vsock_test --control-host=192.168.0.1 --control-port=1234 --mode=client --peer-cid=2\n" @@ -252,6 +257,7 @@ int main(int argc, char **argv) const char *control_port = NULL; struct test_opts opts = { .mode = TEST_MODE_UNSET, + .transport = TEST_TRANSPORT_UNSET, .peer_cid = VMADDR_CID_ANY, }; @@ -283,6 +289,18 @@ int main(int argc, char **argv) case 'P': control_port = optarg; break; + case 't': + if (strcmp(optarg, "vmci") == 0) + opts.transport = TEST_TRANSPORT_VMCI; + else if (strcmp(optarg, "virtio") == 0) + opts.transport = TEST_TRANSPORT_VIRTIO; + else if (strcmp(optarg, "hyperv") == 0) + opts.transport = TEST_TRANSPORT_HYPERV; + else { + fprintf(stderr, "--transport must be \"vmci\" or \"virtio\" or \"hyperv\"\n"); + return EXIT_FAILURE; + } + break; case '?': default: usage(); -- 2.20.1