Skip to content

Commit 2f65b44

Browse files
stefanhaRHdavem330
authored andcommitted
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>
1 parent 9bb8a29 commit 2f65b44

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

‎tools/testing/vsock/util.c‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,24 @@ void run_tests(const struct test_case *test_cases,
161161
printf("%s...", test_cases[i].name);
162162
fflush(stdout);
163163

164-
if (opts->mode == TEST_MODE_CLIENT)
164+
if (opts->mode == TEST_MODE_CLIENT) {
165+
/* Full barrier before executing the next test. This
166+
* ensures that client and server are executing the
167+
* same test case. In particular, it means whoever is
168+
* faster will not see the peer still executing the
169+
* last test. This is important because port numbers
170+
* can be used by multiple test cases.
171+
*/
172+
control_expectln("NEXT");
173+
control_writeln("NEXT");
174+
165175
run = test_cases[i].run_client;
166-
else
176+
} else {
177+
control_writeln("NEXT");
178+
control_expectln("NEXT");
179+
167180
run = test_cases[i].run_server;
181+
}
168182

169183
if (run)
170184
run(opts);

0 commit comments

Comments
 (0)