Skip to content

Commit

Permalink
tests: Do not use "\n" in g_test_message() strings
Browse files Browse the repository at this point in the history
g_test_message() takes care of the newline on its own, so we
should not use \n in the strings here.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
  • Loading branch information
huth committed Mar 7, 2019
1 parent 142659b commit 13ee9e3
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 26 deletions.
4 changes: 2 additions & 2 deletions tests/ivshmem-test.c
Expand Up @@ -74,7 +74,7 @@ static inline unsigned in_reg(IVState *s, enum Reg reg)
unsigned res;

res = qpci_io_readl(s->dev, s->reg_bar, reg);
g_test_message("*%s -> %x\n", name, res);
g_test_message("*%s -> %x", name, res);

return res;
}
Expand All @@ -83,7 +83,7 @@ static inline void out_reg(IVState *s, enum Reg reg, unsigned v)
{
const char *name = reg2str(reg);

g_test_message("%x -> *%s\n", v, name);
g_test_message("%x -> *%s", v, name);
qpci_io_writel(s->dev, s->reg_bar, reg, v);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/m48t59-test.c
Expand Up @@ -199,9 +199,9 @@ static void bcd_check_time(void)
t = (long)mktime(datep);
s = (long)mktime(&start);
if (t < s) {
g_test_message("RTC is %ld second(s) behind wall-clock\n", (s - t));
g_test_message("RTC is %ld second(s) behind wall-clock", (s - t));
} else {
g_test_message("RTC is %ld second(s) ahead of wall-clock\n", (t - s));
g_test_message("RTC is %ld second(s) ahead of wall-clock", (t - s));
}

g_assert_cmpint(ABS(t - s), <=, wiggle);
Expand Down
4 changes: 2 additions & 2 deletions tests/migration-test.c
Expand Up @@ -1066,7 +1066,7 @@ int main(int argc, char **argv)

tmpfs = mkdtemp(template);
if (!tmpfs) {
g_test_message("mkdtemp on path (%s): %s\n", template, strerror(errno));
g_test_message("mkdtemp on path (%s): %s", template, strerror(errno));
}
g_assert(tmpfs);

Expand All @@ -1087,7 +1087,7 @@ int main(int argc, char **argv)

ret = rmdir(tmpfs);
if (ret != 0) {
g_test_message("unable to rmdir: path (%s): %s\n",
g_test_message("unable to rmdir: path (%s): %s",
tmpfs, strerror(errno));
}

Expand Down
4 changes: 2 additions & 2 deletions tests/rtc-test.c
Expand Up @@ -165,9 +165,9 @@ static void check_time(int wiggle)
t = (long)mktime(datep);
s = (long)mktime(&start);
if (t < s) {
g_test_message("RTC is %ld second(s) behind wall-clock\n", (s - t));
g_test_message("RTC is %ld second(s) behind wall-clock", (s - t));
} else {
g_test_message("RTC is %ld second(s) ahead of wall-clock\n", (t - s));
g_test_message("RTC is %ld second(s) ahead of wall-clock", (t - s));
}

g_assert_cmpint(ABS(t - s), <=, wiggle);
Expand Down
6 changes: 3 additions & 3 deletions tests/rtl8139-test.c
Expand Up @@ -46,12 +46,12 @@ static QPCIDevice *get_device(void)
static unsigned __attribute__((unused)) in_##name(void) \
{ \
unsigned res = qpci_io_read##len(dev, dev_bar, (val)); \
g_test_message("*%s -> %x\n", #name, res); \
g_test_message("*%s -> %x", #name, res); \
return res; \
} \
static void out_##name(unsigned v) \
{ \
g_test_message("%x -> *%s\n", v, #name); \
g_test_message("%x -> *%s", v, #name); \
qpci_io_write##len(dev, dev_bar, (val), v); \
}

Expand Down Expand Up @@ -176,7 +176,7 @@ static void test_timer(void)
}
}

g_test_message("Everythink is ok!\n");
g_test_message("Everythink is ok!");
}


Expand Down
8 changes: 4 additions & 4 deletions tests/test-aio-multithread.c
Expand Up @@ -178,7 +178,7 @@ static void test_multi_co_schedule(int seconds)
}

join_aio_contexts();
g_test_message("scheduled %d, queued %d, retry %d, total %d\n",
g_test_message("scheduled %d, queued %d, retry %d, total %d",
count_other, count_here, count_retry,
count_here + count_other + count_retry);
}
Expand Down Expand Up @@ -242,7 +242,7 @@ static void test_multi_co_mutex(int threads, int seconds)
}

join_aio_contexts();
g_test_message("%d iterations/second\n", counter / seconds);
g_test_message("%d iterations/second", counter / seconds);
g_assert_cmpint(counter, ==, atomic_counter);
}

Expand Down Expand Up @@ -361,7 +361,7 @@ static void test_multi_fair_mutex(int threads, int seconds)
}

join_aio_contexts();
g_test_message("%d iterations/second\n", counter / seconds);
g_test_message("%d iterations/second", counter / seconds);
g_assert_cmpint(counter, ==, atomic_counter);
}

Expand Down Expand Up @@ -417,7 +417,7 @@ static void test_multi_mutex(int threads, int seconds)
}

join_aio_contexts();
g_test_message("%d iterations/second\n", counter / seconds);
g_test_message("%d iterations/second", counter / seconds);
g_assert_cmpint(counter, ==, atomic_counter);
}

Expand Down
10 changes: 4 additions & 6 deletions tests/test-coroutine.c
Expand Up @@ -369,7 +369,7 @@ static void perf_lifecycle(void)
}
duration = g_test_timer_elapsed();

g_test_message("Lifecycle %u iterations: %f s\n", max, duration);
g_test_message("Lifecycle %u iterations: %f s", max, duration);
}

static void perf_nesting(void)
Expand All @@ -393,7 +393,7 @@ static void perf_nesting(void)
}
duration = g_test_timer_elapsed();

g_test_message("Nesting %u iterations of %u depth each: %f s\n",
g_test_message("Nesting %u iterations of %u depth each: %f s",
maxcycles, maxnesting, duration);
}

Expand Down Expand Up @@ -426,8 +426,7 @@ static void perf_yield(void)
}
duration = g_test_timer_elapsed();

g_test_message("Yield %u iterations: %f s\n",
maxcycles, duration);
g_test_message("Yield %u iterations: %f s", maxcycles, duration);
}

static __attribute__((noinline)) void dummy(unsigned *i)
Expand All @@ -449,8 +448,7 @@ static void perf_baseline(void)
}
duration = g_test_timer_elapsed();

g_test_message("Function call %u iterations: %f s\n",
maxcycles, duration);
g_test_message("Function call %u iterations: %f s", maxcycles, duration);
}

static __attribute__((noinline)) void perf_cost_func(void *opaque)
Expand Down
10 changes: 5 additions & 5 deletions tests/vhost-user-test.c
Expand Up @@ -337,7 +337,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
}

if (size != VHOST_USER_HDR_SIZE) {
g_test_message("Wrong message size received %d\n", size);
g_test_message("Wrong message size received %d", size);
return;
}

Expand All @@ -348,7 +348,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
p += VHOST_USER_HDR_SIZE;
size = qemu_chr_fe_read_all(chr, p, msg.size);
if (size != msg.size) {
g_test_message("Wrong message size received %d != %d\n",
g_test_message("Wrong message size received %d != %d",
size, msg.size);
return;
}
Expand Down Expand Up @@ -476,7 +476,7 @@ static const char *init_hugepagefs(void)
}

if (access(path, R_OK | W_OK | X_OK)) {
g_test_message("access on path (%s): %s\n", path, strerror(errno));
g_test_message("access on path (%s): %s", path, strerror(errno));
abort();
return NULL;
}
Expand All @@ -486,13 +486,13 @@ static const char *init_hugepagefs(void)
} while (ret != 0 && errno == EINTR);

if (ret != 0) {
g_test_message("statfs on path (%s): %s\n", path, strerror(errno));
g_test_message("statfs on path (%s): %s", path, strerror(errno));
abort();
return NULL;
}

if (fs.f_type != HUGETLBFS_MAGIC) {
g_test_message("Warning: path not on HugeTLBFS: %s\n", path);
g_test_message("Warning: path not on HugeTLBFS: %s", path);
abort();
return NULL;
}
Expand Down

0 comments on commit 13ee9e3

Please sign in to comment.