summaryrefslogtreecommitdiffstats
path: root/tools/testing/vsock/util.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2019-12-18 19:07:02 +0100
committerDavid S. Miller <davem@davemloft.net>2019-12-21 06:09:21 +0100
commit2f65b44e199c6521be8dbc7458250c74a86ce2aa (patch)
treead5f4de841816b69a84d540e0376507b91c984ce /tools/testing/vsock/util.c
parentVSOCK: extract connect/accept functions from vsock_diag_test.c (diff)
downloadlinux-2f65b44e199c6521be8dbc7458250c74a86ce2aa.tar.xz
linux-2f65b44e199c6521be8dbc7458250c74a86ce2aa.zip
VSOCK: add full barrier between test cases
See code comment for details. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/vsock/util.c')
-rw-r--r--tools/testing/vsock/util.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/testing/vsock/util.c b/tools/testing/vsock/util.c
index f838bcee3589..4280a56ba677 100644
--- a/tools/testing/vsock/util.c
+++ b/tools/testing/vsock/util.c
@@ -161,10 +161,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);