From d0718e988cf8e92a11f93e936af13728123b6bce Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 5 Jun 2012 17:48:08 +0300 Subject: [PATCH] test/dump: allow to run manually Without the srcdir envvar (and a couple trivial changes). Signed-off-by: Ran Benita --- src/keymap-dump.c | 4 ++-- test/{ => data}/dump.data | 0 test/dump.c | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) rename test/{ => data}/dump.data (100%) diff --git a/src/keymap-dump.c b/src/keymap-dump.c index f80e354..4fafde5 100644 --- a/src/keymap-dump.c +++ b/src/keymap-dump.c @@ -98,8 +98,8 @@ do { \ /* If it was truncated, embiggen the string and roll from the top. */ \ if (!do_realloc(buf, size, *offset, _printed)) { \ fprintf(stderr, \ - "xkbcommon: failed to allocate %lu bytes for keymap\n", \ - (unsigned long) *size); \ + "xkbcommon: failed to allocate %zu bytes for keymap\n", \ + *size); \ free(*buf); \ *buf = NULL; \ _ret = false; \ diff --git a/test/dump.data b/test/data/dump.data similarity index 100% rename from test/dump.data rename to test/data/dump.data diff --git a/test/dump.c b/test/dump.c index 16d1768..abb9f0a 100644 --- a/test/dump.c +++ b/test/dump.c @@ -52,8 +52,8 @@ int main(int argc, char *argv[]) char *path; int fd; - assert(srcdir); - assert(asprintf(&path, "%s/test/dump.data", srcdir) != -1); + srcdir = srcdir ? srcdir : "."; + assert(asprintf(&path, "%s/test/data/dump.data", srcdir) != -1); fd = open(path, O_RDONLY); assert(fd >= 0); assert(stat(path, &stat_buf) == 0); @@ -72,9 +72,8 @@ int main(int argc, char *argv[]) if (strcmp(as_string, expected) != 0) { printf("dumped map differs from expected!\n\n"); - printf("length: got %lu, expected %lu\n", - (unsigned long) strlen(as_string), - (unsigned long) strlen(expected)); + printf("length: got %zu, expected %zu\n", + strlen(as_string), strlen(expected)); printf("result:\n%s\n", as_string); assert(0); } -- 2.7.4