From patchwork Wed Aug 24 09:39:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6D2FDC32793 for ; Wed, 24 Aug 2022 09:49:13 +0000 (UTC) Received: from localhost ([::1]:58316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQn0a-0001b3-Ac for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 05:49:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmsU-00012L-D0 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:40:50 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:41972) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmsS-0001GJ-Ov for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:40:50 -0400 Received: by mail-pj1-x1033.google.com with SMTP id p9-20020a17090a2d8900b001fb86ec43aaso593984pjd.0 for ; Wed, 24 Aug 2022 02:40:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=1DPLOLxJPplKModHASULqKHpd5A7q1S4jYAA/H54UVA=; b=NTMJESw9CbFuTPFTy7uDbRb7S0q4eiAUy9o9dKmBv5zpRZDNA8lqIkJ+UlpVJTCLpd EX0PfRq/IkFCg2Ss90LMEawZU4SYIlOdqkx8RbE09Y0CqsGJcxKLK6BET+RcoPbQo6/J V/YJQvhPFTWvmZlwgLUeODuOi6vwLCvsCGexqxEVstebFUMj5DLO0rz9lXIQdpyKhfFu 7oA7I9jlze/5ip/RvD7em2qId9qwr8YfKEGKknSb5ivQSG+ZYtXTnJX89I2vii+HqGop k4TOzQ9br5yN0iLIaAeEAMJCvJDA/2Oca9moGHOwhd0CUZZRv3zY+kgdq4Ro+N4C+hnj fCqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=1DPLOLxJPplKModHASULqKHpd5A7q1S4jYAA/H54UVA=; b=qHeAtz73o+AyOj5h+nKQ1HyIsCVtcc/IjOSvP8x/uSygpDiNDbhwBDbyC2EH11Kf3+ kkqrU65Im5BNk7j0fOee8pIKJWWF7OcFAt8GctHa56ywGLSRjo9Ewd7vZEDjyOu6oGCR V29Hfx0G6+hONyuRWu4/L1i9X9Jt4SXzD59ArDklrz2hW5zhMcqP5t4tnWOyaKVJ+MUD +Eyz4gZml0FrhBljF83z4UcuKi8Ls12UhUfuBUFj/2J/DLoEN50MfUh7boi91Ebbg8Gp hg/s5avgWUXhA5jgx0LWV+31+kb1Zhr1ojZJblt1+JFigMtIoAq1zAmQLZUuCzLuVmeE OBtw== X-Gm-Message-State: ACgBeo0QJEmJMk5mGbZHQtK3gmA85IcW22yPt6yt51i4wNRtMTjaa4Yz VVz7h7iMVNj9DXyHXB1gv10MjDj+hPI= X-Google-Smtp-Source: AA6agR4zk0Xa55oBSL+RlSkfR4P9shz7zdk6fr0tBv+CAIvLj0MPkj97lg0oUYwhGQOUO+jgxZKitw== X-Received: by 2002:a17:902:b413:b0:172:a628:7915 with SMTP id x19-20020a170902b41300b00172a6287915mr28472711plr.99.1661334046118; Wed, 24 Aug 2022 02:40:46 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:40:45 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Alexander Bulekov , Bandan Das , Darren Kenny , Laurent Vivier , Paolo Bonzini , Qiuhao Li , Stefan Hajnoczi , Thomas Huth Subject: [PATCH 01/51] tests/qtest: Use g_setenv() Date: Wed, 24 Aug 2022 17:39:39 +0800 Message-Id: <20220824094029.1634519-2-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Windows does not provide a setenv() API, but glib does. Replace setenv() call with the glib version. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé --- tests/qtest/fuzz/generic_fuzz.c | 8 ++++---- tests/qtest/libqtest.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c index 447ffe8178..afc1d20355 100644 --- a/tests/qtest/fuzz/generic_fuzz.c +++ b/tests/qtest/fuzz/generic_fuzz.c @@ -994,16 +994,16 @@ static GString *generic_fuzz_predefined_config_cmdline(FuzzTarget *t) g_assert(t->opaque); config = t->opaque; - setenv("QEMU_AVOID_DOUBLE_FETCH", "1", 1); + g_setenv("QEMU_AVOID_DOUBLE_FETCH", "1", 1); if (config->argfunc) { args = config->argfunc(); - setenv("QEMU_FUZZ_ARGS", args, 1); + g_setenv("QEMU_FUZZ_ARGS", args, 1); g_free(args); } else { g_assert_nonnull(config->args); - setenv("QEMU_FUZZ_ARGS", config->args, 1); + g_setenv("QEMU_FUZZ_ARGS", config->args, 1); } - setenv("QEMU_FUZZ_OBJECTS", config->objects, 1); + g_setenv("QEMU_FUZZ_OBJECTS", config->objects, 1); return generic_fuzz_cmdline(t); } diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 8c159eacf5..ad6860d774 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1424,7 +1424,7 @@ QTestState *qtest_inproc_init(QTestState **s, bool log, const char* arch, * way, qtest_get_arch works for inproc qtest. */ gchar *bin_path = g_strconcat("/qemu-system-", arch, NULL); - setenv("QTEST_QEMU_BINARY", bin_path, 0); + g_setenv("QTEST_QEMU_BINARY", bin_path, 0); g_free(bin_path); return qts; From patchwork Wed Aug 24 09:39:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953154 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3347AC00140 for ; Wed, 24 Aug 2022 10:03:31 +0000 (UTC) Received: from localhost ([::1]:49422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnEQ-0007x3-9u for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:03:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmsc-0001L6-2E; Wed, 24 Aug 2022 05:40:58 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:36445) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmsa-0001Ho-1g; Wed, 24 Aug 2022 05:40:57 -0400 Received: by mail-pl1-x635.google.com with SMTP id c2so15200937plo.3; Wed, 24 Aug 2022 02:40:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=UXKRju1FGFN9DPiFZ4J+hFGTgwWa8qqlnkHV2v3j370=; b=H75A5dn2AgcFzIemjLr66iiTva3GHNNLzQ2BqKqEOqymi/V9I9hNPP+jPXbauTFtpD lt2vzI9GKKbj8+Q9a4joEw+z0TtKwxnMea2/D5f1a0xMRY7FSd07R0zmHePNlklYJ2JS Szuh/Ao9ywa6TWQZ4jXFflmeqvQwkrA11V/yn8y77QKNnHLMLJwjXFqRzuu63mUXsbRW JKiPqbvnpSxbOGmaQtJus5U7uZ9rXI8HTAd0v9SvbxJMLbzs1ABvT2WX1PE5IOgzQD4m CzQzCAhHGF4ZZBvDVVZJTm2r6mdSSmSKiEZMqOUfYbFMB5mixLqySMaPI5NlsXyFD2gn 37sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=UXKRju1FGFN9DPiFZ4J+hFGTgwWa8qqlnkHV2v3j370=; b=q7x3j7bGS1ZSLgHA4J+0eLMINHJxI5gYJo007rVNpWSDG3+tkSCm/GoM2E1NAeVJ6q EdZzpl0mvAJ/p9sP8/SfaoRfnvT3BcFK+chPtkf329aIBkqUp8rkgBwzyL6F4753VabI 9CeE9mXfN8WgYfwPoPXpxcfZrZfF3pud+C9fJJXB/Ek6MHugVt7kRQfLKk1auXm7NtsG G1q9N8cg855n7mCLj1CUvv/u4WzdeR+cxTaVfTXz3rmQ3sQ9TufOwbzYW0x3E7T2HsYB nCUz4ApWKuXmNdj9GLVslRxlx3Ko1mERIldy3ozZVsqdIIYAGJKxNhCqGyvdXMdvKv6c VZkg== X-Gm-Message-State: ACgBeo2u+sUceZmGpuYNhDzl8GAKkCk7c4/8kX5iHcbkLYvvR5A/nt3l mBhY5eiyAhyO0VB0SIBogj3tgN7AaO0= X-Google-Smtp-Source: AA6agR6aFBd6Ct7J3zKfU/Rxwxz5UguxZ2dUU+5JppZ9BjXc75nNr2MK9jtT1QIIg6o75yc8NqYmoQ== X-Received: by 2002:a17:90a:f0c9:b0:1fa:e017:7d13 with SMTP id fa9-20020a17090af0c900b001fae0177d13mr7486488pjb.128.1661334054042; Wed, 24 Aug 2022 02:40:54 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:40:53 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Alexander Bulekov , Bandan Das , Darren Kenny , "Dr. David Alan Gilbert" , John Snow , Juan Quintela , Konstantin Kostiuk , Laurent Vivier , Markus Armbruster , Michael Roth , Paolo Bonzini , Qiuhao Li , Stefan Hajnoczi , Thomas Huth , qemu-block@nongnu.org Subject: [PATCH 02/51] tests/qtest: Use g_mkdtemp() Date: Wed, 24 Aug 2022 17:39:40 +0800 Message-Id: <20220824094029.1634519-3-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 --- 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/generic_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 { static inline gchar *generic_fuzzer_virtio_9p_args(void){ char tmpdir[] = "/tmp/qemu-fuzz.XXXXXX"; - g_assert_nonnull(mkdtemp(tmpdir)); + g_assert_nonnull(g_mkdtemp(tmpdir)); return g_strdup_printf("-machine q35 -nodefaults " "-device virtio-9p,fsdev=hshare,mount_tag=hshare " 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[] = "/tmp/cxl-test-XXXXXX"; const char *tmpfs; - tmpfs = mkdtemp(template); + tmpfs = g_mkdtemp(template); g_string_printf(cmdline, QEMU_PXB_CMD QEMU_RP QEMU_T3D, tmpfs, tmpfs); @@ -109,7 +109,7 @@ static void cxl_1pxb_2rp_2t3d(void) char template[] = "/tmp/cxl-test-XXXXXX"; const char *tmpfs; - tmpfs = mkdtemp(template); + tmpfs = g_mkdtemp(template); 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[] = "/tmp/cxl-test-XXXXXX"; const char *tmpfs; - tmpfs = mkdtemp(template); + tmpfs = g_mkdtemp(template); 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 = mmap(0, TMPSHMSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); g_assert(tmpshmem != MAP_FAILED); /* server */ - if (mkdtemp(dir) == NULL) { - g_error("mkdtemp: %s", g_strerror(errno)); + if (g_mkdtemp(dir) == NULL) { + g_error("g_mkdtemp: %s", g_strerror(errno)); } tmpdir = dir; tmpserver = 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 = concat_path(pwd, "qtest-9p-local-XXXXXX"); - local_test_path = mkdtemp(template); + local_test_path = g_mkdtemp(template); if (!local_test_path) { - g_test_message("mkdtemp('%s') failed: %s", template, strerror(errno)); + g_test_message("g_mkdtemp('%s') failed: %s", template, strerror(errno)); } g_assert(local_test_path != 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_args, int *sock_fd) char *sock_path, sock_dir[] = "/tmp/qtest-serial-XXXXXX"; QTestState *qts; - g_assert_true(mkdtemp(sock_dir) != NULL); + g_assert_true(g_mkdtemp(sock_dir) != NULL); sock_path = g_strdup_printf("%s/sock", sock_dir); sock_fd_init = init_socket(sock_path); diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 520a5f917c..52988b86eb 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2450,9 +2450,9 @@ int main(int argc, char **argv) return g_test_run(); } - tmpfs = mkdtemp(template); + tmpfs = g_mkdtemp(template); if (!tmpfs) { - g_test_message("mkdtemp on path (%s): %s", template, strerror(errno)); + g_test_message("g_mkdtemp on path (%s): %s", template, strerror(errno)); } g_assert(tmpfs); 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; 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 = 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 = g_thread_new(NULL, thread_function, server->loop); - tmpfs = mkdtemp(template); + tmpfs = g_mkdtemp(template); if (!tmpfs) { - g_test_message("mkdtemp on path (%s): %s", template, strerror(errno)); + g_test_message("g_mkdtemp on path (%s): %s", template, strerror(errno)); } g_assert(tmpfs); 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, gchar **envp) fixture->loop = g_main_loop_new(NULL, FALSE); fixture->test_dir = g_strdup("/tmp/qgatest.XXXXXX"); - g_assert_nonnull(mkdtemp(fixture->test_dir)); + g_assert_nonnull(g_mkdtemp(fixture->test_dir)); path = g_build_filename(fixture->test_dir, "sock", NULL); cwd = g_get_current_dir(); From patchwork Wed Aug 24 09:39:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953122 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 83768C00140 for ; Wed, 24 Aug 2022 09:45:13 +0000 (UTC) Received: from localhost ([::1]:59820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQmwi-0005Uq-Ce for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 05:45:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmsv-00027F-FB; Wed, 24 Aug 2022 05:41:17 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:33629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmst-0001KP-Vk; Wed, 24 Aug 2022 05:41:17 -0400 Received: by mail-pl1-x635.google.com with SMTP id 2so15218274pll.0; Wed, 24 Aug 2022 02:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=oO0SYzbawNGrDg6auw+O7c5purm7PS7f7P59XKUxYbE=; b=bHffE/UwOb1YAe22yBuG5fn/8y6I7CgETiarUmwh0cOsZ4toU1fBE240zfzNmvuEkD AtwCBy016YB072o6x/1itEcsJ5I9Acq97/h9DabW+wKtYunIWYOB6HbqbGD3PvBcAjRK LjCHTZLLzVptMLV3gkWIfMwRWBZif/c5rdLwZUHu5OAQzFKqfBXEkh/TJCpihpNgXumt xugWUmQVUeQLyE9gkr5qK43uzs0PYUbzyIEIRTeakubsceLeGFOlojLTJL3EGzg3ydOr 6deW8S5esFxDpdbfNWYnm1m7GOFpkQDrJivCWFlObMHRXkz1CRl3XQqR0uHEADgpiRaY 7S5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=oO0SYzbawNGrDg6auw+O7c5purm7PS7f7P59XKUxYbE=; b=z4W5Fu/goIrBhvmx6KtNtYqW3pS/C8SPFZQvWTr9UF9na1egtjpjp6aKl3J4x2Y3dj /3Q7OQWvXSUWUqyOWeCyDnQ3ApNiJvYNKBjs52NTjcZpcDxbqfnJ3OzJnt08J9WsULlr mWcmQmglNpWG9sNPajtWeBsUMfb79DA2xgES8f3of6tUN12OCtwG1YNwVwfUE6eLCd/9 nZxXswThuSHQT95FPjwlQ4sNj8/jH9Qj13XdetGiDcQAPfIjO7BJvCFhqIroLKWi/NnH uPvXQruMNi8T9WYLsCcpBZK2pz0hWkD8P/6kFO6qVgrgqG3lGE8ZS6iUALtME7U2AKVE sY/Q== X-Gm-Message-State: ACgBeo0lQJJQgcxjP4wnjW7Cf3yeDRGMEUSlDHfuls3lgkXiywMd5Bob cCZxJTKSQu/U34FW/GwAGjRYwD5R4DA= X-Google-Smtp-Source: AA6agR6WF5MDSNfIXFV63CN8Viuk6Y1f0mlwIKX0E4X/WN200TS/sctBRDiJLarwM/v19YIWslMj9A== X-Received: by 2002:a17:903:2483:b0:16c:dfcf:38e8 with SMTP id p3-20020a170903248300b0016cdfcf38e8mr28430232plw.43.1661334074159; Wed, 24 Aug 2022 02:41:14 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:41:13 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Hanna Reitz , Kevin Wolf , qemu-block@nongnu.org Subject: [PATCH 03/51] block: Unify the get_tmp_filename() implementation Date: Wed, 24 Aug 2022 17:39:41 +0800 Message-Id: <20220824094029.1634519-4-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng At present get_tmp_filename() has platform specific implementations to get the directory to use for temporary files. Switch over to use g_get_tmp_dir() which works on all supported platforms. Signed-off-by: Bin Meng --- block.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/block.c b/block.c index bc85f46eed..d06df47f72 100644 --- a/block.c +++ b/block.c @@ -864,21 +864,10 @@ int bdrv_probe_geometry(BlockDriverState *bs, HDGeometry *geo) */ int get_tmp_filename(char *filename, int size) { -#ifdef _WIN32 - char temp_dir[MAX_PATH]; - /* GetTempFileName requires that its output buffer (4th param) - have length MAX_PATH or greater. */ - assert(size >= MAX_PATH); - return (GetTempPath(MAX_PATH, temp_dir) - && GetTempFileName(temp_dir, "qem", 0, filename) - ? 0 : -GetLastError()); -#else int fd; const char *tmpdir; - tmpdir = getenv("TMPDIR"); - if (!tmpdir) { - tmpdir = "/var/tmp"; - } + tmpdir = g_get_tmp_dir(); + if (snprintf(filename, size, "%s/vl.XXXXXX", tmpdir) >= size) { return -EOVERFLOW; } @@ -891,7 +880,6 @@ int get_tmp_filename(char *filename, int size) return -errno; } return 0; -#endif } /* From patchwork Wed Aug 24 09:39:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E8285C00140 for ; Wed, 24 Aug 2022 09:57:38 +0000 (UTC) Received: from localhost ([::1]:37992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQn8k-00087r-2g for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 05:57:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmsz-0002H4-Hk for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:41:21 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:46880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmsy-0001L5-2K for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:41:21 -0400 Received: by mail-pl1-x636.google.com with SMTP id jm11so15166184plb.13 for ; Wed, 24 Aug 2022 02:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=EZVtm0SvUeW5TzKWeVkn+QL0GZmVIRTePkK09k2LuDo=; b=I7tZixZ9DlnNl6LPagcrRUkB0muB8Kr4lbWvRANjZKoLQaUI1TBZw5E/nr3yliNlrL qmjELqZpnRUK4OHhhq/zjS023cbRlnGmmpeHjNPt9uakCLHhtME7EV9Z3feYZLkepYEH TQq+5KMp6vbLFv+o9WUmd5cZgcwzP9mYr+6TklYIKzuajTEVxrBk5EeCEmhUDQpN9rrj ufn+TJw3KfDB7UGUXCkSjGS50ExUF524oMcmW1fRHXcT5J8fyNg73rvOm0IZFFrEZPpz KOXUYVm+XqJqs99q1w8KYnJKq1QCGhiQwPyLNPJoLcw+be0b0bG5GbID2VMzb00EwJ+n K3cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=EZVtm0SvUeW5TzKWeVkn+QL0GZmVIRTePkK09k2LuDo=; b=H9qX+VZP+MYyqYKCARzBJj+TkNruC55wvTcqDnQLk8ndEzzcY8MmFLM9qlQ7B+lsmq g/y5zolQRIodRcPAiYUlGHTexDqdZIYQcuXQkvMUCTJuz0bWk7ES1ms8FESGyDsNvZGo OzYt0zQ7M17bUsY0oTBUQEn0SuAm0tlzy4E94xzdqQZNsArz01dKmqf1Fs38ORPRvs1Q eptB4aK/wOgZ3pTp2Qf64O6YtZh3olML4/wxc7ghgcyp/vvlQuaSQXwCN6Ei3wylETnz y/pRr1bHhajmW35eyQPRETYcXBUJYow1E2uCqkYOwlHg3WMYlaYguxJOchJwHabXvMqQ 4/+A== X-Gm-Message-State: ACgBeo2AZUs9T2AoB7D/Y4zi0kRiu27RLv4DYqeKONMbYXcZ8XLGWUVC ujPnJ0qj3cgXdGaYxurSbgKPH0mVDEY= X-Google-Smtp-Source: AA6agR5KyV54s6DsPFRoE58SNQ2NsWhlTYaIlHqJcYpxnDphITa6Sf6W+FId74ZmhmuvOta4x+8zsA== X-Received: by 2002:a17:902:9886:b0:172:bb36:70f1 with SMTP id s6-20020a170902988600b00172bb3670f1mr26829368plp.139.1661334077298; Wed, 24 Aug 2022 02:41:17 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:41:17 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH 04/51] semihosting/arm-compat-semi: Avoid using hardcoded /tmp Date: Wed, 24 Aug 2022 17:39:42 +0800 Message-Id: <20220824094029.1634519-5-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Use g_get_tmp_dir() to get the directory to use for temporary files. Signed-off-by: Bin Meng --- semihosting/arm-compat-semi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index e741674238..d5e66cc298 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -503,7 +503,8 @@ void do_common_semihosting(CPUState *cs) GET_ARG(0); GET_ARG(1); GET_ARG(2); - len = asprintf(&s, "/tmp/qemu-%x%02x", getpid(), (int)arg1 & 0xff); + len = asprintf(&s, "%s/qemu-%x%02x", g_get_tmp_dir(), + getpid(), (int)arg1 & 0xff); if (len < 0) { common_semi_set_ret(cs, -1); break; From patchwork Wed Aug 24 09:39:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 592D7C00140 for ; Wed, 24 Aug 2022 10:10:34 +0000 (UTC) Received: from localhost ([::1]:54668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnLF-0005im-6E for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:10:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmt4-0002Qg-MB for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:41:26 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:42702) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmt2-0001MR-5F for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:41:26 -0400 Received: by mail-pg1-x534.google.com with SMTP id q63so307367pga.9 for ; Wed, 24 Aug 2022 02:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=eT7i3FFQc8PKKRNmStJpuuvLEJ+xIi8cvZUWYereUgg=; b=p47+6C9tssfPWv9BETDMsqh64W3+bu2N3xF/7dhXwCtmpD2GYRRWihXipD9l65BhXY PZhP3e128o5zbFiLLamo+7fuebF9fqmT+WxNiQQ3htiCyyN2XCR3vUaivlzAo0TNzRXI HCuSHw6spa9ZVD2Npl/3Jr+yphS4IanP7pLciB+srzCJuVmIye06wnZ5f53J+AF8R4p3 4QhIV34Kj8gnNUNDejsMkrKlZWNjsJXqJ4KroJQnxJFW7ldwn3+L4illeuXCC0A98x4V kC4eH0XZAnJe6nQrbM8zOLNTWGPP66WOyecwyvgf4t910HRjhMJw6xi6RRmAZT7Z0q1z dheQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=eT7i3FFQc8PKKRNmStJpuuvLEJ+xIi8cvZUWYereUgg=; b=IJYlL3ZJsh3hF3xAS1dvhirYxdp/H1+jN4t+HFHMokBLkARagVw4Pr2giy7VzTbxpV 40yoY2SbfGflfJAL425xxz0r5w6+1zvEnXxxKVioF8opFW3wYu90bAkNHbsJWgttBGLS Y2uR724gM+qnPVADAHoQzR7mmj9nFTCivrDJVidTEZjvjZ95y8qJ+4ZU45vl3cqua9Ig ZJTb6Q+/5T6vW4zhZ8p4lekyMTYICOncjaokbgD9mrbF0sDXEpxogioGfeHJbDZwAP4f /ylW2VIzaAYQ7Z2NXFAKXO8AnXB9JxUVUR79AlqKo0xCdwHfL/h6+TRHQSx8MmKP2Rb8 4auQ== X-Gm-Message-State: ACgBeo1pgBxvgevaH2ePCGBUSRGlXlzvH0mXcd1Y5yOAyLU8MahZKgGP /W8KYun71Hs28DYLMwp7N1/W8InHS3s= X-Google-Smtp-Source: AA6agR5Eb6m0IlugLrXcv5q6A/iKTNFX3dL0JP8rJloM3sVwsYvaXKMgNU+xwu+YXfbZtfQ0RIN3vw== X-Received: by 2002:a05:6a00:1687:b0:518:6c6b:6a9a with SMTP id k7-20020a056a00168700b005186c6b6a9amr29351167pfc.81.1661334082646; Wed, 24 Aug 2022 02:41:22 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:41:22 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Richard Henderson Subject: [PATCH 05/51] tcg: Avoid using hardcoded /tmp Date: Wed, 24 Aug 2022 17:39:43 +0800 Message-Id: <20220824094029.1634519-6-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Use g_get_tmp_dir() to get the directory to use for temporary files. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- tcg/tcg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 0f9cfe96f2..932156a352 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -4729,13 +4729,15 @@ static void tcg_register_jit_int(const void *buf_ptr, size_t buf_size, /* Enable this block to be able to debug the ELF image file creation. One can use readelf, objdump, or other inspection utilities. */ { - FILE *f = fopen("/tmp/qemu.jit", "w+b"); + char *jit = g_strdup_printf("%s/qemu.jit", g_get_tmp_dir()); + FILE *f = fopen(jit, "w+b"); if (f) { if (fwrite(img, img_size, 1, f) != img_size) { /* Avoid stupid unused return value warning for fwrite. */ } fclose(f); } + g_free(jit); } #endif From patchwork Wed Aug 24 09:39:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 938B9C00140 for ; Wed, 24 Aug 2022 10:02:14 +0000 (UTC) Received: from localhost ([::1]:49806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnDB-0006Zx-J4 for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:02:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmtB-0002bB-RP for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:41:33 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:36580) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmt6-0001NS-3e for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:41:33 -0400 Received: by mail-pf1-x42b.google.com with SMTP id w29so10406521pfj.3 for ; Wed, 24 Aug 2022 02:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=hjdri8IS0vHiKp8ufTWi8yEKyLd7PN9XXMLuAWqNzss=; b=bwqtZfXir5VLsjLv0GMiUpHqv3oAUV1nlAmY308E+vai6ebHqLhC9WuYqiQPXn0luN 5Yd4g4dh8VHVUWvH4Ccbtm50D3jL7zc4SXBNwgauLd1Jgsu2tFsprtzqctDN/UMRPhKr 3gnAgnVCeHWjSydL2D1k/++b7Q5qI7K7U/SU3KTudS3zvEPaE8z7CY/VPvAlSnYUXal3 WICTlFHQGGGLDOAjEm3P6j87R8BTETt2tXSGnVnanpcVSzUmii+/62VOeQ1qVOMIur/9 l4j/3VRnjsXAogdJuGI8gKFwF8EnE8JGpRgW1ftqk9lFw+5tMrPNUO9+70ti1+LjohMp 9zeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=hjdri8IS0vHiKp8ufTWi8yEKyLd7PN9XXMLuAWqNzss=; b=dWypxDzpKN8z6uQ+48QMHf9L7+SQmc2D3/EeCjuV2SmLObXYdoQzP5CFwJug6lT85K U9xj+By4fADHCM/j2AJZrk2fUuK/f6mxBEXx+HnPOU0aim2jyrin6DkEFYfM4xJbbsRV d8ctBos1Nr3ArKaoejme4VYXA4zKsIoanOlO/S0ahdxu9PY7ukSLK0Y8xNNGOwuGcC89 Zu4MyxfmOFk1qy77pUa1kRm+Hgucqazn901rUdUXn0bvjN6oLoPvLburCgaSVL43tVMN +6bz4wv4O4kiV8OFBnjU77/yNsgvM7Sr6b6sBs1R/qxeF9yg+PEcQwGL2zqA5GjSCepn Vn2w== X-Gm-Message-State: ACgBeo2J6zG/8eG0oTsbxQtf3v/1UWtyaf5Ekd7zUfswZG2RbcQQdGbt mheKoDqoQitx1+uuSS2jlQqmRSNOzdE= X-Google-Smtp-Source: AA6agR5zXJev3TG/qw7WAroQsFZJCSwOK8iGF2Obq+9gByiqkFBmxxxes+Wdp6LOTa8Ea8PP4/6alw== X-Received: by 2002:a05:6a00:1ac8:b0:536:f09a:eecc with SMTP id f8-20020a056a001ac800b00536f09aeeccmr7794376pfv.50.1661334086448; Wed, 24 Aug 2022 02:41:26 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:41:26 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH 06/51] util/qemu-sockets: Use g_get_tmp_dir() to get the directory for temporary files Date: Wed, 24 Aug 2022 17:39:44 +0800 Message-Id: <20220824094029.1634519-7-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Replace the existing logic to get the directory for temporary files with g_get_tmp_dir(), which works for win32 too. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- util/qemu-sockets.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 83f4bd6fd2..0c41ca9e42 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -919,9 +919,8 @@ static int unix_listen_saddr(UnixSocketAddress *saddr, if (saddr->path[0] || abstract) { path = saddr->path; } else { - const char *tmpdir = getenv("TMPDIR"); - tmpdir = tmpdir ? tmpdir : "/tmp"; - path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", tmpdir); + path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", + g_get_tmp_dir()); } pathlen = strlen(path); From patchwork Wed Aug 24 09:39:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953167 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CF2DC00140 for ; Wed, 24 Aug 2022 10:15:08 +0000 (UTC) Received: from localhost ([::1]:37542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnPf-00039Y-3I for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:15:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmte-0002ul-Jg; Wed, 24 Aug 2022 05:42:04 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:53904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmtb-0001WD-BT; Wed, 24 Aug 2022 05:42:02 -0400 Received: by mail-pj1-x1030.google.com with SMTP id m15so8460677pjj.3; Wed, 24 Aug 2022 02:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=trWpCFmc885+Hbmydl7kHMuVBjh6162eTb0KUJVdu8M=; b=e0Yaknpcgf7hBFJYxusqzUm+qOvpcJiD8u/ZjdYt5t2m77MNIt9MJmkhQo1uvXbB8b pZmwqbNZd4s2n6+rnFvgbQDSnIWQHxWyc6JkyLm+NR/+OdQiTc/sIxpDKefmsGdtynr7 uFjOuhym6YYTDOvE+mv5gzgcBQuzEPvsemoJSEa/np63O6tqElukz2SAuzytK2o3BIlf xDbbQS/iEYd84GbYqDDKBdF7V45lClKOs6KZQMJeyz+Uzl0OOv/RS+gKgVchz6BzGB0m 5x2fufRzaPX3i7e6jgTXbKy/iv+/s78dFh3ldZ1BPi3yETgeA/BklUYNrEXeNzMg2sh4 /jTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=trWpCFmc885+Hbmydl7kHMuVBjh6162eTb0KUJVdu8M=; b=oA4w7fmXQgrTS1p89D3qSTfQ42glCHq3yWSyS945quHTW+7VNu6qUnQxg31L1JKil5 ReN+J+d3nOJFQfzdFBWVVkMFVB0KQPubRh+DMqGOCZ02ZAqofo2CWlOAtV787QvtxIWK 13bzMHxBYutbpUK3n6KsJdJNeVsKIdQtGnFfhqkaFX7DwlT9Oeije3lXoB/Q9Sho7sa2 FtDA9MH/MestvwwPY7h8wCRYwWOKiza47lrWQtqFciGDx/ppiUOqZg0q9BhqzvsuKoA3 WDjdMWBokvtFKLXBiLQmkrYz5j0icoeJEUH5CON52hZDbsM2/BVwV+nmVneBeRKovb6b cgRw== X-Gm-Message-State: ACgBeo1A3eG8xGuW6rVRKJSn3GLmTQbN+Z/vhz/CS+84LPrtpZS6eLy4 C0e7SP1BJ6/Tubv1pOq3YbiSXCYXuxA= X-Google-Smtp-Source: AA6agR5ZfEBiPtMraGoKOQIiglSQYZKltjyt4Ctsz31RHVPE07kuVgMYzkojKpeldWJhnZy4GQeGyQ== X-Received: by 2002:a17:902:8bc7:b0:172:c32f:7d30 with SMTP id r7-20020a1709028bc700b00172c32f7d30mr22188206plo.48.1661334116753; Wed, 24 Aug 2022 02:41:56 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.41.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:41:56 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Alexander Bulekov , Andrew Jeffery , Bandan Das , Coiby Xu , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Darren Kenny , "Dr. David Alan Gilbert" , Fam Zheng , Joel Stanley , John Snow , Juan Quintela , Konstantin Kostiuk , Laurent Vivier , Markus Armbruster , Michael Roth , Paolo Bonzini , Peter Maydell , Qiuhao Li , Stefan Hajnoczi , Thomas Huth , qemu-arm@nongnu.org, qemu-block@nongnu.org Subject: [PATCH 07/51] tests: Avoid using hardcoded /tmp in test cases Date: Wed, 24 Aug 2022 17:39:45 +0800 Message-Id: <20220824094029.1634519-8-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Use g_get_tmp_dir() to get the directory to use for temporary files. Signed-off-by: Bin Meng --- tests/qtest/fuzz/generic_fuzz_configs.h | 6 ++++-- tests/qtest/ahci-test.c | 15 +++++++++++---- tests/qtest/aspeed_smc-test.c | 4 +++- tests/qtest/boot-serial-test.c | 8 ++++++-- tests/qtest/cxl-test.c | 9 ++++++--- tests/qtest/fdc-test.c | 4 +++- tests/qtest/fuzz/virtio_blk_fuzz.c | 2 +- tests/qtest/hd-geo-test.c | 8 ++++---- tests/qtest/ide-test.c | 8 ++++++-- tests/qtest/libqtest.c | 10 +++++++--- tests/qtest/migration-test.c | 4 +++- tests/qtest/pflash-cfi02-test.c | 7 +++++-- tests/qtest/qmp-test.c | 4 +++- tests/qtest/vhost-user-blk-test.c | 3 ++- tests/qtest/vhost-user-test.c | 3 ++- tests/qtest/virtio-blk-test.c | 2 +- tests/qtest/virtio-scsi-test.c | 3 ++- tests/unit/test-image-locking.c | 6 ++++-- tests/unit/test-qga.c | 2 +- tests/vhost-user-bridge.c | 3 ++- 20 files changed, 76 insertions(+), 35 deletions(-) diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/generic_fuzz_configs.h index 0775e6702b..d0f9961187 100644 --- a/tests/qtest/fuzz/generic_fuzz_configs.h +++ b/tests/qtest/fuzz/generic_fuzz_configs.h @@ -20,13 +20,15 @@ typedef struct generic_fuzz_config { } generic_fuzz_config; static inline gchar *generic_fuzzer_virtio_9p_args(void){ - char tmpdir[] = "/tmp/qemu-fuzz.XXXXXX"; + char *tmpdir = g_strdup_printf("%s/qemu-fuzz.XXXXXX", g_get_tmp_dir()); g_assert_nonnull(g_mkdtemp(tmpdir)); - return g_strdup_printf("-machine q35 -nodefaults " + gchar *args = g_strdup_printf("-machine q35 -nodefaults " "-device virtio-9p,fsdev=hshare,mount_tag=hshare " "-fsdev local,id=hshare,path=%s,security_model=mapped-xattr," "writeout=immediate,fmode=0600,dmode=0700", tmpdir); + g_free(tmpdir); + return args; } const generic_fuzz_config predefined_configs[] = { diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index f1e510b0ac..f26cd6f86f 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -44,9 +44,9 @@ #define TEST_IMAGE_SIZE_MB_SMALL 64 /*** Globals ***/ -static char tmp_path[] = "/tmp/qtest.XXXXXX"; -static char debug_path[] = "/tmp/qtest-blkdebug.XXXXXX"; -static char mig_socket[] = "/tmp/qtest-migration.XXXXXX"; +static char *tmp_path; +static char *debug_path; +static char *mig_socket; static bool ahci_pedantic; static const char *imgfmt; static unsigned test_image_size_mb; @@ -1437,7 +1437,7 @@ static void test_ncq_simple(void) static int prepare_iso(size_t size, unsigned char **buf, char **name) { - char cdrom_path[] = "/tmp/qtest.iso.XXXXXX"; + char *cdrom_path = g_strdup_printf("%s/qtest.iso.XXXXXX", g_get_tmp_dir()); unsigned char *patt; ssize_t ret; int fd = mkstemp(cdrom_path); @@ -1454,6 +1454,7 @@ static int prepare_iso(size_t size, unsigned char **buf, char **name) *name = g_strdup(cdrom_path); *buf = patt; + g_free(cdrom_path); return fd; } @@ -1872,6 +1873,7 @@ int main(int argc, char **argv) } /* Create a temporary image */ + tmp_path = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); fd = mkstemp(tmp_path); g_assert(fd >= 0); if (have_qemu_img()) { @@ -1889,11 +1891,13 @@ int main(int argc, char **argv) close(fd); /* Create temporary blkdebug instructions */ + debug_path = g_strdup_printf("%s/qtest-blkdebug.XXXXXX", g_get_tmp_dir()); fd = mkstemp(debug_path); g_assert(fd >= 0); close(fd); /* Reserve a hollow file to use as a socket for migration tests */ + mig_socket = g_strdup_printf("%s/qtest-migration.XXXXXX", g_get_tmp_dir()); fd = mkstemp(mig_socket); g_assert(fd >= 0); close(fd); @@ -1947,8 +1951,11 @@ int main(int argc, char **argv) /* Cleanup */ unlink(tmp_path); + g_free(tmp_path); unlink(debug_path); + g_free(debug_path); unlink(mig_socket); + g_free(mig_socket); return ret; } diff --git a/tests/qtest/aspeed_smc-test.c b/tests/qtest/aspeed_smc-test.c index 05ce941566..cab769459c 100644 --- a/tests/qtest/aspeed_smc-test.c +++ b/tests/qtest/aspeed_smc-test.c @@ -608,7 +608,7 @@ static void test_write_block_protect_bottom_bit(void) flash_reset(); } -static char tmp_path[] = "/tmp/qtest.m25p80.XXXXXX"; +static char *tmp_path; int main(int argc, char **argv) { @@ -617,6 +617,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); + tmp_path = g_strdup_printf("%s/qtest.m25p80.XXXXXX", g_get_tmp_dir()); fd = mkstemp(tmp_path); g_assert(fd >= 0); ret = ftruncate(fd, FLASH_SIZE); @@ -646,5 +647,6 @@ int main(int argc, char **argv) qtest_quit(global_qtest); unlink(tmp_path); + g_free(tmp_path); return ret; } diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c index 2f99d71cab..404adcfa20 100644 --- a/tests/qtest/boot-serial-test.c +++ b/tests/qtest/boot-serial-test.c @@ -224,8 +224,10 @@ static bool check_guest_output(QTestState *qts, const testdef_t *test, int fd) static void test_machine(const void *data) { const testdef_t *test = data; - char serialtmp[] = "/tmp/qtest-boot-serial-sXXXXXX"; - char codetmp[] = "/tmp/qtest-boot-serial-cXXXXXX"; + char *serialtmp = g_strdup_printf("%s/qtest-boot-serial-sXXXXXX", + g_get_tmp_dir()); + char *codetmp = g_strdup_printf("%s/qtest-boot-serial-cXXXXXX", + g_get_tmp_dir()); const char *codeparam = ""; const uint8_t *code = NULL; QTestState *qts; @@ -264,6 +266,7 @@ static void test_machine(const void *data) serialtmp, test->extra); if (code) { unlink(codetmp); + g_free(codetmp); } if (!check_guest_output(qts, test, ser_fd)) { @@ -271,6 +274,7 @@ static void test_machine(const void *data) serialtmp); } unlink(serialtmp); + g_free(serialtmp); qtest_quit(qts); diff --git a/tests/qtest/cxl-test.c b/tests/qtest/cxl-test.c index 4e6d285061..b3733cdb5f 100644 --- a/tests/qtest/cxl-test.c +++ b/tests/qtest/cxl-test.c @@ -92,12 +92,13 @@ static void cxl_2root_port(void) static void cxl_t3d(void) { g_autoptr(GString) cmdline = g_string_new(NULL); - char template[] = "/tmp/cxl-test-XXXXXX"; + char *template = g_strdup_printf("%s/cxl-test-XXXXXX", g_get_tmp_dir()); const char *tmpfs; tmpfs = g_mkdtemp(template); g_string_printf(cmdline, QEMU_PXB_CMD QEMU_RP QEMU_T3D, tmpfs, tmpfs); + g_free(template); qtest_start(cmdline->str); qtest_end(); @@ -106,13 +107,14 @@ static void cxl_t3d(void) static void cxl_1pxb_2rp_2t3d(void) { g_autoptr(GString) cmdline = g_string_new(NULL); - char template[] = "/tmp/cxl-test-XXXXXX"; + char *template = g_strdup_printf("%s/cxl-test-XXXXXX", g_get_tmp_dir()); const char *tmpfs; tmpfs = g_mkdtemp(template); g_string_printf(cmdline, QEMU_PXB_CMD QEMU_2RP QEMU_2T3D, tmpfs, tmpfs, tmpfs, tmpfs); + g_free(template); qtest_start(cmdline->str); qtest_end(); @@ -121,7 +123,7 @@ static void cxl_1pxb_2rp_2t3d(void) static void cxl_2pxb_4rp_4t3d(void) { g_autoptr(GString) cmdline = g_string_new(NULL); - char template[] = "/tmp/cxl-test-XXXXXX"; + char *template = g_strdup_printf("%s/cxl-test-XXXXXX", g_get_tmp_dir()); const char *tmpfs; tmpfs = g_mkdtemp(template); @@ -129,6 +131,7 @@ static void cxl_2pxb_4rp_4t3d(void) g_string_printf(cmdline, QEMU_2PXB_CMD QEMU_4RP QEMU_4T3D, tmpfs, tmpfs, tmpfs, tmpfs, tmpfs, tmpfs, tmpfs, tmpfs); + g_free(template); qtest_start(cmdline->str); qtest_end(); diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c index 52ade90a7d..8651100b05 100644 --- a/tests/qtest/fdc-test.c +++ b/tests/qtest/fdc-test.c @@ -68,7 +68,7 @@ enum { DSKCHG = 0x80, }; -static char test_image[] = "/tmp/qtest.XXXXXX"; +static char *test_image; #define assert_bit_set(data, mask) g_assert_cmphex((data) & (mask), ==, (mask)) #define assert_bit_clear(data, mask) g_assert_cmphex((data) & (mask), ==, 0) @@ -608,6 +608,7 @@ int main(int argc, char **argv) int ret; /* Create a temporary raw image */ + test_image = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); fd = mkstemp(test_image); g_assert(fd >= 0); ret = ftruncate(fd, TEST_IMAGE_SIZE); @@ -640,6 +641,7 @@ int main(int argc, char **argv) /* Cleanup */ qtest_end(); unlink(test_image); + g_free(test_image); return ret; } diff --git a/tests/qtest/fuzz/virtio_blk_fuzz.c b/tests/qtest/fuzz/virtio_blk_fuzz.c index 236d078cc8..3e9541a38a 100644 --- a/tests/qtest/fuzz/virtio_blk_fuzz.c +++ b/tests/qtest/fuzz/virtio_blk_fuzz.c @@ -181,7 +181,7 @@ static void drive_destroy(void *path) static char *drive_create(void) { int fd, ret; - char *t_path = g_strdup("/tmp/qtest.XXXXXX"); + char *t_path = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); /* Create a temporary raw image */ fd = mkstemp(t_path); diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index 413cf964c0..dc5d8422ea 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -27,7 +27,7 @@ static char *create_test_img(int secs) { - char *template = strdup("/tmp/qtest.XXXXXX"); + char *template = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); int fd, ret; fd = mkstemp(template); @@ -36,7 +36,7 @@ static char *create_test_img(int secs) close(fd); if (ret) { - free(template); + g_free(template); template = NULL; } @@ -422,7 +422,7 @@ static MBRpartitions empty_mbr = { {false, 0, 0, 0, 0, 0, 0, 0, 0}, static char *create_qcow2_with_mbr(MBRpartitions mbr, uint64_t sectors) { - const char *template = "/tmp/qtest.XXXXXX"; + const char *template = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); char *raw_path = strdup(template); char *qcow2_path = strdup(template); char cmd[100 + 2 * PATH_MAX]; @@ -987,7 +987,7 @@ test_add_done: for (i = 0; i < backend_last; i++) { if (img_file_name[i]) { unlink(img_file_name[i]); - free(img_file_name[i]); + g_free(img_file_name[i]); } } diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index 5bcb75a7e5..ebbf8e0126 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -121,8 +121,8 @@ enum { static QPCIBus *pcibus = NULL; static QGuestAllocator guest_malloc; -static char tmp_path[] = "/tmp/qtest.XXXXXX"; -static char debug_path[] = "/tmp/qtest-blkdebug.XXXXXX"; +static char *tmp_path; +static char *debug_path; static QTestState *ide_test_start(const char *cmdline_fmt, ...) { @@ -1015,11 +1015,13 @@ int main(int argc, char **argv) int ret; /* Create temporary blkdebug instructions */ + debug_path = g_strdup_printf("%s/qtest-blkdebug.XXXXXX", g_get_tmp_dir()); fd = mkstemp(debug_path); g_assert(fd >= 0); close(fd); /* Create a temporary raw image */ + tmp_path = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); fd = mkstemp(tmp_path); g_assert(fd >= 0); ret = ftruncate(fd, TEST_IMAGE_SIZE); @@ -1049,7 +1051,9 @@ int main(int argc, char **argv) /* Cleanup */ unlink(tmp_path); + g_free(tmp_path); unlink(debug_path); + g_free(debug_path); return ret; } diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 7c9fc07de4..34744ace7c 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -265,8 +265,10 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) s = g_new(QTestState, 1); - socket_path = g_strdup_printf("/tmp/qtest-%d.sock", getpid()); - qmp_socket_path = g_strdup_printf("/tmp/qtest-%d.qmp", getpid()); + socket_path = g_strdup_printf("%s/qtest-%d.sock", + g_get_tmp_dir(), getpid()); + qmp_socket_path = g_strdup_printf("%s/qtest-%d.qmp", + g_get_tmp_dir(), getpid()); /* It's possible that if an earlier test run crashed it might * have left a stale unix socket lying around. Delete any @@ -390,9 +392,10 @@ QTestState *qtest_initf(const char *fmt, ...) QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd) { int sock_fd_init; - char *sock_path, sock_dir[] = "/tmp/qtest-serial-XXXXXX"; + char *sock_path, *sock_dir; QTestState *qts; + sock_dir = g_strdup_printf("%s/qtest-serial-XXXXXX", g_get_tmp_dir()); g_assert_true(g_mkdtemp(sock_dir) != NULL); sock_path = g_strdup_printf("%s/sock", sock_dir); @@ -406,6 +409,7 @@ QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd) unlink(sock_path); g_free(sock_path); rmdir(sock_dir); + g_free(sock_dir); g_assert_true(*sock_fd >= 0); diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 52988b86eb..5fa4ffeff0 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2422,7 +2422,8 @@ static bool kvm_dirty_ring_supported(void) int main(int argc, char **argv) { - char template[] = "/tmp/migration-test-XXXXXX"; + char *template = g_strdup_printf("%s/migration-test-XXXXXX", + g_get_tmp_dir()); const bool has_kvm = qtest_has_accel("kvm"); const bool has_uffd = ufd_version_check(); const char *arch = qtest_get_arch(); @@ -2576,6 +2577,7 @@ int main(int argc, char **argv) g_test_message("unable to rmdir: path (%s): %s", tmpfs, strerror(errno)); } + g_free(template); return ret; } diff --git a/tests/qtest/pflash-cfi02-test.c b/tests/qtest/pflash-cfi02-test.c index 7fce614b64..6de83717dd 100644 --- a/tests/qtest/pflash-cfi02-test.c +++ b/tests/qtest/pflash-cfi02-test.c @@ -56,7 +56,7 @@ typedef struct { QTestState *qtest; } FlashConfig; -static char image_path[] = "/tmp/qtest.XXXXXX"; +static char *image_path; /* * The pflash implementation allows some parameters to be unspecified. We want @@ -608,6 +608,7 @@ static void test_cfi_in_autoselect(const void *opaque) static void cleanup(void *opaque) { unlink(image_path); + g_free(image_path); } /* @@ -635,16 +636,18 @@ static const FlashConfig configuration[] = { int main(int argc, char **argv) { + image_path = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); int fd = mkstemp(image_path); if (fd == -1) { g_printerr("Failed to create temporary file %s: %s\n", image_path, strerror(errno)); + g_free(image_path); exit(EXIT_FAILURE); } if (ftruncate(fd, UNIFORM_FLASH_SIZE) < 0) { int error_code = errno; close(fd); - unlink(image_path); + cleanup(NULL); g_printerr("Failed to truncate file %s to %u MB: %s\n", image_path, UNIFORM_FLASH_SIZE, strerror(error_code)); exit(EXIT_FAILURE); diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c index bf7304c7dc..b950dbafaf 100644 --- a/tests/qtest/qmp-test.c +++ b/tests/qtest/qmp-test.c @@ -161,11 +161,12 @@ static void test_qmp_protocol(void) /* Out-of-band tests */ -char tmpdir[] = "/tmp/qmp-test-XXXXXX"; +char *tmpdir; char *fifo_name; static void setup_blocking_cmd(void) { + tmpdir = g_strdup_printf("%s/qmp-test-XXXXXX", g_get_tmp_dir()); if (!g_mkdtemp(tmpdir)) { g_error("g_mkdtemp: %s", strerror(errno)); } @@ -179,6 +180,7 @@ static void cleanup_blocking_cmd(void) { unlink(fifo_name); rmdir(tmpdir); + g_free(tmpdir); } static void send_cmd_that_blocks(QTestState *s, const char *id) diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c index a81c2a2715..07a4c2d500 100644 --- a/tests/qtest/vhost-user-blk-test.c +++ b/tests/qtest/vhost-user-blk-test.c @@ -841,7 +841,8 @@ static char *create_listen_socket(int *fd) char *path; /* No race because our pid makes the path unique */ - path = g_strdup_printf("/tmp/qtest-%d-sock.XXXXXX", getpid()); + path = g_strdup_printf("%s/qtest-%d-sock.XXXXXX", + g_get_tmp_dir(), getpid()); tmp_fd = mkstemp(path); g_assert_cmpint(tmp_fd, >=, 0); close(tmp_fd); diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index d7d6cfc9bd..a41168de25 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -482,7 +482,7 @@ static TestServer *test_server_new(const gchar *name, struct vhost_user_ops *ops) { TestServer *server = g_new0(TestServer, 1); - char template[] = "/tmp/vhost-test-XXXXXX"; + char *template = g_strdup_printf("%s/vhost-test-XXXXXX", g_get_tmp_dir()); const char *tmpfs; server->context = g_main_context_new(); @@ -501,6 +501,7 @@ static TestServer *test_server_new(const gchar *name, server->socket_path = g_strdup_printf("%s/%s.sock", tmpfs, name); server->mig_path = g_strdup_printf("%s/%s.mig", tmpfs, name); server->chr_name = g_strdup_printf("chr-%s", name); + g_free(template); g_mutex_init(&server->data_mutex); g_cond_init(&server->data_cond); diff --git a/tests/qtest/virtio-blk-test.c b/tests/qtest/virtio-blk-test.c index dc5eed31c8..8920ce7c46 100644 --- a/tests/qtest/virtio-blk-test.c +++ b/tests/qtest/virtio-blk-test.c @@ -49,7 +49,7 @@ static void drive_destroy(void *path) static char *drive_create(void) { int fd, ret; - char *t_path = g_strdup("/tmp/qtest.XXXXXX"); + char *t_path = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); /* Create a temporary raw image */ fd = mkstemp(t_path); diff --git a/tests/qtest/virtio-scsi-test.c b/tests/qtest/virtio-scsi-test.c index 8ceb12aacd..33ab6ec685 100644 --- a/tests/qtest/virtio-scsi-test.c +++ b/tests/qtest/virtio-scsi-test.c @@ -268,7 +268,7 @@ static void test_iothread_attach_node(void *obj, void *data, QVirtioSCSIPCI *scsi_pci = obj; QVirtioSCSI *scsi = &scsi_pci->scsi; QVirtioSCSIQueues *vs; - char tmp_path[] = "/tmp/qtest.XXXXXX"; + char *tmp_path = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); int fd; int ret; @@ -309,6 +309,7 @@ static void test_iothread_attach_node(void *obj, void *data, fail: qvirtio_scsi_pci_free(vs); unlink(tmp_path); + g_free(tmp_path); } static void *virtio_scsi_hotplug_setup(GString *cmd_line, void *arg) diff --git a/tests/unit/test-image-locking.c b/tests/unit/test-image-locking.c index ba057bd66c..795c602ff6 100644 --- a/tests/unit/test-image-locking.c +++ b/tests/unit/test-image-locking.c @@ -76,7 +76,7 @@ static void check_locked_bytes(int fd, uint64_t perm_locks, static void test_image_locking_basic(void) { BlockBackend *blk1, *blk2, *blk3; - char img_path[] = "/tmp/qtest.XXXXXX"; + char *img_path = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); uint64_t perm, shared_perm; int fd = mkstemp(img_path); @@ -112,12 +112,13 @@ static void test_image_locking_basic(void) blk_unref(blk3); close(fd); unlink(img_path); + g_free(img_path); } static void test_set_perm_abort(void) { BlockBackend *blk1, *blk2; - char img_path[] = "/tmp/qtest.XXXXXX"; + char *img_path = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); uint64_t perm, shared_perm; int r; int fd = mkstemp(img_path); @@ -140,6 +141,7 @@ static void test_set_perm_abort(void) check_locked_bytes(fd, perm, ~shared_perm); blk_unref(blk1); blk_unref(blk2); + g_free(img_path); } int main(int argc, char **argv) diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c index a05a4628ed..b73d231cd5 100644 --- a/tests/unit/test-qga.c +++ b/tests/unit/test-qga.c @@ -59,7 +59,7 @@ fixture_setup(TestFixture *fixture, gconstpointer data, gchar **envp) fixture->loop = g_main_loop_new(NULL, FALSE); - fixture->test_dir = g_strdup("/tmp/qgatest.XXXXXX"); + fixture->test_dir = g_strdup_printf("%s/qgatest.XXXXXX", g_get_tmp_dir()); g_assert_nonnull(g_mkdtemp(fixture->test_dir)); path = g_build_filename(fixture->test_dir, "sock", NULL); diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index 9b1dab2f28..0da6a6157f 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -631,7 +631,7 @@ static void *notifier_thread(void *arg) static void vubr_host_notifier_setup(VubrDev *dev) { - char template[] = "/tmp/vubr-XXXXXX"; + char *template = g_strdup_printf("%s/vubr-XXXXXX", g_get_tmp_dir()); pthread_t thread; size_t length; void *addr; @@ -640,6 +640,7 @@ vubr_host_notifier_setup(VubrDev *dev) length = qemu_real_host_page_size() * VHOST_USER_BRIDGE_MAX_QUEUES; fd = mkstemp(template); + g_free(template); if (fd < 0) { vubr_die("mkstemp()"); } From patchwork Wed Aug 24 09:39:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953171 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F40CAC00140 for ; Wed, 24 Aug 2022 10:22:17 +0000 (UTC) Received: from localhost ([::1]:55704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnWb-0000cI-3P for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:22:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmte-0002vj-L7; Wed, 24 Aug 2022 05:42:04 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:34581) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmtd-0001WL-44; Wed, 24 Aug 2022 05:42:02 -0400 Received: by mail-pf1-x42e.google.com with SMTP id x19so13186490pfq.1; Wed, 24 Aug 2022 02:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=7LWxjzLiMjVy2izI9dRF2Sjpli2Wn10pIJc7DSpn6QU=; b=brdxMJGzxUwCXxXL4kV2S6/E0Ku999Foeiqquf6mQi3/b3gHgiE6SXy5f+RlSqSsnz 0+mdtqrFDKmqeWGKEZecGnrz2sek+LRQM/pLpEHeF8OOmt7kkGQZuULr6hgmAOJ5q0bl 84rZ184Yxm020cPx1b7Hc2xdScQYWJqOqT5MTPoJ0RZmLWvqBwizoZOG5H46B0JPPTIM eP2V8gaPEoJ1hBbTjY/ejvgvMouDO5CDbSoa49Mjz91OS4NSy/BMgBzBA1cv2HOTRM9s vo+mzoYv0KS7l+ujdCfwmFLBMmCei+Hj27ksrNCYYt5oPr5/6m2dwcXYye1xYj+N0jL9 ZeTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=7LWxjzLiMjVy2izI9dRF2Sjpli2Wn10pIJc7DSpn6QU=; b=yIaDef0FyHoE28sXMZWonTkZS3tTmgqdDUdBbNEiatL0mPVpsKBdDv2WGkFm7CzBSs 5PQ1AdckBVRbp4m95fdEBzO4A4d8jZy8dYzl+g2RPiXcUBnJTuYZYCAwBf0NeaEPwlD7 Gw1yfmuMilcax+cjW39HSlxkFFvS+j8uRbLQ0ivZ9R/pe3wUVN8OFyjbmWOML5lTWrm/ SFIq7mHiTQuPEqJJd6c15cnPJQZVRMzRY14Fh9dr33lPUNkglsu6lgW+BcUemTgkSubu kWmG/MVbdGC6qwFsoTimOh4yraZF422H7mVES+9+yYMOZkt3kNTxCMIECMLhfv2eCYyb lhKA== X-Gm-Message-State: ACgBeo2FwyGEU1DOPEpgN/9n03ZDiqxve0neL9i2+dtRsViM0B+Hsluz 26pZgHQ8PRbGQLESxxm3x8hpUuCVElE= X-Google-Smtp-Source: AA6agR5v/k8hr1mxNevhLJOqumg6Wn3LkoHhqDmQk7vcQw4U/bv+iHEsgxrihGpE0HpyeJOzfsoAjQ== X-Received: by 2002:a65:6c10:0:b0:429:4a5:a4d0 with SMTP id y16-20020a656c10000000b0042904a5a4d0mr24185074pgu.614.1661334119236; Wed, 24 Aug 2022 02:41:59 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:41:58 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Hanna Reitz , Kevin Wolf , qemu-block@nongnu.org Subject: [PATCH 08/51] block/vvfat: Unify the mkdir() call Date: Wed, 24 Aug 2022 17:39:46 +0800 Message-Id: <20220824094029.1634519-9-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng There is a difference in the mkdir() call for win32 and non-win32 platforms, and currently is handled in the codes with #ifdefs. glib provides a portable g_mkdir_with_parents() API and we can use it to unify the codes without #ifdefs. Signed-off-by: Bin Meng --- block/vvfat.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/block/vvfat.c b/block/vvfat.c index d6dd919683..9c389ce5ea 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2726,13 +2726,9 @@ static int handle_renames_and_mkdirs(BDRVVVFATState* s) mapping_t* mapping; int j, parent_path_len; -#ifdef __MINGW32__ - if (mkdir(commit->path)) + if (g_mkdir_with_parents(commit->path, 0755)) { return -5; -#else - if (mkdir(commit->path, 0755)) - return -5; -#endif + } mapping = insert_mapping(s, commit->param.mkdir.cluster, commit->param.mkdir.cluster + 1); From patchwork Wed Aug 24 09:39:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953158 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89BD5C32793 for ; Wed, 24 Aug 2022 10:09:13 +0000 (UTC) Received: from localhost ([::1]:39746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnJw-00044Y-Bb for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:09:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmtf-0002w5-Jy for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:04 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:36580) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmte-0001NS-3Q for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:03 -0400 Received: by mail-pf1-x42b.google.com with SMTP id w29so10407716pfj.3 for ; Wed, 24 Aug 2022 02:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=uGLFIworI1xOFZhnwuk3wq/AntR+XkzGoiU2XFOTgo0=; b=hK3zf2SdQjnuubDCuPzkm2tPHXZvcyonSeV/7cfAvKHhaTWgLvDrirR1wgCLudhaO9 EHyM5BUvxz0urxbDwRrsyvqGkF8nAwizB5HeZkxby0IFXTICcDoMgRcgOl1O5oAR+3Ud 52BPnhCaufzCWEIEWyMNjJTO8vtHOD/lqEXUKZtT3FcgbSr0BjXxy2ocxRzy7lbvgacR stlK8n6mAUySGE5hmmS91CF4bBNIP0Ei/LeNAlWqEoFZFCVmDtidOaYeCrPyJY0P/QjA 8MVPYDKiYYhiGQ3icK/ESlqomNAqN1zAHrXsRuW2TniGgTUilk6L64rnaYxip2sO3tP4 eJvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=uGLFIworI1xOFZhnwuk3wq/AntR+XkzGoiU2XFOTgo0=; b=c615jSQIZjORRNlL2VJlpjYuMblGAUGcrOqLxd4XDDiIXorfoXoA1Cytq383m0nYnw 1Uuq4VydndeRdqPomMLcQOFFk9006S7GV+YxfWxuO3y5t7912MfNwTWyih+sv61s8Xmq G/KrsPz2U3X2gtYXVNIjgSTFFvgdrgHY9l2BbQ9/CWGS99AM1P1eckT5ZeHSS2s+udSW Eto0E0q6Y2SqZs08uoo7UryijTkwWLLgzbtYUxJpqCxGTLO4+hYzgMyWriMigcpJElLN PcDEoifzsrvVFJNf7Plhxb/++TZV7ipH40uM0vm6YM7y2JsKWytzm2k6/uqkRDwln3sT w9JQ== X-Gm-Message-State: ACgBeo1WlzvRONqxKnkQlJqneugyzNtwTwiLwk3q0haIfLAnmPjL9YtP y2FAnWEg/PHfp2UQCVE39tU1wr9jBk4= X-Google-Smtp-Source: AA6agR5HL6ux2y05GQJjqW4yDOr+iimfNi1fY83MnW1Vi0+bCpgTOtPZJTGNZnjWjx1t+FNgqzAM9Q== X-Received: by 2002:a63:18d:0:b0:42b:321e:b55 with SMTP id 135-20020a63018d000000b0042b321e0b55mr406888pgb.39.1661334121145; Wed, 24 Aug 2022 02:42:01 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:00 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Christian Schoenebeck , Greg Kurz Subject: [PATCH 09/51] fsdev/virtfs-proxy-helper: Use g_mkdir_with_parents() Date: Wed, 24 Aug 2022 17:39:47 +0800 Message-Id: <20220824094029.1634519-10-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Use the same g_mkdir_with_parents() call to create a directory on all platforms. Signed-off-by: Bin Meng --- fsdev/virtfs-proxy-helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index 2dde27922f..d0cf76d6d1 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -639,7 +639,7 @@ static int do_create_others(int type, struct iovec *iovec) if (retval < 0) { goto err_out; } - retval = mkdir(path.data, mode); + retval = g_mkdir_with_parents(path.data, mode); break; case T_SYMLINK: retval = proxy_unmarshal(iovec, offset, "ss", &oldpath, &path); From patchwork Wed Aug 24 09:39:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953147 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58ABEC00140 for ; Wed, 24 Aug 2022 09:53:32 +0000 (UTC) Received: from localhost ([::1]:41962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQn4l-0004So-7a for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 05:53:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmtj-0002xG-RP for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:09 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:46997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmth-0001Wm-71 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:07 -0400 Received: by mail-pj1-x102f.google.com with SMTP id o14-20020a17090a0a0e00b001fabfd3369cso944536pjo.5 for ; Wed, 24 Aug 2022 02:42:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=okL54vu8KfmBMW82fUAkEZfCTjhZQ+qL9qNrcu24ZKE=; b=FULijv6JOJ5jD36MfgHbXDe1LFAZbDtmXhukncB6/emRjx4LoHOoscfoM47iKCm5p8 Zjjcyy8uaCSXcjMAPaphEAj2GrE5FLdouimrEu2Yjcb7cn/pDBUY1d7zo1/RSY8zmiam Ps/bfDefgd3YkjIycCwNhCyTREj+ltvLu9x8gttR8aG+AXhj5oEbqQqTwqCSnWQIHebx kDr2ycNn4H0C1UlGuhJghBicBRMtneiPfZmqC3GekAVCMPx3uqfOkwIZyPlxh5PCdg/0 xVuePhq/2GYfTuolfg9WiIVrWxouy8cx9N63s58PY4aUXWd6gK9mTWjPs7m8nO1vAgrD emvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=okL54vu8KfmBMW82fUAkEZfCTjhZQ+qL9qNrcu24ZKE=; b=xMVOTa0BfscjQ25fRqxTNqi4e3D/erbI8UNy8Q064bB/wyZhi8/V9jZ5go4ivdVKeT 7jQyouGGSAcgNbD9ihBXVtJbXnFK/mqLgB6cjBbpwJuaNPBfArhvswFpiIVVlIgt2pOr Iu+Gug+GGS8exHiqgcqv0Nf4eFVEJHavIw/c8sTYfaSucpg1gn7lxo8yEtZkBBBE05lk 96KoorvAkhYwH3cnnyWnofpaXxw3NO8bmsVQt5Plsa3NEvqZEnn0sOfuWWM6Dqhw/nEu YruuJVoZ9JDqPJ0dzvi2KKnLSJfVeLBR4f0Tp8lq5YeKgYdhej4ipJF4b2hawwCR6+TE FbiA== X-Gm-Message-State: ACgBeo0hebUeGZEbsfoDoo439+6UuqqeQ6FAb8ZHjKKkfxqRavbAe8FJ 11bQuEXFyrzUGuy1eyE0XNs/k5FxtNE= X-Google-Smtp-Source: AA6agR78K0zd6IKnw/srvkSGYqPCa3h6gsk1dDJ8TQSAdKdFECekouX+FjYs0eaKDvn+JaJvj7r1JA== X-Received: by 2002:a17:90a:640c:b0:1f7:6ecf:33b6 with SMTP id g12-20020a17090a640c00b001f76ecf33b6mr7430107pjj.3.1661334122960; Wed, 24 Aug 2022 02:42:02 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:02 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Gerd Hoffmann Subject: [PATCH 10/51] hw/usb: dev-mtp: Use g_mkdir_with_parents() Date: Wed, 24 Aug 2022 17:39:48 +0800 Message-Id: <20220824094029.1634519-11-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Use the same g_mkdir_with_parents() call to create a directory on all platforms. Signed-off-by: Bin Meng --- hw/usb/dev-mtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 5831395cef..97c894f231 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -1622,7 +1622,7 @@ static void usb_mtp_write_data(MTPState *s, uint32_t handle) if (s->dataset.filename) { path = g_strdup_printf("%s/%s", parent->path, s->dataset.filename); if (s->dataset.format == FMT_ASSOCIATION) { - ret = mkdir(path, mask); + ret = g_mkdir_with_parents(path, mask); if (!ret) { usb_mtp_queue_result(s, RES_OK, d->trans, 3, QEMU_STORAGE_ID, From patchwork Wed Aug 24 09:39:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3183BC00140 for ; Wed, 24 Aug 2022 09:55:38 +0000 (UTC) Received: from localhost ([::1]:46866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQn6l-0006Hl-EW for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 05:55:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmtk-0002xI-Gl for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:09 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:34742) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmtj-0001Ww-1V for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:08 -0400 Received: by mail-pg1-x529.google.com with SMTP id 12so14557690pga.1 for ; Wed, 24 Aug 2022 02:42:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=SN2ceznSVxwoPTz/GsOpvn+I87JiMhfV5WRmzyHm7SU=; b=euH1A8kw3PSGPH/748aMxpJ3UvnjdLxXSmTRJXdLMbJb9g+3IbiwQzI64ILAiSdwNN 54vo9PevczcGqX6rfGJuiHYI5J+MFgTWYYczpDrehWIGYm/upFtjA3d4MSCpBrg0b5Cj 0ucCrSu75IbahCpqq4PYP6ZMY5x7UQZoDSmSBZ1Vo+uxLNKUlhlJOHI+dU5ls1VrNruQ bh712Sp6QKB4S2k9U1hauovu79vgjhxcw4wbyyHTDpMUQdQuLH2bTWxuvWewmtUGFWSu TwTalVjmxsPzzh1fHPvGhRZxYd8vyeygUH4G2PGE3ZBWPCfx0n4LHskt8416kCfu8JPq cWOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=SN2ceznSVxwoPTz/GsOpvn+I87JiMhfV5WRmzyHm7SU=; b=WHyLhUtK6AZTPGHatkcoxs/qopc67RUZEIBq7wPRWGStxPHP09NOA2fO5hMq6eY+gJ xjidBsNy95D+pvSyktXW6cPZcRcV3x6hRMA9qTgPu3OStKqZpfNhHWf9G6O1owBhf8ls YHLmlgzC+EZag8kjhe80tWnggmFbJ2lDMQzkipgR4apjNgNXfsM2djdUMytJztnC9bd6 Rgmvf4jIxngnPFhp2BxWy1QRLPoyAaXUOg23fL5DA7uv1ipWDPpkaoLUpOioYO8koQBB VlBJhDH+HLRyUgoXZZLm4U8n9C2YCEndBWbD3PoIlME3qPgMgg68gkxSBZ4Wd8jhNaam XpQg== X-Gm-Message-State: ACgBeo2iE7dGkX/6BJd1HlWlY0hET+Zt1HjPkFqzK5okJUjmKEcCnzdw L4l2nGuPq8J7CUYX+AlC9PQKKq4ldCo= X-Google-Smtp-Source: AA6agR78wfyQrmvdUm2ADf0XWO+XOecbi91ZQpIrMp0ueeij7sZ4uSEHdZouuCujGBoZxF5UZ3H7rQ== X-Received: by 2002:a65:6bca:0:b0:420:712f:ab98 with SMTP id e10-20020a656bca000000b00420712fab98mr23709916pgw.350.1661334124925; Wed, 24 Aug 2022 02:42:04 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:04 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Konstantin Kostiuk , Michael Roth Subject: [PATCH 11/51] qga/commands-posix-ssh: Use g_mkdir_with_parents() Date: Wed, 24 Aug 2022 17:39:49 +0800 Message-Id: <20220824094029.1634519-12-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng g_mkdir() is a deprecated API and newer codes should use g_mkdir_with_parents(). Signed-off-by: Bin Meng Reviewed-by: Konstantin Kostiuk --- qga/commands-posix-ssh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c index f3a580b8cc..2460112a38 100644 --- a/qga/commands-posix-ssh.c +++ b/qga/commands-posix-ssh.c @@ -59,7 +59,7 @@ static bool mkdir_for_user(const char *path, const struct passwd *p, mode_t mode, Error **errp) { - if (g_mkdir(path, mode) == -1) { + if (g_mkdir_with_parents(path, mode) == -1) { error_setg(errp, "failed to create directory '%s': %s", path, g_strerror(errno)); return false; From patchwork Wed Aug 24 09:39:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19042C00140 for ; Wed, 24 Aug 2022 10:14:30 +0000 (UTC) Received: from localhost ([::1]:33694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnP2-0001pm-UG for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:14:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmtp-0002zl-KK for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:14 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:45001) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmtn-0001XG-Pg for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:13 -0400 Received: by mail-pj1-x102c.google.com with SMTP id r15-20020a17090a1bcf00b001fabf42a11cso948658pjr.3 for ; Wed, 24 Aug 2022 02:42:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=PVY8h/tTrArd5DSKz6bRlz61yqGVT8tU2bwvHb4Unqc=; b=WxF1douoWH8KazljzpJ5yLjNHi0hLOKo9lyYLRBSQrWBJM3WGtNE/AaQTx0xGx7Do+ JGGci4dx32MP3bfFdLQBi4XxfYilHUjdihe17B8h+CKkoQcpLW0lI3Lk88PJWvEaWaHH 4djOkyDQBwtjOD7zktx78NF8oj8FYdrunvOOV6yp5wgqk2sN3oov7RYeFBOZqHo7n1oM WcMVBvF9y9fRMj1a8eH9v7iF748+TIL3bXrwHUKZGRl2Kn0myHWz5nA5YZ0s5vyWbjAa +awnweay1AJ7Hln8GX5DyeucdSXKDAMip6+pGuusxZJuOXvythjlN2NjfD/llNeKLnlo P3Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=PVY8h/tTrArd5DSKz6bRlz61yqGVT8tU2bwvHb4Unqc=; b=QNEIyUm1WLjQQ8tku1pdRTqKGC7IvLkUG/Dgs7azGHW75W9509Rn08r2Lnkts5PMWD Oh8NAnX1lZ5nBE22HupTcTdkvmJcouzoOnsJoxa9ixmlRjMIHNAZBxj0M9jT/p6gis46 5kH8xd7fixdzz1yN0PP6U4QxqmD9TvPm4sr2aC3WarLufDBGy3I/Hu/dVLlc4MBIOL0T HTWs7qBakKBF4u22tEkm7wN5UjoGy18W/3MMNK3mQIB16jrPD83swFNo+2brNZe4gwls +18xdDVghmTw4m5nGLr8+iAHkGZtvAagoFUABXis7Z6UKgDPWJzKV/rPArwJl4f7Xgmh YIkw== X-Gm-Message-State: ACgBeo1j0P7Z8+2n67DuOk5Q+xh+pXh4tLHbjY6xlUFPDwHyzQxZn9cs YnQEuoxqo64gj4ls+aDwnekzq/xH2Yo= X-Google-Smtp-Source: AA6agR5qiODdXLnZnXyZiVGECY1Dw3npyrjo9fPV63p4ULNYkJCXUUXCl9kEmSve0I+880unBC7z2Q== X-Received: by 2002:a17:90a:ee88:b0:1fa:aac3:6fb7 with SMTP id i8-20020a17090aee8800b001faaac36fb7mr7379816pjz.62.1661334127901; Wed, 24 Aug 2022 02:42:07 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:07 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Dr. David Alan Gilbert" , Juan Quintela , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 12/51] tests: Use g_mkdir_with_parents() Date: Wed, 24 Aug 2022 17:39:50 +0800 Message-Id: <20220824094029.1634519-13-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Use the same g_mkdir_with_parents() call to create a directory on all platforms. Signed-off-by: Bin Meng Reviewed-by: Dr. David Alan Gilbert --- tests/migration/stress.c | 2 +- tests/qtest/migration-test.c | 6 +++--- tests/unit/test-crypto-tlscredsx509.c | 4 ++-- tests/unit/test-crypto-tlssession.c | 6 +++--- tests/unit/test-io-channel-tls.c | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/migration/stress.c b/tests/migration/stress.c index b7240a15c8..88acf8dc25 100644 --- a/tests/migration/stress.c +++ b/tests/migration/stress.c @@ -232,7 +232,7 @@ static void stress(unsigned long long ramsizeGB, int ncpus) static int mount_misc(const char *fstype, const char *dir) { - if (mkdir(dir, 0755) < 0 && errno != EEXIST) { + if (g_mkdir_with_parents(dir, 0755) < 0 && errno != EEXIST) { fprintf(stderr, "%s (%05d): ERROR: cannot create %s: %s\n", argv0, gettid(), dir, strerror(errno)); return -1; diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 5fa4ffeff0..38356d4aba 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -761,14 +761,14 @@ test_migrate_tls_psk_start_common(QTestState *from, data->workdir = g_strdup_printf("%s/tlscredspsk0", tmpfs); data->pskfile = g_strdup_printf("%s/%s", data->workdir, QCRYPTO_TLS_CREDS_PSKFILE); - mkdir(data->workdir, 0700); + g_mkdir_with_parents(data->workdir, 0700); test_tls_psk_init(data->pskfile); if (mismatch) { data->workdiralt = g_strdup_printf("%s/tlscredspskalt0", tmpfs); data->pskfilealt = g_strdup_printf("%s/%s", data->workdiralt, QCRYPTO_TLS_CREDS_PSKFILE); - mkdir(data->workdiralt, 0700); + g_mkdir_with_parents(data->workdiralt, 0700); test_tls_psk_init_alt(data->pskfilealt); } @@ -873,7 +873,7 @@ test_migrate_tls_x509_start_common(QTestState *from, data->clientcert = g_strdup_printf("%s/client-cert.pem", data->workdir); } - mkdir(data->workdir, 0700); + g_mkdir_with_parents(data->workdir, 0700); test_tls_init(data->keyfile); g_assert(link(data->keyfile, data->serverkey) == 0); diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c index aab4149b56..3c25d75ca1 100644 --- a/tests/unit/test-crypto-tlscredsx509.c +++ b/tests/unit/test-crypto-tlscredsx509.c @@ -75,7 +75,7 @@ static void test_tls_creds(const void *opaque) QCryptoTLSCreds *creds; #define CERT_DIR "tests/test-crypto-tlscredsx509-certs/" - mkdir(CERT_DIR, 0700); + g_mkdir_with_parents(CERT_DIR, 0700); unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT); if (data->isServer) { @@ -141,7 +141,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1); - mkdir(WORKDIR, 0700); + g_mkdir_with_parents(WORKDIR, 0700); test_tls_init(KEYFILE); diff --git a/tests/unit/test-crypto-tlssession.c b/tests/unit/test-crypto-tlssession.c index f222959d36..615a1344b4 100644 --- a/tests/unit/test-crypto-tlssession.c +++ b/tests/unit/test-crypto-tlssession.c @@ -249,8 +249,8 @@ static void test_crypto_tls_session_x509(const void *opaque) #define CLIENT_CERT_DIR "tests/test-crypto-tlssession-client/" #define SERVER_CERT_DIR "tests/test-crypto-tlssession-server/" - mkdir(CLIENT_CERT_DIR, 0700); - mkdir(SERVER_CERT_DIR, 0700); + g_mkdir_with_parents(CLIENT_CERT_DIR, 0700); + g_mkdir_with_parents(SERVER_CERT_DIR, 0700); unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT); unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT); @@ -398,7 +398,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1); - mkdir(WORKDIR, 0700); + g_mkdir_with_parents(WORKDIR, 0700); test_tls_init(KEYFILE); test_tls_psk_init(PSKFILE); diff --git a/tests/unit/test-io-channel-tls.c b/tests/unit/test-io-channel-tls.c index f6fb988c01..cc39247556 100644 --- a/tests/unit/test-io-channel-tls.c +++ b/tests/unit/test-io-channel-tls.c @@ -125,8 +125,8 @@ static void test_io_channel_tls(const void *opaque) #define CLIENT_CERT_DIR "tests/test-io-channel-tls-client/" #define SERVER_CERT_DIR "tests/test-io-channel-tls-server/" - mkdir(CLIENT_CERT_DIR, 0700); - mkdir(SERVER_CERT_DIR, 0700); + g_mkdir_with_parents(CLIENT_CERT_DIR, 0700); + g_mkdir_with_parents(SERVER_CERT_DIR, 0700); unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT); unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT); @@ -273,7 +273,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1); - mkdir(WORKDIR, 0700); + g_mkdir_with_parents(WORKDIR, 0700); test_tls_init(KEYFILE); From patchwork Wed Aug 24 09:39:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92295C00140 for ; Wed, 24 Aug 2022 10:20:37 +0000 (UTC) Received: from localhost ([::1]:43148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnUy-0007kS-B0 for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:20:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmtp-0002zk-Es for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:14 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:42698) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmtn-0001XS-VP for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:13 -0400 Received: by mail-pg1-x52b.google.com with SMTP id q63so308900pga.9 for ; Wed, 24 Aug 2022 02:42:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=W9655HKzuq1+51j74aBikX9dYDW+xgLkZuf/6fT2hgM=; b=LZ9T9xLYEDIxRmLrG3Z7caIqTnkKVucJaTIwdnqgRI/rNSwVne+Fh72ubSqCSFhn2B wuRns4mpJjX9lUQZikwgTmzTJIpzKmdAycv7DYJp3C2lcrK/6qXJ4qX4jzgcj02KO3Ur axb1Y7YVfrhiuCeFyT1U0GX1E4xh4W14vPlhvxgK487CNk+RkC4hN9LkVhO4E/a6TxUD hBUYaVAz8kB6mSKmq5E0W3y/38IbogIQOBSEwsn/cL6xyUsESHMg45y2xPxz2bEoc5Yn CMpw6rWI/C8kIghPoMNFwvzgpMf+VBfkaKe8GNiMGBUeuEe6j5qv6yo2SBLlmVGrtTV7 dcnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=W9655HKzuq1+51j74aBikX9dYDW+xgLkZuf/6fT2hgM=; b=VPU07YZGN03kYYnHGWub+T3O5zuqgHew3C8uYW9K5o15BjIi8aFZgWu6PJpJaiI2Dr 1X7xcudo482GZ09mYOYoIIBdiLgdkdSeucpQ0CYy4d12lkYUNo4IuN+Wu9/VwWIjFk3u eXGEWon1X34MlplsNhOQu6PHmmQ6gJJvq6t+BArUUou8c0tuSn0nBNxOOs7Bnka7C9Ma gMhlycttNt+v8Xsb2vqsroXbCZ15rn2ukeVfbr15EPyTXbCMtgW0xe4tdURguCu+vce1 o8u1PlzXmc9QKjd2Msjoh5kOirEx1n0ZITg/YZl0lyYy/whsMNIH8d21hpYTfyKbfh/r Juzw== X-Gm-Message-State: ACgBeo13Vh5nYHCxPwc/dYdaQfB+EkUWwhQsbPXxHf0A6gQx2RRorUAB FmuEg8p0vTq00IsKQeLIZiA8lAQrX5Y= X-Google-Smtp-Source: AA6agR4SM2xNBCe3ylE4R19QBJfDEEq6QBITiQSsCCr2necm9ff4/U1il/2Qt/bPhz+KUh5aL9GWyA== X-Received: by 2002:a62:be0e:0:b0:536:76fe:ee96 with SMTP id l14-20020a62be0e000000b0053676feee96mr14546120pff.44.1661334130469; Wed, 24 Aug 2022 02:42:10 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:10 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , "Dr. David Alan Gilbert" , Juan Quintela , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 13/51] tests/qtest: migration-test: Handle link() for win32 Date: Wed, 24 Aug 2022 17:39:51 +0800 Message-Id: <20220824094029.1634519-14-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Windows does not provide a link() API like POSIX. Instead it provides a similar API CreateHardLink() that does the same thing, but with different argument order and return value. Signed-off-by: Bin Meng Reviewed-by: Dr. David Alan Gilbert --- tests/qtest/migration-test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 38356d4aba..af9250750b 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -876,9 +876,17 @@ test_migrate_tls_x509_start_common(QTestState *from, g_mkdir_with_parents(data->workdir, 0700); test_tls_init(data->keyfile); +#ifndef _WIN32 g_assert(link(data->keyfile, data->serverkey) == 0); +#else + g_assert(CreateHardLink(data->serverkey, data->keyfile, NULL) != 0); +#endif if (args->clientcert) { +#ifndef _WIN32 g_assert(link(data->keyfile, data->clientkey) == 0); +#else + g_assert(CreateHardLink(data->clientkey, data->keyfile, NULL) != 0); +#endif } TLS_ROOT_REQ_SIMPLE(cacertreq, data->cacert); From patchwork Wed Aug 24 09:39:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953174 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1204CC32796 for ; Wed, 24 Aug 2022 10:26:25 +0000 (UTC) Received: from localhost ([::1]:37028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnaa-0005CR-3Q for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:26:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmtr-00031p-Vp for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:15 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:34553) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmtp-0001Xc-HY for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:14 -0400 Received: by mail-pl1-x635.google.com with SMTP id io24so1898118plb.1 for ; Wed, 24 Aug 2022 02:42:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=3b8VL5TpGtN7dWhCerIisYEccmQt7giekuIGaaaF6O8=; b=qjaaqfAWuFwFCJHnVsNpJJ4gN1ZDvHmCZyVyO4SqM97cld8qBtRn0kZg6ii5eWL4mQ 4AI1pqRO7A1G6V85mw18rNARWTtZgxG54oPSuhyDplklrcoa3sPoToZv60SHmGzqznp7 RCXAiGvk9Dczt2OPMbctu7lNYMCrQ9VTgXmeO2UFijR6sMbrHlw81TJ+zw2fZmS8SfkF pt6hqMjnehG6SHtCfnQV9GlSjGovSzRH9wsNOo7PkISsBv8C66soAKI6OkGtQ7JV68Ed qdp6QyNBUY7kBFo/NFE0eu1yZFVpe/ETKUxUEurFPC/r1qWcSuAeiQVbsoGtBOhkPD3J W3Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=3b8VL5TpGtN7dWhCerIisYEccmQt7giekuIGaaaF6O8=; b=uai9jVRGSynNRRNuHcIB7OBstjVIhRGG87/n78ve26FCinJJuKePYG43kwj+asjwnU /PSgQzxdDN6bp3IVdLrgwGqTqkPsCaNV6kRX+Ti6DV8HU/a4e5TwLy3qqgfJIFQ54I7d /o/khIQDrAPT24l7Hievr8PmZC899zXjAfMgaJtbZ40l4EAgvF+5RTIDe+buiTBk//ny 5zzE0E5BGBU8q2ZUe58EWIZyQHWjPs4yHHIQ0thc65saIUfz7OrXwiLke133Htz/AeKu KhphO+LHnfmLiGpYAzJMfkLwaDYG8lXiQXds4YevEZjNd3AW4ybBd/xZAlwSBO3KW4NY G9IQ== X-Gm-Message-State: ACgBeo26Hwu2ep+EAbTIcmPNqcErKh2sOyXIkNI1NfkFblCEZ9FnF/64 C2IZWPJuLPHXC9BuTvxskNaP2UOV2Xw= X-Google-Smtp-Source: AA6agR5TBeQk+xNJ/7wJcR3S3X6PS/Fvdo+awDk7uXMldiZ9G0Do5uNda7Y3iC5uEX0W7ux4dY1GSg== X-Received: by 2002:a17:90b:4a51:b0:1f5:8308:6ed7 with SMTP id lb17-20020a17090b4a5100b001f583086ed7mr7374559pjb.177.1661334132149; Wed, 24 Aug 2022 02:42:12 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:11 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Stefan Berger Subject: [PATCH 14/51] backends/tpm: Exclude headers and macros that don't exist on win32 Date: Wed, 24 Aug 2022 17:39:52 +0800 Message-Id: <20220824094029.1634519-15-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng These headers and macros do not exist on Windows. Exclude them. Signed-off-by: Bin Meng Reviewed-by: Stefan Berger Reviewed-by: Marc-André Lureau --- backends/tpm/tpm_ioctl.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h index bd6c12cb86..d67bf0283b 100644 --- a/backends/tpm/tpm_ioctl.h +++ b/backends/tpm/tpm_ioctl.h @@ -9,8 +9,10 @@ #ifndef TPM_IOCTL_H #define TPM_IOCTL_H +#ifndef _WIN32 #include #include +#endif #ifdef HAVE_SYS_IOCCOM_H #include @@ -222,6 +224,7 @@ typedef struct ptm_setbuffersize ptm_setbuffersize; #define PTM_CAP_SET_DATAFD (1 << 12) #define PTM_CAP_SET_BUFFERSIZE (1 << 13) +#ifndef _WIN32 enum { PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap), PTM_INIT = _IOWR('P', 1, ptm_init), @@ -241,6 +244,7 @@ enum { PTM_SET_DATAFD = _IOR('P', 15, ptm_res), PTM_SET_BUFFERSIZE = _IOWR('P', 16, ptm_setbuffersize), }; +#endif /* * Commands used by the non-CUSE TPMs From patchwork Wed Aug 24 09:39:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2E3BC00140 for ; Wed, 24 Aug 2022 10:00:56 +0000 (UTC) Received: from localhost ([::1]:35042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnBt-0004ss-TL for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:00:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmtt-00033f-E3 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:19 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:40744) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmtr-0001Y0-SW for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:17 -0400 Received: by mail-pj1-x1034.google.com with SMTP id t11-20020a17090a510b00b001fac77e9d1fso999675pjh.5 for ; Wed, 24 Aug 2022 02:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=hgOj9FjN0Z4iHtZUWCA3zZlRYozZrWgeApjdLVSDtro=; b=Hs3oV/eG9UUNQsyok72N5M4Xj5fnLk9ESMEmuiII03ti3QEg9QQe7tDAPnpN7FsIv6 PuLMW/sbLNua8LfW0p4hVWGbhngxkw/7AcLPBwEp01RUKfwabF4AhrtTzJLiz9wcw+37 iSuBZV3GQ+1nz6JlLO8YOPR+e7oze770qgQ1PKeykiBI5XURyEVs60Z3hwmtom5DYGiQ EOu0iTraXg9pazVJCTq+o6jLC6d6MN8RXLxNZd8rCcRbus3KKe0VKHav6LNNLmWTraum KR8qagi83zbkG9Wt7k1JlmfUFKZmj0IjGTTeCCahEmabSl2UigNHw48sqbN/4XC5sJY6 4IVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=hgOj9FjN0Z4iHtZUWCA3zZlRYozZrWgeApjdLVSDtro=; b=dDakH25aBtta/IIMH5gn1AywuiYW1mumpMknA8+IDw2cEvIhr5uOSbP117otNO5elQ l6inslchnGDbzdFKrw6d/wJ0griCWZ3JTZ2gHmZ0kF+GeRJPPMHwK7SKepFtlTq5DCmw oy0H0dm9fMHmiHDsvvRJNiUSy6sOxdqIDEl0xpx6jhEPlrvJv8il3gD7nEuoMZsnAzVq C9/dVsbiW3Z1+P6yfU1L1rP6Rmj1cays+4jEhnvER54bPwrVaU1qt3BaN7OuU6nI8xXA 7g+Wvss0vFcQVDsP3egozR31GCwy1uCLmp+E8GlbyqEfvZJtZAS07gB9HuxqJoDqWunp x+KA== X-Gm-Message-State: ACgBeo2w0YJE8v3nL1S32cEsxP1HpUCgW6nRB1UUx+9RXDEWMf47hDiy YuZyvryJPvAN5pV8QKlAKeoLPju4o1Y= X-Google-Smtp-Source: AA6agR613Q0tucCxEj4eWjptogZOl/Ts5u43bz7w9ldVLr0zFr5XDG936ObpcvmxJezpG0aLJcJFPg== X-Received: by 2002:a17:90a:6b0d:b0:1fa:c6fe:db6 with SMTP id v13-20020a17090a6b0d00b001fac6fe0db6mr7428055pjj.99.1661334134386; Wed, 24 Aug 2022 02:42:14 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:14 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 15/51] tests/qtest: Adapt {m48t59,rtc}-test cases for win32 Date: Wed, 24 Aug 2022 17:39:53 +0800 Message-Id: <20220824094029.1634519-16-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng There is no tm_gmtoff member in 'struct tm' on Windows. Update rtc-test.c and m48t59-test.c accordingly. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth --- tests/qtest/m48t59-test.c | 2 +- tests/qtest/rtc-test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/m48t59-test.c b/tests/qtest/m48t59-test.c index b94a1230f7..843d2ced8e 100644 --- a/tests/qtest/m48t59-test.c +++ b/tests/qtest/m48t59-test.c @@ -137,7 +137,7 @@ static void cmos_get_date_time(QTestState *s, struct tm *date) date->tm_mday = mday; date->tm_mon = mon - 1; date->tm_year = base_year + year - 1900; -#ifndef __sun__ +#if !defined(__sun__) && !defined(_WIN32) date->tm_gmtoff = 0; #endif diff --git a/tests/qtest/rtc-test.c b/tests/qtest/rtc-test.c index 8126ab1bdb..02ed4e1238 100644 --- a/tests/qtest/rtc-test.c +++ b/tests/qtest/rtc-test.c @@ -111,7 +111,7 @@ static void cmos_get_date_time(struct tm *date) date->tm_mday = mday; date->tm_mon = mon - 1; date->tm_year = base_year + year - 1900; -#ifndef __sun__ +#if !defined(__sun__) && !defined(_WIN32) date->tm_gmtoff = 0; #endif From patchwork Wed Aug 24 09:39:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 287A0C00140 for ; Wed, 24 Aug 2022 10:06:48 +0000 (UTC) Received: from localhost ([::1]:33092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnHb-0002mD-63 for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:06:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmtu-00033q-Rm for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:19 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:34553) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmtt-0001Xc-At for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:18 -0400 Received: by mail-pl1-x635.google.com with SMTP id io24so1898254plb.1 for ; Wed, 24 Aug 2022 02:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=I101fY0zL7gfjmjMvi0/DEXFe1fki2ZjtkZJncbRgy4=; b=aX2TUiM6ZvCN6gi+QHlW0SMzkdq6x3JWRI51+KGX0SorWyt9KF/VA5AJbFAnODK8Oq KI2IJPTdwu1J0hVuV18B0ZVlXULMPP4Zq6//HlaOH6+3ET4MTK2vgauIoiS30IGatYxA jmOAsh0tEXNi+zcSdIOOfMT7dLahpZicQUMFmHsyqEAxGQWjo//Ou6EuZZhOJeeFxUZb N3IzsoKWR5yxHiuXc8a/2i+gJh7MphnfhatP7/v/nICCGWVF2wMYo5XOoA4FXE76xUm8 TOpPK7ty4P6Gd6cDsyzsNY6kHRei3r3PmVvDjXkHhYXD52//M5TT4gEgmJO4VySOkOEs 588A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=I101fY0zL7gfjmjMvi0/DEXFe1fki2ZjtkZJncbRgy4=; b=EaVQYGXBNW4AnrzIX+j632Vl2ZAc/GcmKoGeHGpfYoj02HuHxE87a1ZPA6NQ9Zq8Sc EOy89uPG7I135zZyBUQvi1UP8JRa6wSK74XALad4/JDN11Oq95e7w8EGi9svx7ex7gFO zkqtyfQD1useV7yG1buDolTu2DSpkEVb3x5WGd8d+whtGEffEK5bzoO7AXI9SQetV3TI h0Fh+ttyBcxWKJ+GZtqU9RxzMKuToMWSekQcvvQPM404I2ABISTAFC+OpaeQNj2mu7E8 28qcAmRT1KKKrD1iOGF4EuHvBcGXX2i3SuZ+MIJx+IpI9gOMIn92vXjGfz+uz9+VS7M0 Y0Ag== X-Gm-Message-State: ACgBeo1MWifLEAjwVr/FK/VjEOkHTXITAonsa6VXGXpfvTrI7E0F3nG1 GAlOMr/XiD4GTU5YtXUlPvKDsfrkp5k= X-Google-Smtp-Source: AA6agR7S6SmhP2v1S0VLmCZGnwWF8Moc0TZj0F7jbXTzZ8fHjZ2FE4nv1bHR5hJ7bKZYPP0ny5VhzA== X-Received: by 2002:a17:903:2450:b0:173:9fe:70e5 with SMTP id l16-20020a170903245000b0017309fe70e5mr4859801pls.148.1661334136437; Wed, 24 Aug 2022 02:42:16 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:16 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 16/51] tests/qtest: Build e1000e-test for posix only Date: Wed, 24 Aug 2022 17:39:54 +0800 Message-Id: <20220824094029.1634519-17-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng The whole e1000e-test test case relies on socketpair() which does not exist on win32. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth --- tests/qtest/meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index be4b30dea2..9d0f82bf1c 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -239,7 +239,6 @@ qos_test_ss.add( 'adm1272-test.c', 'ds1338-test.c', 'e1000-test.c', - 'e1000e-test.c', 'eepro100-test.c', 'es1370-test.c', 'ipoctal232-test.c', @@ -267,6 +266,9 @@ qos_test_ss.add( 'virtio-iommu-test.c', 'vmxnet3-test.c', ) +if config_host.has_key('CONFIG_POSIX') + qos_test_ss.add(files('e1000e-test.c')) +endif if have_virtfs qos_test_ss.add(files('virtio-9p-test.c')) endif From patchwork Wed Aug 24 09:39:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953214 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9911C00140 for ; Wed, 24 Aug 2022 10:27:52 +0000 (UTC) Received: from localhost ([::1]:55480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnbv-0006ZC-W9 for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:27:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33776) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmtx-000368-75 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:21 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:46997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmtv-0001Wm-IV for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:20 -0400 Received: by mail-pj1-x102f.google.com with SMTP id o14-20020a17090a0a0e00b001fabfd3369cso945030pjo.5 for ; Wed, 24 Aug 2022 02:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=vUeT/wlv8A0+FPAxIWhpLkds8vbnKER1tCflKpvf5G8=; b=PzRlwJvazkZj7n12AdnMyBlG7ks/Us4ip1yPTEujxhiiE5Aow3Nm1peAUmyG4GqjGp N4SfZ6v+haLM8Tk19j6rYZXOs892pk/yL7eGyXBRUs9X1XiTlo+JlJB8ODtOhY8tsejz jekGTi0w82h9M4iMcLRBkIbHEemCOp9lhuL1ZcknFZAkNk9o/MaRncpC/lNqQuRI4ZoA pT6I1cN0peG2GcxHHZjH8Shrjap+KWQxTFA2agA1WFSUsG44WMVnMt8WftzlkMaGXYbW m0WQ9k5FW0vyrcf6//QeagDypiRznPvbeaaqlBy/kGTCKSy7d0URYWPhFgr/GBoiXw/5 kEWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=vUeT/wlv8A0+FPAxIWhpLkds8vbnKER1tCflKpvf5G8=; b=12woY32CJ15ibXlyY19WHEJ2bUAALWXdz5WAimIzIOLcDgWx3TDBGSocsTddn3j7J6 aFD7K96JAe2BwE0+W+hpuVUTK+6beZOrQU5dB1x3IjJY3qFVGWQ3dHYHEMZFnGKvo2Dr ccQ78SrZ63lxmLrUUApRqo8O711MCtFOrIYl1yQFGgyHMQzuuicPZWUH+jT68OzMzsBp HbjSAsICtAfZlmmaTM5gAKrgx5Ce1j2Kh+uOjJlLsn6gjjQMHgWigom03BoNkm6K8Nkx 3OF5ctxA+COHhgcOGJ6WESpjv34x5BLeqG3o7Vxfnh06gfQWfwQf/gsDONmNBW1yNofs AVrQ== X-Gm-Message-State: ACgBeo06y8CHVB1Cm4XX/02AckdQvkBButC83Kc+ipU9hsY/yuUc7gUB rAKcZARKo5s84SarwCj+qtoJay2Cmak= X-Google-Smtp-Source: AA6agR6WXSxdG5oVI2obxQdYSftfWrLhPr2fpJtSaHZf6l3g0vJutOD/Iq2EgIbEEZkNc27ddnNaTg== X-Received: by 2002:a17:902:f542:b0:173:a8a:d7bf with SMTP id h2-20020a170902f54200b001730a8ad7bfmr4806063plf.134.1661334138698; Wed, 24 Aug 2022 02:42:18 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:18 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Jason Wang , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 17/51] tests/qtest: Build virtio-net-test for posix only Date: Wed, 24 Aug 2022 17:39:55 +0800 Message-Id: <20220824094029.1634519-18-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng All of the virtio-net-test test cases require socketpair() to do the test setup. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- tests/qtest/virtio-net-test.c | 6 ------ tests/qtest/meson.build | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c index 6ded252901..d44c3d9666 100644 --- a/tests/qtest/virtio-net-test.c +++ b/tests/qtest/virtio-net-test.c @@ -26,8 +26,6 @@ #define QVIRTIO_NET_TIMEOUT_US (30 * 1000 * 1000) #define VNET_HDR_SIZE sizeof(struct virtio_net_hdr_mrg_rxbuf) -#ifndef _WIN32 - static void rx_test(QVirtioDevice *dev, QGuestAllocator *alloc, QVirtQueue *vq, int socket) @@ -165,8 +163,6 @@ static void stop_cont_test(void *obj, void *data, QGuestAllocator *t_alloc) rx_stop_cont_test(dev, t_alloc, rx, sv[0]); } -#endif - static void hotplug(void *obj, void *data, QGuestAllocator *t_alloc) { QVirtioPCIDevice *dev = obj; @@ -324,10 +320,8 @@ static void register_virtio_net_test(void) }; qos_add_test("hotplug", "virtio-net-pci", hotplug, &opts); -#ifndef _WIN32 qos_add_test("basic", "virtio-net", send_recv_test, &opts); qos_add_test("rx_stop_cont", "virtio-net", stop_cont_test, &opts); -#endif qos_add_test("announce-self", "virtio-net", announce_self, &opts); /* These tests do not need a loopback backend. */ diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 9d0f82bf1c..72bb9e21f3 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -259,7 +259,6 @@ qos_test_ss.add( 'usb-hcd-ohci-test.c', 'virtio-test.c', 'virtio-blk-test.c', - 'virtio-net-test.c', 'virtio-rng-test.c', 'virtio-scsi-test.c', 'virtio-serial-test.c', @@ -267,7 +266,7 @@ qos_test_ss.add( 'vmxnet3-test.c', ) if config_host.has_key('CONFIG_POSIX') - qos_test_ss.add(files('e1000e-test.c')) + qos_test_ss.add(files('e1000e-test.c', 'virtio-net-test.c')) endif if have_virtfs qos_test_ss.add(files('virtio-9p-test.c')) From patchwork Wed Aug 24 09:39:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953152 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 924DBC00140 for ; Wed, 24 Aug 2022 10:01:35 +0000 (UTC) Received: from localhost ([::1]:60524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnCY-00059Y-Fs for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:01:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmu0-0003Gk-TW for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:24 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:33627) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmtz-0001Ys-3P for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:24 -0400 Received: by mail-pl1-x62d.google.com with SMTP id 2so15220372pll.0 for ; Wed, 24 Aug 2022 02:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=egPBjLFOzH2BItTwAJOAYvxF5nntobkrM7llqKrjcSw=; b=qsjs9EA6ub7htysYKqy/NANvhT3OwOgQ59U4XURNx2QZzpERT8m5LN+HWxWMDU3H/F RVoi3EI/eZsgq5SGtHg4m4AtzB8aEggXXg6weuhAths1lF47Lm6ax/Mq3ywWEG7asgXg +BC7hccB26Uwwqv6f5SM8cxFqyHahDiLsQhMnzI3PgLw8K7qq9/xOnmp56sr3QCtoME8 OwA2jL5FvceL2XzQD2Eb0vKUwOvem0LTJyQDHkl1XzOMJE9f29tHugyS6emiN/n1CQ53 XTPxYjr42aK/3/DwJlDw1vcfaolTyILgJN1R3S1n/ZA3+/Sq61Qou2lL0KhfwRZIKPmp O7Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=egPBjLFOzH2BItTwAJOAYvxF5nntobkrM7llqKrjcSw=; b=g7Iseaq5/aujHfUhX9qEQMXUbMznYDZ+upmBpFTFVe25MKLuKHxC1TO2o8aMQ/Cji+ t1xgo831Oqum04LvahlUeLHk29PAPfwcIMnj9y9eB+KQBd+xqgDcJMcyh+8xjDOQtL97 IgpEcDZyw77PNHwQmnjjtGbiTyJXqxCxSM5wPB8DAatVw4WkEqf7XDaouP2OubALRCM8 HYgqeb6Khv92z2z5Zr1H32Kv5daQvC/+EfARm71zRkji83Y2gCWVjH7D6P8/L0U8VAoF ktI719nsyQbd2wdiiXrloCVKFfcR9jiJdQfp+zm7OA663qYzFcMjMulYAzHfEf6ImOy7 WKqA== X-Gm-Message-State: ACgBeo3txPtTA4CTux673hcxOC3E2QGSXibl07M9WJdUarjQL+l1bPKo mdG1o72lPWzEfni1MfMl3qCuSA8Dx/o= X-Google-Smtp-Source: AA6agR6z5b2+kRc4XbBwlBXAV222dfFFZjXEltEwrHIgx29Wa2A3eKmmZIax1+OleQzltVijzWRYTw== X-Received: by 2002:a17:90b:3b8a:b0:1f5:1df2:1fff with SMTP id pc10-20020a17090b3b8a00b001f51df21fffmr7554690pjb.169.1661334141453; Wed, 24 Aug 2022 02:42:21 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:21 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Ani Sinha , Igor Mammedov , Laurent Vivier , "Michael S. Tsirkin" , Paolo Bonzini , Thomas Huth Subject: [PATCH 18/51] tests/qtest: Build cases that use memory-backend-file for posix only Date: Wed, 24 Aug 2022 17:39:56 +0800 Message-Id: <20220824094029.1634519-19-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng As backends/meson.build tells us, hostmem-file.c is only supported on POSIX platforms, hence any test case that utilizes the memory backend file should be guarded by CONFIG_POSIX too. Signed-off-by: Bin Meng Acked-by: Thomas Huth --- tests/qtest/bios-tables-test.c | 10 ++++++++++ tests/qtest/cxl-test.c | 4 ++++ tests/qtest/meson.build | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 7c5f736b51..36783966b0 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1461,6 +1461,7 @@ static void test_acpi_piix4_tcg_acpi_hmat(void) test_acpi_tcg_acpi_hmat(MACHINE_PC); } +#ifdef CONFIG_POSIX static void test_acpi_erst(const char *machine) { gchar *tmp_path = g_dir_make_tmp("qemu-test-erst.XXXXXX", NULL); @@ -1511,6 +1512,7 @@ static void test_acpi_microvm_acpi_erst(void) g_free(tmp_path); free_test_data(&data); } +#endif /* CONFIG_POSIX */ static void test_acpi_virt_tcg(void) { @@ -1551,6 +1553,7 @@ static void test_acpi_q35_viot(void) free_test_data(&data); } +#ifdef CONFIG_POSIX static void test_acpi_q35_cxl(void) { gchar *tmp_path = g_dir_make_tmp("qemu-test-cxl.XXXXXX", NULL); @@ -1593,6 +1596,7 @@ static void test_acpi_q35_cxl(void) g_free(tmp_path); free_test_data(&data); } +#endif /* CONFIG_POSIX */ static void test_acpi_virt_viot(void) { @@ -1805,8 +1809,10 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm); qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat); qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat); +#ifdef CONFIG_POSIX qtest_add_func("acpi/piix4/acpierst", test_acpi_piix4_acpi_erst); qtest_add_func("acpi/q35/acpierst", test_acpi_q35_acpi_erst); +#endif qtest_add_func("acpi/q35/applesmc", test_acpi_q35_applesmc); qtest_add_func("acpi/q35/pvpanic-isa", test_acpi_q35_pvpanic_isa); qtest_add_func("acpi/microvm", test_acpi_microvm_tcg); @@ -1818,7 +1824,9 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/q35/ivrs", test_acpi_q35_tcg_ivrs); if (strcmp(arch, "x86_64") == 0) { qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg); +#ifdef CONFIG_POSIX qtest_add_func("acpi/microvm/acpierst", test_acpi_microvm_acpi_erst); +#endif } } if (has_kvm) { @@ -1826,7 +1834,9 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); } qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); +#ifdef CONFIG_POSIX qtest_add_func("acpi/q35/cxl", test_acpi_q35_cxl); +#endif qtest_add_func("acpi/q35/slic", test_acpi_q35_slic); } else if (strcmp(arch, "aarch64") == 0) { if (has_tcg) { diff --git a/tests/qtest/cxl-test.c b/tests/qtest/cxl-test.c index b3733cdb5f..4b4e7e5088 100644 --- a/tests/qtest/cxl-test.c +++ b/tests/qtest/cxl-test.c @@ -89,6 +89,7 @@ static void cxl_2root_port(void) qtest_end(); } +#ifdef CONFIG_POSIX static void cxl_t3d(void) { g_autoptr(GString) cmdline = g_string_new(NULL); @@ -136,6 +137,7 @@ static void cxl_2pxb_4rp_4t3d(void) qtest_start(cmdline->str); qtest_end(); } +#endif /* CONFIG_POSIX */ int main(int argc, char **argv) { @@ -147,8 +149,10 @@ int main(int argc, char **argv) qtest_add_func("/pci/cxl/pxb_x2_with_window", cxl_2pxb_with_window); qtest_add_func("/pci/cxl/rp", cxl_root_port); qtest_add_func("/pci/cxl/rp_x2", cxl_2root_port); +#ifdef CONFIG_POSIX qtest_add_func("/pci/cxl/type3_device", cxl_t3d); qtest_add_func("/pci/cxl/rp_x2_type3_x2", cxl_1pxb_2rp_2t3d); qtest_add_func("/pci/cxl/pxb_x2_root_port_x4_type3_x4", cxl_2pxb_4rp_4t3d); +#endif return g_test_run(); } diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 72bb9e21f3..9e484e60ba 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -71,7 +71,8 @@ qtests_i386 = \ (config_all_devices.has_key('CONFIG_SB16') ? ['fuzz-sb16-test'] : []) + \ (config_all_devices.has_key('CONFIG_SDHCI_PCI') ? ['fuzz-sdcard-test'] : []) + \ (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) + \ - (config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) + \ + (config_host.has_key('CONFIG_POSIX') and \ + config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) + \ (config_all_devices.has_key('CONFIG_VIRTIO_NET') and \ config_all_devices.has_key('CONFIG_Q35') and \ config_all_devices.has_key('CONFIG_VIRTIO_PCI') and \ From patchwork Wed Aug 24 09:39:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88890C32796 for ; Wed, 24 Aug 2022 10:13:17 +0000 (UTC) Received: from localhost ([::1]:52654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnNs-0000Kt-Gj for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:13:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmu3-0003Nc-1U for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:27 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:51133) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmu1-0001Yy-8n for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:26 -0400 Received: by mail-pj1-x102b.google.com with SMTP id g18so16539640pju.0 for ; Wed, 24 Aug 2022 02:42:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=5lVamr0P85d3jCGn5N3zgxP8+z+BcFBCgzNisZd7pVc=; b=EwftjWsxSFoONCsCgawmZBUtodhh88DibzYCIpi5E4w6fFyKxGuj5MvWzQhMjYpH6N pEfXJLFpuMje4BinTZcSVOotlwptzY+Nq3K8bUiGu0743uJBBGWPn/ltiFkF4QxiCqHS kSQDKoyHENoid5f0+DpgHbdVHzcWS9hm/GG89/2d9YBdWbeeq0FtT4NfTsavLgOhzcPP rtPa6zyg6/vOmo32qLiF6FO/KxmLs4xdE3bxvi3uNjQnEYBusJrCgqAKACNsplKE6pJd 6kJnpY9qNcfyVH6NO/gH3ksjeLu39ppHmme5qxBs1DSfsQPq5fQATEdlDriiF5xQtZF1 gMoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=5lVamr0P85d3jCGn5N3zgxP8+z+BcFBCgzNisZd7pVc=; b=BwKVKOxKsQedrZy73uiq/CkJ7yKW5Yi6fcYlTK7n6zU5hJjXbwE1YtdlsRa6jU20j4 bTL5BSfidfD+Pc3BKHrR8CFWpQtf+dXsblQSWdvHN10oYARnq+G+12lUkGaZAjJcnjcf fZuXV/o4FUq+rbN0IxvN/PjTtVK++1E7pd3OU0RTVtSSVQzAxYswn6KgeJ8zktmSXwzG KWgBVwoYkb+xykaSvJLUYGnhoaGsQ15jm/36d1+78Z2rmvYj6xmXVX9qndfKLEny6oRG VzaUpkxQDKrqZG6qHL18kSGZ4OcdRBDpSgrHNrvYtKwD4RrIKps3mmnyIZX50DDioIVv TGoQ== X-Gm-Message-State: ACgBeo3QpOcJNFZ7ySjd3dQQ0YCrw233p2pftUyNCvFgAjWiOKcqZ23B N2l1ivy4SExv7km8o1TzeZMawzyitnw= X-Google-Smtp-Source: AA6agR5RBHhXC1wjezFv+dNPzH4vOPdvLLIgW5x6dveS9GcLAZM98WB4VYKZ5tFiZy75v9XSsD47cg== X-Received: by 2002:a17:90a:f0c9:b0:1fa:e017:7d13 with SMTP id fa9-20020a17090af0c900b001fae0177d13mr7491493pjb.128.1661334143559; Wed, 24 Aug 2022 02:42:23 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:23 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 19/51] tests/qtest: Build test-filter-{mirror, redirector} cases for posix only Date: Wed, 24 Aug 2022 17:39:57 +0800 Message-Id: <20220824094029.1634519-20-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng The test-filter-{mirror,redirector} cases use socketpair() API that is only available on POSIX and should only be built for POSIX. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- tests/qtest/meson.build | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 9e484e60ba..c97da5a062 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -42,6 +42,7 @@ qtests_cxl = \ qtests_i386 = \ (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \ (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \ (have_tools ? ['ahci-test'] : []) + \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_SGA') ? ['boot-serial-test'] : []) + \ @@ -95,8 +96,7 @@ qtests_i386 = \ 'vmgenid-test', 'migration-test', 'test-x86-cpuid-compat', - 'numa-test', - 'test-filter-redirector' + 'numa-test' ] if dbus_display @@ -120,29 +120,34 @@ endif qtests_x86_64 = qtests_i386 qtests_alpha = ['boot-serial-test'] + \ - ['test-filter-mirror', 'test-filter-redirector'] + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \ (slirp.found() ? ['test-netfilter'] : []) + \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) qtests_avr = [ 'boot-serial-test' ] qtests_hppa = ['boot-serial-test'] + \ - ['test-filter-mirror', 'test-filter-redirector'] + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \ (slirp.found() ? ['test-netfilter'] : []) + \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) qtests_m68k = ['boot-serial-test'] + \ - ['test-filter-mirror', 'test-filter-redirector'] + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \ (slirp.found() ? ['test-netfilter'] : []) qtests_microblaze = ['boot-serial-test'] + \ - ['test-filter-mirror', 'test-filter-redirector'] + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \ (slirp.found() ? ['test-netfilter'] : []) qtests_microblazeel = qtests_microblaze qtests_mips = \ - ['test-filter-mirror', 'test-filter-redirector'] + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \ (slirp.found() ? ['test-netfilter'] : []) + \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) @@ -152,7 +157,8 @@ qtests_mips64 = qtests_mips qtests_mips64el = qtests_mips qtests_ppc = \ - ['test-filter-mirror', 'test-filter-redirector'] + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \ (slirp.found() ? ['test-netfilter'] : []) + \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_M48T59') ? ['m48t59-test'] : []) + \ @@ -174,13 +180,15 @@ qtests_sh4 = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-te qtests_sh4eb = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) qtests_sparc = ['prom-env-test', 'm48t59-test', 'boot-serial-test'] + \ - ['test-filter-mirror', 'test-filter-redirector'] + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \ (slirp.found() ? ['test-netfilter'] : []) qtests_sparc64 = \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (slirp.found() ? ['test-netfilter'] : []) + \ - ['test-filter-mirror', 'test-filter-redirector'] + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \ ['prom-env-test', 'boot-serial-test'] qtests_npcm7xx = \ From patchwork Wed Aug 24 09:39:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953168 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED67FC00140 for ; Wed, 24 Aug 2022 10:19:03 +0000 (UTC) Received: from localhost ([::1]:40498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnTS-000659-Rm for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:19:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmu5-0003S2-Ny for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:29 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:52737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmu3-0001Z8-8T for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:28 -0400 Received: by mail-pj1-x102e.google.com with SMTP id f21so16511204pjt.2 for ; Wed, 24 Aug 2022 02:42:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=o/vNmGGWktBgN2DDen09I7Im1S9JADF0xZI5Ri8LXOA=; b=JfPa2gw0RpTDfNi7CXk9AiSRSEHycE2Ui2elHgCAASoH2CTOVeekl8r9bI5oSFSRBU rqYu6Ax/COVtVZPStLKuY2lIQsej574khAyJPGw5LyIswH2I63DXSADPdcblNEM7+UVd 1si3fTa1j9UY5gZzkBeBE3G5uJ6O9/c9NEpwfy6xXPrwi+9t8HZWGbUGUNBz7QK4Syzk 1FGal5INJKP6i0S9YGJhHwvZxsoNIUv2V7bjrdUgnSEHHTdVU7l13Hz9crYsyp44JozI DDEh3CYva3WkEBwicPtzBp6T0uZ7U5VFthBMc66NzRzYv2ODmkN4ogjf6S2QiTMkprh3 6WBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=o/vNmGGWktBgN2DDen09I7Im1S9JADF0xZI5Ri8LXOA=; b=MjxFIXcEVeOow4VP1Wi6Ky5Gsp4kH/Yr+6SXpBHBYxa+saZRgjwkHGaCuj7Z3WTFHV QAMJWo1VxAl8N9zFJeIs1psjII5w4s2HkvY+T6oAMa3i8kjEWrcyu6ztPIKUKcnRjrTW BlXvjO2m1lG6aIdMXWN5XXqnKA7jefZevff9FgRT+6Xo2d6O/SVSTaJe61bBMhTYqKo+ WdQSJsPoDjrKat5S0TsjKq/dvEEmPbt1r+XvUW1+74OuRzb7zGRkukl9LX4YqV9pFZMY tW7rBbKoDbvltTjZH3bNbt+4KkD/xIYeDoJWzxgEsYjG3oGF9dnK2u/B7Toc0BG6VQey 598Q== X-Gm-Message-State: ACgBeo1RVrBYOOgejdqYXZul9UoNuYaPL2rW93pMFj3PBJtANrJaO3Dk bgGW9XQ5lj0h55uYB20Nn2PGWASgbLw= X-Google-Smtp-Source: AA6agR5A9QOVfTfpygKeicp+08FdUArPB+j5VWE9g6tmMVc+3a4NsMPnxvbnHoYGNAYAkgbt2n3p4A== X-Received: by 2002:a17:902:ab8d:b0:172:9382:4d1e with SMTP id f13-20020a170902ab8d00b0017293824d1emr27914872plr.133.1661334145658; Wed, 24 Aug 2022 02:42:25 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:25 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 20/51] tests/qtest: i440fx-test: Skip running request_{bios, pflash} for win32 Date: Wed, 24 Aug 2022 17:39:58 +0800 Message-Id: <20220824094029.1634519-21-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng The request_{bios,pflash} test cases call mmap() which does not exist on win32. Exclude them. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth Signed-off-by: Bin Meng --- tests/qtest/i440fx-test.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/qtest/i440fx-test.c b/tests/qtest/i440fx-test.c index 6d7d4d8d8f..3890f1237c 100644 --- a/tests/qtest/i440fx-test.c +++ b/tests/qtest/i440fx-test.c @@ -278,6 +278,8 @@ static void test_i440fx_pam(gconstpointer opaque) qtest_end(); } +#ifndef _WIN32 + #define BLOB_SIZE ((size_t)65536) #define ISA_BIOS_MAXSZ ((size_t)(128 * 1024)) @@ -396,6 +398,8 @@ static void request_pflash(FirmwareTestFixture *fixture, fixture->is_bios = false; } +#endif /* _WIN32 */ + int main(int argc, char **argv) { TestData data; @@ -406,8 +410,10 @@ int main(int argc, char **argv) qtest_add_data_func("i440fx/defaults", &data, test_i440fx_defaults); qtest_add_data_func("i440fx/pam", &data, test_i440fx_pam); +#ifndef _WIN32 add_firmware_test("i440fx/firmware/bios", request_bios); add_firmware_test("i440fx/firmware/pflash", request_pflash); +#endif return g_test_run(); } From patchwork Wed Aug 24 09:39:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953226 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8ED1C32793 for ; Wed, 24 Aug 2022 10:34:26 +0000 (UTC) Received: from localhost ([::1]:55880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQniL-0003BE-Jw for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:34:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmu7-0003UL-PH for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:31 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:51133) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmu6-0001Yy-0v for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:31 -0400 Received: by mail-pj1-x102b.google.com with SMTP id g18so16539816pju.0 for ; Wed, 24 Aug 2022 02:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Q1LOr75ldxNy4JPk8mGR6OHZijSnHEDxgtXAj7RfZ6w=; b=Z8jIb21aeRsix3mRDGDGTUEmGiO246Be/3Rh10eg3xB4Z5WMJ+3xpoKubcUfcv+se+ QTmCEnbtqSP2SH6vm4xR3yX6o7NtPbOvxKls7c2j32Q9Xz1aYEzQc1nw4VUcBBEaV+Xs 45+Ycz7mQE/1Dy41Qghn9PXMi4cTes7oAW1k8FsfKfdfRMGQTkGQoGavWHBmjC8TrSjK j3/yzf8snLFK3lIDMGGlg7X+oXQy6L52soZR0sC5r0TfMgpZGR09k2Bu3VlMiYNfMy+Z pmnEcfNr2JXcnT4B9DVmdLjGVw6DBxXzeIBF8zMOYhsF5t7pJJ5ujK9Gk/Tq+h4wEY5S ta8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Q1LOr75ldxNy4JPk8mGR6OHZijSnHEDxgtXAj7RfZ6w=; b=KVOribmIIZzeCJQUxd1hK/UuK9Y5lJLV6ObWg1tQxMBNjqwNYhcKEJNFQKWMSHpFz2 KzabOoeXd8fWqtPq1Tqi8emoi9bR75Rr8eBIcGpCVQTLbr29B78R8RpbZW8CLuDTT//5 IzhUOgHKu3Dpgk0LORGbK8KI4FdJpFx8Xh8P8KgKPqrurB0N9TAAvqTUowzrYbsegCOs 2eTCYKOhir0l9TA/CYtkeEBS9asZGvacmPVvnqdFhLTqDJScLc5hEM0uzcRrNkF0SCqm 2FLnj8JAiZJ7ukAQ750gnBPSVttcZPHc3JC/GqVU/MD9TDklCqQ7kNz83odbkQZDujNe wrmg== X-Gm-Message-State: ACgBeo2G+IGO0pMN4z4HJP3OLKoXCiwx4WhQo4cHmJpbpCE8/rK6mCdC WczcIo3Gr8bpcH2ZqYb0yCz9kLjmCVM= X-Google-Smtp-Source: AA6agR7Y0Q3wZwz9P+7kz5MoKZKUgdeceSrbqcZM6ENNrp+jCQDWj3QawsxqA1lWG7SyW2SaLRSmfA== X-Received: by 2002:a17:902:864c:b0:172:bc0d:c769 with SMTP id y12-20020a170902864c00b00172bc0dc769mr25910815plt.146.1661334148133; Wed, 24 Aug 2022 02:42:28 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:27 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , "Dr. David Alan Gilbert" , Juan Quintela , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 21/51] tests/qtest: migration-test: Skip running test_migrate_fd_proto on win32 Date: Wed, 24 Aug 2022 17:39:59 +0800 Message-Id: <20220824094029.1634519-22-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng The test case 'test_migrate_fd_proto' calls socketpair() which does not exist on win32. Exclude it. The helper function wait_command_fd() is not needed anymore, hence exclude it too. Signed-off-by: Bin Meng Reviewed-by: Dr. David Alan Gilbert --- tests/qtest/migration-helpers.h | 2 ++ tests/qtest/migration-helpers.c | 2 ++ tests/qtest/migration-test.c | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h index 59561898d0..db0684de48 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -17,8 +17,10 @@ extern bool got_stop; +#ifndef _WIN32 G_GNUC_PRINTF(3, 4) QDict *wait_command_fd(QTestState *who, int fd, const char *command, ...); +#endif G_GNUC_PRINTF(2, 3) QDict *wait_command(QTestState *who, const char *command, ...); diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c index c6fbeb3974..f6f3c6680f 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -34,6 +34,7 @@ static void check_stop_event(QTestState *who) } } +#ifndef _WIN32 /* * Events can get in the way of responses we are actually waiting for. */ @@ -58,6 +59,7 @@ QDict *wait_command_fd(QTestState *who, int fd, const char *command, ...) return ret; } +#endif /* * Events can get in the way of responses we are actually waiting for. diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index af9250750b..2ae7498d5d 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1629,6 +1629,7 @@ static void test_precopy_tcp_tls_x509_reject_anon_client(void) #endif /* CONFIG_TASN1 */ #endif /* CONFIG_GNUTLS */ +#ifndef _WIN32 static void *test_migrate_fd_start_hook(QTestState *from, QTestState *to) { @@ -1697,6 +1698,7 @@ static void test_migrate_fd_proto(void) }; test_precopy_common(&args); } +#endif /* _WIN32 */ static void do_test_validate_uuid(MigrateStart *args, bool should_fail) { @@ -2531,7 +2533,9 @@ int main(int argc, char **argv) #endif /* CONFIG_GNUTLS */ /* qtest_add_func("/migration/ignore_shared", test_ignore_shared); */ +#ifndef _WIN32 qtest_add_func("/migration/fd_proto", test_migrate_fd_proto); +#endif qtest_add_func("/migration/validate_uuid", test_validate_uuid); qtest_add_func("/migration/validate_uuid_error", test_validate_uuid_error); qtest_add_func("/migration/validate_uuid_src_not_set", From patchwork Wed Aug 24 09:40:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953233 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCC0AC00140 for ; Wed, 24 Aug 2022 10:40:45 +0000 (UTC) Received: from localhost ([::1]:32932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnoS-0001BG-OY for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:40:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmu9-0003Z4-Bi for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:33 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:34557) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmu7-0001Zi-Qi for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:33 -0400 Received: by mail-pj1-x1030.google.com with SMTP id c16-20020a17090aa61000b001fb3286d9f7so3048980pjq.1 for ; Wed, 24 Aug 2022 02:42:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=/pjgCB/qOD1l65Q+5L6mduAGMNDgz5QBySrXjGl7kz0=; b=qIw0rgLIhEI4J0m9ccBvOoNw6Kfwgf9lyJZ+qz5FocUdXKJR/WnaPc9N1bgtMucesV 0H/I1EflYtWDiT3jwlWydSuAy+pL5H6FhGcqRhRRWLL9Ovgum+0jOdyYUSl8zy+YZcEn MH7vvHvO/KyKie8WmHRcZFI7dPDb727E2Hs2a4lgP53Z/5mmR9fgsMH7QIBCwoMdtRUi HqXR3AqsPm1yUDPq3GHEBMiYrq/c/oqSOqq1Xv2HNOur1BtXsazuTG/znnnTT7tARyOj +sxeYU1WM01RXgQyyqs7s0gHTU+uQP/Qi3Cy4OsjLXyUaLHL3i5W5qdkOzh8VGzgaC8L dixg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=/pjgCB/qOD1l65Q+5L6mduAGMNDgz5QBySrXjGl7kz0=; b=AZkzoXyHAIVQsiIJE9eEy0AGEfxxv6NGZmCoQhxbvtv/QETNyjeVrr3aVtH6ra+u7s hW8CD3nTRI2I41ESsRp+IRVZwtUQja8jitSJTSGKSAcatg9NQ0IzikxdCcBPtCYlEpzq 3AMom9iXQAGjby3D5xNSRTX54LnSNMkJl3G0Wur+T7o6SyZ6LEucWVV+EDebXDa9MFhc GjPFzkZHNR5JM417TM1eGiMAzwnFMgF3gEGXX7zX/InT6W/0RQkddA8OpzsuU8atkxR9 qi+0h4wqEs+KgWKq3FpLxCP8AkXS9JRsZ3ZIKgF5Bh9KxBkbBry0z7kIoZWoJjdjP9S3 1wzw== X-Gm-Message-State: ACgBeo2usxUz08hACsQZROBAtGM9uz60Bc9h0KA2SXHxhv4xh1El4FRp XXaKAsoJ1XAM62bzm37tjw4sRcRmF64= X-Google-Smtp-Source: AA6agR4MrX3OtOxW5UbAff9oJ8SUzKudGTCJJ2mbyQc3D59xdTJDndmYGd/Y3udEtiR3YDvy1I0Z8A== X-Received: by 2002:a17:90a:a097:b0:1fb:5bc:7778 with SMTP id r23-20020a17090aa09700b001fb05bc7778mr7448887pjp.209.1661334150455; Wed, 24 Aug 2022 02:42:30 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:30 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Markus Armbruster , Paolo Bonzini , Thomas Huth Subject: [PATCH 22/51] tests/qtest: qmp-test: Skip running test_qmp_oob for win32 Date: Wed, 24 Aug 2022 17:40:00 +0800 Message-Id: <20220824094029.1634519-23-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng The test_qmp_oob test case calls mkfifo() which does not exist on win32. Exclude it. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth --- tests/qtest/qmp-test.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c index b950dbafaf..4a165447f8 100644 --- a/tests/qtest/qmp-test.c +++ b/tests/qtest/qmp-test.c @@ -159,6 +159,8 @@ static void test_qmp_protocol(void) qtest_quit(qts); } +#ifndef _WIN32 + /* Out-of-band tests */ char *tmpdir; @@ -279,6 +281,8 @@ static void test_qmp_oob(void) qtest_quit(qts); } +#endif /* _WIN32 */ + /* Preconfig tests */ static void test_qmp_preconfig(void) @@ -338,7 +342,9 @@ int main(int argc, char *argv[]) g_test_init(&argc, &argv, NULL); qtest_add_func("qmp/protocol", test_qmp_protocol); +#ifndef _WIN32 qtest_add_func("qmp/oob", test_qmp_oob); +#endif qtest_add_func("qmp/preconfig", test_qmp_preconfig); qtest_add_func("qmp/missing-any-arg", test_qmp_missing_any_arg); From patchwork Wed Aug 24 09:40:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953227 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C81F1C3F6B0 for ; Wed, 24 Aug 2022 10:36:22 +0000 (UTC) Received: from localhost ([::1]:49206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnk5-0004SM-Ac for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:36:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuD-0003iy-9A for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:37 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:35402) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuB-0001aF-H0 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:36 -0400 Received: by mail-pg1-x535.google.com with SMTP id r69so14557081pgr.2 for ; Wed, 24 Aug 2022 02:42:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=hdtxjLMnNVU1rKYleO313NZ7D82NDLkpXwsAYvVj3S0=; b=mVqbC3O/frS8lRjN7/wJv4EuqSVn9CFQWeOfEI9WVWNXIfCBXkaj/gllYvuDo4l2iH d8Ocp0GW2jkwn7Lseoy9DAfZsR/2dcIcAJ3qZEB0kyQez0yOyd/7voACySdajC/JGpni gAbCB364XJ/zB9K934O590g7FYSFrhkqsut0zkp/iJU13wFGzO79IdyLpyc0oovcBn/G E+WQWYAbefRm8Qc6INVRtf6lnldEwiFyLEu6HAqYkS2kBlIX+pbB8gSUwvNAusNMYEhw Ngc3JOgag6sYiEUsUzJ0cGBM2IxUL//iECRECtSex0pLmZHcEDArwt7BpvTzkZTiXQR2 8czQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=hdtxjLMnNVU1rKYleO313NZ7D82NDLkpXwsAYvVj3S0=; b=p6oaWPYYriCaWFhahn2eKyd3cRuWIXM4wZyBg5mgwodnD3e80h3bTwmc0TfAHXGvRn 3y/jZvIFKKpxDlHwEzSeKZyjTAX6f0kO3o0/UvuKwx3PjefnMOaoSXZV6ho669PevkgI UfKkyDOm+H2trAk3PNRLt2ig0G+Om11yPNicu4TFOdnfATVcEQ0AAiywcTIpPijW6rY9 XH9Y1LdLKWILRkO3g2cNYySWQr+cd94foWhZCit71UC7Qv2KAG0QcpkSc0WHZeTtJhMe ffEkH7s6BrkBPipYcJgGA6r8yjMoaICEdKVEBDdO7NoCgowwQQ24uvZ6p1LaVlbwQ4lG IUYg== X-Gm-Message-State: ACgBeo1hyZKrNO2uxtphQ2esWH5dm1yDKDvAk8Zpw5WrBt8nuElF2EZm nIm2vvilAglANUcTVlWrc6OXHlTwKaY= X-Google-Smtp-Source: AA6agR7lo9wbggC3jooao5yYq3psZ6ceOVwNBVBisI5RnYyxfZmwOBeHPZ6gzh1+RWKKLYxLsguefg== X-Received: by 2002:a65:6d19:0:b0:42a:37d7:90da with SMTP id bf25-20020a656d19000000b0042a37d790damr20688393pgb.16.1661334153909; Wed, 24 Aug 2022 02:42:33 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:33 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , Eduardo Habkost , Laurent Vivier , Marcel Apfelbaum , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Thomas Huth , Yanan Wang Subject: [PATCH 23/51] accel/qtest: Support qtest accelerator for Windows Date: Wed, 24 Aug 2022 17:40:01 +0800 Message-Id: <20220824094029.1634519-24-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng Currently signal SIGIPI [=SIGUSR1] is used to kick the dummy CPU when qtest accelerator is used. However SIGUSR1 is unsupported on Windows. To support Windows, we add a QemuSemaphore CPUState::sem to kick the dummy CPU instead for Windows. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- include/hw/core/cpu.h | 1 + accel/dummy-cpus.c | 14 ++++++++++++-- softmmu/cpus.c | 9 +++++---- accel/meson.build | 1 + accel/qtest/meson.build | 1 + 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 500503da13..c564108877 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -325,6 +325,7 @@ struct CPUState { struct QemuThread *thread; #ifdef _WIN32 HANDLE hThread; + QemuSemaphore sem; #endif int thread_id; bool running, has_waiter; diff --git a/accel/dummy-cpus.c b/accel/dummy-cpus.c index 10429fdfb2..d6a1b8d0a2 100644 --- a/accel/dummy-cpus.c +++ b/accel/dummy-cpus.c @@ -21,8 +21,6 @@ static void *dummy_cpu_thread_fn(void *arg) { CPUState *cpu = arg; - sigset_t waitset; - int r; rcu_register_thread(); @@ -32,8 +30,13 @@ static void *dummy_cpu_thread_fn(void *arg) cpu->can_do_io = 1; current_cpu = cpu; +#ifndef _WIN32 + sigset_t waitset; + int r; + sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); +#endif /* signal CPU creation */ cpu_thread_signal_created(cpu); @@ -41,6 +44,7 @@ static void *dummy_cpu_thread_fn(void *arg) do { qemu_mutex_unlock_iothread(); +#ifndef _WIN32 do { int sig; r = sigwait(&waitset, &sig); @@ -49,6 +53,9 @@ static void *dummy_cpu_thread_fn(void *arg) perror("sigwait"); exit(1); } +#else + qemu_sem_wait(&cpu->sem); +#endif qemu_mutex_lock_iothread(); qemu_wait_io_event(cpu); } while (!cpu->unplug); @@ -69,4 +76,7 @@ void dummy_start_vcpu_thread(CPUState *cpu) cpu->cpu_index); qemu_thread_create(cpu->thread, thread_name, dummy_cpu_thread_fn, cpu, QEMU_THREAD_JOINABLE); +#ifdef _WIN32 + qemu_sem_init(&cpu->sem, 0); +#endif } diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 23b30484b2..fd10db927a 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -437,18 +437,19 @@ void qemu_wait_io_event(CPUState *cpu) void cpus_kick_thread(CPUState *cpu) { -#ifndef _WIN32 - int err; - if (cpu->thread_kicked) { return; } cpu->thread_kicked = true; - err = pthread_kill(cpu->thread->thread, SIG_IPI); + +#ifndef _WIN32 + int err = pthread_kill(cpu->thread->thread, SIG_IPI); if (err && err != ESRCH) { fprintf(stderr, "qemu:%s: %s", __func__, strerror(err)); exit(1); } +#else + qemu_sem_post(&cpu->sem); #endif } diff --git a/accel/meson.build b/accel/meson.build index b9a963cf80..b21c85dc0a 100644 --- a/accel/meson.build +++ b/accel/meson.build @@ -17,4 +17,5 @@ dummy_ss.add(files( )) specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: dummy_ss) +specific_ss.add_all(when: ['CONFIG_WIN32'], if_true: dummy_ss) specific_ss.add_all(when: ['CONFIG_XEN'], if_true: dummy_ss) diff --git a/accel/qtest/meson.build b/accel/qtest/meson.build index 4c65600293..a4876fc0f2 100644 --- a/accel/qtest/meson.build +++ b/accel/qtest/meson.build @@ -1,2 +1,3 @@ qtest_module_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: files('qtest.c')) +qtest_module_ss.add(when: ['CONFIG_WIN32'], if_true: files('qtest.c')) From patchwork Wed Aug 24 09:40:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953250 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B021CC32793 for ; Wed, 24 Aug 2022 10:44:52 +0000 (UTC) Received: from localhost ([::1]:35874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnsR-000868-MP for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:44:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuO-00043B-ED for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:48 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:37610) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuD-0001aY-W9 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:48 -0400 Received: by mail-pf1-x42f.google.com with SMTP id x15so15076276pfp.4 for ; Wed, 24 Aug 2022 02:42:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=MdKeSTbLm3PS0opC2HpSIBVAL/dC7LQ0XETPzs3c6S0=; b=boEs1TbeHauz9OftzSqMwRTzDCoO9q9S29lEWsea9vxDgu2ajlbn4z1BAS/c6wv/8/ QJ5HcaTNuxt/Xzxca42gOTih7McIkjVzVNZ+8XKixZFROUd8rLsmX9D2qi3I+9yeMyyn 1mKEOdhSyQ+tqSzqYVCy/FsO/XwWjavMlF/rzNJXbGfnehLQXdFaY+qC8dkFXNZC6Hp7 DwHeVkmSAHLFViieg9O4SJkZLe94QhRT5N9qvfsdrStgxtp52WY8kBc0L8gkQb3E3hZ4 ypgIeHPA1owJFhfzDrhZLtEtLRjJYfMHUqcTiVXM4skTDUtVOheHDT16n+UcwuW0OF/Z 7bZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=MdKeSTbLm3PS0opC2HpSIBVAL/dC7LQ0XETPzs3c6S0=; b=WvY+Srg/V70fuRgrdGmhmU0RP3vJMTf4QxjHGz6ufMSdB+wPbGQVbX3JKGQPs5gUYi 8+UjGG2Bstwyk17OcVK4bxxa1B9CXQBe+l9Xc3OfYgoLdS8ZDCdhsFZl/VWM2aKMcXOl 1fnpBxhhA96ng4dFpKE9LbYQrCoog0kVECadkWTI5ovp1RDCZ5JUhxaYjzPupAirrW5p hLkpLsu9AhVp34i+zed0CM05SmIAz2nKwjCeb4pU4DwjsmbKfSjJfEXNWRgrfFHA42SA W8X7T8WZc26rwLgqU9IlGGwf9aE/D6UpP0oWD2MO6TnhnmEyQhFv92jP6OmjtHXAfApm wcuA== X-Gm-Message-State: ACgBeo2kx6WsrhSbtFeux3BtKUVZzSSLrxeVf4kijMV/FMwbEyiE4zc+ wzTxSU6uCsGlI7EdQKdAlahePNJISsM= X-Google-Smtp-Source: AA6agR437Al04JiYuVOLRO+sqrXxjpJazG7NQeDvzYhm3KD+wRpwotEbrRmRAGPdTQ5fbnS5sMx+5A== X-Received: by 2002:a05:6a00:813:b0:536:e993:731b with SMTP id m19-20020a056a00081300b00536e993731bmr8396022pfk.34.1661334156527; Wed, 24 Aug 2022 02:42:36 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:35 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 24/51] tests/qtest: libqos: Drop inclusion of Date: Wed, 24 Aug 2022 17:40:02 +0800 Message-Id: <20220824094029.1634519-25-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng There is no in the Windows build environment. Actually this is not needed in the non-win32 builds too. Drop it. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Tested-by: Thomas Huth Reviewed-by: Marc-André Lureau --- tests/qtest/libqos/libqos.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/qtest/libqos/libqos.c b/tests/qtest/libqos/libqos.c index 85c7641add..5ffda080ec 100644 --- a/tests/qtest/libqos/libqos.c +++ b/tests/qtest/libqos/libqos.c @@ -1,6 +1,4 @@ #include "qemu/osdep.h" -#include - #include "../libqtest.h" #include "libqos.h" #include "pci.h" From patchwork Wed Aug 24 09:40:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953172 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE8E0C00140 for ; Wed, 24 Aug 2022 10:24:32 +0000 (UTC) Received: from localhost ([::1]:39600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnYl-0003c7-DD for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:24:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuM-0003zQ-Ld; Wed, 24 Aug 2022 05:42:46 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:36456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuJ-0001ar-9t; Wed, 24 Aug 2022 05:42:46 -0400 Received: by mail-pl1-x636.google.com with SMTP id c2so15204130plo.3; Wed, 24 Aug 2022 02:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=8cdvfFR41bNG20qDmhS/eM1yLaADTlT1CXePgdiY3RA=; b=p1viruIfLlnSonmUePXWWlgTgxuADqVRqGQPl4piM7ddJj4ez6OAPWKU1+nr9xXryn 0LYM78u8f59yMYnEUAM58Wu9yRNZKq6jK0FVnFMeN4kMHJZBREgs6KwUJpeM/M3TttWd RHNH68tw80UnN8tpjGCVR616f0KWwY1RSAheIKzGKYZzoNafY+is0cayCNHWvvV9xkJk IKjJF++gHmRgLB359eu5jOSuzLVF2kt019nH7sYCEBr4/o5ZdQsqF2q/yo9nbOou47CA 4i3css5q/ciCgocEOcWCmRLOmPnJSZ+VYlzQ6bNtyvuVi7Q4rswPizCJk0Ab6/GILzT4 wgWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=8cdvfFR41bNG20qDmhS/eM1yLaADTlT1CXePgdiY3RA=; b=u0E4ICRGZ2OyUoTv9rO76jutkqAQRFduLgMf6fM0+Hxq6OuMER4pvpQGo9OXPDgsKk yDWLWhVy8xOeIw5L4l/mBQCoYPYlbhQMmrXuNF3EtSu7PSDSN16qh5kqw234/bdQQMNU B1/Jf2D+IiVtr4ZYrDSULT8BdVCxXzlx/6pwAlMmUbGsyRqstf6kIFQz1i8znNhjB9VH fLPp+N3Sjz4SUKY7Ffb/XKcQuqD7Bl1KzVf/TT3WQKfr2UbZHSpDqmhKMX30pHBQBHF7 p9S+wp27lFhVovdm8BwDBXefuZQf4AdqbDyB2ITK6vEWC9gCs0aMT00ZTwUbZqO2rfOv 9rnQ== X-Gm-Message-State: ACgBeo1E5E8BHuCe2v4tCrvxxyPZrpwVpwSUAIQVnHI/Wxu/o0fl58i4 2+FrBTHmPdybcwvwmsXyvkecbk9/k3s= X-Google-Smtp-Source: AA6agR6PZP203B+5K55eEac5EKeL7Rl0ZEfkE41ZS89EILVSFq9krLKz7cOjTZOmHeZD2RL43Ilm2Q== X-Received: by 2002:a17:90b:30cb:b0:1fa:d69e:b581 with SMTP id hi11-20020a17090b30cb00b001fad69eb581mr7508763pjb.103.1661334161472; Wed, 24 Aug 2022 02:42:41 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:41 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , Alexander Bulekov , Bandan Das , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Daniel Henrique Barboza , Darren Kenny , David Gibson , Greg Kurz , Laurent Vivier , Paolo Bonzini , Qiuhao Li , Stefan Hajnoczi , Thomas Huth , qemu-ppc@nongnu.org Subject: [PATCH 25/51] tests/qtest: libqos: Rename malloc.h to libqos-malloc.h Date: Wed, 24 Aug 2022 17:40:03 +0800 Message-Id: <20220824094029.1634519-26-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng The qtest/libqos directory is included via the "-I" option to search for header files when building qtest. Unfortunately the malloc.h has a name conflict with the standard libc header, leading to a build failure on the Windows host, due to the MinGW libc stdlib.h header file includes malloc.h and it now gets wrongly pointed to the one in the qtest/libqos directory. Rename "qtest/libqos/malloc.h" to "qtest/libqos/libqos-malloc.h" to avoid the namespace pollution. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Reviewed-by: Thomas Huth Reviewed-by: Marc-André Lureau --- tests/qtest/libqos/generic-pcihost.h | 2 +- tests/qtest/libqos/{malloc.h => libqos-malloc.h} | 0 tests/qtest/libqos/libqos.h | 2 +- tests/qtest/libqos/malloc-pc.h | 2 +- tests/qtest/libqos/malloc-spapr.h | 2 +- tests/qtest/libqos/pci-pc.h | 2 +- tests/qtest/libqos/pci-spapr.h | 2 +- tests/qtest/libqos/qgraph.h | 2 +- tests/qtest/libqos/qos_external.h | 2 +- tests/qtest/libqos/rtas.h | 2 +- tests/qtest/libqos/virtio.h | 2 +- tests/qtest/e1000e-test.c | 2 +- tests/qtest/fuzz/qos_fuzz.c | 2 +- tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c | 2 +- tests/qtest/libqos/arm-imx25-pdk-machine.c | 2 +- tests/qtest/libqos/arm-n800-machine.c | 2 +- tests/qtest/libqos/arm-raspi2-machine.c | 2 +- tests/qtest/libqos/arm-sabrelite-machine.c | 2 +- tests/qtest/libqos/arm-smdkc210-machine.c | 2 +- tests/qtest/libqos/arm-virt-machine.c | 2 +- tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c | 2 +- tests/qtest/libqos/e1000e.c | 2 +- tests/qtest/libqos/{malloc.c => libqos-malloc.c} | 2 +- tests/qtest/libqos/qos_external.c | 2 +- tests/qtest/libqos/virtio-mmio.c | 2 +- tests/qtest/libqos/virtio-pci.c | 2 +- tests/qtest/qos-test.c | 2 +- tests/qtest/libqos/meson.build | 2 +- 28 files changed, 27 insertions(+), 27 deletions(-) rename tests/qtest/libqos/{malloc.h => libqos-malloc.h} (100%) rename tests/qtest/libqos/{malloc.c => libqos-malloc.c} (99%) diff --git a/tests/qtest/libqos/generic-pcihost.h b/tests/qtest/libqos/generic-pcihost.h index c693c769df..6493a8712a 100644 --- a/tests/qtest/libqos/generic-pcihost.h +++ b/tests/qtest/libqos/generic-pcihost.h @@ -14,7 +14,7 @@ #define LIBQOS_GENERIC_PCIHOST_H #include "pci.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" typedef struct QGenericPCIBus { diff --git a/tests/qtest/libqos/malloc.h b/tests/qtest/libqos/libqos-malloc.h similarity index 100% rename from tests/qtest/libqos/malloc.h rename to tests/qtest/libqos/libqos-malloc.h diff --git a/tests/qtest/libqos/libqos.h b/tests/qtest/libqos/libqos.h index ba7df448ca..9b4dd509f0 100644 --- a/tests/qtest/libqos/libqos.h +++ b/tests/qtest/libqos/libqos.h @@ -3,7 +3,7 @@ #include "../libqtest.h" #include "pci.h" -#include "malloc.h" +#include "libqos-malloc.h" typedef struct QOSState QOSState; diff --git a/tests/qtest/libqos/malloc-pc.h b/tests/qtest/libqos/malloc-pc.h index d8d79853c8..e531473601 100644 --- a/tests/qtest/libqos/malloc-pc.h +++ b/tests/qtest/libqos/malloc-pc.h @@ -13,7 +13,7 @@ #ifndef LIBQOS_MALLOC_PC_H #define LIBQOS_MALLOC_PC_H -#include "malloc.h" +#include "libqos-malloc.h" void pc_alloc_init(QGuestAllocator *s, QTestState *qts, QAllocOpts flags); diff --git a/tests/qtest/libqos/malloc-spapr.h b/tests/qtest/libqos/malloc-spapr.h index f99572fd71..f544c0d611 100644 --- a/tests/qtest/libqos/malloc-spapr.h +++ b/tests/qtest/libqos/malloc-spapr.h @@ -8,7 +8,7 @@ #ifndef LIBQOS_MALLOC_SPAPR_H #define LIBQOS_MALLOC_SPAPR_H -#include "malloc.h" +#include "libqos-malloc.h" void spapr_alloc_init(QGuestAllocator *s, QTestState *qts, QAllocOpts flags); diff --git a/tests/qtest/libqos/pci-pc.h b/tests/qtest/libqos/pci-pc.h index 49ec9507f2..849bd493de 100644 --- a/tests/qtest/libqos/pci-pc.h +++ b/tests/qtest/libqos/pci-pc.h @@ -14,7 +14,7 @@ #define LIBQOS_PCI_PC_H #include "pci.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" typedef struct QPCIBusPC { diff --git a/tests/qtest/libqos/pci-spapr.h b/tests/qtest/libqos/pci-spapr.h index 20a43718b7..3dbf1e58ae 100644 --- a/tests/qtest/libqos/pci-spapr.h +++ b/tests/qtest/libqos/pci-spapr.h @@ -8,7 +8,7 @@ #ifndef LIBQOS_PCI_SPAPR_H #define LIBQOS_PCI_SPAPR_H -#include "malloc.h" +#include "libqos-malloc.h" #include "pci.h" #include "qgraph.h" diff --git a/tests/qtest/libqos/qgraph.h b/tests/qtest/libqos/qgraph.h index 871740c0dc..6e94824d09 100644 --- a/tests/qtest/libqos/qgraph.h +++ b/tests/qtest/libqos/qgraph.h @@ -21,7 +21,7 @@ #include #include "qemu/module.h" -#include "malloc.h" +#include "libqos-malloc.h" /* maximum path length */ #define QOS_PATH_MAX_ELEMENT_SIZE 50 diff --git a/tests/qtest/libqos/qos_external.h b/tests/qtest/libqos/qos_external.h index 8446e3df0b..ea37364887 100644 --- a/tests/qtest/libqos/qos_external.h +++ b/tests/qtest/libqos/qos_external.h @@ -21,7 +21,7 @@ #include "qgraph.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qapi/qapi-types-machine.h" #include "qapi/qapi-types-qom.h" diff --git a/tests/qtest/libqos/rtas.h b/tests/qtest/libqos/rtas.h index f38f99dfab..be8353d505 100644 --- a/tests/qtest/libqos/rtas.h +++ b/tests/qtest/libqos/rtas.h @@ -5,7 +5,7 @@ #ifndef LIBQOS_RTAS_H #define LIBQOS_RTAS_H -#include "malloc.h" +#include "libqos-malloc.h" int qrtas_get_time_of_day(QTestState *qts, QGuestAllocator *alloc, struct tm *tm, uint32_t *ns); diff --git a/tests/qtest/libqos/virtio.h b/tests/qtest/libqos/virtio.h index b8bd06e1b8..7adc7cbd10 100644 --- a/tests/qtest/libqos/virtio.h +++ b/tests/qtest/libqos/virtio.h @@ -10,7 +10,7 @@ #ifndef LIBQOS_VIRTIO_H #define LIBQOS_VIRTIO_H -#include "malloc.h" +#include "libqos-malloc.h" #include "standard-headers/linux/virtio_ring.h" #define QVIRTIO_F_BAD_FEATURE 0x40000000ull diff --git a/tests/qtest/e1000e-test.c b/tests/qtest/e1000e-test.c index c98779c7c0..4cdd8238f2 100644 --- a/tests/qtest/e1000e-test.c +++ b/tests/qtest/e1000e-test.c @@ -31,7 +31,7 @@ #include "qemu/iov.h" #include "qemu/module.h" #include "qemu/bitops.h" -#include "libqos/malloc.h" +#include "libqos/libqos-malloc.h" #include "libqos/e1000e.h" static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *alloc) diff --git a/tests/qtest/fuzz/qos_fuzz.c b/tests/qtest/fuzz/qos_fuzz.c index c856d3d500..3a3d9c16dd 100644 --- a/tests/qtest/fuzz/qos_fuzz.c +++ b/tests/qtest/fuzz/qos_fuzz.c @@ -23,7 +23,7 @@ #include "qemu/main-loop.h" #include "tests/qtest/libqtest.h" -#include "tests/qtest/libqos/malloc.h" +#include "tests/qtest/libqos/libqos-malloc.h" #include "tests/qtest/libqos/qgraph.h" #include "tests/qtest/libqos/qgraph_internal.h" #include "tests/qtest/libqos/qos_external.h" diff --git a/tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c b/tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c index c8a3ea11eb..ab24add8eb 100644 --- a/tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c +++ b/tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c @@ -19,7 +19,7 @@ #include "qemu/osdep.h" #include "../libqtest.h" #include "qemu/module.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" #include "sdhci.h" diff --git a/tests/qtest/libqos/arm-imx25-pdk-machine.c b/tests/qtest/libqos/arm-imx25-pdk-machine.c index 54d0c95330..8fe128fae8 100644 --- a/tests/qtest/libqos/arm-imx25-pdk-machine.c +++ b/tests/qtest/libqos/arm-imx25-pdk-machine.c @@ -20,7 +20,7 @@ #include "qemu/osdep.h" #include "../libqtest.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" #include "i2c.h" diff --git a/tests/qtest/libqos/arm-n800-machine.c b/tests/qtest/libqos/arm-n800-machine.c index ecd46b1daf..4e5afe0164 100644 --- a/tests/qtest/libqos/arm-n800-machine.c +++ b/tests/qtest/libqos/arm-n800-machine.c @@ -20,7 +20,7 @@ #include "qemu/osdep.h" #include "../libqtest.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" #include "i2c.h" diff --git a/tests/qtest/libqos/arm-raspi2-machine.c b/tests/qtest/libqos/arm-raspi2-machine.c index 0a2943440b..367c6c17a5 100644 --- a/tests/qtest/libqos/arm-raspi2-machine.c +++ b/tests/qtest/libqos/arm-raspi2-machine.c @@ -19,7 +19,7 @@ #include "qemu/osdep.h" #include "../libqtest.h" #include "qemu/module.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" #include "sdhci.h" diff --git a/tests/qtest/libqos/arm-sabrelite-machine.c b/tests/qtest/libqos/arm-sabrelite-machine.c index ec19a01660..94f6a20fc7 100644 --- a/tests/qtest/libqos/arm-sabrelite-machine.c +++ b/tests/qtest/libqos/arm-sabrelite-machine.c @@ -19,7 +19,7 @@ #include "qemu/osdep.h" #include "../libqtest.h" #include "qemu/module.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" #include "sdhci.h" diff --git a/tests/qtest/libqos/arm-smdkc210-machine.c b/tests/qtest/libqos/arm-smdkc210-machine.c index 4bff249ee8..9bbce924ea 100644 --- a/tests/qtest/libqos/arm-smdkc210-machine.c +++ b/tests/qtest/libqos/arm-smdkc210-machine.c @@ -19,7 +19,7 @@ #include "qemu/osdep.h" #include "../libqtest.h" #include "qemu/module.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" #include "sdhci.h" diff --git a/tests/qtest/libqos/arm-virt-machine.c b/tests/qtest/libqos/arm-virt-machine.c index 139eaba142..4e87405b58 100644 --- a/tests/qtest/libqos/arm-virt-machine.c +++ b/tests/qtest/libqos/arm-virt-machine.c @@ -19,7 +19,7 @@ #include "qemu/osdep.h" #include "../libqtest.h" #include "qemu/module.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" #include "virtio-mmio.h" #include "generic-pcihost.h" diff --git a/tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c b/tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c index 3be80020a6..daac762a06 100644 --- a/tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c +++ b/tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c @@ -19,7 +19,7 @@ #include "qemu/osdep.h" #include "../libqtest.h" #include "qemu/module.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" #include "sdhci.h" diff --git a/tests/qtest/libqos/e1000e.c b/tests/qtest/libqos/e1000e.c index f87e0e84b2..fc14b07884 100644 --- a/tests/qtest/libqos/e1000e.c +++ b/tests/qtest/libqos/e1000e.c @@ -23,7 +23,7 @@ #include "qemu/iov.h" #include "qemu/module.h" #include "qemu/bitops.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" #include "e1000e.h" diff --git a/tests/qtest/libqos/malloc.c b/tests/qtest/libqos/libqos-malloc.c similarity index 99% rename from tests/qtest/libqos/malloc.c rename to tests/qtest/libqos/libqos-malloc.c index f0c8f950c8..d7566972c4 100644 --- a/tests/qtest/libqos/malloc.c +++ b/tests/qtest/libqos/libqos-malloc.c @@ -11,7 +11,7 @@ */ #include "qemu/osdep.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qemu/host-utils.h" typedef struct MemBlock { diff --git a/tests/qtest/libqos/qos_external.c b/tests/qtest/libqos/qos_external.c index b7a0b873a3..c6bb8bff09 100644 --- a/tests/qtest/libqos/qos_external.c +++ b/tests/qtest/libqos/qos_external.c @@ -24,7 +24,7 @@ #include "qapi/qmp/qstring.h" #include "qemu/module.h" #include "qapi/qmp/qlist.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" #include "qgraph_internal.h" #include "qos_external.h" diff --git a/tests/qtest/libqos/virtio-mmio.c b/tests/qtest/libqos/virtio-mmio.c index a6cca8613b..bd0b1d890b 100644 --- a/tests/qtest/libqos/virtio-mmio.c +++ b/tests/qtest/libqos/virtio-mmio.c @@ -12,7 +12,7 @@ #include "qemu/module.h" #include "virtio.h" #include "virtio-mmio.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "qgraph.h" #include "standard-headers/linux/virtio_ring.h" diff --git a/tests/qtest/libqos/virtio-pci.c b/tests/qtest/libqos/virtio-pci.c index 67c2498c84..485b8f6b7e 100644 --- a/tests/qtest/libqos/virtio-pci.c +++ b/tests/qtest/libqos/virtio-pci.c @@ -13,7 +13,7 @@ #include "virtio-pci.h" #include "pci.h" #include "pci-pc.h" -#include "malloc.h" +#include "libqos-malloc.h" #include "malloc-pc.h" #include "qgraph.h" #include "standard-headers/linux/virtio_ring.h" diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c index f97d0a08fd..831db5cf2a 100644 --- a/tests/qtest/qos-test.c +++ b/tests/qtest/qos-test.c @@ -25,7 +25,7 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/qapi-visit-machine.h" #include "qapi/qapi-visit-qom.h" -#include "libqos/malloc.h" +#include "libqos/libqos-malloc.h" #include "libqos/qgraph.h" #include "libqos/qgraph_internal.h" #include "libqos/qos_external.h" diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build index fd5d6e5ae1..cff83c86d9 100644 --- a/tests/qtest/libqos/meson.build +++ b/tests/qtest/libqos/meson.build @@ -6,7 +6,7 @@ libqos_srcs = files( 'qos_external.c', 'pci.c', 'fw_cfg.c', - 'malloc.c', + 'libqos-malloc.c', 'libqos.c', 'sdhci-cmd.c', From patchwork Wed Aug 24 09:40:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953248 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32948C00140 for ; Wed, 24 Aug 2022 10:42:52 +0000 (UTC) Received: from localhost ([::1]:57738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnqV-000468-75 for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:42:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuN-00040m-5O for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:47 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:52737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuL-0001Z8-I1 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:46 -0400 Received: by mail-pj1-x102e.google.com with SMTP id f21so16511832pjt.2 for ; Wed, 24 Aug 2022 02:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=ZMTvAyZuMin22FzdWCyxbO3Nu5c2nRBEHD5FUVRQ7yc=; b=Y01zgjERpQES6bO6YeaIYqLerOel2Luq/wOKifwLKj70Fzj/fwLs+4HFsvoyaY1F5r UaxOEl8bYlJSK2o2AyULTuON9ethgWmP8PYG6n+8orAw2wWLTvkq+GcNaT3V/4lCh98k qmNKSVPryPBZbeKD2lDtxkA0uN15p/oWvYH61i343EbUhlEOZ9SzMEZL9YTwKELcjasY E52ujwxgnF+tefJZ1ZMXXdkSvqzqDW61dOOEdguQ84GtYZDy/rNy+4jjUrb3OQKN6skK KxI/XZeRqlvY2pwUq3/CYR0PQ6unO8MNBCCvtRO5Y+q0DD9bYMuQ67NzVz7UE7ZYGoL9 5iOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=ZMTvAyZuMin22FzdWCyxbO3Nu5c2nRBEHD5FUVRQ7yc=; b=kHeAbBVAkNziuS81iLYlucwRnA3c4zQSORo7HkRtLPaxHVg3omRl8cIbg8tq67vUfI xvM2EsHtgeFyI38vWpSCl4rOiR4nvEVEAIBh6r+1X4+ed1LngEknLKaysTx5LcPz8yQ8 Zl1t91E3Eq9TctUIF0sZfWqZTtoLjgM765W46/3nyg75KhSJQ5fb9QNlJ134uJx3l7DG 6ONLm5bGwQPTtopri0k1kNUh7SFOE0k6DZlUkmFS2rwYOhfENydVhmCXRueTQgs0zeCe jklWAQljEl6r5cYrq2QHeSC0NqSIipZabLdTbrdtsMIdNxOwiUVUoX1TcsE7dSzxFonE FRhw== X-Gm-Message-State: ACgBeo1KW/duWGcwjSfmtgp1kje6IPcX+kIEt7G8zC6YfHf93jGJxI5Y I4btZjw5vBaJUZVtRG/K05WfdhIR6eI= X-Google-Smtp-Source: AA6agR5JY7gv4+4mKWYWp2YARd9r4xpdqubJztnuKLZdTxq5H6A3di7v7WAz8bRgrt4ggvsrJQzD+A== X-Received: by 2002:a17:90a:17e1:b0:1f2:2ff2:6cae with SMTP id q88-20020a17090a17e100b001f22ff26caemr7495766pja.196.1661334164143; Wed, 24 Aug 2022 02:42:44 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:43 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 26/51] tests/qtest: libqtest: Move global_qtest definition back to libqtest.c Date: Wed, 24 Aug 2022 17:40:04 +0800 Message-Id: <20220824094029.1634519-27-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng Commit dd2107497275 ("tests/libqtest: Use libqtest-single.h in tests that require global_qtest") moved global_qtest to libqtest-single.h, by declaring global_qtest attribute to be common and weak. This trick unfortunately does not work on Windows, and building qtest test cases results in multiple definition errors of the weak symbol global_qtest, as Windows PE does not have the concept of the so-called weak symbol like ELF in the *nix world. Let's move the definition of global_qtest back to libqtest.c. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng --- tests/qtest/libqtest-single.h | 2 +- tests/qtest/libqtest.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qtest/libqtest-single.h b/tests/qtest/libqtest-single.h index 4e7d0ae1dc..3294985d7b 100644 --- a/tests/qtest/libqtest-single.h +++ b/tests/qtest/libqtest-single.h @@ -13,7 +13,7 @@ #include "libqtest.h" -QTestState *global_qtest __attribute__((common, weak)); +extern QTestState *global_qtest; /** * qtest_start: diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 34744ace7c..909583dad3 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -65,6 +65,8 @@ struct QTestState GList *pending_events; }; +QTestState *global_qtest; + static GHookList abrt_hooks; static struct sigaction sigact_old; From patchwork Wed Aug 24 09:40:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 818B1C00140 for ; Wed, 24 Aug 2022 10:31:20 +0000 (UTC) Received: from localhost ([::1]:56818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnfL-0001HW-Ee for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:31:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuP-00046t-O0 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:50 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:41956) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuO-0001bT-0Y for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:49 -0400 Received: by mail-pg1-x533.google.com with SMTP id 202so14542886pgc.8 for ; Wed, 24 Aug 2022 02:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=IfI/qWhUWiZQhG5XwWjV6xjarmHg12V73Blb6zZFpuQ=; b=lgIvNYS2uxagdXZauE9C99i9XdDYqd8KPAc1aWEHEl3QH9uGAj8wgzNykpP7DX0YqY 2dE5eJBC9O5CBWv7EJpLMcAVgqCbzQ8bz3m4MEiqbBr1KnkOwxT3sz8Yw70UJ7WNtsSz 31CuFlzqfgxQkQ6jdHUxfZhQmwkGiLyBdnezlzyDeJoNIwFRQHoyUd3zfAbwPmyqcEjJ D+dAeGva2CA5hZ54wRfOunVGapRIkhtNzrzB8QgAE+tQu2/SPMk9R1fR4hfB0uGFBw2t lAndgigtdIBo24kYN/5FxUZQpu/VAXhH1/lLRswBCZTFuy0fgFUAf4hXiuBk2X77xKTn j3Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=IfI/qWhUWiZQhG5XwWjV6xjarmHg12V73Blb6zZFpuQ=; b=kP4xGPpnuDqoy3H3j1rpXPV49UrjfS/rjeaLbi9HGv31ehdDKfi/pGrqy+yJBvy2Cn 0AqPha+yZ2RZ9SFnpACRxpPXzptitilGJLns+qk3T5D7mi9YNBd1kcCNBXkNx0E9YVKf b7LR4DgrIbKyvHJ/J4p2Yd5eFhD11s/5VcT8pQnp24py/pOFGf1NgFp3tSa3QlSUARvm ili3KJQ6ZZkK/qryVHjyCalVXA1lZuXoTwgGnwez1u/7rUM/yQuA4o3nISRkgWvqJ7/J Z7yHKkWGaqUnAtiDUHDPe0ut2oFyMVLgo1a316IsButDkMOcHSIlbZkPapxIpLhmHmXF 0Odg== X-Gm-Message-State: ACgBeo0O4eFTyluYeXR9Om9vTZR78TaLZB32yovel4Y6O6GcLeduztxN 0uGCRyE+fWPoB/B86bKBbWOgmrLfBVM= X-Google-Smtp-Source: AA6agR5sJ9C0HFPuKJAG/c6z7BkLhItFVTK2K80PhDjyHaoJLFMEwWfHP7cOEBwuVq2W0Jw+keLmNw== X-Received: by 2002:a05:6a00:1410:b0:528:5a5a:d846 with SMTP id l16-20020a056a00141000b005285a5ad846mr29523999pfu.9.1661334166406; Wed, 24 Aug 2022 02:42:46 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:46 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 27/51] tests/qtest: Use send/recv for socket communication Date: Wed, 24 Aug 2022 17:40:05 +0800 Message-Id: <20220824094029.1634519-28-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x533.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng Socket communication in the libqtest and libqmp codes uses read() and write() which work on any file descriptor on *nix, and sockets in *nix are an example of a file descriptor. However sockets on Windows do not use *nix-style file descriptors, so read() and write() cannot be used on sockets on Windows. Switch over to use send() and recv() instead which work on both Windows and *nix. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng --- tests/qtest/libqmp.c | 4 ++-- tests/qtest/libqtest.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qtest/libqmp.c b/tests/qtest/libqmp.c index ade26c15f0..995a39c1f8 100644 --- a/tests/qtest/libqmp.c +++ b/tests/qtest/libqmp.c @@ -36,7 +36,7 @@ typedef struct { static void socket_send(int fd, const char *buf, size_t size) { - size_t res = qemu_write_full(fd, buf, size); + ssize_t res = send(fd, buf, size, 0); assert(res == size); } @@ -69,7 +69,7 @@ QDict *qmp_fd_receive(int fd) ssize_t len; char c; - len = read(fd, &c, 1); + len = recv(fd, &c, 1, 0); if (len == -1 && errno == EINTR) { continue; } diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 909583dad3..b7b7c9c541 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -438,7 +438,7 @@ void qtest_quit(QTestState *s) static void socket_send(int fd, const char *buf, size_t size) { - size_t res = qemu_write_full(fd, buf, size); + ssize_t res = send(fd, buf, size, 0); assert(res == size); } @@ -470,7 +470,7 @@ static GString *qtest_client_socket_recv_line(QTestState *s) ssize_t len; char buffer[1024]; - len = read(s->fd, buffer, sizeof(buffer)); + len = recv(s->fd, buffer, sizeof(buffer), 0); if (len == -1 && errno == EINTR) { continue; } From patchwork Wed Aug 24 09:40:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953231 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2536C00140 for ; Wed, 24 Aug 2022 10:39:31 +0000 (UTC) Received: from localhost ([::1]:56834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnnG-0007g7-1g for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:39:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuR-0004AW-LD for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:51 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:36369) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuP-0001br-Vs for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:51 -0400 Received: by mail-pg1-x534.google.com with SMTP id s206so14562245pgs.3 for ; Wed, 24 Aug 2022 02:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=KoPI4eXuTPrxafT3ECcIZJJvMLwXtdkRP59ne1WxHZs=; b=HpR6r7lFNgVnv5TTgYMTT85ojDH9R5bGU8TzcUviZNPTDLbQmqUOtVqT8wJZbThJTN q+kipI5ERspKLaZNFz+I+s1p86MKuEWJuHQ4jcwhw+5jeDDBp4o6VXsLoZegZP3w52Bp nhF31De5ews9lUm+Sql4IrNQ6iB4DjXKPXsHvfNmneTKz6KUhUyg2JBRHY8reviUon6/ xdfxr0d+zumf+PwdUktkgegcBA6D0HyTSFMRQY4eftCftyCtnKqfrWC3H5SLN7l6n7Rp eMllUuekKQByaKI1/6eTl6Z1aCic9BXYxCOeZ/rpDqQ9mIWLjd+00FRE2UaCmM0DXqSB riow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=KoPI4eXuTPrxafT3ECcIZJJvMLwXtdkRP59ne1WxHZs=; b=L+RS7CpNdE9vkraAv2kp79adtN3bmfJ4IboA//AzOl4TaVSllCxmKeOliLU0SpWpb0 Id2VoSuuMP4j4AAGZFCSSDmq3biu4xnbZ0wI2P3L939/dAdLUV5fAmrcCYPEVT+ikTxn VKVzZpaGzK5jRov2pgPV/J9nDPRiqf1ebiufd9K8YGuRSAVms9Y1NTrwIbfJML9HKzFF KCzX7n5FAtnwIengb3mLFydazO/gbq2fFVokAvBmozBb0j53Pf8Jtu5oop1CyTjy6BuL lIntO25wBWEzYC0l5Nx4bQjyssIW4ycGuG1wU+dDNdcgXb5oFsKPDz2fBS6ju2Um8w/2 siIQ== X-Gm-Message-State: ACgBeo1HHhbU8lPVrJV/NMEHEPKMbIDlgnBf40xWaA5aJYPlfmOLxolt rJXUtWHhBIZ6xLUAyHPrwBZfZekNN8s= X-Google-Smtp-Source: AA6agR6WysJXSwpm6X+LW2edpDXbbPpHLrV3NVja2kl0R7CZoKaPsKsstR/e56wxnxm/6B6qvF/heA== X-Received: by 2002:a65:6755:0:b0:41d:70c1:be0 with SMTP id c21-20020a656755000000b0041d70c10be0mr24234622pgu.99.1661334168420; Wed, 24 Aug 2022 02:42:48 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:48 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 28/51] tests/qtest: libqtest: Exclude the *_fds APIs for win32 Date: Wed, 24 Aug 2022 17:40:06 +0800 Message-Id: <20220824094029.1634519-29-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng libqmp.c::qmp_fd_vsend_fds() is not available on Windows, hence any APIs in libqtest that call libqmp.c::qmp_fd_vsend_fds() should be excluded for win32 too. This includes the following: * qtest_qmp_vsend_fds() * qtest_vqmp_fds() * qtest_qmp_fds() * qtest_qmp_add_client() Note qtest_qmp_vsend() was wrongly written to call qmp_fd_vsend_fds() previously, but it should call the non fds version API qmp_fd_vsend(). Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- tests/qtest/libqtest.h | 8 ++++++++ tests/qtest/libqtest.c | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index 94b187837d..3abc75964d 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -94,6 +94,7 @@ void qtest_kill_qemu(QTestState *s); */ void qtest_quit(QTestState *s); +#ifndef _WIN32 /** * qtest_qmp_fds: * @s: #QTestState instance to operate on. @@ -108,6 +109,7 @@ void qtest_quit(QTestState *s); QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num, const char *fmt, ...) G_GNUC_PRINTF(4, 5); +#endif /* _WIN32 */ /** * qtest_qmp: @@ -152,6 +154,7 @@ void qtest_qmp_send_raw(QTestState *s, const char *fmt, ...) */ int qtest_socket_server(const char *socket_path); +#ifndef _WIN32 /** * qtest_vqmp_fds: * @s: #QTestState instance to operate on. @@ -167,6 +170,7 @@ int qtest_socket_server(const char *socket_path); QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num, const char *fmt, va_list ap) G_GNUC_PRINTF(4, 0); +#endif /* _WIN32 */ /** * qtest_vqmp: @@ -181,6 +185,7 @@ QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num, QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); +#ifndef _WIN32 /** * qtest_qmp_vsend_fds: * @s: #QTestState instance to operate on. @@ -196,6 +201,7 @@ QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap) void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num, const char *fmt, va_list ap) G_GNUC_PRINTF(4, 0); +#endif /* _WIN32 */ /** * qtest_qmp_vsend: @@ -743,6 +749,7 @@ void qtest_qmp_device_add_qdict(QTestState *qts, const char *drv, void qtest_qmp_device_add(QTestState *qts, const char *driver, const char *id, const char *fmt, ...) G_GNUC_PRINTF(4, 5); +#ifndef _WIN32 /** * qtest_qmp_add_client: * @qts: QTestState instance to operate on @@ -752,6 +759,7 @@ void qtest_qmp_device_add(QTestState *qts, const char *driver, const char *id, * Call QMP ``getfd`` followed by ``add_client`` with the given @fd. */ void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd); +#endif /* _WIN32 */ /** * qtest_qmp_device_del: diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index b7b7c9c541..1b24a4f1f7 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -594,17 +594,20 @@ int qtest_socket_server(const char *socket_path) return sock; } +#ifndef _WIN32 void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num, const char *fmt, va_list ap) { qmp_fd_vsend_fds(s->qmp_fd, fds, fds_num, fmt, ap); } +#endif void qtest_qmp_vsend(QTestState *s, const char *fmt, va_list ap) { - qmp_fd_vsend_fds(s->qmp_fd, NULL, 0, fmt, ap); + qmp_fd_vsend(s->qmp_fd, fmt, ap); } +#ifndef _WIN32 QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num, const char *fmt, va_list ap) { @@ -613,6 +616,7 @@ QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num, /* Receive reply */ return qtest_qmp_receive(s); } +#endif QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap) { @@ -622,6 +626,7 @@ QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap) return qtest_qmp_receive(s); } +#ifndef _WIN32 QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num, const char *fmt, ...) { @@ -633,6 +638,7 @@ QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num, va_end(ap); return response; } +#endif QDict *qtest_qmp(QTestState *s, const char *fmt, ...) { @@ -1329,6 +1335,7 @@ void qtest_qmp_device_add(QTestState *qts, const char *driver, const char *id, qobject_unref(args); } +#ifndef _WIN32 void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd) { QDict *resp; @@ -1348,6 +1355,7 @@ void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd) g_assert(!qdict_haskey(resp, "error")); qobject_unref(resp); } +#endif /* * Generic hot-unplugging test via the device_del QMP command. From patchwork Wed Aug 24 09:40:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB78CC32793 for ; Wed, 24 Aug 2022 10:50:27 +0000 (UTC) Received: from localhost ([::1]:45482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnxq-0005aH-Ix for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:50:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuT-0004GG-Kl for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:56 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:40815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuS-0001cB-0V for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:53 -0400 Received: by mail-pf1-x42e.google.com with SMTP id y141so15966782pfb.7 for ; Wed, 24 Aug 2022 02:42:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=7B//sRlwmvr0NqRVKAmxDWMajm9GtHuIKBPMgzMp1rQ=; b=S0LDz4mgG3iVYKSUqh8+rhpHR5eUZY1VYYnZPoaOrsumn1PE0EmZFMyKx3NxhW8ihB 1Can46UqFVM8RkPuA2tvnc5mTmGc6IAFRzhY6ShJv8JMOniVCBAluv2isa6xcyeBSKfp CwKz5zTrFfIvn/bNJQAKoWap/Ry7bEjV49UqABNRiAqxsj1KWIxovDo+Popu8UYagqu7 gSsb6BiZRShy90Vu5klhmTOckoQBL557N674mwRio3GfhLsaMzWjREKnPl1TFLlfeo70 b4LdBZ+eBArYgNav2tl8AcmYXEaIwvniP5uu5O+c5u87hUFTbYEcKK0oC7OVmN/T5R4B 4VlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=7B//sRlwmvr0NqRVKAmxDWMajm9GtHuIKBPMgzMp1rQ=; b=B9Dy/NfvtVnGHEWmrpWZxd9cGaipk0gW8Z/LhbCBkb8/iIZqrVBzD3LtwXm2uxhTTy aO0bcP6V2TdbkrMZvM36SspkTsYI14t9Nu2U2gydwIpqumuEMjTANmdqcQwlP0raw/g/ 1fuzPvK5XSl7pvWqxH/WB4EtW0HHuTd6L2pWD5xRCeWXTuO7YGxbsHGiwgDDa2Nfjcnq a24XO1XFSBtE8IFaP6g2bdrhQolJ62CB2hqnr0iRAwQYqfjNIOILidqV1ogrilTXIcXj 71E+43FN5IsekRimT874Mo0xUcHFahIuVYggielAwSZo1QeQJzr7ka7j0UlC4ts9vM6r 94ug== X-Gm-Message-State: ACgBeo20A1Ioh39LrNCWTXfL2NuY4ACZ51C4NF36BR3w60zWkbPDNk2L mE3G2BTlebbrVuHbQiLPW22veqAoK1M= X-Google-Smtp-Source: AA6agR4FJgKJn/DcSXVToENvx6SagYVahEUG2h4MSpz7/d7gAm+L+eYsxlbRl0QKf+xIESTfrBdUpg== X-Received: by 2002:a05:6a00:24d1:b0:537:2916:e1d with SMTP id d17-20020a056a0024d100b0053729160e1dmr3537906pfv.66.1661334170485; Wed, 24 Aug 2022 02:42:50 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:50 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 29/51] tests/qtest: libqtest: Install signal handler via signal() Date: Wed, 24 Aug 2022 17:40:07 +0800 Message-Id: <20220824094029.1634519-30-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng At present the codes uses sigaction() to install signal handler with a flag SA_RESETHAND. Such usage can be covered by the signal() API that is a simplified interface to the general sigaction() facility. Update to use signal() to install the signal handler, as it is avaiable on Windows which we are going to support. Signed-off-by: Bin Meng --- tests/qtest/libqtest.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 1b24a4f1f7..70d7578740 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -68,7 +68,7 @@ struct QTestState QTestState *global_qtest; static GHookList abrt_hooks; -static struct sigaction sigact_old; +static sighandler_t sighandler_old; static int qtest_query_target_endianness(QTestState *s); @@ -181,20 +181,12 @@ static void sigabrt_handler(int signo) static void setup_sigabrt_handler(void) { - struct sigaction sigact; - - /* Catch SIGABRT to clean up on g_assert() failure */ - sigact = (struct sigaction){ - .sa_handler = sigabrt_handler, - .sa_flags = SA_RESETHAND, - }; - sigemptyset(&sigact.sa_mask); - sigaction(SIGABRT, &sigact, &sigact_old); + sighandler_old = signal(SIGABRT, sigabrt_handler); } static void cleanup_sigabrt_handler(void) { - sigaction(SIGABRT, &sigact_old, NULL); + signal(SIGABRT, sighandler_old); } static bool hook_list_is_empty(GHookList *hook_list) From patchwork Wed Aug 24 09:40:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953274 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1935BC00140 for ; Wed, 24 Aug 2022 10:55:33 +0000 (UTC) Received: from localhost ([::1]:46066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQo2m-0003AB-50 for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:55:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuW-0004H9-Tl; Wed, 24 Aug 2022 05:42:57 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:43528) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuV-0001cf-9S; Wed, 24 Aug 2022 05:42:56 -0400 Received: by mail-pg1-x531.google.com with SMTP id v4so14530702pgi.10; Wed, 24 Aug 2022 02:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=sE4uin/5Bmc8/yGa6VCpnxa0hplMimzWw2M8gv5/mEQ=; b=fV1hODKhOZvakcFDKm461LeBn6X9stN3iz2YM9PxYQmpmn29VpVPGPBcOd4Kd5QUNI yMeMwKYr4eHe8luNoSBvtRMlzUhz2dNR3FEaUtUZ0WZYrMHxDvU/hlDRq6tl0U9iN3u8 LhZL6b/QSSkQLp0qOYCEc4V87KPLliXiQIwl/31BvLcFcDharzzqQbiLNF9V048xTN+j 6x99p4LYHVCP682xu716wOzfYReZ52TovFs05XT0kJBWJIg3YGOzAm2Rtctf8HbXR+oE nF6IJ0DIJjvPZZv4SKSU1ibwXDyB/L0zNGp8qQ4s66yjqTt7OOE84VDvCjNK9+zFkiz3 zcUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=sE4uin/5Bmc8/yGa6VCpnxa0hplMimzWw2M8gv5/mEQ=; b=MEVfcLJyKDgisvy02G0Enyt7wKaMNIaYJ+iXZdbanjkqnM6ZL61Go2Nl71F+KRb4I8 8x12m7RGPrPoIhR9npXl7tLPOvWkiHG2ysdD2EqjPlAV3eYE2e4Gvkzi9ch3iaVc6i8p 6asfWhcDzU32HTus6Lmy4cXXxYVfixaUKJbdT7ryV8rypG8yABWgLVKActlfNFZpFP1M kZDSQ5hWAfsY1ZSRyk6xUkrREYHXhzdruHubDRt5xuAQ6c+HbW2/+tHDs3TEqHYUA1fC stIjwjmCoObv1M1VJQutzUOqqcTQzWYxfmYa2z4UGQk1PkiWMlYEPsz9xv7VxVNNc6tP 6V1w== X-Gm-Message-State: ACgBeo31Qd2TcdZeJxy4dfnNbdfGcYB4JWVa+bMlDfSs5tcWqI5rKLDc /qEVBjxdN7uh+yuI+ZlCPl/XXht0pQY= X-Google-Smtp-Source: AA6agR6rZkHeHlGQXKdzSxISjnNBYsPTX5eqpxcAX8FqaIhEPaQP3uY/1HZW/G9r1dCM33evv7zbuw== X-Received: by 2002:a05:6a00:180b:b0:536:816b:f770 with SMTP id y11-20020a056a00180b00b00536816bf770mr15277423pfa.3.1661334173373; Wed, 24 Aug 2022 02:42:53 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:53 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Hanna Reitz , Kevin Wolf , Laurent Vivier , Paolo Bonzini , Thomas Huth , qemu-block@nongnu.org Subject: [PATCH 30/51] tests: Skip iotests and qtest when '--without-default-devices' Date: Wed, 24 Aug 2022 17:40:08 +0800 Message-Id: <20220824094029.1634519-31-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng When QEMU is configured with '--without-default-devices', we should not build and run iotests and qtest because devices used by these test cases are not built in. Signed-off-by: Bin Meng --- tests/qemu-iotests/meson.build | 5 +++++ tests/qtest/meson.build | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build index 323a4acb6a..38d9a874d2 100644 --- a/tests/qemu-iotests/meson.build +++ b/tests/qemu-iotests/meson.build @@ -2,6 +2,11 @@ if not have_tools or targetos == 'windows' or get_option('gprof') subdir_done() endif +# Skip iotests if configured without a default selection of devices +if not get_option('default_devices') + subdir_done() +endif + foreach cflag: config_host['QEMU_CFLAGS'].split() if cflag.startswith('-fsanitize') and \ not cflag.contains('safe-stack') and not cflag.contains('cfi-icall') diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index c97da5a062..0291b3966c 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -4,6 +4,11 @@ if not config_host.has_key('CONFIG_POSIX') subdir_done() endif +# Skip QTests if configured without a default selection of devices +if not get_option('default_devices') + subdir_done() +endif + slow_qtests = { 'ahci-test' : 60, 'bios-tables-test' : 120, From patchwork Wed Aug 24 09:40:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97F0CC32796 for ; Wed, 24 Aug 2022 10:47:26 +0000 (UTC) Received: from localhost ([::1]:36460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnuu-00024I-7z for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:47:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuZ-0004Jf-3d for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:00 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:36369) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuW-0001br-VF for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:42:58 -0400 Received: by mail-pg1-x534.google.com with SMTP id s206so14562498pgs.3 for ; Wed, 24 Aug 2022 02:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=CPsT8yKW9uSm1LoqvEpj4UnWFz4dPJ5OToB007xj8tE=; b=CqPR1+QBNs+cQpCW93zLh+SOdajgwCxnaqA9hceFY+/lJmFoP7+tPsOHgyKirwNDwY WZK1ys112Q0XVK0HsBf5xLwSJECbQSKiqLLEVyCytsDrer3fIGWsVFURNnp7Tl1OOpy5 ZA0Vo7zU/QOhWeaXKMDLKFUkMFY5yFXFepXVQ0LmlijMXIW9TpMUXk+Y6pcF5z6JcfBC YPyhJrRTipe0e9SB/ixPSHwpq1wITpcwP7yIMeXyRNTHpKhfltsbB3xbdBw7St2t1vf8 SX1lv09fABlssEXHKnMTitdt8ATpkmYtJGbjipHTGHDDmbKCC+WImoAPBQiwDVJdPnG5 QjRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=CPsT8yKW9uSm1LoqvEpj4UnWFz4dPJ5OToB007xj8tE=; b=iDFj7rVEJxzQOPEUbbS9U7KMBo9jAPeq/tDdhfa4fHwyM4YfQSHUHa9DUxbAxg+XCi Fli2CmyojUaOP/cVUgWv5BeUO2qfeCf27UjwEXelLmPLRd8GLe0w1E05zP77NIYZ8zr7 f92D1JJKcFtiDwzxrdzu0+jk+SN8UR6e5TH8c+B31N+EXGc/A9t/ow+JoLmunpCQcgnG puYJ7AHpgJoa93zLTrREu/ZuPVPqB61hE30HzdwmFt1acPShgCUfQ1kUeNYmUw4Kqlof K6n3sR9vBcC2XwbWfuM8KgfHhUHWEz8P8VwxPTbNjoWXQgcMhgCZxPakgGvlNTc8Q09F WKGg== X-Gm-Message-State: ACgBeo36bmZN9LMQy9OvbUHfAbrX7yrrCHHiVOlQSXWiZJb/Y5O129D1 ACIQn3YUsiKX9QlPXpHOvg1OJup+oek= X-Google-Smtp-Source: AA6agR4rjqEu1PIXZWh6c8j5VqyAUg3JTCPKQVlTXI8dlRxYGUpr5/CA81YbyDX1N21B/CSGxAbsQg== X-Received: by 2002:a63:d16:0:b0:41d:fe52:1d2f with SMTP id c22-20020a630d16000000b0041dfe521d2fmr24011424pgl.416.1661334175932; Wed, 24 Aug 2022 02:42:55 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:55 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Xuzhou Cheng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 31/51] tests/qtest: Support libqtest to build and run on Windows Date: Wed, 24 Aug 2022 17:40:09 +0800 Message-Id: <20220824094029.1634519-32-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng At present the libqtest codes were written to depend on several POSIX APIs, including fork(), kill() and waitpid(). Unfortunately these APIs are not available on Windows. This commit implements the corresponding functionalities using win32 native APIs. With this change, all qtest cases can build successfully on a Windows host, and we can start qtest testing on Windows now. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng --- tests/qtest/libqtest.c | 101 +++++++++++++++++++++++++++++++++++++++- tests/qtest/meson.build | 5 +- 2 files changed, 101 insertions(+), 5 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 70d7578740..99e52ff571 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -16,9 +16,11 @@ #include "qemu/osdep.h" +#ifndef _WIN32 #include #include #include +#endif /* _WIN32 */ #ifdef __linux__ #include #endif /* __linux__ */ @@ -27,6 +29,7 @@ #include "libqmp.h" #include "qemu/ctype.h" #include "qemu/cutils.h" +#include "qemu/sockets.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qjson.h" #include "qapi/qmp/qlist.h" @@ -35,6 +38,16 @@ #define MAX_IRQ 256 #define SOCKET_TIMEOUT 50 +#ifndef _WIN32 +# define CMD_EXEC "exec " +# define DEV_STDERR "/dev/fd/2" +# define DEV_NULL "/dev/null" +#else +# define CMD_EXEC "" +# define DEV_STDERR "2" +# define DEV_NULL "nul" +#endif + typedef void (*QTestSendFn)(QTestState *s, const char *buf); typedef void (*ExternalSendFn)(void *s, const char *buf); typedef GString* (*QTestRecvFn)(QTestState *); @@ -68,6 +81,9 @@ struct QTestState QTestState *global_qtest; static GHookList abrt_hooks; +#ifdef _WIN32 +typedef void (*sighandler_t)(int); +#endif static sighandler_t sighandler_old; static int qtest_query_target_endianness(QTestState *s); @@ -120,10 +136,18 @@ bool qtest_probe_child(QTestState *s) pid_t pid = s->qemu_pid; if (pid != -1) { +#ifndef _WIN32 pid = waitpid(pid, &s->wstatus, WNOHANG); if (pid == 0) { return true; } +#else + DWORD exit_code; + GetExitCodeProcess((HANDLE)pid, &exit_code); + if (exit_code == STILL_ACTIVE) { + return true; + } +#endif s->qemu_pid = -1; } return false; @@ -137,13 +161,23 @@ void qtest_set_expected_status(QTestState *s, int status) void qtest_kill_qemu(QTestState *s) { pid_t pid = s->qemu_pid; +#ifndef _WIN32 int wstatus; +#else + DWORD ret, exit_code; +#endif /* Skip wait if qtest_probe_child already reaped. */ if (pid != -1) { +#ifndef _WIN32 kill(pid, SIGTERM); TFR(pid = waitpid(s->qemu_pid, &s->wstatus, 0)); assert(pid == s->qemu_pid); +#else + TerminateProcess((HANDLE)pid, s->expected_status); + ret = WaitForSingleObject((HANDLE)pid, INFINITE); + assert(ret == WAIT_OBJECT_0); +#endif s->qemu_pid = -1; } @@ -151,6 +185,7 @@ void qtest_kill_qemu(QTestState *s) * Check whether qemu exited with expected exit status; anything else is * fishy and should be logged with as much detail as possible. */ +#ifndef _WIN32 wstatus = s->wstatus; if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) != s->expected_status) { fprintf(stderr, "%s:%d: kill_qemu() tried to terminate QEMU " @@ -167,6 +202,16 @@ void qtest_kill_qemu(QTestState *s) __FILE__, __LINE__, sig, signame, dump); abort(); } +#else + GetExitCodeProcess((HANDLE)pid, &exit_code); + CloseHandle((HANDLE)pid); + if (exit_code != s->expected_status) { + fprintf(stderr, "%s:%d: kill_qemu() tried to terminate QEMU " + "process but encountered exit status %ld (expected %d)\n", + __FILE__, __LINE__, exit_code, s->expected_status); + abort(); + } +#endif } static void kill_qemu_hook_func(void *s) @@ -245,6 +290,38 @@ static const char *qtest_qemu_binary(void) return qemu_bin; } +#ifdef _WIN32 +static pid_t qtest_create_process(char *cmd) +{ + STARTUPINFO si; + PROCESS_INFORMATION pi; + BOOL ret; + + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + ZeroMemory(&pi, sizeof(pi)); + + ret = CreateProcess(NULL, /* module name */ + cmd, /* command line */ + NULL, /* process handle not inheritable */ + NULL, /* thread handle not inheritable */ + FALSE, /* set handle inheritance to FALSE */ + 0, /* No creation flags */ + NULL, /* use parent's environment block */ + NULL, /* use parent's starting directory */ + &si, /* pointer to STARTUPINFO structure */ + &pi /* pointer to PROCESS_INFORMATION structure */ + ); + if (ret == 0) { + fprintf(stderr, "%s:%d: unable to create a new process (%s)\n", + __FILE__, __LINE__, strerror(GetLastError())); + abort(); + } + + return (pid_t)pi.hProcess; +} +#endif /* _WIN32 */ + QTestState *qtest_init_without_qmp_handshake(const char *extra_args) { QTestState *s; @@ -272,6 +349,9 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) unlink(socket_path); unlink(qmp_socket_path); +#ifdef _WIN32 + socket_init(); +#endif sock = init_socket(socket_path); qmpsock = init_socket(qmp_socket_path); @@ -280,7 +360,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) qtest_add_abrt_handler(kill_qemu_hook_func, s); - command = g_strdup_printf("exec %s %s" + command = g_strdup_printf(CMD_EXEC "%s %s" "-qtest unix:%s " "-qtest-log %s " "-chardev socket,path=%s,id=char0 " @@ -289,7 +369,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) "%s" " -accel qtest", qemu_binary, tracearg, socket_path, - getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null", + getenv("QTEST_LOG") ? DEV_STDERR : DEV_NULL, qmp_socket_path, extra_args ?: ""); @@ -298,6 +378,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) s->pending_events = NULL; s->wstatus = 0; s->expected_status = 0; +#ifndef _WIN32 s->qemu_pid = fork(); if (s->qemu_pid == 0) { #ifdef __linux__ @@ -320,6 +401,9 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) execlp("/bin/sh", "sh", "-c", command, NULL); exit(1); } +#else + s->qemu_pid = qtest_create_process(command); +#endif /* _WIN32 */ g_free(command); s->fd = socket_accept(sock); @@ -338,9 +422,19 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) s->irq_level[i] = false; } + /* + * Stopping QEMU for debugging is not supported on Windows. + * + * Using DebugActiveProcess() API can suspend the QEMU process, + * but gdb cannot attach to the process. Using the undocumented + * NtSuspendProcess() can suspend the QEMU process and gdb can + * attach to the process, but gdb cannot resume it. + */ +#ifndef _WIN32 if (getenv("QTEST_STOP")) { kill(s->qemu_pid, SIGSTOP); } +#endif /* ask endianness of the target */ @@ -393,6 +487,9 @@ QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd) g_assert_true(g_mkdtemp(sock_dir) != NULL); sock_path = g_strdup_printf("%s/sock", sock_dir); +#ifdef _WIN32 + socket_init(); +#endif sock_fd_init = init_socket(sock_path); qts = qtest_initf("-chardev socket,id=s0,path=%s -serial chardev:s0 %s", diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 0291b3966c..6d469a1822 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -1,6 +1,5 @@ -# All QTests for now are POSIX-only, but the dependencies are -# really in libqtest, not in the testcases themselves. -if not config_host.has_key('CONFIG_POSIX') +# Build all QTests for POSIX and Windows +if not config_host.has_key('CONFIG_POSIX') and not config_host.has_key('CONFIG_WIN32') subdir_done() endif From patchwork Wed Aug 24 09:40:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953157 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A3B4CC00140 for ; Wed, 24 Aug 2022 10:07:29 +0000 (UTC) Received: from localhost ([::1]:44492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnIG-00036j-Og for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:07:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuc-0004MQ-TF; Wed, 24 Aug 2022 05:43:03 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:54853) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmua-0001ef-Jq; Wed, 24 Aug 2022 05:43:01 -0400 Received: by mail-pj1-x1029.google.com with SMTP id bf22so16490340pjb.4; Wed, 24 Aug 2022 02:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Fh5IADzLChmDjxkrpWsCj8Fs3Tnsz/cyvb/BerXAflg=; b=LqblTMxq3Mc6jUl5h8nnSzgNibYFICp8fZsnoRN19X1eqDPQIKuenoldw82V/ni8du jJckz9Yx1U4bfRebjJUN9lxoKP7x4ajA+IGd6ZgJgQQ88BQJ4DMOvg8Pe0zla7tciQzH 8eP2bsnAcoqn0eHjZanLP5A2CTeM78ZmYnOnW60WfNs/YNRJ6gzYYn9wCjKxBi1q1/zy 336xswD8TUW21oI+M79kW+6DbwvgiPkCBLDNRDVwS13S4x8jKsyBcjRyfhQt7ep+cgVd SDOwRW8181J2pLmG8I+pWHjDWov+cMnIUnJxc7ijTHtFWn91zNeo2F6Iwgma6YJVrMz3 4cxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Fh5IADzLChmDjxkrpWsCj8Fs3Tnsz/cyvb/BerXAflg=; b=SZKxcrSk3IwfmIfO5SpJ24vXs06hC+UnkuEAXVM6mWa4MfxVdYYdwespmQAVenW/Y4 D9HPNAbCTybKaZfKXb6OopXskkdRjPmJwevNsDAXHckkejrisHLBC5WIfECsRn53eCdG UeGi8AM1trHCl3aa3mCvTRw5lwWitvhfVcP/GVV0JODrSv8u9Ahp1NRYNwXCg9h6CtEB pZoAOzxalVyJm5IDawKQ6bCvMwikb1NG4EVDq8jlfRkWVUU9bTclPlp9hmAzvqqCz4+S PRbeQ7k7pFJOy8mAjJU3MS1GkYFXdQeTk+qhQLmBcXcp4ydlJ7jtti1u46M2wuFJR/Hd LnSg== X-Gm-Message-State: ACgBeo2yhqdNKslQCUSs+IfMBF2XhTnsmkFvUULBwjkEVPYir82TevgB QHLMVF5x2PULUeHZS4lMI+ASVzQFmNM= X-Google-Smtp-Source: AA6agR4rIQOiAg2O2QvH0ykk9DKb2bOB3N3VoYE7fp6sDLNSeafa4RG4CcjKoXk9BXSGR0RSDa0HUw== X-Received: by 2002:a17:902:ea12:b0:172:de75:bc7b with SMTP id s18-20020a170902ea1200b00172de75bc7bmr15835560plg.25.1661334178803; Wed, 24 Aug 2022 02:42:58 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:42:58 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , John Snow , Laurent Vivier , Paolo Bonzini , Thomas Huth , qemu-block@nongnu.org Subject: [PATCH 32/51] tests/qtest: Fix ERROR_SHARING_VIOLATION for win32 Date: Wed, 24 Aug 2022 17:40:10 +0800 Message-Id: <20220824094029.1634519-33-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng On Windows, the MinGW provided mkstemp() API opens the file with exclusive access, denying other processes to read/write the file. Such behavior prevents the QEMU executable from opening the file, (e.g.: CreateFile returns ERROR_SHARING_VIOLATION). This can be fixed by closing the file and reopening it. Signed-off-by: Bin Meng --- tests/qtest/ahci-test.c | 14 ++++++++++++++ tests/qtest/boot-serial-test.c | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index f26cd6f86f..0e88cd0eef 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -1443,6 +1443,20 @@ static int prepare_iso(size_t size, unsigned char **buf, char **name) int fd = mkstemp(cdrom_path); g_assert(fd != -1); +#ifdef _WIN32 + /* + * On Windows, the MinGW provided mkstemp() API opens the file with + * exclusive access, denying other processes to read/write the file. + * Such behavior prevents the QEMU executable from opening the file, + * (e.g.: CreateFile returns ERROR_SHARING_VIOLATION). + * + * Close the file and reopen it. + */ + close(fd); + fd = open(cdrom_path, O_WRONLY); + g_assert(fd != -1); +#endif + g_assert(buf); g_assert(name); patt = g_malloc(size); diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c index 404adcfa20..fb6c81bf35 100644 --- a/tests/qtest/boot-serial-test.c +++ b/tests/qtest/boot-serial-test.c @@ -235,6 +235,19 @@ static void test_machine(const void *data) ser_fd = mkstemp(serialtmp); g_assert(ser_fd != -1); +#ifdef _WIN32 + /* + * On Windows, the MinGW provided mkstemp() API opens the file with + * exclusive access, denying other processes to read/write the file. + * Such behavior prevents the QEMU executable from opening the file, + * (e.g.: CreateFile returns ERROR_SHARING_VIOLATION). + * + * Close the file and reopen it. + */ + close(ser_fd); + ser_fd = open(serialtmp, O_RDONLY); + g_assert(ser_fd != -1); +#endif if (test->kernel) { code = test->kernel; From patchwork Wed Aug 24 09:40:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 342A3C00140 for ; Wed, 24 Aug 2022 10:57:36 +0000 (UTC) Received: from localhost ([::1]:44900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQo4l-0006EY-2b for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:57:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuh-0004NX-2R; Wed, 24 Aug 2022 05:43:07 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:40598) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmud-0001f8-Pr; Wed, 24 Aug 2022 05:43:05 -0400 Received: by mail-pl1-x632.google.com with SMTP id x23so15191752pll.7; Wed, 24 Aug 2022 02:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=/VLZ6dLEwhi2chftBh37GSy19Wuab6YAYmjufo6q520=; b=VLCeVfQ0VlrSUdv/RbrmfZbWOD/r6Nj51yvPcKqsi2UruZ2hwydXU/z8gByVOX6EHA A4tnnOP1BnTubE5yyNy8Fx+SsOBFpQT4LzhVv0RCqP85oWcYV6vKjTFmaVlNKDmdr98j UQx10XLhTsSn/BkUtxolKgFxuLfcTym4mxuFOnDEaeoTLk6f4tWGY+OB+vtczzCU5suh lfVZMbvg42/BLgLie+pEmgHWnpMiRjeht7FMxutQ7geJQgTEZd2Vr65z0KWhJfQSo4Fy dt88w2jlb+jgTaxr/o7Y9kBXV2vGy4rXp2G7Ph0CniiLMXbspdfwncc7IcJUUZLBZCu0 J0Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=/VLZ6dLEwhi2chftBh37GSy19Wuab6YAYmjufo6q520=; b=T2eU6c0nVH/ZlHqEPpmw3fJoWU8kmfDA0XfRvNKzywAuL0NiQ7s/QstDGuBQ0cP06w uP/JPKhCYhSd0PnQ7OTDfIW/rJx1GcBEWCIUAqjiWOCLzP1bNLD5o3nvBbKBmlQBWD6E ZMXX/TwG4zPdlH6q7zw9CoavAWayfbVBpYaH3lyKmKTUG9OR9c2uAol+xDi5xJEGLFtW XC0oolqNEoKNIw5P5CVFE6OCO6HN9UUcJiXyuovnVnbPylhCLIN+GWhvztu99godEdYH Y6hLuvh+DAlScO/OcDSJH+3E3wPode7JgsnuEqJkRvLLIOff3RjGpx67Pmp88Y505+kU Mtbw== X-Gm-Message-State: ACgBeo1efpU98k1HNGzM6vWErfzAHz2uk0SkH7BvcYLlJcLhKZs9hkBI XaKJ47UeiLSMI+XeyBrP9VKJxWQrXx8= X-Google-Smtp-Source: AA6agR4Yh9tytQwZIx+V6LzE1S5IiFITxtOROjx6UWm1XchsDbdFiQlfjC6vDYybCOxDcw3N8IJv9Q== X-Received: by 2002:a17:902:7783:b0:173:11e6:a580 with SMTP id o3-20020a170902778300b0017311e6a580mr3219028pll.10.1661334181357; Wed, 24 Aug 2022 02:43:01 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.42.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:00 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , John Snow , Laurent Vivier , Paolo Bonzini , Thomas Huth , qemu-block@nongnu.org Subject: [PATCH 33/51] tests/qtest: {ahci, ide}-test: Use relative path for temporary files Date: Wed, 24 Aug 2022 17:40:11 +0800 Message-Id: <20220824094029.1634519-34-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng These test cases uses "blkdebug:path/to/config:path/to/image" for testing. On Windows, absolute file paths contain the delimiter ':' which causes the blkdebug filename parser fail to parse filenames. Signed-off-by: Bin Meng Signed-off-by: Bin Meng --- tests/qtest/ahci-test.c | 19 ++++++++++++++++--- tests/qtest/ide-test.c | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index 0e88cd0eef..bce9ff770c 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -1848,7 +1848,7 @@ static void create_ahci_io_test(enum IOMode type, enum AddrMode addr, int main(int argc, char **argv) { - const char *arch; + const char *arch, *base; int ret; int fd; int c; @@ -1886,8 +1886,21 @@ int main(int argc, char **argv) return 0; } + /* + * "base" stores the starting point where we create temporary files. + * + * On Windows, this is set to the relative path of current working + * directory, because the absolute path causes the blkdebug filename + * parser fail to parse "blkdebug:path/to/config:path/to/image". + */ +#ifndef _WIN32 + base = g_get_tmp_dir(); +#else + base = "."; +#endif + /* Create a temporary image */ - tmp_path = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); + tmp_path = g_strdup_printf("%s/qtest.XXXXXX", base); fd = mkstemp(tmp_path); g_assert(fd >= 0); if (have_qemu_img()) { @@ -1905,7 +1918,7 @@ int main(int argc, char **argv) close(fd); /* Create temporary blkdebug instructions */ - debug_path = g_strdup_printf("%s/qtest-blkdebug.XXXXXX", g_get_tmp_dir()); + debug_path = g_strdup_printf("%s/qtest-blkdebug.XXXXXX", base); fd = mkstemp(debug_path); g_assert(fd >= 0); close(fd); diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index ebbf8e0126..c5cad6c0be 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -1011,17 +1011,31 @@ static void test_cdrom_dma(void) int main(int argc, char **argv) { + const char *base; int fd; int ret; + /* + * "base" stores the starting point where we create temporary files. + * + * On Windows, this is set to the relative path of current working + * directory, because the absolute path causes the blkdebug filename + * parser fail to parse "blkdebug:path/to/config:path/to/image". + */ +#ifndef _WIN32 + base = g_get_tmp_dir(); +#else + base = "."; +#endif + /* Create temporary blkdebug instructions */ - debug_path = g_strdup_printf("%s/qtest-blkdebug.XXXXXX", g_get_tmp_dir()); + debug_path = g_strdup_printf("%s/qtest-blkdebug.XXXXXX", base); fd = mkstemp(debug_path); g_assert(fd >= 0); close(fd); /* Create a temporary raw image */ - tmp_path = g_strdup_printf("%s/qtest.XXXXXX", g_get_tmp_dir()); + tmp_path = g_strdup_printf("%s/qtest.XXXXXX", base); fd = mkstemp(tmp_path); g_assert(fd >= 0); ret = ftruncate(fd, TEST_IMAGE_SIZE); From patchwork Wed Aug 24 09:40:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953284 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5673EC00140 for ; Wed, 24 Aug 2022 11:04:23 +0000 (UTC) Received: from localhost ([::1]:44134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQoBK-0004kg-BN for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 07:04:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmui-0004OX-Jj for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:11 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:34555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuf-0001fP-TA for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:08 -0400 Received: by mail-pl1-x633.google.com with SMTP id io24so1899648plb.1 for ; Wed, 24 Aug 2022 02:43:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=4Ic8Dewm4aoDrdRLw64oIo7eHOUzBmGaQZ6sE0IwdOY=; b=jG/wQsD1ovlMBd/EBk/jX9hepGicoP4nWz+DY6uHIk1H44ND8LxPeRRcSBvbd8VoZb X6Qonji6B7yGhM4DcVSQypJ9f2bwgS2LJhL0DGjYNjXDv6KxlcGB26PjZeWgabgSnmeD oiflKc3H3KSyhKidgrfV13HlO+bNaT0ar2iCNtgdPWwSMf9xUnubmQtrNmSykMobKotY NVYA9iP3kcldspF2PKe5wFrhJFI+YMYJn2WF7gZj6WAkZe2LIjyda98m4smUFrYPkbJA H0OzxreYNl4/5uDmrEeJUKpFFQRlAIN3mfn8kZVrWZBDwkhBfPtC2zZzmxuLfxgkH5sU d+2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=4Ic8Dewm4aoDrdRLw64oIo7eHOUzBmGaQZ6sE0IwdOY=; b=ql2yJ5qeukelJbai+TAFY+W/sHkuvrAXqvG/4nh8hAM5PrVCgqpC1mpe1Nvq8uU/e7 RrsIXAt95lThv04VFgP+KgTuzX3F6NaqbU96mM67g+By7zZv9QxqCeCA846zNQqpAUa4 ut7r5UJtJ+ZSiwhYVhX5aTYXNXRAJkJgcq7Xon28A/KXMk+WIkk5+cY4E+2aL9PkLsKG uvczecK5tbrJG0Pu8vlnwkXPXUONeQuIAEs6y9iasjxuo7ZxGgEHUstw5Ar7pOUycrD3 6rFXl8Ns+BG45ICTebWQpFLwEw5We3DB/rbgjT0Yqq4qmi2rjoTsXT2nD91oOvW5yto4 V/ZA== X-Gm-Message-State: ACgBeo1WLlGpKkr5trATPIY+i9dCVu5Rgk17b/ps1cFemBjvTyPAU0TT dvUzbtVv8hxvewR0mHzJaRYOiD/UNeU= X-Google-Smtp-Source: AA6agR50nKWKX3hEzItpGrCI8zzpBfI0Wn0y2+eoW4OOUGLgaDo9no/QXSzsdSc4wF6KhP2bapc59w== X-Received: by 2002:a17:902:bd49:b0:172:df88:8981 with SMTP id b9-20020a170902bd4900b00172df888981mr15553890plx.120.1661334183799; Wed, 24 Aug 2022 02:43:03 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:03 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Ani Sinha , Igor Mammedov , "Michael S. Tsirkin" Subject: [PATCH 34/51] tests/qtest: bios-tables-test: Adapt the case for win32 Date: Wed, 24 Aug 2022 17:40:12 +0800 Message-Id: <20220824094029.1634519-35-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Single quotes in the arguments (oem_id='CRASH ') are not removed in the Windows environment before it is passed to the QEMU executable. The space in the argument causes the "-acpitable" option parser to think that all of its parameters are done, hence it complains: '-acpitable' requires one of 'data' or 'file' Change to use double quotes which works fine on all platforms. Also /dev/null does not work on win32, and nul should be used. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- tests/qtest/bios-tables-test.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 36783966b0..0148ce388c 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1615,6 +1615,12 @@ static void test_acpi_virt_viot(void) free_test_data(&data); } +#ifndef _WIN32 +# define DEV_NULL "/dev/null" +#else +# define DEV_NULL "nul" +#endif + static void test_acpi_q35_slic(void) { test_data data = { @@ -1622,9 +1628,9 @@ static void test_acpi_q35_slic(void) .variant = ".slic", }; - test_acpi_one("-acpitable sig=SLIC,oem_id='CRASH ',oem_table_id='ME'," - "oem_rev=00002210,asl_compiler_id='qemu'," - "asl_compiler_rev=00000000,data=/dev/null", + test_acpi_one("-acpitable sig=SLIC,oem_id=\"CRASH \",oem_table_id=ME," + "oem_rev=00002210,asl_compiler_id=qemu," + "asl_compiler_rev=00000000,data=" DEV_NULL, &data); free_test_data(&data); } From patchwork Wed Aug 24 09:40:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67244C00140 for ; Wed, 24 Aug 2022 11:03:06 +0000 (UTC) Received: from localhost ([::1]:45884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQoA4-0003pm-58 for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 07:03:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmui-0004OZ-Sg for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:11 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:38517) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuh-0001ft-Co for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:08 -0400 Received: by mail-pf1-x433.google.com with SMTP id y127so13000933pfy.5 for ; Wed, 24 Aug 2022 02:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=u98oOh2RZJczW5UAcqsVUjAFpgf7KCCG68fKfAs85dg=; b=ADokp7IbBe6sNqDoaeIH5+IGs35wZ6xDjqAdtOZhmV+TEBqYAtJRKETCLPwUC7xS// MRlX21bpUa5fQynBeS/tGiK2Tg38i9ge/+egam5S2VOHkGILfg4sk5AmqFf6QG2KOHuz QFQKYn8rQ4dhsvCuEvU1ErLig8pRIqaQZshJJ9AUG4xiFYxfutcL41zwD7TkiQhIVnEJ xahE2swvNzOEljkje5qOhJfd4vBaaC2IbnyxzjeDsqR7JGtDPVZLDETrmpPU4ehwWL5k 4HeSuftdKqjcjSa1J0ZDfecpDmU7xXR0+oiCXJjAe5sSJyVR7I8DarI+vSSzWGjLWyhR iC8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=u98oOh2RZJczW5UAcqsVUjAFpgf7KCCG68fKfAs85dg=; b=IHXJFICynPem4fglxMzSwNz9FOrJi6IchCfvh9NA3nzcON1v9pVStA/HwyGh0jK+Ph sBqb+skjmArXv8kXbfjNmDvrUdu8ZSH5Sr3SyXFQMU9ooQW8jckEHHpfXkWeoRpNM1Cc eMbDyW8qMbdto9yV55oKi8NnbWsn9mQAf39JL4gCWX6jJ6c+JiR3WBz1RaCj2RIm5I9l hh4oU1y7CdaMoP4qMCpSRIHn4ivfcOf3+m37FD03W3vQ+awBPq2JuaSVz6qs6LprtMdJ C+YQ+bifCGWL3XZiBy5SV3W39dU0mbmlS8luTXLyoRDDIQgFLxUNqRyUDOPC9b5mhXjI rBwA== X-Gm-Message-State: ACgBeo2zjiP1cjsAmoSRvXWV+6Scuh2iNR5vqaquHzjPPEBCSZs1mxjo q6dYrnCLf4tu1spoNvXdv37as9o8hMo= X-Google-Smtp-Source: AA6agR7npptidhh5bxOO7LDgFmActNzUSNI0cpOBCLF05bODydPEdxRuPELPaHebGnwhhn60AgymUg== X-Received: by 2002:a63:3509:0:b0:42b:15a6:8267 with SMTP id c9-20020a633509000000b0042b15a68267mr2453122pga.570.1661334185942; Wed, 24 Aug 2022 02:43:05 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:05 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 35/51] tests/qtest: device-plug-test: Reverse the usage of double/single quotes Date: Wed, 24 Aug 2022 17:40:13 +0800 Message-Id: <20220824094029.1634519-36-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng The usage of double/single quotes in test_pci_unplug_json_request() should be reversed to work on both win32 and non-win32 platforms: - The value of -device parameter needs to be surrounded by "" as Windows does not drop '' when passing it to QEMU which causes QEMU command line option parser failure. - The JSON key/value pairs need to be surrounded by '' to make the JSON parser happy on Windows. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth --- tests/qtest/device-plug-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index 2e3137843e..a1fb99c8ff 100644 --- a/tests/qtest/device-plug-test.c +++ b/tests/qtest/device-plug-test.c @@ -95,7 +95,7 @@ static void test_pci_unplug_json_request(void) } QTestState *qtest = qtest_initf( - "%s -device '{\"driver\": \"virtio-mouse-pci\", \"id\": \"dev0\"}'", + "%s -device \"{'driver': 'virtio-mouse-pci', 'id': 'dev0'}\"", machine_addition); /* From patchwork Wed Aug 24 09:40:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8A1EC00140 for ; Wed, 24 Aug 2022 10:13:23 +0000 (UTC) Received: from localhost ([::1]:34564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnNy-0000Zu-2B for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:13:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmul-0004Og-5m for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:11 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:38518) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuj-0001h0-Ki for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:10 -0400 Received: by mail-pf1-x434.google.com with SMTP id y127so13001004pfy.5 for ; Wed, 24 Aug 2022 02:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=0zcu0n9LW86iNDYo0FnxWs0JURAtkjxHBse1nGh+orQ=; b=jAwRr3TJdj3E6aVSq0FR8RTUwDndv30CUAf843Oedit4lvZXFumH0KMAJ9Qme4LYFI tX9CMpf4P09Nef4WvMHk6ma6jrQf1SzyWdjhGUbxjgnGJYcAP+ktcc8tuB5qFWSU5OUa pUdBm4AA1a1uOB6K8sVoE4qBg/3BvmOcCqF0+jBIHUwNKhP1hWXJIA9BR/ofgh2dgg1p vwXMLh4dQVv8kcvkOx/CPKagLBsdNY7h9wex1EyF4PJ9QFCJ1jz5aR89X6JOSCfl2WOY fiqbbAQ9JPiSzD3j7umzxAiRpx6HvbExhd+DUdH1Y3Lr9YUeWrsBMw5AUS1FRdvJvrXQ wm6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=0zcu0n9LW86iNDYo0FnxWs0JURAtkjxHBse1nGh+orQ=; b=rqTYVsDjhZM/GqNrPltV7tqvnHmZaaIFHP9yINqSzJjsLJ33DhpVZoFVuwTttuWV9E Uj9v7IULFrzGAK1u1mGpNXsGuKIdMUcMo9UjZilZ91MmoC11GfhqsyeXapiUv92hdj4x 3FrLbn7X/JtW7ZsF3cT7Lj9/94Qe9BkPM8V+DNr1aUIhqbpbpGHChN+wGmecXDFj/KJe ZeUdNgpM6t0mXWGxBcccB48/y/wY1LxMQhLT7PKt9xje4sj5z1DZQKeuBAoB/18EtoaE Tr6KteFekajMNU/K8lYcYktz/Iicy/enCMESBUIsjMuXc6d9oP1RcrkUe6LV5SHRhjYZ eKxg== X-Gm-Message-State: ACgBeo0ADgJvGe/CxKvlpZPe5TQ+HaL6rWLwqER6xewOb7X07XEkB9Bj cvI52fzZQwp75hre8EEMCUfL9ofwMpU= X-Google-Smtp-Source: AA6agR5q/NqyG0wSZNYTpwWW43l0RKmfKOF48j5KkwZP3MokFVf/vXIjLwIsga03EQJpzZXl++xalA== X-Received: by 2002:a63:5912:0:b0:42a:dcc6:210d with SMTP id n18-20020a635912000000b0042adcc6210dmr7470279pgb.50.1661334187964; Wed, 24 Aug 2022 02:43:07 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:07 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 36/51] tests/qtest: machine-none-test: Use double quotes to pass the cpu option Date: Wed, 24 Aug 2022 17:40:14 +0800 Message-Id: <20220824094029.1634519-37-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Single quotes in the arguments (e.g.: -cpu 'qemu64,apic-id=0') are not removed in the Windows environment before it is passed to the QEMU executable. Such argument causes a failure in the QEMU CPU option parser codes. Change to use double quotes which works fine on all platforms. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth --- tests/qtest/machine-none-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/machine-none-test.c b/tests/qtest/machine-none-test.c index f92fab479f..31cc0bfb01 100644 --- a/tests/qtest/machine-none-test.c +++ b/tests/qtest/machine-none-test.c @@ -81,7 +81,7 @@ static void test_machine_cpu_cli(void) " add it to cpus_map\n", arch); return; /* TODO: die here to force all targets have a test */ } - qts = qtest_initf("-machine none -cpu '%s'", cpu_model); + qts = qtest_initf("-machine none -cpu \"%s\"", cpu_model); response = qtest_qmp(qts, "{ 'execute': 'quit' }"); g_assert(qdict_haskey(response, "return")); From patchwork Wed Aug 24 09:40:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6857C32793 for ; Wed, 24 Aug 2022 10:19:18 +0000 (UTC) Received: from localhost ([::1]:49480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnTi-0006Ku-0h for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:19:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmun-0004Qn-Tk for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:16 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:45013) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmum-0001jM-3s for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:13 -0400 Received: by mail-pj1-x1032.google.com with SMTP id r15-20020a17090a1bcf00b001fabf42a11cso950691pjr.3 for ; Wed, 24 Aug 2022 02:43:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=hUl0ynk/tFixZOGM/lQ3GUXaTY7tp/lhfNkZoNncHPk=; b=EF9AIrePmYD2JceHt4BGbq+PRGTpecsKp+p6fyNfxYUsb+huoFjrZxf2xFbPfr0M/l prgyKNVmXTWE2/JQ04ZzlwUtEIsCODPgqLoHZDJGZ9OAnmDNEjw8PJAQ6KMIggcnZYJt jkCHqFGdUkWwUgvU1Q+UzTB8R0Cj4qzIo9Qpxi9Nqp8ryT1D/X82hX0Xnr/3UROmoG/F ZuHrdOMwNECJEYBxXOjA7w1zEgvSF5QXARXWUYcjrPgZ3NiJhw+sWZcAkT3wC5UArhPM hDVsbMG6hMZSvxsx9SGDI1vw8kYeWbC2GuJLlcdyyvdWDC9/tK4VRrO1UtWHghaGY3rq /rkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=hUl0ynk/tFixZOGM/lQ3GUXaTY7tp/lhfNkZoNncHPk=; b=LO4tn0wLk39rExv4yEWuF8H59gtkID0PJ9ZOIZfKhXP1x4bP7n7w2uJXSr7HlvQSw5 bMSCauh+DIjG5uTzZ0FR4yYvifedgPiHYZZfVJgM5rkbfn+BvkcOXVSD/tpr2rfNflBb E78ehbPG6t+JMpFfBhLtLBaaDo8FKd44Kns4IzbJiw7LVfW7gxTZBTfVGZRK6seOZT+O vuJYf7UOZAgZ3wPwHpnvT7esdrJwlyo7CMVjH7tosGvk7clVxMsv66rzLYKklP78C2fE ODPiE6leovv4dbrLfiZ4sCRxyyIefvIjHq33VvozaSJdKY0AKcyVNRKG8r7aq465k263 Vm5A== X-Gm-Message-State: ACgBeo0YN89H967uKVslOIr7ICbquesLKPj/mFu+7OE1gIU6hysKrEjd Dylsm+N0li2EvubxfTgCjcEqJsl07Jw= X-Google-Smtp-Source: AA6agR7rlNgKaUJlakGO1/J0so4uMaqd860TscxMeD9DxwvESwDi7a0+sWjPk2Z5WX6e8oVfcLkYYw== X-Received: by 2002:a17:90b:378a:b0:1fa:f716:a427 with SMTP id mz10-20020a17090b378a00b001faf716a427mr7573477pjb.153.1661334190406; Wed, 24 Aug 2022 02:43:10 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:10 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , "Dr. David Alan Gilbert" , Juan Quintela , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 37/51] tests/qtest: migration-test: Disable IO redirection for win32 Date: Wed, 24 Aug 2022 17:40:15 +0800 Message-Id: <20220824094029.1634519-38-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng On Windows the QEMU executable is created via CreateProcess() and IO redirection does not work, so we need to set MigrateStart::hide_stderr to false to disable adding IO redirection to the command line. Signed-off-by: Bin Meng --- tests/qtest/migration-test.c | 39 +++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 2ae7498d5d..125d48d855 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -53,6 +53,17 @@ static bool uffd_feature_thread_id; */ #define DIRTYLIMIT_TOLERANCE_RANGE 25 /* MB/s */ +/* + * On Windows the QEMU executable is created via CreateProcess() and IO + * redirection does not work, so we need to set MigrateStart::hide_stderr + * to false to disable adding IO redirection to the command line. + */ +#ifndef _WIN32 +# define HIDE_STDERR true +#else +# define HIDE_STDERR false +#endif + #if defined(__linux__) #include #include @@ -1186,7 +1197,7 @@ static void test_postcopy_recovery_common(MigrateCommon *args) g_autofree char *uri = NULL; /* Always hide errors for postcopy recover tests since they're expected */ - args->start.hide_stderr = true; + args->start.hide_stderr = HIDE_STDERR; if (migrate_postcopy_prepare(&from, &to, args)) { return; @@ -1287,7 +1298,7 @@ static void test_postcopy_preempt_all(void) static void test_baddest(void) { MigrateStart args = { - .hide_stderr = true + .hide_stderr = HIDE_STDERR }; QTestState *from, *to; @@ -1410,7 +1421,7 @@ static void test_precopy_unix_tls_x509_default_host(void) g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); MigrateCommon args = { .start = { - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }, .connect_uri = uri, .listen_uri = uri, @@ -1526,7 +1537,7 @@ static void test_precopy_tcp_tls_psk_mismatch(void) { MigrateCommon args = { .start = { - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }, .listen_uri = "tcp:127.0.0.1:0", .start_hook = test_migrate_tls_psk_start_mismatch, @@ -1564,7 +1575,7 @@ static void test_precopy_tcp_tls_x509_mismatch_host(void) { MigrateCommon args = { .start = { - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }, .listen_uri = "tcp:127.0.0.1:0", .start_hook = test_migrate_tls_x509_start_mismatch_host, @@ -1590,7 +1601,7 @@ static void test_precopy_tcp_tls_x509_hostile_client(void) { MigrateCommon args = { .start = { - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }, .listen_uri = "tcp:127.0.0.1:0", .start_hook = test_migrate_tls_x509_start_hostile_client, @@ -1616,7 +1627,7 @@ static void test_precopy_tcp_tls_x509_reject_anon_client(void) { MigrateCommon args = { .start = { - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }, .listen_uri = "tcp:127.0.0.1:0", .start_hook = test_migrate_tls_x509_start_reject_anon_client, @@ -1747,7 +1758,7 @@ static void test_validate_uuid_error(void) MigrateStart args = { .opts_source = "-uuid 11111111-1111-1111-1111-111111111111", .opts_target = "-uuid 22222222-2222-2222-2222-222222222222", - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }; do_test_validate_uuid(&args, true); @@ -1757,7 +1768,7 @@ static void test_validate_uuid_src_not_set(void) { MigrateStart args = { .opts_target = "-uuid 22222222-2222-2222-2222-222222222222", - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }; do_test_validate_uuid(&args, false); @@ -1767,7 +1778,7 @@ static void test_validate_uuid_dst_not_set(void) { MigrateStart args = { .opts_source = "-uuid 11111111-1111-1111-1111-111111111111", - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }; do_test_validate_uuid(&args, false); @@ -1990,7 +2001,7 @@ static void test_multifd_tcp_tls_psk_mismatch(void) { MigrateCommon args = { .start = { - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }, .listen_uri = "defer", .start_hook = test_migrate_multifd_tcp_tls_psk_start_mismatch, @@ -2038,7 +2049,7 @@ static void test_multifd_tcp_tls_x509_mismatch_host(void) */ MigrateCommon args = { .start = { - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }, .listen_uri = "defer", .start_hook = test_migrate_multifd_tls_x509_start_mismatch_host, @@ -2062,7 +2073,7 @@ static void test_multifd_tcp_tls_x509_reject_anon_client(void) { MigrateCommon args = { .start = { - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }, .listen_uri = "defer", .start_hook = test_migrate_multifd_tls_x509_start_reject_anon_client, @@ -2088,7 +2099,7 @@ static void test_multifd_tcp_tls_x509_reject_anon_client(void) static void test_multifd_tcp_cancel(void) { MigrateStart args = { - .hide_stderr = true, + .hide_stderr = HIDE_STDERR, }; QTestState *from, *to, *to2; QDict *rsp; From patchwork Wed Aug 24 09:40:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB5F4C00140 for ; Wed, 24 Aug 2022 11:09:52 +0000 (UTC) Received: from localhost ([::1]:40864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQoGY-00022t-VK for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 07:09:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmur-0004Qv-7y; Wed, 24 Aug 2022 05:43:19 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:42714) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuo-0001kK-QI; Wed, 24 Aug 2022 05:43:16 -0400 Received: by mail-pg1-x536.google.com with SMTP id q63so310853pga.9; Wed, 24 Aug 2022 02:43:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=eEoKxp42Yd3WBOROS2c0qiQDyg/EAnV+AW6xakgUti4=; b=VBq3AAQqrP8uyu8gEHd6zVduVlv5Ef+ui/ZaK/yoS01xBZkfkrfB599Al+MK154LGr BZ/YC88oX42d3ShsrSfa7VcVx/cZcsYESbfCAgWkMC1rdcqbXVHh5wQlDwz41QlXs+++ YxrEC7cyBhY9iyDftLFX5S2RZVFUAO2RGKX6XN1Mrg1HIk1FwTOKGsrPiEK/7TOyepNe OoykRdEsyE4n+m2AcKDGsQ1oVezGmqOQNBJ1oju3r8EwRtR0672jX3X3FeV7eS5UEbpv S+FktJ2wGxzZV3WyMb3iBywP18dt7BDAsE/Y8kaeIVTOs7IPCuUO2caObQICxpandBgn 4cwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=eEoKxp42Yd3WBOROS2c0qiQDyg/EAnV+AW6xakgUti4=; b=BAUFO3aqYf3a1+kmIvUSwaXB6CX+mUf0CBUEi+nkIGzZ0WKqDQ1X+68kRQ1HOHfyl1 RioyckEjdVYO47jiBWkF3RK6yMm/3WWnnb/0rX8rhbQdYsua+mPZTamqY+q4iXPFJYPr JUdRtce7BCDsmJQ5r4Y0E89UB82+FIgYfTrA7sjPjyMnwS0oGJozWDKKrM7jbJNE5D3/ y6JBHyipHvjWHjFuRyyhRVJa6dhj42kUkH48opN+gJKajGtP0RMGabx9yBn2QI6d6CTE rG5CbO7hObqavI++4pPJU0DOGdJsb6z7UyeuqD1bsmRU6kQ/Km0NSsz2Hx7kwdkKlfqP 1DnQ== X-Gm-Message-State: ACgBeo275WcJd3vc49n0sZ0NsPDL0of8RO95kcyjeY/KLEt01gMJcr9I 6/g86+XwzN19Fo+XL+oD9NQo8NPaFo8= X-Google-Smtp-Source: AA6agR7xNemF/2rVM3wx90IZYhfUNqRdR8Tbsqs9yvCnWdWSUsBtlzX6r1sK1NIr4hYOcTm5evluhQ== X-Received: by 2002:a65:6d9a:0:b0:41c:c77:7b6 with SMTP id bc26-20020a656d9a000000b0041c0c7707b6mr24403796pgb.139.1661334193051; Wed, 24 Aug 2022 02:43:13 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:12 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , John Snow , Laurent Vivier , Paolo Bonzini , Thomas Huth , qemu-block@nongnu.org Subject: [PATCH 38/51] tests/qtest: {ahci,ide}-test: Open file in binary mode Date: Wed, 24 Aug 2022 17:40:16 +0800 Message-Id: <20220824094029.1634519-39-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x536.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng By default Windows opens file in text mode, while a POSIX compliant implementation treats text files and binary files the same. The fopen() 'mode' string can include the letter 'b' to indicate binary mode shall be used. POSIX spec says the character 'b' shall have no effect, but is allowed for ISO C standard conformance. Let's add the letter 'b' which works on both POSIX and Windows. Similar situation applies to the open() 'flags' where O_BINARY is used for binary mode. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- tests/qtest/ahci-test.c | 2 +- tests/qtest/ide-test.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index bce9ff770c..be11508c75 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -1453,7 +1453,7 @@ static int prepare_iso(size_t size, unsigned char **buf, char **name) * Close the file and reopen it. */ close(fd); - fd = open(cdrom_path, O_WRONLY); + fd = open(cdrom_path, O_WRONLY | O_BINARY); g_assert(fd != -1); #endif diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index c5cad6c0be..ee03dea4fa 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -892,7 +892,7 @@ static void cdrom_pio_impl(int nblocks) /* Prepopulate the CDROM with an interesting pattern */ generate_pattern(pattern, patt_len, ATAPI_BLOCK_SIZE); - fh = fopen(tmp_path, "w+"); + fh = fopen(tmp_path, "wb+"); ret = fwrite(pattern, ATAPI_BLOCK_SIZE, patt_blocks, fh); g_assert_cmpint(ret, ==, patt_blocks); fclose(fh); @@ -993,7 +993,7 @@ static void test_cdrom_dma(void) prdt[0].size = cpu_to_le32(len | PRDT_EOT); generate_pattern(pattern, ATAPI_BLOCK_SIZE * 16, ATAPI_BLOCK_SIZE); - fh = fopen(tmp_path, "w+"); + fh = fopen(tmp_path, "wb+"); ret = fwrite(pattern, ATAPI_BLOCK_SIZE, 16, fh); g_assert_cmpint(ret, ==, 16); fclose(fh); From patchwork Wed Aug 24 09:40:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953290 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0A0F7C00140 for ; Wed, 24 Aug 2022 11:15:34 +0000 (UTC) Received: from localhost ([::1]:60716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQoM8-0000Ev-LN for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 07:15:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmut-0004RZ-UR for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:23 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:35489) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuq-0001lq-Q9 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:18 -0400 Received: by mail-pl1-x634.google.com with SMTP id y4so15195427plb.2 for ; Wed, 24 Aug 2022 02:43:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=EOFKHiRmcE74HgecgSGAabnZE3vUv0bvhkBrDlb0U9A=; b=nyLGNG/k8QKO0L9U3XkOZOlFQivxUx6Hz8G6QKP+yFtbDDmLV7blKQmbLXQ+IlGZWT EIXAn+7AGT/fC+V0q0m0mAFNJvLEygu2a7YzJGVrRaV35QaJQhQW+6BARRdcz/3jE+L2 ESiN+e7WHUm+6DAdvwNF/V04ZqS3fUQgaaFy2299NrcyYCqVyU9Rp3q0k5ee+vxcdmO1 MMFfGU5v6N6URy3kwGs1f3N0prKvDfNerlnuTDWyQDmo5LTmxZdOUGYFPvbhhcF7uqxt yeM1+R3WkLcUCC+iQjYQHRJyUdzabHH/BRe5XcbI1dgFAQIHkDD6NIzdX1Ddm9+OiLeU rkrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=EOFKHiRmcE74HgecgSGAabnZE3vUv0bvhkBrDlb0U9A=; b=PQh1DIKdypBz9+2h4yETfIa0eJqZ+zkkJxiARXkSATkQ+OivUcNsct88laUYLEEHom MUlE/TA0+maGC5xbH4+pvDNCloSeT6TMVIsVA2JdzGq3fav9Hty+WhRyvZ6Io1ypfR1j stATWkqHRJZNWOvP2+39SmL8sg1yJO6cVMwaJ8y8/FJdVNXEAm3M2OguKUFeiLbwAbxd LMsbZWra1BgMzcHVvIpe/CipAI0qpj2P1RnTgpgXE6YEhsR848UmDL9owRxATcIixOP5 CAqJwRNd5aAf7rj7MYxJy+qZMZk5WFhwEuPljP7ImFWjwPT1um0+X8KQNt6aROeEpfFV xMRg== X-Gm-Message-State: ACgBeo1AAVfjGNldFNn/E4l/da0GYZkfPSFDq/Ej3fuLe7ov8fHoVtqf El057MlssLKmh7qfDMHggGIVgy8TcYk= X-Google-Smtp-Source: AA6agR6KtzTvp5fnDoEd/kUeMWOU3ajThweLYJ/BWEtVANY8QmJeUSMZD3FJyZwB8pZw4j42uIFdhg== X-Received: by 2002:a17:90a:d982:b0:1fb:aec:e8db with SMTP id d2-20020a17090ad98200b001fb0aece8dbmr7317472pjv.148.1661334195215; Wed, 24 Aug 2022 02:43:15 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:14 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 39/51] tests/qtest: virtio-net-failover: Disable migration tests for win32 Date: Wed, 24 Aug 2022 17:40:17 +0800 Message-Id: <20220824094029.1634519-40-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng These tests use the exec migration protocol, which is unsupported on Windows as of today. Disable these tests for now. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng --- tests/qtest/virtio-net-failover.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-failover.c index 443ee56de9..4a809590bf 100644 --- a/tests/qtest/virtio-net-failover.c +++ b/tests/qtest/virtio-net-failover.c @@ -588,6 +588,7 @@ static void test_hotplug_2_reverse(void) machine_stop(qts); } +#ifndef _WIN32 static QDict *migrate_status(QTestState *qts) { QDict *resp, *ret; @@ -1827,6 +1828,7 @@ static void test_multi_in(gconstpointer opaque) machine_stop(qts); } +#endif /* _WIN32 */ int main(int argc, char **argv) { @@ -1857,7 +1859,11 @@ int main(int argc, char **argv) qtest_add_func("failover-virtio-net/hotplug/2_reverse", test_hotplug_2_reverse); - /* migration tests */ +#ifndef _WIN32 + /* + * These migration tests cases use the exec migration protocol, + * which is unsupported on Windows. + */ qtest_add_data_func("failover-virtio-net/migrate/on/out", tmpfile, test_migrate_out); qtest_add_data_func("failover-virtio-net/migrate/on/in", tmpfile, @@ -1886,6 +1892,7 @@ int main(int argc, char **argv) tmpfile, test_multi_out); qtest_add_data_func("failover-virtio-net/migrate/multi/in", tmpfile, test_multi_in); +#endif /* _WIN32 */ ret = g_test_run(); From patchwork Wed Aug 24 09:40:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F39B8C32793 for ; Wed, 24 Aug 2022 10:24:33 +0000 (UTC) Received: from localhost ([::1]:39606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnYm-0003em-Tv for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:24:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmux-0004Rh-2S for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:24 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:34755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmut-0001mg-Mr for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:21 -0400 Received: by mail-pg1-x52e.google.com with SMTP id 12so14559970pga.1 for ; Wed, 24 Aug 2022 02:43:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=paTY5YEP1jsreKma1QR+zPm4bWzf2LxlFPbO3yVctjg=; b=Tfd0/b2IXE9rDdRsV2eAJrgw/Z7ZClGxrdyqYWfsTtUJv2/Luw7dCdEsidgAb12sFO 6PvwjO3hPjix1ZA/2PnK43cE8ClL88t6uKu1aUxIkIuWYDZko/QOyUrispBSNOvsxUn0 fIg949JaNCA204JUfKbppItwJWdBa4LQNVQLpt+HYuEOJx50yWDfhuvugL+p3wOhpwgR bVUeUkrYGzOtu6DWc31mCXQS0Cgi+Ex1sQ28fuHyP9y3HOpjbn2HyKNODYtlBKTw+OLp kmAh1V6Oi0ed4FvuQdxggIn5iCDfCLqTWlHiVONyJ5qMXfNnEwn6xDCIVoJYGa4LT3X+ i1iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=paTY5YEP1jsreKma1QR+zPm4bWzf2LxlFPbO3yVctjg=; b=iuKfZ+17byTuKqF1/A+QqqiK/HE4yOFNWXxn2X+DEhDvn9wDQi4KYbmBL5pXks0cVM FaC8Oiow2B7J4xQBI5gqVrkMsD0LN7f6wRqfnDq32jxletdX5kaXkth+SI8JRzOHK6JF /IWHmmeDkWo+Tj0LfbnDtMj45+tT5PBo5RTTs4qxjvo9Vr6QEafwbF7xKrtxgdJtaDAF mpy5twDaSUAddxSjKcisRmOO09A9O70nrXeXEt3K89w/l5qKMW5fx+OVjOTbgWuiGTjl dD0XAZr+EYC8S0UEpF77QwnsrkfJpBj6FNmeGXgiHiFcxm6hKHwDtAL/Mbzpli17bB80 leNQ== X-Gm-Message-State: ACgBeo0GP92JTq8C6v/MqFKgvXnRDuSw6xaLbAFkT9U8yBLJdfMjYu8U Vz19F4w9/aZwallLQpkhv2aTDF6WnK4= X-Google-Smtp-Source: AA6agR7SAPzNS16io4sRXRVvDvfVpzFuYgcjDArHoCPwHchiIlN8E9IFExstYkptRzQ8OpcRb+fo3Q== X-Received: by 2002:a62:38d4:0:b0:536:3cde:4d07 with SMTP id f203-20020a6238d4000000b005363cde4d07mr21804166pfa.66.1661334197213; Wed, 24 Aug 2022 02:43:17 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:16 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini Subject: [PATCH 40/51] chardev/char-file: Add FILE_SHARE_WRITE when openning the file for win32 Date: Wed, 24 Aug 2022 17:40:18 +0800 Message-Id: <20220824094029.1634519-41-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng The combination of GENERIC_WRITE and FILE_SHARE_READ options does not allow the same file to be opened again by CreateFile() from another QEMU process with the same options when the previous QEMU process still holds the file handle openned. As per [1] we should add FILE_SHARE_WRITE to the share mode to allow such use case. This change makes the behavior be consisten with the POSIX platforms. [1] https://docs.microsoft.com/en-us/windows/win32/fileio/creating-and-opening-files Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng --- chardev/char-file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chardev/char-file.c b/chardev/char-file.c index 2fd80707e5..66385211eb 100644 --- a/chardev/char-file.c +++ b/chardev/char-file.c @@ -60,8 +60,8 @@ static void qmp_chardev_open_file(Chardev *chr, flags = CREATE_ALWAYS; } - out = CreateFile(file->out, accessmode, FILE_SHARE_READ, NULL, flags, - FILE_ATTRIBUTE_NORMAL, NULL); + out = CreateFile(file->out, accessmode, FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, flags, FILE_ATTRIBUTE_NORMAL, NULL); if (out == INVALID_HANDLE_VALUE) { error_setg(errp, "open %s failed", file->out); return; From patchwork Wed Aug 24 09:40:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953216 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B5A1AC00140 for ; Wed, 24 Aug 2022 10:31:43 +0000 (UTC) Received: from localhost ([::1]:37038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnfi-0001Ot-D2 for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:31:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmuz-0004SJ-AQ for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:26 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:38680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuv-0001nk-A1 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:23 -0400 Received: by mail-pl1-x630.google.com with SMTP id x19so15188906plc.5 for ; Wed, 24 Aug 2022 02:43:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=gaj+hsFra3tAAn41KvUkD6S/64I4IDGVCSXdBoXHO4Y=; b=VUtrICafBqG5XkXx5nGmzMDoekmJWM/zvT+7TEVeQwS6I4+3SDULmAVSprYnc9G7bd CWK3bv8bL0rZZBrWld38PDkozHxJCl7oDZ7o6zYBqbRkVFsyvC1R6god2OjZ5g3nrwVX kwnzODmz522M5Rt4MrtMrOgU1tbAtUYQHyA1uL9GKJUokgCnGDtNNzsuV2n9iLsQMg34 u7TOSKp7lhFUDz/3JWzNGn/pGvD8s6x2WlByRfKwkcoD3AeTNBNgCFWtBSOl1rxU1FBx NpxwV8UXAqgiHQD02y+vpEU1TTMtYmIlZYLsudha2iN7aPFORe507/tMtCOTxuYvJ4H8 J2Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=gaj+hsFra3tAAn41KvUkD6S/64I4IDGVCSXdBoXHO4Y=; b=8DFQ4mtw2KxmW+pXd2ZOf8pjW3m25eZrFwbZuzD9dXQdlMGrP61S4L1jrVtimtHi77 wpdTHbhBZRAUrss3V45c19mgRvtBdaOlx52cnpT2pxajK9QyXk6tPvFqluJCAWNH30c1 GAR4v9F1dQaEVN0rblAgSJxSf1VbpyoRvf2Pd+ulLOSL0A02z1dxPLnkFnr4InBy0qyc NiM83WKp4eW4USZlj2cQGT3Ji77jkxPwtvlqwVrgMHoSDn50iywY82jNkxETA4otHbnN wtNMe2F6J+A0gmOqSBolzpMxGqSi7QBNerkuOzDEqo6AJqS5V/Lxqc45Pg0NIB/nWXVr IxjA== X-Gm-Message-State: ACgBeo0zEcTmtipGZk1cxLF/EDM6VUdNrsG4XEcgVXSAunvn6Og/PJf5 ivjpZ5LyJyFK7tgLlhuWRkmepzo0FNw= X-Google-Smtp-Source: AA6agR5B1Wi6+1whPfRy/KEcWJHZxlVPYEwuKw02+TfXPJNmwX8h1PBi8SGm932FejldgP0EVJU6KQ== X-Received: by 2002:a17:90a:304a:b0:1fa:d832:5aca with SMTP id q10-20020a17090a304a00b001fad8325acamr7351025pjl.16.1661334199814; Wed, 24 Aug 2022 02:43:19 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:19 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , "Dr. David Alan Gilbert" , Juan Quintela , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 41/51] tests/qtest: migration-test: Kill "to" after migration is canceled Date: Wed, 24 Aug 2022 17:40:19 +0800 Message-Id: <20220824094029.1634519-42-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng Make sure QEMU process "to" is killed before launching another target for migration in the test_multifd_tcp_cancel case. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- tests/qtest/migration-test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 125d48d855..18ec079abf 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2132,6 +2132,10 @@ static void test_multifd_tcp_cancel(void) wait_for_migration_pass(from); migrate_cancel(from); + /* Make sure QEMU process "to" is killed */ + if (qtest_probe_child(to)) { + qtest_kill_qemu(to); + } args = (MigrateStart){ .only_target = true, From patchwork Wed Aug 24 09:40:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B3B2C00140 for ; Wed, 24 Aug 2022 11:22:22 +0000 (UTC) Received: from localhost ([::1]:59992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQoSj-0006Kl-8u for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 07:22:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmv1-0004ST-5U; Wed, 24 Aug 2022 05:43:28 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:45735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmuy-0001oH-9J; Wed, 24 Aug 2022 05:43:26 -0400 Received: by mail-pg1-x536.google.com with SMTP id f4so12712765pgc.12; Wed, 24 Aug 2022 02:43:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=ohy+ZaRm+mExMl6IasKlBa1D9a82pE4z4g4jo6700W8=; b=EFa36jtNPvYtjxpE+KhgJMJiHEArv3lvGNBpYs8rNtYVOJ2h5L5tnNXhwshALvkBSv t+4ACo4IWpzDvvgwlRhuVaaaw7SCVrw62iGL51Ttjv3/GLIGZYSeCyrCWs/0+p52Ho6V eZWyJudGq9qkprfJZ6GfJM1VlhoBq/41m6s2rslW6njYVLH14q/WAPKbT3/SSYtdFL73 OG8Vo3ofAqIR149E7xi3SHvJtZcNmfg66S2co4p0G7FqV5LaoA26twA6Tj0VF9GN6VpE RbDwUhVkf1Tk/C8OHtD159sljtsQ4/suF1p4xMxDnCpER9+qhdikM3hpxsQeBTQ56/Ts S3OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=ohy+ZaRm+mExMl6IasKlBa1D9a82pE4z4g4jo6700W8=; b=j4XidXyxmX+i/X7HLkr+jpiGXW410qpCp36Su+SaEmLr9kFpKJcaRBQ+cIZoJDKTyA M36AonbfR0MNV4xNeHq+HbXH2yyEiL9OOvez43vICKNZIqcbtG7xOgJKwgFIrRXCRQCW twH8IDNMG1E8oxu29jUzMsm7bMpBJ+G24IUKKa7PlgSvd6smXNkur8yP9OmqXfmE7YHf LhjSsKNdaI5lXjF+9FEyFv7EMThSpTjE0H0uxCqMlt4euDeL+MSeD9xUtVud/HCvAQVJ +fGk1v6japuffUmPQ8bmITaZspeN6A9D1IxlcfHV+NAHwR7l+wJNxYsTekwISqlOcddB /t7A== X-Gm-Message-State: ACgBeo1UcRVWZMp/GS2LRriKGMtgGR4h07oizSvbB2lOJbcpRuZQ6GO/ bcQWYQgQzxK2Sld5erNoaLaRqT3tsxY= X-Google-Smtp-Source: AA6agR6bx+H5hvlsCfy0SQNQpJsv5cGpqgtTzuWACh35mc98Z24eSOFRsWe+SJAr8exISxezTqElDQ== X-Received: by 2002:a05:6a00:2918:b0:536:3967:5d08 with SMTP id cg24-20020a056a00291800b0053639675d08mr21463197pfb.68.1661334202610; Wed, 24 Aug 2022 02:43:22 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:22 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Daniel Henrique Barboza , David Gibson , Greg Kurz , qemu-ppc@nongnu.org Subject: [PATCH 42/51] hw/ppc: spapr: Use qemu_vfree() to free spapr->htab Date: Wed, 24 Aug 2022 17:40:20 +0800 Message-Id: <20220824094029.1634519-43-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x536.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng spapr->htab is allocated by qemu_memalign(), hence we should use qemu_vfree() to free it. Fixes: c5f54f3e31bf ("pseries: Move hash page table allocation to reset time") Fixes: b4db54132ffe ("target/ppc: Implement H_REGISTER_PROCESS_TABLE H_CALL"") Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Reviewed-by: Daniel Henrique Barboza Reviewed-by: Marc-André Lureau --- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index bc9ba6e6dc..4034f4d130 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1522,7 +1522,7 @@ int spapr_hpt_shift_for_ramsize(uint64_t ramsize) void spapr_free_hpt(SpaprMachineState *spapr) { - g_free(spapr->htab); + qemu_vfree(spapr->htab); spapr->htab = NULL; spapr->htab_shift = 0; close_htab_fd(spapr); From patchwork Wed Aug 24 09:40:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953249 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05941C00140 for ; Wed, 24 Aug 2022 10:43:53 +0000 (UTC) Received: from localhost ([::1]:56104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnrU-00072h-45 for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:43:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmv4-0004TI-3j; Wed, 24 Aug 2022 05:43:30 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:42734) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmv1-0001ol-7O; Wed, 24 Aug 2022 05:43:28 -0400 Received: by mail-pj1-x1030.google.com with SMTP id s3-20020a17090a2f0300b001facfc6fdbcso957368pjd.1; Wed, 24 Aug 2022 02:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=MHfTEu/249wVV9m0rBn3cA/BnwhFgurm/PYKRUtzg+o=; b=ZZK1hRnYE1UDVwGvYkKI2LanoP3FgMW+1eLQGcXLgaAknQhWlHpDk1G1aG0/uf8LMu y54chOAX4JZPoMJ3LzQc2GDdCS4qknDTBFAFMSiR+O5GaI3Rt2CBMB3GyydJ23FOgjWz oArmj5LDEvjSzwQQsGVDz1N1NLCsOGGgkl9dm+G00CCJMGy76vZG6hiwkiLwWSYUJs2i +qa4ykgb0OWlUWRb+7t3W7KE+OoR2lEmYaE9n9G8AHIoC8SzzX3TDyNAgufQ5lMRcxX9 Tv3RrNlb0wwFgN39PpH6SKXvzC7f0ZJWrHTbP5Bm5NIqJ8mlJMy3xWsRQkQmsNZFg3pr J7jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=MHfTEu/249wVV9m0rBn3cA/BnwhFgurm/PYKRUtzg+o=; b=L2lHWrGPrUuH5BG5wTYcq7ERwjtXdI/yQQEidqZ4kvnJC2Yh5kRd4bYDwF0NqAWD0K KXX/MV3aym/zs5LpLCHaV96FWMbAPptlm+msDdmRqDiAOF0O/45314mofcudkqjSAyA+ O7hvs+3Zv6l8qad/1jgCyTL4WW7HrX7/SQ1V2XTWF7TrRzej2kUVK0V0cbOfLo1KZE0y IBtmjBQ4DTIV5a/4OaFOq6sa8dk5Q38L8ZDSTfc1l0ta5DM1VcVgZGEQrrbWnJYWrJfc HeKYUuiHWO0UtpUkT2HIvEWbdcj7ba108CYjprYw7uaSAmDkQSkAOjuLsi8q+OlGk+Rj BoUg== X-Gm-Message-State: ACgBeo2ResUmzdux2zf1bsh7VqC1m7JxoNRq8vl/1pc2WqW/UUIOLQT8 y9Yv8xrAzGm2l7r0wFCtz21becNF7Rg= X-Google-Smtp-Source: AA6agR4xoekxEgNHaKoZU/b9XwWIXxLm5ZQP4bl1zHL6rBDjhPECybJknIQ+cPD4IzWj/LolL81Ldw== X-Received: by 2002:a17:90a:e543:b0:1fa:d591:12c4 with SMTP id ei3-20020a17090ae54300b001fad59112c4mr7302607pjb.91.1661334205265; Wed, 24 Aug 2022 02:43:25 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:24 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Havard Skinnemoen , Laurent Vivier , Paolo Bonzini , Thomas Huth , Tyrone Ting , qemu-arm@nongnu.org Subject: [PATCH 43/51] tests/qtest: npcm7xx_emc-test: Skip running test_{tx, rx} on win32 Date: Wed, 24 Aug 2022 17:40:21 +0800 Message-Id: <20220824094029.1634519-44-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng The test cases 'test_{tx,rx}' call socketpair() which does not exist on win32. Exclude them. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth Reviewed-by: Hao Wu --- tests/qtest/npcm7xx_emc-test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c index a353fef0ca..c373d24e1e 100644 --- a/tests/qtest/npcm7xx_emc-test.c +++ b/tests/qtest/npcm7xx_emc-test.c @@ -209,6 +209,7 @@ static int emc_module_index(const EMCModule *mod) return diff; } +#ifndef _WIN32 static void packet_test_clear(void *sockets) { int *test_sockets = sockets; @@ -243,6 +244,7 @@ static int *packet_test_init(int module_num, GString *cmd_line) g_test_queue_destroy(packet_test_clear, test_sockets); return test_sockets; } +#endif /* _WIN32 */ static uint32_t emc_read(QTestState *qts, const EMCModule *mod, NPCM7xxPWMRegister regno) @@ -250,6 +252,7 @@ static uint32_t emc_read(QTestState *qts, const EMCModule *mod, return qtest_readl(qts, mod->base_addr + regno * sizeof(uint32_t)); } +#ifndef _WIN32 static void emc_write(QTestState *qts, const EMCModule *mod, NPCM7xxPWMRegister regno, uint32_t value) { @@ -339,6 +342,7 @@ static bool emc_soft_reset(QTestState *qts, const EMCModule *mod) g_message("%s: Timeout expired", __func__); return false; } +#endif /* _WIN32 */ /* Check emc registers are reset to default value. */ static void test_init(gconstpointer test_data) @@ -387,6 +391,7 @@ static void test_init(gconstpointer test_data) qtest_quit(qts); } +#ifndef _WIN32 static bool emc_wait_irq(QTestState *qts, const EMCModule *mod, int step, bool is_tx) { @@ -843,6 +848,7 @@ static void test_rx(gconstpointer test_data) qtest_quit(qts); } +#endif /* _WIN32 */ static void emc_add_test(const char *name, const TestData* td, GTestDataFunc fn) @@ -865,8 +871,10 @@ int main(int argc, char **argv) td->module = &emc_module_list[i]; add_test(init, td); +#ifndef _WIN32 add_test(tx, td); add_test(rx, td); +#endif } return g_test_run(); From patchwork Wed Aug 24 09:40:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953305 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F047C00140 for ; Wed, 24 Aug 2022 11:28:24 +0000 (UTC) Received: from localhost ([::1]:38980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQoYZ-0004A2-Bl for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 07:28:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmv6-0004UF-RC; Wed, 24 Aug 2022 05:43:34 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:42739) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmv5-0001qE-6Z; Wed, 24 Aug 2022 05:43:32 -0400 Received: by mail-pj1-x1035.google.com with SMTP id s3-20020a17090a2f0300b001facfc6fdbcso957475pjd.1; Wed, 24 Aug 2022 02:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=absMu0MsCcS+D8Q8iKeaSzi8XuqAyekaCuc9H9DLYbc=; b=NDv6cXqYoVIT6UlJFchvJvI+7vc9VAWbvNd8EzFyl0Xyy9JSejdoTtHowjqeyY5WN/ 1SjWn/ZzooHtZMTLk2ehGXnsRGzjFJ9iCQnlZjpLjLHsUBc4Q7EPJ8ADRtBSpIfAhg8l D5gfwgybFUY3yOy6LSUSSwp6gcG9DPlBEIFnSQRmhKB0GXQ+edUtrSbFoIYelcp9aPtN 4ji2U4v+N3tcYObSlcRmJTPdEMCceVHQbOvD2s+rNDGN1+gBWln4jwOS24pkmv/RURMf Ax6TSvJmbDivLCmMM0G1bUVpFLM2EOKffasyDtVcFH4JSqv6KSRiPcEKECN65oi8mTe9 Oksg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=absMu0MsCcS+D8Q8iKeaSzi8XuqAyekaCuc9H9DLYbc=; b=EM5Qe0V6Akki9ilSurkQJ/a3S+rpowIoF6rqkt0PvstLfWEcVEZbt4A7TwlG5aahm6 0vXBrw6BgORxIpR71hHVgmH49KzpWKRyXAqS8Yd/QHOBsnh6ZYO0A+oFQPaQxu1ZEJYd 7cAwL4Rr4vr4IdOYW9kTPayct1ZMK+E3KVrLe1a36xsvGXXg7jznIvE7qScxq9T5z3sN wsI/8Fo+7uj/1cQxTc4jOqnJU/andLLS4i5lAaPKEA8y76eolUi733LBRtswcP1yG5Lb KtjH4WFdJ2+k6TTJz3dGbZ49TluGxCwueioB0WtQfycgO51Hv5/WzJdRSt2SQ/isNANu d5SA== X-Gm-Message-State: ACgBeo2qrqdWwsnN62wcZ8okwj2SSrUycgklcwtvFDuAf7laqhx2VYUn 4xL8uxxbU+5ZQmzkcODvDvrJjWyWTW8= X-Google-Smtp-Source: AA6agR6KlU+xRZ2lkZP2HppMEyj38xUjcrmF2XbzsyhEkWSoBlawKVR+FaBgroKzTEyBH2FLgMiS4w== X-Received: by 2002:a17:90a:6b0d:b0:1fa:c6fe:db6 with SMTP id v13-20020a17090a6b0d00b001fac6fe0db6mr7432037pjj.99.1661334208035; Wed, 24 Aug 2022 02:43:28 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:27 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Joel Stanley , Laurent Vivier , Paolo Bonzini , Peter Maydell , Thomas Huth , qemu-arm@nongnu.org Subject: [PATCH 44/51] tests/qtest: microbit-test: Fix socket access for win32 Date: Wed, 24 Aug 2022 17:40:22 +0800 Message-Id: <20220824094029.1634519-45-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Sockets on Windows do not use *nix-style file descriptors, so write()/read()/close() do not work on Windows. Switch over to use send()/recv()/closesocket() which work with sockets on all platforms. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- tests/qtest/microbit-test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/qtest/microbit-test.c b/tests/qtest/microbit-test.c index b71daae9a9..4bc267020b 100644 --- a/tests/qtest/microbit-test.c +++ b/tests/qtest/microbit-test.c @@ -51,7 +51,7 @@ static void uart_rw_to_rxd(QTestState *qts, int sock_fd, const char *in, { int i, in_len = strlen(in); - g_assert_true(write(sock_fd, in, in_len) == in_len); + g_assert_true(send(sock_fd, in, in_len, 0) == in_len); for (i = 0; i < in_len; i++) { g_assert_true(uart_wait_for_event(qts, NRF51_UART_BASE + A_UART_RXDRDY)); @@ -77,7 +77,7 @@ static void test_nrf51_uart(void) char s[10]; QTestState *qts = qtest_init_with_serial("-M microbit", &sock_fd); - g_assert_true(write(sock_fd, "c", 1) == 1); + g_assert_true(send(sock_fd, "c", 1, 0) == 1); g_assert_cmphex(qtest_readl(qts, NRF51_UART_BASE + A_UART_RXD), ==, 0x00); qtest_writel(qts, NRF51_UART_BASE + A_UART_ENABLE, 0x04); @@ -97,17 +97,17 @@ static void test_nrf51_uart(void) qtest_writel(qts, NRF51_UART_BASE + A_UART_STARTTX, 0x01); uart_w_to_txd(qts, "d"); - g_assert_true(read(sock_fd, s, 10) == 1); + g_assert_true(recv(sock_fd, s, 10, 0) == 1); g_assert_cmphex(s[0], ==, 'd'); qtest_writel(qts, NRF51_UART_BASE + A_UART_SUSPEND, 0x01); qtest_writel(qts, NRF51_UART_BASE + A_UART_TXD, 'h'); qtest_writel(qts, NRF51_UART_BASE + A_UART_STARTTX, 0x01); uart_w_to_txd(qts, "world"); - g_assert_true(read(sock_fd, s, 10) == 5); + g_assert_true(recv(sock_fd, s, 10, 0) == 5); g_assert_true(memcmp(s, "world", 5) == 0); - close(sock_fd); + closesocket(sock_fd); qtest_quit(qts); } From patchwork Wed Aug 24 09:40:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953306 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64152C00140 for ; Wed, 24 Aug 2022 11:36:14 +0000 (UTC) Received: from localhost ([::1]:57898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQog8-0001xQ-Pf for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 07:36:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmv8-0004V1-Tk for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:36 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:43525) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmv6-0001rk-6Q for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:33 -0400 Received: by mail-pg1-x52a.google.com with SMTP id v4so14531915pgi.10 for ; Wed, 24 Aug 2022 02:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=dRHhWPJXiN/4/A11QD7zEQfLoQkKTg9o+isZ5w1L5e4=; b=DijW74OWB2eWz9Ojal28Y5v6r3SE2TdD7WVXvXriN/6blq08UM7V4dFXNme1gtuqSY WSEZu3r2AWD4xcrlQSrXeIScxS6myobDMKPcWwDI2WyQm1pxWlAi4mMlGD0Zi6xRVnbV prIRXaXIQtxJzZyySpWBIR54/cJ8xx+mOdr4uX4PAzCUFp1cYbbw+n/Y+EEchqbY3DaT UhJJEY7wcOFeoLZkiVtZli5eJ4Z+oGOxFBEsTWD8BohaR9IIYBFIAePcryucP0ic3PWI M59M9uQ+AGLS6cb/G4qNvFi3DfqAZsWUYO64XjT97iRteq/hjQYOtdarrT4fSoY30pN8 I1bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=dRHhWPJXiN/4/A11QD7zEQfLoQkKTg9o+isZ5w1L5e4=; b=LN8K5P9WYM7Gm1i0T28v/MzcrubQx8BDAl2+dpSzoyA5PurITQOcMIjGHoCrN3J9fV Kf1WWWKWFYbYbPyYMvlQTtE6cJjh4xcGO4CgD0x5DLl1s+rPPVneK5TS70Yq3GnsQgsj B1Sbblo/mEjAkJkHzEeMpDp9W5//nQdQQDFIqAb46WCMDcA7LwGhgbm4quJMNvmsKixP YGCdaSe2JDB3mSfcXPlbW+OXHDm5SH3TpVCijDcq7nvnhdaBRA33WEQgJ1QzvDbyG85g mlGIAsNR4qKdEOy1GToNG3FRHZyM7T/XaqqmJGKduJWL+YRMG3L0hq4Ac2evjh5Bnqwr pTww== X-Gm-Message-State: ACgBeo28HQgZycSGw6tuM8k07Zj1QjLomoYg+3zPPXrpMsSZlvvw0kju PEVF+KDH0UEk04ZL7hs5uhNN42ohXIk= X-Google-Smtp-Source: AA6agR7cRjAvZg3xRyk3AUzz2mVMwWY4nn+tzhJjiNQJ5clFrSadpzgtPWCkxihhA7Sa+zM9RaRoLg== X-Received: by 2002:a65:6bca:0:b0:420:712f:ab98 with SMTP id e10-20020a656bca000000b00420712fab98mr23713431pgw.350.1661334210229; Wed, 24 Aug 2022 02:43:30 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:29 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 45/51] tests/qtest: prom-env-test: Use double quotes to pass the prom-env option Date: Wed, 24 Aug 2022 17:40:23 +0800 Message-Id: <20220824094029.1634519-46-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Single quotes like -prom-env 'nvramrc=cafec0de 4000 l!' in the arguments are not removed in the Windows environment before it is passed to the QEMU executable. Such argument causes a failure in the QEMU prom-env option parser codes. Change to use double quotes which works fine on all platforms. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth --- tests/qtest/prom-env-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/prom-env-test.c b/tests/qtest/prom-env-test.c index c2b0448e55..39ccb59797 100644 --- a/tests/qtest/prom-env-test.c +++ b/tests/qtest/prom-env-test.c @@ -58,8 +58,8 @@ static void test_machine(const void *machine) " -machine " PSERIES_DEFAULT_CAPABILITIES; } - qts = qtest_initf("-M %s -accel tcg %s -prom-env 'use-nvramrc?=true' " - "-prom-env 'nvramrc=%x %x l!' ", (const char *)machine, + qts = qtest_initf("-M %s -accel tcg %s -prom-env \"use-nvramrc?=true\" " + "-prom-env \"nvramrc=%x %x l!\" ", (const char *)machine, extra_args, MAGIC, ADDRESS); check_guest_memory(qts); qtest_quit(qts); From patchwork Wed Aug 24 09:40:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953288 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D939AC00140 for ; Wed, 24 Aug 2022 11:10:24 +0000 (UTC) Received: from localhost ([::1]:41608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQoH9-0002z4-Iq for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 07:10:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmvA-0004Vk-Rz for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:37 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:42938) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmv7-0001sw-NF for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:35 -0400 Received: by mail-pf1-x433.google.com with SMTP id y15so11987232pfr.9 for ; Wed, 24 Aug 2022 02:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=F0tptSCqhJOQrvbB4isSFD9NCdxNi1hMprPFt8tETzY=; b=LYsjvN/x9aEuSqhpXHXwgLQ5k8RXHez+dJbE4zvToHUDwX7/e/riE8UggNCli7Euiw qcsIn4vwlB/Px3dfrKq2yg1BnaKltp5lbuGkMjAN25uGQUMGj/dJwzN1R85m07GNF9R9 uR7xYfIiLFTFB8sD6v563LLnaKU999iyF/iMCvmxXRXtlvHrJjsnRWf1mKFHLrR5fjh2 sHS7Iv+YLtYLECz1E1sVou070aZOm8+/eSFZuZgI2pNHXon3ZijJA8IouF9jM8gO1xEc EzaoDS6AIgMFMWYuABDiUUd/UkAogqznjfpzOETJvb4QVajxn2raXKEQVcrtHeR/6LRS RWPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=F0tptSCqhJOQrvbB4isSFD9NCdxNi1hMprPFt8tETzY=; b=00tIZGp9B04aG6AsCwAnJFfHmD94daPtRLmnbdrNG8VWlKaX18SB56ykGg+tHuaPPn LztCt0TNcPkK3pvUr096riecQPjNmn0J6A4wn+NcveFvCuQ/IqGaQ6IjWZdNKKCfLwFD FWuzktxGUodGWHVdRK8srJ5wWaBxxUyV0KYAlqUgdOUZk9VXNTPxf3WtZFwbU+Oeen7f g4G35cA1vPykgd+TzzgZYh4p+pi5nOOYhbMHMrnmtT020gAHGXtT9p4lsJd/5oRfR4NL DmW4tuCpjaDLXnVUSeELWzrhGg6boCew1uv7CaGDY7qeKKvHKXL83+qM8sk1r8AJJzfo YYog== X-Gm-Message-State: ACgBeo2QGZwRDA7REBE42FXp7HHPHnQbbZNagU0YyTogViuWC00csx53 iTt7JnW+1tdfAID9nTslOkknNy0BwIk= X-Google-Smtp-Source: AA6agR4wKbwtpR8AjgdyQdje8U0tJQ4vNu7ni5C0B1FebCH9MA0Yy2jk9pXfBc31uSxglIjmNpWzkA== X-Received: by 2002:aa7:8e05:0:b0:536:5dda:e634 with SMTP id c5-20020aa78e05000000b005365ddae634mr17547436pfr.35.1661334212217; Wed, 24 Aug 2022 02:43:32 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:31 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 46/51] tests/qtest: libqtest: Replace the call to close a socket with closesocket() Date: Wed, 24 Aug 2022 17:40:24 +0800 Message-Id: <20220824094029.1634519-47-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng close() is a *nix function. It works on any file descriptor, and sockets in *nix are an example of a file descriptor. closesocket() is a Windows-specific function, which works only specifically with sockets. Sockets on Windows do not use *nix-style file descriptors, and socket() returns a handle to a kernel object instead, so it must be closed with closesocket(). In QEMU there is already a logic to handle such platform difference in os-posix.h and os-win32.h, that: * closesocket maps to close on POSIX * closesocket maps to a wrapper that calls the real closesocket() on Windows Replace the call to close a socket with closesocket() instead. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- tests/qtest/libqtest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 99e52ff571..918f4657ed 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -115,7 +115,7 @@ static int socket_accept(int sock) (void *)&timeout, sizeof(timeout))) { fprintf(stderr, "%s failed to set SO_RCVTIMEO: %s\n", __func__, strerror(errno)); - close(sock); + closesocket(sock); return -1; } @@ -126,7 +126,7 @@ static int socket_accept(int sock) if (ret == -1) { fprintf(stderr, "%s failed: %s\n", __func__, strerror(errno)); } - close(sock); + closesocket(sock); return ret; } @@ -512,8 +512,8 @@ void qtest_quit(QTestState *s) qtest_remove_abrt_handler(s); qtest_kill_qemu(s); - close(s->fd); - close(s->qmp_fd); + closesocket(s->fd); + closesocket(s->qmp_fd); g_string_free(s->rx, true); for (GList *it = s->pending_events; it != NULL; it = it->next) { From patchwork Wed Aug 24 09:40:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1DE9EC00140 for ; Wed, 24 Aug 2022 11:49:38 +0000 (UTC) Received: from localhost ([::1]:46150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQot8-0000bA-01 for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 07:49:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmvC-0004XN-BA for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:38 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:40920) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmv9-0001tw-R7 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:37 -0400 Received: by mail-pg1-x532.google.com with SMTP id w13so9474448pgq.7 for ; Wed, 24 Aug 2022 02:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=KNoYD8dCMjVvXD7l6AFXvjIplF+y/seVMIxP0e3Hrho=; b=mZEqbFZG4On1tN55lgipnchPnF4qUcohXmRl/A3IlBWrwJl4P9OdnRklu6e4YKq54I Ak61Ml8CWejHGATGZ5fvmkXPT844sLmBtLwWDev0EUne5DVXTvAJd0hK5FtwBr9wC1Z0 +eqejq6sVj/9qM4gpylIwnVMpoYrVSyjul9qBcelOYc5YISWXn9t3RUjoxl6jxJKc2Yn qVZZr4HobZX/+ntj8LIQYBGCw8VmCEWhGzpiYHDqw4QvCPeou/uOoVfdDkO8ScwcYr3a hwwbqbxfeEaH+D2LJ3XefKiYXWq8L4AfsZd23X14zCbPeIrM1jh/s21/LxZWZwGMpZJv g1zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=KNoYD8dCMjVvXD7l6AFXvjIplF+y/seVMIxP0e3Hrho=; b=rpl+rjYfcveDU+b0/SQ0O0P+H5K7Xd/n2cVCEnKzJhDv/EiHNKIvLEvQQ15naBayNE YG+FmV2uSvNiVmQ/Uloybh5bQ0HgM5r94H1s8SSqIxJfywlHVfiEBTWId22cUdZiN99l /kSqBb5Ltt1hPgebcNSlqNNyuE+vOSeQdlPX+WgYA/rJVOEOkDPSdbOd4yPnTd+xK4BF zlIrxn23cWOGuKyrGdRafOIhz9goTwA7XU5Ya5NG9/ZZzDmMcOa15NL2STgAUxOuXnvj ajo1MjIrciONghibZrrwKWcFqAcP5Mk1w9JK0LEl7h5yY7QDavdj0iJ3lPtUadzEJ7ZZ 7YLA== X-Gm-Message-State: ACgBeo0nsiTjqFxP0guk6pOCSQ4PW9ZJbyrKYDzhYQSLhBrkUa4yKsdi uO2vQfyAzELlaK4S1iCtqGOz6b/j2S4= X-Google-Smtp-Source: AA6agR6lbBCU3hcBIWie281FWXZo8Rcp7V5wbWG8phwnaFQeHj7pNJsmqmbLG0tQEWMdjrVZgeFUow== X-Received: by 2002:a05:6a00:2283:b0:537:2c29:fc8 with SMTP id f3-20020a056a00228300b005372c290fc8mr3214660pfe.42.1661334214376; Wed, 24 Aug 2022 02:43:34 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:34 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 47/51] tests/qtest: libqtest: Correct the timeout unit of blocking receive calls for win32 Date: Wed, 24 Aug 2022 17:40:25 +0800 Message-Id: <20220824094029.1634519-48-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x532.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Some qtest cases don't get response from the the QEMU executable under test in time on Windows. It turns out that the socket receive call got timeout before it receive the complete response. The timeout value is supposed to be set to 50 seconds via the setsockopt() call, but there is a difference among platforms. The timeout unit of blocking receive calls is measured in seconds on non-Windows platforms but milliseconds on Windows. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- tests/qtest/libqtest.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 918f4657ed..7b41971347 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -36,13 +36,14 @@ #include "qapi/qmp/qstring.h" #define MAX_IRQ 256 -#define SOCKET_TIMEOUT 50 #ifndef _WIN32 +# define SOCKET_TIMEOUT 50 # define CMD_EXEC "exec " # define DEV_STDERR "/dev/fd/2" # define DEV_NULL "/dev/null" #else +# define SOCKET_TIMEOUT 50000 # define CMD_EXEC "" # define DEV_STDERR "2" # define DEV_NULL "nul" @@ -108,8 +109,16 @@ static int socket_accept(int sock) struct sockaddr_un addr; socklen_t addrlen; int ret; + /* + * timeout unit of blocking receive calls is different among platfoms. + * It's in seconds on non-Windows platforms but milliseconds on Windows. + */ +#ifndef _WIN32 struct timeval timeout = { .tv_sec = SOCKET_TIMEOUT, .tv_usec = 0 }; +#else + DWORD timeout = SOCKET_TIMEOUT; +#endif if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (void *)&timeout, sizeof(timeout))) { From patchwork Wed Aug 24 09:40:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953232 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49AA0C00140 for ; Wed, 24 Aug 2022 10:39:54 +0000 (UTC) Received: from localhost ([::1]:47674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnnY-00004t-AF for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:39:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmvD-0004YQ-GU for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:39 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:47079) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmvC-0001uv-1K for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:39 -0400 Received: by mail-pf1-x432.google.com with SMTP id p185so1501873pfb.13 for ; Wed, 24 Aug 2022 02:43:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=k+wOqDGAd9uW6KVCk7h/YSoejf9awPSlxEfxhVeL2s0=; b=BlUUof9KV7lo3UYByGgMBl4hZCyN+BBdHZ2Tr1C+nPomC0ZFXokTWg/sgZ1Vt67zab wbF954lhuV7jSa27O1FYBqGs5mBsbsS40dYaxXiIcCy3AFtozhvOQPIVIK4fJSyZPkFl Ca+Ay23X4xMBxCJdc5QWPoRBNCDa5Ndt6U07yXpUOoXiFMh4K19CaunIuUYcO/KvNnoM sJrEG9Xxqz7m4uZjgix+IAiiRMxB6d4sQxH+nfr4o//pbAh1JZdf/wtkks9HCiCBwX5h 0/PG9ge7kxvWNjtUmDZi0+LyN7O6rCZ+OCOMoWMmsjyvIM4TGjecn9aXr9zdeA+oHHbq xecQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=k+wOqDGAd9uW6KVCk7h/YSoejf9awPSlxEfxhVeL2s0=; b=U7tAvCIXFRJ8uyirECI/bqjTSWFt4VFfcpKyauG0urL4nfxVoYqrdwvPITLrDFlCBk ZNAq9oegQ3/IVvZ6cTcvMlbN3+GKhHaAlSSzcGA3j8pZa1KMW2IBGyD+YmGiTUiduJl8 4k3xS4e4L5gmet86XLk8QiQpvAaxDvgNTQa0Bfuhr1htKw0/F14Mc9mWDPa6fmSfp/cs So9t1pvejiyxu1sIfg1H3mrKoV3dXTUaBx052zOFInJwAgxo7Q/TgAoY19zvOU2SyC/Y 9dk5rrBLsRKTJln0Fn1vzryc8rfFILVLC2Goe8ZnaXwyA5+8tRVssDNSHrCSs9OVe6h2 B2yw== X-Gm-Message-State: ACgBeo0PNSUuS1KKagXUUlsR8afh0le6TJt1VQ+H14e9y9asBr08jt0w xSRY+JpUFjSuYVmb+Kzp6sOkc4MTSqM= X-Google-Smtp-Source: AA6agR7Ye5D0NyOAW6AHEspp+cycbkplrlSxx1gFwSzmM9NXktwH8s6xUlRHeUXDi66hDxhnNbhq4g== X-Received: by 2002:aa7:96a1:0:b0:536:9a2:5012 with SMTP id g1-20020aa796a1000000b0053609a25012mr24572239pfk.24.1661334216073; Wed, 24 Aug 2022 02:43:36 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:35 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH 48/51] io/channel-watch: Drop a superfluous '#ifdef WIN32' Date: Wed, 24 Aug 2022 17:40:26 +0800 Message-Id: <20220824094029.1634519-49-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng In the win32 version qio_channel_create_socket_watch() body there is no need to do a '#ifdef WIN32'. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé --- io/channel-watch.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/io/channel-watch.c b/io/channel-watch.c index 0289b3647c..89f3c8a88a 100644 --- a/io/channel-watch.c +++ b/io/channel-watch.c @@ -285,11 +285,9 @@ GSource *qio_channel_create_socket_watch(QIOChannel *ioc, GSource *source; QIOChannelSocketSource *ssource; -#ifdef WIN32 WSAEventSelect(socket, ioc->event, FD_READ | FD_ACCEPT | FD_CLOSE | FD_CONNECT | FD_WRITE | FD_OOB); -#endif source = g_source_new(&qio_channel_socket_source_funcs, sizeof(QIOChannelSocketSource)); From patchwork Wed Aug 24 09:40:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953270 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCF80C00140 for ; Wed, 24 Aug 2022 10:50:26 +0000 (UTC) Received: from localhost ([::1]:45480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQnxp-0005UT-Rj for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:50:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmvF-0004d5-4K for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:41 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:45660) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmvD-0001vg-Dk for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:40 -0400 Received: by mail-pl1-x634.google.com with SMTP id u22so15173826plq.12 for ; Wed, 24 Aug 2022 02:43:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=gKxyDa7lKyWG5WkBmx+APlEruT/rzwWcMPKdz4TXZxE=; b=SFoZENIBmBu9tOpu74KvH9CSn7EwhCAtdV9yo82+axZchtmdoe/1UO4Ry2tfRRlz0k k0tFUc8h3SdH7xiEE/tM5LX2YXpYfVADc5FHT3AMbxc0/EHSU3mSsB2xl6vpaZoOpC/x jAH/eQCO2wR28Izp3fKsPQaNZiRU/D9+W0uDynCwkstakbmbV5eCsiqudBPEM81LttHD alMKZ9NM7v40a5Wo9ycEte6Rg6u7xuteXmsxEo4ZFftVH5yKlDgy4phCDhs9Ma8tvWu5 CsxRj3acSgqlFIVT8D9TvuqmLY4uSkRm7SiviVB7zfFS9EbQzMwmnO49KLY+4QadQva8 131g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=gKxyDa7lKyWG5WkBmx+APlEruT/rzwWcMPKdz4TXZxE=; b=K/OycWdR5kVpHwMYb96fAdH1mJIKDn6v0EnKWfdYcfHnvU+yg2xR08h5CGlWSzxTdK bcKMa0Pj1LyneFAmcgk2nU6DliAOIgO+twrdGBs1zRruUkVJqf8as7YT22EPVxBxJ4aT 4kS99RsWoCecr93H+IZOyjmohJUNB7mL4g0GQVEc8nPT40/Jj1+vht6KaqgAuZ3B83ov hR6glgVhQYByme5hBBoc+WWhPqZyCLVtJ/OBnuMNazPCmfNWDdG7mfGHRPcOQBhuErVm MMY6cLnJzMIM3g1AUUcXU1dDtxFtpwHtEqx1laSElM2XiDtg1QDra9TCY70We/j0XG3U nphg== X-Gm-Message-State: ACgBeo3JmCpZBI1MWxTkn1/1mv1dRc6+7/lyLCcahj2yFjC/IGt8h3mj LZ56lfNvDf8maqrIbDJhn3IukwGvMZE= X-Google-Smtp-Source: AA6agR7R4Ggo59qr8j5X0/6MA331SC6M7I85cNMVBFA8PFo0pfmlhLeqMbnUmN5vQvJ6PsNZx1DfFA== X-Received: by 2002:a17:902:e851:b0:172:dda3:77d3 with SMTP id t17-20020a170902e85100b00172dda377d3mr15775461plg.19.1661334217828; Wed, 24 Aug 2022 02:43:37 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:37 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH 49/51] io/channel-watch: Fix socket watch on Windows Date: Wed, 24 Aug 2022 17:40:27 +0800 Message-Id: <20220824094029.1634519-50-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Random failure was observed when running qtests on Windows due to "Broken pipe" detected by qmp_fd_receive(). What happened is that the qtest executable sends testing data over a socket to the QEMU under test but no response is received. The errno of the recv() call from the qtest executable indicates ETIMEOUT, due to the qmp chardev's tcp_chr_read() is never called to receive testing data hence no response is sent to the other side. tcp_chr_read() is registered as the callback of the socket watch GSource. The reason of the callback not being called by glib, is that the source check fails to indicate the source is ready. There are two socket watch sources created to monitor the same socket event object from the char-socket backend in update_ioc_handlers(). During the source check phase, qio_channel_socket_source_check() calls WSAEnumNetworkEvents() to discovers occurrences of network events for the indicated socket, clear internal network event records, and reset the event object. Testing shows that if we don't reset the event object by not passing the event handle to WSAEnumNetworkEvents() the symptom goes away and qtest runs very stably. It looks we don't need to call WSAEnumNetworkEvents() at all, as we don't parse the result of WSANETWORKEVENTS returned from this API. We use select() to poll the socket status. Fix this instability by dropping the WSAEnumNetworkEvents() call. Signed-off-by: Bin Meng Reviewed-by: Daniel P. Berrangé --- During the testing, I removed the following codes in update_ioc_handlers(): remove_hup_source(s); s->hup_source = qio_channel_create_watch(s->ioc, G_IO_HUP); g_source_set_callback(s->hup_source, (GSourceFunc)tcp_chr_hup, chr, NULL); g_source_attach(s->hup_source, chr->gcontext); and such change also makes the symptom go away. And if I moved the above codes to the beginning, before the call to io_add_watch_poll(), the symptom also goes away. It seems two sources watching on the same socket event object is the key that leads to the instability. The order of adding a source watch seems to also play a role but I can't explain why. Hopefully a Windows and glib expert could explain this behavior. io/channel-watch.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/io/channel-watch.c b/io/channel-watch.c index 89f3c8a88a..e34d86e810 100644 --- a/io/channel-watch.c +++ b/io/channel-watch.c @@ -115,17 +115,13 @@ static gboolean qio_channel_socket_source_check(GSource *source) { static struct timeval tv0; - QIOChannelSocketSource *ssource = (QIOChannelSocketSource *)source; - WSANETWORKEVENTS ev; fd_set rfds, wfds, xfds; if (!ssource->condition) { return 0; } - WSAEnumNetworkEvents(ssource->socket, ssource->ioc->event, &ev); - FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); From patchwork Wed Aug 24 09:40:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953273 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2FCEC32796 for ; Wed, 24 Aug 2022 10:55:30 +0000 (UTC) Received: from localhost ([::1]:46068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQo2j-0003Eh-Th for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 06:55:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmvJ-0004jy-00 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:45 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:42935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmvG-0001wU-9t for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:44 -0400 Received: by mail-pl1-x62c.google.com with SMTP id v23so9909165plo.9 for ; Wed, 24 Aug 2022 02:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=yHfvFbtV55sIFsllW+Yh1BVm3WnXAcaxhuBNZ2Rs4dY=; b=n98X281VnSIXn3kaNQ4oC0g06Bd3h21W4/4R3DYvQaogjZR3GX8XlPJY6U7ovZo4K6 xb45hx5EyZKBC+goYwJdNOZMTz2TvxCC/zFvshvC0yLmQ/bMEP7KmeSS4B0RbuSvwWRZ GdaQnFn4J7VR8DhsVqqhsVvL5EXQQQNg+HKPr0DQwdTTn1A9bn3zyPPQHGazWOeln/CF b8nG1K+Y5c4m/uDXyK94VXnuxIQOh7CLK61jahrJsj7L3Cr0Dqhz7qGZYYOG//fqh0rN JnrDXTKrUXi0msOPH2hQXni8uqQ3h6ORHgr4AIKZI7m0/C/ddJSVNQDrSpemsLys3ETA cpwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=yHfvFbtV55sIFsllW+Yh1BVm3WnXAcaxhuBNZ2Rs4dY=; b=GPQomE86T/UhanZ6EbX7fm/Ja1DSm/DoMRwXp5U/fr0HdO2cbsZK/p0BQSU0cfnPR+ CjnUBUTSF/OSQyPfjhVHPiTrXQKfoG0QqGxH+bpYBSCUFQM0Z6F/2LU54/yEMHOTT1aU ZeFNPzc86bk0ve3lpFSz7GaL+y/LxWubyJny31apx6YQ02kVmfheTuIbDE/GrfRIMQSY kXz1+BHLWTjDH81CkTGN+GJQAlbrVW7nvFTR1C6MO44jwQQFN7Ux2UD2+ncQpNrL8hdl 8oEszsCCo2/VfhJMHTmxyTeeafkfijdkpzOMqLKMbJ0kvZZwFvjpdFE+wnJKqmPqz81n NXHQ== X-Gm-Message-State: ACgBeo2qgmryDd/eOCp6RY2nycgfdpgw8Qzp6HLSf7fSTuubtCtBqZQK RrfXGdPy+wsNNSmbXkcI4vgPQZaTEwU= X-Google-Smtp-Source: AA6agR7VCqP14AnB0BgzlFcLgFyL94Kxm2pb/fJcLkwbgILm2ODzmvsVJnWWah0bZ80BAPxfqZNn2w== X-Received: by 2002:a17:90a:1912:b0:1f7:8c6c:4fde with SMTP id 18-20020a17090a191200b001f78c6c4fdemr7600625pjg.8.1661334220282; Wed, 24 Aug 2022 02:43:40 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:39 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Alex_Benn=C3=A9e?= , Beraldo Leal , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH 50/51] .gitlab-ci.d/windows.yml: Increase the timeout to the runner limit Date: Wed, 24 Aug 2022 17:40:28 +0800 Message-Id: <20220824094029.1634519-51-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng commit 9f8e6cad65a6 ("gitlab-ci: Speed up the msys2-64bit job by using --without-default-devices" changed to compile QEMU with the --without-default-devices switch for the msys2-64bit job, due to the build could not complete within the project timeout (1h), and also mentioned that a bigger timeout was getting ignored on the shared Gitlab-CI Windows runners. However as of today it seems the shared Gitlab-CI Windows runners does honor the job timeout, and the runner has the timeout limit of 2h, so let's increase the timeout to the runner limit and drop the configure switch "--without-default-devices" to get a larger build coverage. As a result of this, the check-qtest starts running on Windows in CI. Signed-off-by: Bin Meng --- .gitlab-ci.d/windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.d/windows.yml b/.gitlab-ci.d/windows.yml index c4bde758be..d4fd821b5f 100644 --- a/.gitlab-ci.d/windows.yml +++ b/.gitlab-ci.d/windows.yml @@ -10,7 +10,7 @@ - ${CI_PROJECT_DIR}/msys64/var/cache needs: [] stage: build - timeout: 70m + timeout: 2h before_script: - If ( !(Test-Path -Path msys64\var\cache ) ) { mkdir msys64\var\cache @@ -59,7 +59,7 @@ msys2-64bit: - $env:MSYSTEM = 'MINGW64' # Start a 64 bit Mingw environment - $env:MSYS = 'winsymlinks:native' # Enable native Windows symlink - .\msys64\usr\bin\bash -lc './configure --target-list=x86_64-softmmu - --enable-capstone --without-default-devices' + --enable-capstone' - .\msys64\usr\bin\bash -lc "sed -i '/^ROMS=/d' build/config-host.mak" - .\msys64\usr\bin\bash -lc 'make -j2' - .\msys64\usr\bin\bash -lc 'make check' From patchwork Wed Aug 24 09:40:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 12953276 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C54FCC00140 for ; Wed, 24 Aug 2022 11:00:01 +0000 (UTC) Received: from localhost ([::1]:43658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQo76-0001Eo-JQ for qemu-devel@archiver.kernel.org; Wed, 24 Aug 2022 07:00:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQmvR-00050d-WD for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:54 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:34560) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQmvI-0001wz-89 for qemu-devel@nongnu.org; Wed, 24 Aug 2022 05:43:53 -0400 Received: by mail-pl1-x634.google.com with SMTP id io24so1900802plb.1 for ; Wed, 24 Aug 2022 02:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=4oQw+eQhY7hVGzdAfMaik/NQNQlk5bn8HV+UO9xrDSE=; b=f2HY8z/CO/OBp04wuKvuQwgymMtZa73d6IuR7cPd5mM/SZZu/v9nJeY5D0JozmrxlT cjrWdnLeTlZENE/dp1Qw/1Qf9OChl/4+SZOWrCzvJN4dgBM7DH5iWS0DLqgn3eRYOG21 uqJj7NFeIeNcKKlzakeR+3PM+AGRzqYmmu17hxf8EZcA6WluPQNUcKMg0XeBBHrJdr3V 9igS01XS1SApzZMimjAEf8sjr94/GpOOlcbhGS99DYE1cLp11i0HSI1xxl8IpHfL2B4O Q6JJv7ER2FXtcIZZfY6GMDBLqB827vcum3FTHuSqOCh8S5VcvJrpT3+Yk16GwGEoR2ny 58Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=4oQw+eQhY7hVGzdAfMaik/NQNQlk5bn8HV+UO9xrDSE=; b=mmGuQMJQxNl7KmwCYuZyhVHE2A8Io9CTO1/AXKbVRA+EMZdyaLVoDtGDIoXXIqPCp5 puOGTC76KfXZF+snLgv89mEsWd4rIAzXgJEC/zFOlITCnip2OouclOolYOUI6q3why/i CqVChaQPuSRaVjLzKD3Jm+/mHUZ7+rNCagaNVxqrXvM/GbuG2Izc0vEThZNxwZ84VDRh xcRAXRlsXfCL1LEvxQKT/KftVyxcIDVSJ9PIrk/EKapE5qFMPpWzHAWsUmm6JtpznveV GxxXOx68U6PuW8JMm+gx/haT1ltpwZy5eMQnEpZoGuUuQxIJyUFGeZf/bLbYToySz1at fGcQ== X-Gm-Message-State: ACgBeo0qcSqwT3oid8Z0MsHZXQSfcRy9QinHyjGbXP2ZnwKFBJnRqT33 NYgQbe/sB7E8o5WmZOxi2qByMQ6jk/E= X-Google-Smtp-Source: AA6agR6U2Ff7fq2DkSsnsBw10MHiNNF26Ys3D2dsl58nWz0J/xzQ0r7mSgnI4KL5vK7RKnJCoi8XJQ== X-Received: by 2002:a17:903:2450:b0:173:9fe:70e5 with SMTP id l16-20020a170903245000b0017309fe70e5mr4863488pls.148.1661334222779; Wed, 24 Aug 2022 02:43:42 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b14-20020a170903228e00b001728eb339e2sm12165972plh.286.2022.08.24.02.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 02:43:42 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: Bin Meng , Emanuele Giuseppe Esposito , Hanna Reitz , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Vladimir Sementsov-Ogievskiy , Willian Rampazzo Subject: [PATCH 51/51] docs/devel: testing: Document writing portable test cases Date: Wed, 24 Aug 2022 17:40:29 +0800 Message-Id: <20220824094029.1634519-52-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220824094029.1634519-1-bmeng.cn@gmail.com> References: <20220824094029.1634519-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Update the best practices of how to write portable test cases that can be built and run successfully on both Linux and Windows hosts. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- docs/devel/testing.rst | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 3f6ebd5073..8fcabda30f 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -115,6 +115,36 @@ check-block are in the "auto" group). See the "QEMU iotests" section below for more information. +Writing portable test cases +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Both unit tests and qtests can run on a Linux host as well as a Windows host. +Care must be taken when writing portable test cases that can be built and run +successfully on both hosts. The following are some best practices: + +* Use portable APIs from glib whenever necessary, e.g.: g_setenv(), + g_mkdtemp(), g_mkdir_with_parents(). +* Avoid using hardcoded /tmp for temporary file directory. + Use g_get_tmp_dir() instead. +* Bear in mind that Windows has different special string representation for + stdin/stdout/stderr and null devices. For example if your test case uses + "/dev/fd/2" and "/dev/null" on Linux, remember to use "2" and "nul" on + Windows instead. Also IO redirection does not work on Windows, so avoid + using "2>nul" whenever necessary. +* If your test cases uses the blkdebug feature, use relative path to pass + the config and image file paths in the command line as Windows absolute + path contains the delimeter ":" which will confuse the blkdebug parser. +* Use double quotes in your extra QEMU commmand line in your test cases + instead of single quotes, as Windows does not drop single quotes when + passing the command line to QEMU. +* Windows opens a file in text mode by default, while a POSIX compliant + implementation treats text files and binary files the same. So if your + test cases opens a file to write some data and later wants to compare the + written data with the original one, be sure to pass the letter 'b' as + part of the mode string to fopen(), or O_BINARY flag for the open() call. +* If a certain test case can only run on POSIX or Linux hosts, use a proper + #ifdef in the codes. If the whole test suite cannot run on Windows, disable + the build in the meson.build file. + QEMU iotests ------------