summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2015-04-04 16:14:22 +0200
committerUli Schlachter <psychon@znc.in>2015-04-04 16:17:09 +0200
commit761079ac8af9be533852fd4011003dec628a97e6 (patch)
tree21ffac2ca6ee96608ed8bf9a9274de6604963fbb
parent4ed12c46dec9a3055e009c5ecd6cba5c258ce642 (diff)
Test: Skip tests if no X11 server is available
This was suggested by Ran Benita, thanks! Signed-off-by: Uli Schlachter <psychon@znc.in>
-rw-r--r--tests/test.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test.c b/tests/test.c
index 4e01a0e..fae85a1 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -28,6 +28,8 @@
#include <stdlib.h>
#include <string.h>
+#define SKIP 77
+
static int check_request(xcb_errors_context_t *ctx, uint8_t opcode, const char *expected)
{
const char *actual = xcb_errors_get_name_for_major_code(ctx, opcode);
@@ -105,7 +107,7 @@ static int test_randr(xcb_connection_t *c, xcb_errors_context_t *ctx)
if (!reply || !reply->present) {
fprintf(stderr, "RANDR not supported by display\n");
free(reply);
- return 1;
+ return SKIP;
}
err |= check_request(ctx, reply->major_opcode, "RandR");
@@ -134,7 +136,7 @@ static int test_valid_connection(void)
if (xcb_connection_has_error(c)) {
fprintf(stderr, "Failed to connect to X11 server (%d)\n",
xcb_connection_has_error(c));
- return 1;
+ return SKIP;
}
if (xcb_errors_context_new(c, &ctx) < 0) {
fprintf(stderr, "Failed to initialize util-errors\n");