diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/common.c | 2 | ||||
-rw-r--r-- | test/log.c | 22 | ||||
-rw-r--r-- | test/rulescomp.c | 6 |
3 files changed, 17 insertions, 13 deletions
diff --git a/test/common.c b/test/common.c index 2d49824..351276e 100644 --- a/test/common.c +++ b/test/common.c @@ -101,7 +101,7 @@ test_get_context(void) xkb_context_include_path_append(ctx, test_get_path("")); - xkb_set_log_priority(ctx, XKB_LOG_LEVEL_DEBUG); + xkb_set_log_level(ctx, XKB_LOG_LEVEL_DEBUG); xkb_set_log_verbosity(ctx, 101); return ctx; @@ -32,9 +32,11 @@ #pragma GCC diagnostic ignored "-Wmissing-format-attribute" static const char * -priority_to_string(int priority) +log_level_to_string(enum xkb_log_level level) { - switch (priority) { + switch (level) { + case XKB_LOG_LEVEL_CRITICAL: + return "critical"; case XKB_LOG_LEVEL_ERROR: return "error"; case XKB_LOG_LEVEL_WARNING: @@ -49,7 +51,8 @@ priority_to_string(int priority) } ATTR_PRINTF(3, 0) static void -log_fn(struct xkb_context *ctx, int priority, const char *fmt, va_list args) +log_fn(struct xkb_context *ctx, enum xkb_log_level level, + const char *fmt, va_list args) { char *s; int size; @@ -59,7 +62,7 @@ log_fn(struct xkb_context *ctx, int priority, const char *fmt, va_list args) size = vasprintf(&s, fmt, args); assert(size != -1); - darray_append_string(*ls, priority_to_string(priority)); + darray_append_string(*ls, log_level_to_string(level)); darray_append_lit(*ls, ": "); darray_append_string(*ls, s); free(s); @@ -73,6 +76,7 @@ main(void) int ret; ret = setenv("XKB_LOG", "warn", 1); + assert(ret == 0); ret = setenv("XKB_VERBOSITY", "5", 1); assert(ret == 0); ctx = xkb_context_new(0); @@ -86,22 +90,22 @@ main(void) log_info(ctx, "first info\n"); log_dbg(ctx, "first debug: %s\n", "hello"); log_err(ctx, "first error: %lu\n", 115415UL); - log_lvl(ctx, 5, "first verbose 5\n"); + log_vrb(ctx, 5, "first verbose 5\n"); - xkb_set_log_priority(ctx, XKB_LOG_LEVEL_DEBUG); + xkb_set_log_level(ctx, XKB_LOG_LEVEL_DEBUG); log_warn(ctx, "second warning: %d\n", 87); log_dbg(ctx, "second debug: %s %s\n", "hello", "world"); log_info(ctx, "second info\n"); log_err(ctx, "second error: %lu\n", 115415UL); - log_lvl(ctx, 6, "second verbose 6\n"); + log_vrb(ctx, 6, "second verbose 6\n"); xkb_set_log_verbosity(ctx, 0); - xkb_set_log_priority(ctx, XKB_LOG_LEVEL_CRITICAL); + xkb_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL); log_warn(ctx, "third warning: %d\n", 87); log_dbg(ctx, "third debug: %s %s\n", "hello", "world"); log_info(ctx, "third info\n"); log_err(ctx, "third error: %lu\n", 115415UL); - log_lvl(ctx, 0, "third verbose 0\n"); + log_vrb(ctx, 0, "third verbose 0\n"); printf("%s", log_string.item); diff --git a/test/rulescomp.c b/test/rulescomp.c index fe17b8d..0d40761 100644 --- a/test/rulescomp.c +++ b/test/rulescomp.c @@ -70,11 +70,11 @@ static void benchmark(struct xkb_context *context) { struct timespec start, stop, elapsed; - enum xkb_log_level old_prio = xkb_get_log_priority(context); + enum xkb_log_level old_level = xkb_get_log_level(context); int old_verb = xkb_get_log_verbosity(context); int i; - xkb_set_log_priority(context, XKB_LOG_LEVEL_CRITICAL); + xkb_set_log_level(context, XKB_LOG_LEVEL_CRITICAL); xkb_set_log_verbosity(context, 0); clock_gettime(CLOCK_MONOTONIC, &start); @@ -82,7 +82,7 @@ benchmark(struct xkb_context *context) assert(test_rmlvo_silent(context, "evdev", "evdev", "us", "", "")); clock_gettime(CLOCK_MONOTONIC, &stop); - xkb_set_log_priority(context, old_prio); + xkb_set_log_level(context, old_level); xkb_set_log_verbosity(context, old_verb); elapsed.tv_sec = stop.tv_sec - start.tv_sec; |