From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH] tests/unit/test-util-sockets: Use g_file_open_tmp() to create temp file
Date: Sat, 25 Dec 2021 11:15:50 +0100 [thread overview]
Message-ID: <f08fb158-99a5-baf2-0d82-ca44727ecd98@redhat.com> (raw)
In-Reply-To: <2bc0b1f2-54ba-af6a-298b-0c86ac4d921f@linaro.org>
On 12/25/21 02:23, Richard Henderson wrote:
> On 12/24/21 3:45 PM, Philippe Mathieu-Daudé wrote:
>> Similarly to commit e63ed64c6d1 ("tests/qtest/virtio-net-failover:
>> Use g_file_open_tmp() to create temporary file"), avoid calling
>> g_test_rand_int() before g_test_init(): use g_file_open_tmp().
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> tests/unit/test-util-sockets.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/unit/test-util-sockets.c
>> b/tests/unit/test-util-sockets.c
>> index 72b92465298..896247e3ed3 100644
>> --- a/tests/unit/test-util-sockets.c
>> +++ b/tests/unit/test-util-sockets.c
>> @@ -305,9 +305,11 @@ static void test_socket_unix_abstract(void)
>> };
>> int i;
>> + i = g_file_open_tmp("unix-XXXXXX", &addr.u.q_unix.path, NULL);
>> + g_assert_true(i >= 0);
>
> Just g_assert.
Per https://docs.gtk.org/glib/testing.html#testing-framework:
Note that g_assert() should not be used in unit tests, since
it is a no-op when compiling with G_DISABLE_ASSERT. Use g_assert()
in production code, and g_assert_true() in unit tests.
We don't really use G_DISABLE_ASSERT, but g_assert_true()
seems appropriate here...
> Otherwise,
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Thanks.
prev parent reply other threads:[~2021-12-25 10:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-24 23:45 [PATCH] tests/unit/test-util-sockets: Use g_file_open_tmp() to create temp file Philippe Mathieu-Daudé
2021-12-25 1:23 ` Richard Henderson
2021-12-25 10:15 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f08fb158-99a5-baf2-0d82-ca44727ecd98@redhat.com \
--to=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).