aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/vsock/control.c
diff options
context:
space:
mode:
authorStefano Garzarella <sgarzare@redhat.com>2019-12-18 19:07:06 +0100
committerDavid S. Miller <davem@davemloft.net>2019-12-20 21:09:21 -0800
commit5a2b2425634dd8d340d3889f2317a752a1a87618 (patch)
tree3378d547e04b073903a9283e317347f6d46ce0f2 /tools/testing/vsock/control.c
parentvsock_test: wait for the remote to close the connection (diff)
downloadlinux-dev-5a2b2425634dd8d340d3889f2317a752a1a87618.tar.xz
linux-dev-5a2b2425634dd8d340d3889f2317a752a1a87618.zip
testing/vsock: add parameters to list and skip tests
Some tests can fail with transports that have a slightly different behavior, so let's add the possibility to specify which tests to skip. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/vsock/control.c')
-rw-r--r--tools/testing/vsock/control.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/testing/vsock/control.c b/tools/testing/vsock/control.c
index 45f328c6ff23..4874872fc5a3 100644
--- a/tools/testing/vsock/control.c
+++ b/tools/testing/vsock/control.c
@@ -205,11 +205,22 @@ void control_expectln(const char *str)
char *line;
line = control_readln();
- if (strcmp(str, line) != 0) {
+
+ control_cmpln(line, str, true);
+
+ free(line);
+}
+
+bool control_cmpln(char *line, const char *str, bool fail)
+{
+ if (strcmp(str, line) == 0)
+ return true;
+
+ if (fail) {
fprintf(stderr, "expected \"%s\" on control socket, got \"%s\"\n",
str, line);
exit(EXIT_FAILURE);
}
- free(line);
+ return false;
}