Netdev List
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: netdev@vger.kernel.org
Cc: Jorgen Hansen <jhansen@vmware.com>,
	Dexuan Cui <decui@microsoft.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH 3/5] VSOCK: add full barrier between test cases
Date: Wed, 13 Dec 2017 14:49:09 +0000	[thread overview]
Message-ID: <20171213144911.6428-4-stefanha@redhat.com> (raw)
In-Reply-To: <20171213144911.6428-1-stefanha@redhat.com>

See code comment for details.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 tools/testing/vsock/util.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/tools/testing/vsock/util.c b/tools/testing/vsock/util.c
index 75a78f295b37..2be923fe9922 100644
--- a/tools/testing/vsock/util.c
+++ b/tools/testing/vsock/util.c
@@ -165,10 +165,24 @@ void run_tests(const struct test_case *test_cases,
 		printf("%s...", test_cases[i].name);
 		fflush(stdout);
 
-		if (opts->mode == TEST_MODE_CLIENT)
+		if (opts->mode == TEST_MODE_CLIENT) {
+			/* Full barrier before executing the next test.  This
+			 * ensures that client and server are executing the
+			 * same test case.  In particular, it means whoever is
+			 * faster will not see the peer still executing the
+			 * last test.  This is important because port numbers
+			 * can be used by multiple test cases.
+			 */
+			control_expectln("NEXT");
+			control_writeln("NEXT");
+
 			run = test_cases[i].run_client;
-		else
+		} else {
+			control_writeln("NEXT");
+			control_expectln("NEXT");
+
 			run = test_cases[i].run_server;
+		}
 
 		if (run)
 			run(opts);
-- 
2.14.3

  parent reply	other threads:[~2017-12-13 14:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-13 14:49 [PATCH 0/5] VSOCK: add vsock_test test suite Stefan Hajnoczi
2017-12-13 14:49 ` [PATCH 1/5] VSOCK: extract utility functions from vsock_diag_test.c Stefan Hajnoczi
2017-12-13 14:49 ` [PATCH 2/5] VSOCK: extract connect/accept " Stefan Hajnoczi
2017-12-13 21:32   ` David Miller
2017-12-14  9:49     ` Stefan Hajnoczi
2017-12-13 14:49 ` Stefan Hajnoczi [this message]
2017-12-13 14:49 ` [PATCH 4/5] VSOCK: add send_byte()/recv_byte() test utilities Stefan Hajnoczi
2017-12-13 14:49 ` [PATCH 5/5] VSOCK: add AF_VSOCK test cases Stefan Hajnoczi
2017-12-20 14:48 ` [PATCH 0/5] VSOCK: add vsock_test test suite Jorgen S. Hansen
2018-01-02 12:05   ` Stefan Hajnoczi
2018-01-03 16:09     ` Jorgen S. Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171213144911.6428-4-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=decui@microsoft.com \
    --cc=jhansen@vmware.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox