[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 04/18] tests/qtest: migration-test: Avoid using hardcoded
From: |
Bin Meng |
Subject: |
Re: [PATCH v5 04/18] tests/qtest: migration-test: Avoid using hardcoded /tmp |
Date: |
Wed, 26 Oct 2022 08:44:35 +0800 |
On Wed, Oct 26, 2022 at 7:44 AM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 10/7/22 01:19, Bin Meng wrote:
> > From: Bin Meng <bin.meng@windriver.com>
> >
> > This case was written to use hardcoded /tmp directory for temporary
> > files. Update to use g_dir_make_tmp() for a portable implementation.
> >
> > Signed-off-by: Bin Meng <bin.meng@windriver.com>
> > Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >
> > Changes in v5:
> > - Use g_autoptr(GError)
> >
> > Changes in v4:
> > - Update the error reporting by using the GError "error" argument
> > of g_dir_make_tmp()
> > - Remove the const from tmpfs declaration
> >
> > Changes in v3:
> > - Split to a separate patch
>
> This patch breaks with gcc 12:
Weird GCC ...
GCC 9 reported [1], but not GCC 11, and now GCC 12 reported again.
>
>
> > @@ -2479,9 +2479,10 @@ int main(int argc, char **argv)
> > return g_test_run();
> > }
> >
> > - tmpfs = g_mkdtemp(template);
> > + tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err);
> > if (!tmpfs) {
> > - g_test_message("g_mkdtemp on path (%s): %s", template,
> > strerror(errno));
> > + g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs,
> > + err->message);
> > }
> > g_assert(tmpfs);
> >
>
> ../src/tests/qtest/migration-test.c: In function ‘main’:
> ../src/tests/qtest/migration-test.c:2484:49: error: ‘%s’ directive argument
> is null
> [-Werror=format-overflow=]
> 2484 | g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs,
> | ^~
>
> The compiler correctly notices that tmpfs was tested and found to be null,
> but tried to
> print it anyway.
>
Patch [1] already queued in qemu-trivial
[1]
20221017132023.2228641-1-bmeng.cn@gmail.com/">http://patchwork.ozlabs.org/project/qemu-devel/patch/20221017132023.2228641-1-bmeng.cn@gmail.com/
Regards,
Bin
- [PATCH v5 00/18] tests/qtest: Enable running qtest on Windows, Bin Meng, 2022/10/06
- [PATCH v5 05/18] block/vvfat: Unify the mkdir() call, Bin Meng, 2022/10/06
- [PATCH v5 07/18] hw/usb: dev-mtp: Use g_mkdir(), Bin Meng, 2022/10/06
- [PATCH v5 06/18] fsdev/virtfs-proxy-helper: Use g_mkdir(), Bin Meng, 2022/10/06
- [PATCH v5 08/18] accel/qtest: Support qtest accelerator for Windows, Bin Meng, 2022/10/06
- [PATCH v5 09/18] tests/qtest: Use send/recv for socket communication, Bin Meng, 2022/10/06