From nobody Mon Feb 9 15:09:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1661885038; cv=none; d=zohomail.com; s=zohoarc; b=Gnn8th5ywCnsT3IGGCLuxGlGPnqYOoLcEim+5qOZI8DC2a4HSzWH5Vfwvdv3xk9Lb5pdoB41/zsQp7yxp3iv0REQS1EKN8yIPwvDaAi4+xjvRlDfy6YtDJ7HX6fhsFesnPvIek8GQEWt42MuAd6BGaX8FTqzYSdZI5dl1hE8+bU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661885038; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=w0egD9Eogz8rPxc55iTt5FN1zSnqy/4Dc/efaDL748E=; b=m6R4hYvsf0Et6IS4MYzNlNdiIQGDZUtL2P+dVGiYkQcLE/UnC+P5upSY13zvXtp4HM2fiBER/LOCk9zru4N3s6MbKw9zR6dXHfInJEzPp3BljrnpLWGgrkyaK93lAYKsakbiJGnd1VjJ8Pfrm4uE2qcqpMNf1/mMgIqlprGWJSc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661885038241242.16251745766317; Tue, 30 Aug 2022 11:43:58 -0700 (PDT) Received: from localhost ([::1]:37018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT6DM-0001mE-Rk for importer@patchew.org; Tue, 30 Aug 2022 14:43:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT6A2-0007L1-6f for qemu-devel@nongnu.org; Tue, 30 Aug 2022 14:40:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:28458) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT69z-00054l-2d for qemu-devel@nongnu.org; Tue, 30 Aug 2022 14:40:28 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-403-C5cNcV-nM4-OXq9AUUhjqg-1; Tue, 30 Aug 2022 14:40:19 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2520B101AA47; Tue, 30 Aug 2022 18:40:19 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.125]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1E3A1410DD5; Tue, 30 Aug 2022 18:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661884825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w0egD9Eogz8rPxc55iTt5FN1zSnqy/4Dc/efaDL748E=; b=Th+OCmghaEIvtCb4cgoKExEQJOR2OZLQdLcdVdtPkPKxJUobW+GwqBTBM6MAkrLsC01ZAV BuZUFpv8AlciGwdqFPmfz9LoNkW8m/VEmNIy00Mwv7lkuno6RTz0WsgN2XOCdo9hoNPKz5 HZw98YvRWT9/IdDY0fjwuHTZtTZf67I= X-MC-Unique: C5cNcV-nM4-OXq9AUUhjqg-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson , Peter Maydell Cc: Bin Meng Subject: [PULL 02/23] tests/qtest: Use g_mkdtemp() Date: Tue, 30 Aug 2022 20:39:51 +0200 Message-Id: <20220830184012.77978-3-thuth@redhat.com> In-Reply-To: <20220830184012.77978-1-thuth@redhat.com> References: <20220830184012.77978-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1661885040296100001 Content-Type: text/plain; charset="utf-8" From: Bin Meng Windows does not provide a mkdtemp() API, but glib does. Replace mkdtemp() call with the glib version. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth Message-Id: <20220824094029.1634519-3-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/fuzz/generic_fuzz_configs.h | 2 +- tests/qtest/cdrom-test.c | 2 +- tests/qtest/cxl-test.c | 6 +++--- tests/qtest/ivshmem-test.c | 4 ++-- tests/qtest/libqos/virtio-9p.c | 4 ++-- tests/qtest/libqtest.c | 2 +- tests/qtest/migration-test.c | 4 ++-- tests/qtest/qmp-test.c | 4 ++-- tests/qtest/vhost-user-test.c | 4 ++-- tests/unit/test-qga.c | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/gen= eric_fuzz_configs.h index 004c701915..0775e6702b 100644 --- a/tests/qtest/fuzz/generic_fuzz_configs.h +++ b/tests/qtest/fuzz/generic_fuzz_configs.h @@ -21,7 +21,7 @@ typedef struct generic_fuzz_config { =20 static inline gchar *generic_fuzzer_virtio_9p_args(void){ char tmpdir[] =3D "/tmp/qemu-fuzz.XXXXXX"; - g_assert_nonnull(mkdtemp(tmpdir)); + g_assert_nonnull(g_mkdtemp(tmpdir)); =20 return g_strdup_printf("-machine q35 -nodefaults " "-device virtio-9p,fsdev=3Dhshare,mount_tag=3Dhshare " diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c index a7766a9e65..26a2400181 100644 --- a/tests/qtest/cdrom-test.c +++ b/tests/qtest/cdrom-test.c @@ -52,7 +52,7 @@ static int prepare_image(const char *arch, char *isoimage) perror("Error creating temporary iso image file"); return -1; } - if (!mkdtemp(srcdir)) { + if (!g_mkdtemp(srcdir)) { perror("Error creating temporary directory"); goto cleanup; } diff --git a/tests/qtest/cxl-test.c b/tests/qtest/cxl-test.c index 2133e973f4..4e6d285061 100644 --- a/tests/qtest/cxl-test.c +++ b/tests/qtest/cxl-test.c @@ -95,7 +95,7 @@ static void cxl_t3d(void) char template[] =3D "/tmp/cxl-test-XXXXXX"; const char *tmpfs; =20 - tmpfs =3D mkdtemp(template); + tmpfs =3D g_mkdtemp(template); =20 g_string_printf(cmdline, QEMU_PXB_CMD QEMU_RP QEMU_T3D, tmpfs, tmpfs); =20 @@ -109,7 +109,7 @@ static void cxl_1pxb_2rp_2t3d(void) char template[] =3D "/tmp/cxl-test-XXXXXX"; const char *tmpfs; =20 - tmpfs =3D mkdtemp(template); + tmpfs =3D g_mkdtemp(template); =20 g_string_printf(cmdline, QEMU_PXB_CMD QEMU_2RP QEMU_2T3D, tmpfs, tmpfs, tmpfs, tmpfs); @@ -124,7 +124,7 @@ static void cxl_2pxb_4rp_4t3d(void) char template[] =3D "/tmp/cxl-test-XXXXXX"; const char *tmpfs; =20 - tmpfs =3D mkdtemp(template); + tmpfs =3D g_mkdtemp(template); =20 g_string_printf(cmdline, QEMU_2PXB_CMD QEMU_4RP QEMU_4T3D, tmpfs, tmpfs, tmpfs, tmpfs, tmpfs, tmpfs, diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c index e23a97fa8e..9611d05eb5 100644 --- a/tests/qtest/ivshmem-test.c +++ b/tests/qtest/ivshmem-test.c @@ -481,8 +481,8 @@ int main(int argc, char **argv) tmpshmem =3D mmap(0, TMPSHMSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd,= 0); g_assert(tmpshmem !=3D MAP_FAILED); /* server */ - if (mkdtemp(dir) =3D=3D NULL) { - g_error("mkdtemp: %s", g_strerror(errno)); + if (g_mkdtemp(dir) =3D=3D NULL) { + g_error("g_mkdtemp: %s", g_strerror(errno)); } tmpdir =3D dir; tmpserver =3D g_strconcat(tmpdir, "/server", NULL); diff --git a/tests/qtest/libqos/virtio-9p.c b/tests/qtest/libqos/virtio-9p.c index 70aea8bf62..ae9b0a20e2 100644 --- a/tests/qtest/libqos/virtio-9p.c +++ b/tests/qtest/libqos/virtio-9p.c @@ -48,9 +48,9 @@ void virtio_9p_create_local_test_dir(void) */ char *template =3D concat_path(pwd, "qtest-9p-local-XXXXXX"); =20 - local_test_path =3D mkdtemp(template); + local_test_path =3D g_mkdtemp(template); if (!local_test_path) { - g_test_message("mkdtemp('%s') failed: %s", template, strerror(errn= o)); + g_test_message("g_mkdtemp('%s') failed: %s", template, strerror(er= rno)); } =20 g_assert(local_test_path !=3D NULL); diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index ad6860d774..7c9fc07de4 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -393,7 +393,7 @@ QTestState *qtest_init_with_serial(const char *extra_ar= gs, int *sock_fd) char *sock_path, sock_dir[] =3D "/tmp/qtest-serial-XXXXXX"; QTestState *qts; =20 - g_assert_true(mkdtemp(sock_dir) !=3D NULL); + g_assert_true(g_mkdtemp(sock_dir) !=3D NULL); sock_path =3D g_strdup_printf("%s/sock", sock_dir); =20 sock_fd_init =3D init_socket(sock_path); diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index f63edd0bc8..60f3d4e9d2 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2452,9 +2452,9 @@ int main(int argc, char **argv) return g_test_run(); } =20 - tmpfs =3D mkdtemp(template); + tmpfs =3D g_mkdtemp(template); if (!tmpfs) { - g_test_message("mkdtemp on path (%s): %s", template, strerror(errn= o)); + g_test_message("g_mkdtemp on path (%s): %s", template, strerror(er= rno)); } g_assert(tmpfs); =20 diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c index 9a42480cef..bf7304c7dc 100644 --- a/tests/qtest/qmp-test.c +++ b/tests/qtest/qmp-test.c @@ -166,8 +166,8 @@ char *fifo_name; =20 static void setup_blocking_cmd(void) { - if (!mkdtemp(tmpdir)) { - g_error("mkdtemp: %s", strerror(errno)); + if (!g_mkdtemp(tmpdir)) { + g_error("g_mkdtemp: %s", strerror(errno)); } fifo_name =3D g_strdup_printf("%s/fifo", tmpdir); if (mkfifo(fifo_name, 0666)) { diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 8bf390be20..d7d6cfc9bd 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -491,9 +491,9 @@ static TestServer *test_server_new(const gchar *name, /* run the main loop thread so the chardev may operate */ server->thread =3D g_thread_new(NULL, thread_function, server->loop); =20 - tmpfs =3D mkdtemp(template); + tmpfs =3D g_mkdtemp(template); if (!tmpfs) { - g_test_message("mkdtemp on path (%s): %s", template, strerror(errn= o)); + g_test_message("g_mkdtemp on path (%s): %s", template, strerror(er= rno)); } g_assert(tmpfs); =20 diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c index b27c77a695..a05a4628ed 100644 --- a/tests/unit/test-qga.c +++ b/tests/unit/test-qga.c @@ -60,7 +60,7 @@ fixture_setup(TestFixture *fixture, gconstpointer data, g= char **envp) fixture->loop =3D g_main_loop_new(NULL, FALSE); =20 fixture->test_dir =3D g_strdup("/tmp/qgatest.XXXXXX"); - g_assert_nonnull(mkdtemp(fixture->test_dir)); + g_assert_nonnull(g_mkdtemp(fixture->test_dir)); =20 path =3D g_build_filename(fixture->test_dir, "sock", NULL); cwd =3D g_get_current_dir(); --=20 2.31.1