From nobody Sun Nov 9 17:50:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551457765957906.5414184026077; Fri, 1 Mar 2019 08:29:25 -0800 (PST) Received: from localhost ([127.0.0.1]:40236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzl2E-00054W-NO for importer@patchew.org; Fri, 01 Mar 2019 11:29:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzkuk-0007Fc-40 for qemu-devel@nongnu.org; Fri, 01 Mar 2019 11:21:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzkui-0005qj-Aj for qemu-devel@nongnu.org; Fri, 01 Mar 2019 11:21:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52498) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gzkug-0005mm-7n; Fri, 01 Mar 2019 11:21:32 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 85B9A306D35F; Fri, 1 Mar 2019 16:21:28 +0000 (UTC) Received: from thuth.com (ovpn-116-112.ams2.redhat.com [10.36.116.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C75660143; Fri, 1 Mar 2019 16:21:19 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Laurent Vivier Date: Fri, 1 Mar 2019 17:21:17 +0100 Message-Id: <1551457277-884-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 01 Mar 2019 16:21:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] tests: Do not use "\n" in g_test_message() strings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Juan Quintela , qemu-trivial@nongnu.org, "Dr. David Alan Gilbert" , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" g_test_message() takes care of the newline on its own, so we should not use \n in the strings here. Signed-off-by: Thomas Huth Reviewed-by: Stefan Hajnoczi --- tests/ivshmem-test.c | 4 ++-- tests/m48t59-test.c | 4 ++-- tests/migration-test.c | 4 ++-- tests/rtc-test.c | 4 ++-- tests/rtl8139-test.c | 6 +++--- tests/test-aio-multithread.c | 8 ++++---- tests/test-coroutine.c | 10 ++++------ tests/vhost-user-test.c | 14 +++++++------- 8 files changed, 26 insertions(+), 28 deletions(-) diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index 942ddc9..227561f 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -74,7 +74,7 @@ static inline unsigned in_reg(IVState *s, enum Reg reg) unsigned res; =20 res =3D qpci_io_readl(s->dev, s->reg_bar, reg); - g_test_message("*%s -> %x\n", name, res); + g_test_message("*%s -> %x", name, res); =20 return res; } @@ -83,7 +83,7 @@ static inline void out_reg(IVState *s, enum Reg reg, unsi= gned v) { const char *name =3D reg2str(reg); =20 - 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); } =20 diff --git a/tests/m48t59-test.c b/tests/m48t59-test.c index 4abf9c6..b94a123 100644 --- a/tests/m48t59-test.c +++ b/tests/m48t59-test.c @@ -199,9 +199,9 @@ static void bcd_check_time(void) t =3D (long)mktime(datep); s =3D (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)); } =20 g_assert_cmpint(ABS(t - s), <=3D, wiggle); diff --git a/tests/migration-test.c b/tests/migration-test.c index 8352612..905d545 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -821,7 +821,7 @@ int main(int argc, char **argv) =20 tmpfs =3D mkdtemp(template); if (!tmpfs) { - g_test_message("mkdtemp on path (%s): %s\n", template, strerror(er= rno)); + g_test_message("mkdtemp on path (%s): %s", template, strerror(errn= o)); } g_assert(tmpfs); =20 @@ -839,7 +839,7 @@ int main(int argc, char **argv) =20 ret =3D rmdir(tmpfs); if (ret !=3D 0) { - g_test_message("unable to rmdir: path (%s): %s\n", + g_test_message("unable to rmdir: path (%s): %s", tmpfs, strerror(errno)); } =20 diff --git a/tests/rtc-test.c b/tests/rtc-test.c index d7a96cb..509be70 100644 --- a/tests/rtc-test.c +++ b/tests/rtc-test.c @@ -165,9 +165,9 @@ static void check_time(int wiggle) t =3D (long)mktime(datep); s =3D (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)); } =20 g_assert_cmpint(ABS(t - s), <=3D, wiggle); diff --git a/tests/rtl8139-test.c b/tests/rtl8139-test.c index 68bfc42..49e3f03 100644 --- a/tests/rtl8139-test.c +++ b/tests/rtl8139-test.c @@ -46,12 +46,12 @@ static QPCIDevice *get_device(void) static unsigned __attribute__((unused)) in_##name(void) \ { \ unsigned res =3D 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); \ } =20 @@ -176,7 +176,7 @@ static void test_timer(void) } } =20 - g_test_message("Everythink is ok!\n"); + g_test_message("Everythink is ok!"); } =20 =20 diff --git a/tests/test-aio-multithread.c b/tests/test-aio-multithread.c index 6440d54..d3144be 100644 --- a/tests/test-aio-multithread.c +++ b/tests/test-aio-multithread.c @@ -178,7 +178,7 @@ static void test_multi_co_schedule(int seconds) } =20 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); } @@ -242,7 +242,7 @@ static void test_multi_co_mutex(int threads, int second= s) } =20 join_aio_contexts(); - g_test_message("%d iterations/second\n", counter / seconds); + g_test_message("%d iterations/second", counter / seconds); g_assert_cmpint(counter, =3D=3D, atomic_counter); } =20 @@ -361,7 +361,7 @@ static void test_multi_fair_mutex(int threads, int seco= nds) } =20 join_aio_contexts(); - g_test_message("%d iterations/second\n", counter / seconds); + g_test_message("%d iterations/second", counter / seconds); g_assert_cmpint(counter, =3D=3D, atomic_counter); } =20 @@ -417,7 +417,7 @@ static void test_multi_mutex(int threads, int seconds) } =20 join_aio_contexts(); - g_test_message("%d iterations/second\n", counter / seconds); + g_test_message("%d iterations/second", counter / seconds); g_assert_cmpint(counter, =3D=3D, atomic_counter); } =20 diff --git a/tests/test-coroutine.c b/tests/test-coroutine.c index 28e79b3..e946d93 100644 --- a/tests/test-coroutine.c +++ b/tests/test-coroutine.c @@ -369,7 +369,7 @@ static void perf_lifecycle(void) } duration =3D g_test_timer_elapsed(); =20 - g_test_message("Lifecycle %u iterations: %f s\n", max, duration); + g_test_message("Lifecycle %u iterations: %f s", max, duration); } =20 static void perf_nesting(void) @@ -393,7 +393,7 @@ static void perf_nesting(void) } duration =3D g_test_timer_elapsed(); =20 - 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); } =20 @@ -426,8 +426,7 @@ static void perf_yield(void) } duration =3D g_test_timer_elapsed(); =20 - g_test_message("Yield %u iterations: %f s\n", - maxcycles, duration); + g_test_message("Yield %u iterations: %f s", maxcycles, duration); } =20 static __attribute__((noinline)) void dummy(unsigned *i) @@ -449,8 +448,7 @@ static void perf_baseline(void) } duration =3D g_test_timer_elapsed(); =20 - g_test_message("Function call %u iterations: %f s\n", - maxcycles, duration); + g_test_message("Function call %u iterations: %f s", maxcycles, duratio= n); } =20 static __attribute__((noinline)) void perf_cost_func(void *opaque) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index d961bd0..b5af8c3 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -332,7 +332,7 @@ static void chr_read(void *opaque, const uint8_t *buf, = int size) } =20 if (size !=3D VHOST_USER_HDR_SIZE) { - g_test_message("Wrong message size received %d\n", size); + g_test_message("Wrong message size received %d", size); return; } =20 @@ -343,7 +343,7 @@ static void chr_read(void *opaque, const uint8_t *buf, = int size) p +=3D VHOST_USER_HDR_SIZE; size =3D qemu_chr_fe_read_all(chr, p, msg.size); if (size !=3D msg.size) { - g_test_message("Wrong message size received %d !=3D %d\n", + g_test_message("Wrong message size received %d !=3D %d", size, msg.size); return; } @@ -465,7 +465,7 @@ static const char *init_hugepagefs(const char *path) int ret; =20 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)); return NULL; } =20 @@ -474,12 +474,12 @@ static const char *init_hugepagefs(const char *path) } while (ret !=3D 0 && errno =3D=3D EINTR); =20 if (ret !=3D 0) { - g_test_message("statfs on path (%s): %s\n", path, strerror(errno)); + g_test_message("statfs on path (%s): %s", path, strerror(errno)); return NULL; } =20 if (fs.f_type !=3D HUGETLBFS_MAGIC) { - g_test_message("Warning: path not on HugeTLBFS: %s\n", path); + g_test_message("Warning: path not on HugeTLBFS: %s", path); return NULL; } =20 @@ -979,7 +979,7 @@ int main(int argc, char **argv) =20 tmpfs =3D mkdtemp(template); if (!tmpfs) { - g_test_message("mkdtemp on path (%s): %s\n", template, strerror(er= rno)); + g_test_message("mkdtemp on path (%s): %s", template, strerror(errn= o)); } g_assert(tmpfs); =20 @@ -1032,7 +1032,7 @@ int main(int argc, char **argv) =20 ret =3D rmdir(tmpfs); if (ret !=3D 0) { - g_test_message("unable to rmdir: path (%s): %s\n", + g_test_message("unable to rmdir: path (%s): %s", tmpfs, strerror(errno)); } g_assert_cmpint(ret, =3D=3D, 0); --=20 1.8.3.1