From patchwork Wed Sep 28 07:18:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991732 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 082EFC32771 for ; Wed, 28 Sep 2022 07:41:34 +0000 (UTC) Received: from localhost ([::1]:47794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odRhF-0004Jb-DP for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 03:41:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLQ-0000tI-4U for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21378) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLO-0008RE-8K for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:18:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349536; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S2Ui2OpeTwQj51CzteIj3lNBFTymyVVDOfEP7OQNEXk=; b=fjr3HpR0ARMOa9EZO3W7HFrwTNJ7mZdBkdlfk4KsIZN/ork3VlRTrMN8JZmEzAgOZQlNOs kDfAKodpIOHEkijhnytN7vet0LYl7Lff/TV6ZsCUaMnDS6WiyYgMtoDYuXtECoScPMgXdy MSoXKjsw8z4Ktj/H0Py9jZ0LVn6fe/g= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-464-D8hEf2YiPoyzaHvSW3ok7Q-1; Wed, 28 Sep 2022 03:18:50 -0400 X-MC-Unique: D8hEf2YiPoyzaHvSW3ok7Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 37A53101A528; Wed, 28 Sep 2022 07:18:50 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03AC240C83BB; Wed, 28 Sep 2022 07:18:47 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 01/37] tests/qtest: i440fx-test: Rewrite create_blob_file() to be portable Date: Wed, 28 Sep 2022 09:18:07 +0200 Message-Id: <20220928071843.1468323-2-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 Previously request_{bios, pflash} cases were skipped on win32, mainly due to create_blob_file() calling mmap() which does not exist on win32. This rewirtes create_blob_file() to be portable, so that we can enable these cases on Windows. Suggested-by: Marc-André Lureau Signed-off-by: Bin Meng Reviewed-by: Thomas Huth Message-Id: <20220925113032.1949844-2-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/i440fx-test.c | 54 ++++++++++----------------------------- 1 file changed, 14 insertions(+), 40 deletions(-) diff --git a/tests/qtest/i440fx-test.c b/tests/qtest/i440fx-test.c index 3890f1237c..795fd85343 100644 --- a/tests/qtest/i440fx-test.c +++ b/tests/qtest/i440fx-test.c @@ -278,56 +278,34 @@ 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)) -/* Create a blob file, and return its absolute pathname as a dynamically +/* + * Create a blob file, and return its absolute pathname as a dynamically * allocated string. * The file is closed before the function returns. - * In case of error, NULL is returned. The function prints the error message. + * In case of error, the function aborts and prints the error message. */ static char *create_blob_file(void) { - int ret, fd; + int i, fd; char *pathname; GError *error = NULL; + g_autofree uint8_t *buf = g_malloc(BLOB_SIZE); - ret = -1; fd = g_file_open_tmp("blob_XXXXXX", &pathname, &error); - if (fd == -1) { - fprintf(stderr, "unable to create blob file: %s\n", error->message); - g_error_free(error); - } else { - if (ftruncate(fd, BLOB_SIZE) == -1) { - fprintf(stderr, "ftruncate(\"%s\", %zu): %s\n", pathname, - BLOB_SIZE, strerror(errno)); - } else { - void *buf; - - buf = mmap(NULL, BLOB_SIZE, PROT_WRITE, MAP_SHARED, fd, 0); - if (buf == MAP_FAILED) { - fprintf(stderr, "mmap(\"%s\", %zu): %s\n", pathname, BLOB_SIZE, - strerror(errno)); - } else { - size_t i; - - for (i = 0; i < BLOB_SIZE; ++i) { - ((uint8_t *)buf)[i] = i; - } - munmap(buf, BLOB_SIZE); - ret = 0; - } - } - close(fd); - if (ret == -1) { - unlink(pathname); - g_free(pathname); - } + g_assert_no_error(error); + close(fd); + + for (i = 0; i < BLOB_SIZE; i++) { + buf[i] = i; } - return ret == -1 ? NULL : pathname; + g_file_set_contents(pathname, (char *)buf, BLOB_SIZE, &error); + g_assert_no_error(error); + + return pathname; } static void test_i440fx_firmware(FirmwareTestFixture *fixture, @@ -398,8 +376,6 @@ static void request_pflash(FirmwareTestFixture *fixture, fixture->is_bios = false; } -#endif /* _WIN32 */ - int main(int argc, char **argv) { TestData data; @@ -410,10 +386,8 @@ 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 Sep 28 07:18:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991876 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 D8006C32771 for ; Wed, 28 Sep 2022 09:01:44 +0000 (UTC) Received: from localhost ([::1]:57728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSwk-0007Dk-Lc for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:01:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLP-0000sP-8y for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:18:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:35060) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLM-0008R7-Di for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:18:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=icYOHzCKPT4tZ28xawFjkohy3v7aTvDH9bPp19lPMRo=; b=cSscallQO6K5pqJMQw9K0qzPjaqSxljhs9RRG7yRnW3cmTlucU1Sdheo29yKYiMMQQ6EEI JJzQu+xeuqFu5oB7jeyc9NwgieuMsQbgB0oZMO7RoEQzL+0J87ptEPz6r5Tkco6EObYJGL B2k+0iToE59YbasKJ6LFWBbtkD9zgp8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-413-rr37SpbYMoKwbflr3qwICw-1; Wed, 28 Sep 2022 03:18:52 -0400 X-MC-Unique: rr37SpbYMoKwbflr3qwICw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A3826858F13; Wed, 28 Sep 2022 07:18:51 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9AFC240C83BB; Wed, 28 Sep 2022 07:18:50 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng Subject: [PULL 02/37] tests/qtest: ahci-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:08 +0200 Message-Id: <20220928071843.1468323-3-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth Message-Id: <20220925113032.1949844-6-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/ahci-test.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index f1e510b0ac..1d5929d8c3 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,10 +1437,10 @@ 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"; + g_autofree char *cdrom_path = NULL; unsigned char *patt; ssize_t ret; - int fd = mkstemp(cdrom_path); + int fd = g_file_open_tmp("qtest.iso.XXXXXX", &cdrom_path, NULL); g_assert(fd != -1); g_assert(buf); @@ -1872,7 +1872,7 @@ int main(int argc, char **argv) } /* Create a temporary image */ - fd = mkstemp(tmp_path); + fd = g_file_open_tmp("qtest.XXXXXX", &tmp_path, NULL); g_assert(fd >= 0); if (have_qemu_img()) { imgfmt = "qcow2"; @@ -1889,12 +1889,12 @@ int main(int argc, char **argv) close(fd); /* Create temporary blkdebug instructions */ - fd = mkstemp(debug_path); + fd = g_file_open_tmp("qtest-blkdebug.XXXXXX", &debug_path, NULL); g_assert(fd >= 0); close(fd); /* Reserve a hollow file to use as a socket for migration tests */ - fd = mkstemp(mig_socket); + fd = g_file_open_tmp("qtest-migration.XXXXXX", &mig_socket, NULL); g_assert(fd >= 0); close(fd); @@ -1947,8 +1947,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; } From patchwork Wed Sep 28 07:18:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991899 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 F195CC32771 for ; Wed, 28 Sep 2022 09:12:45 +0000 (UTC) Received: from localhost ([::1]:59980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odT7U-0005H4-Vs for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:12:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLQ-0000tm-Fv for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:22555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLO-0008RH-IP for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/UsJhLzu0nitUvLy8VWmP9xG5F2iel+EKXGwE+FAw14=; b=Sb5oS7esAFJT6ToaisOgHFY1NdLpRtkIckT35kkTZU1r7X2pFJWUpfdTkSMUV45Bvqknqw a1JQCy8uPyBdr6ORIyeqvtFpKldA3V90CnYElA9S+CwaBbKeYgrv2fC08AOX1wAxFMJIKp tN4efszg34t65dm2AvKEWvXqwChbpt8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-597-xb8V2QpWOQis3xblP3Ezeg-1; Wed, 28 Sep 2022 03:18:53 -0400 X-MC-Unique: xb8V2QpWOQis3xblP3Ezeg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 634623800C25; Wed, 28 Sep 2022 07:18:53 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B01840C83BB; Wed, 28 Sep 2022 07:18:51 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PULL 03/37] tests/qtest: aspeed_smc-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:09 +0200 Message-Id: <20220928071843.1468323-4-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth Reviewed-by: Cédric Le Goater Message-Id: <20220925113032.1949844-7-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/aspeed_smc-test.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/qtest/aspeed_smc-test.c b/tests/qtest/aspeed_smc-test.c index 05ce941566..c713a3700b 100644 --- a/tests/qtest/aspeed_smc-test.c +++ b/tests/qtest/aspeed_smc-test.c @@ -608,16 +608,15 @@ static void test_write_block_protect_bottom_bit(void) flash_reset(); } -static char tmp_path[] = "/tmp/qtest.m25p80.XXXXXX"; - int main(int argc, char **argv) { + g_autofree char *tmp_path = NULL; int ret; int fd; g_test_init(&argc, &argv, NULL); - fd = mkstemp(tmp_path); + fd = g_file_open_tmp("qtest.m25p80.XXXXXX", &tmp_path, NULL); g_assert(fd >= 0); ret = ftruncate(fd, FLASH_SIZE); g_assert(ret == 0); From patchwork Wed Sep 28 07:18:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991735 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 5C6C5C32771 for ; Wed, 28 Sep 2022 07:49:13 +0000 (UTC) Received: from localhost ([::1]:50328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odRoe-0002B9-5V for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 03:49:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLS-0000ui-4R for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:39686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLP-0008RX-Az for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DiXSYRKVY/K37b0MnbCYz/QSL2IO2/H/ATo4+OcCqv4=; b=OgKEGP4MGFcJPyylDJygD1DJA5WgnY2IznImMPZgT9hRsXWToJjEe81DzYUrOTyLAdHaBY V3gVltQGWP6PyspAp2RR4z4KbFFk/4PW8hipVn1iANMUtR2Cd3lKztJOSKFVZ6MsE7pJFk CLbrGfWxeEB2BC/ZJIJCR9V7/Fm463Q= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-449-yJpx6LX0Nx2RCPi-gS9HbQ-1; Wed, 28 Sep 2022 03:18:55 -0400 X-MC-Unique: yJpx6LX0Nx2RCPi-gS9HbQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 106293800C20; Wed, 28 Sep 2022 07:18:55 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8E7340C83BB; Wed, 28 Sep 2022 07:18:53 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng Subject: [PULL 04/37] tests/qtest: boot-serial-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:10 +0200 Message-Id: <20220928071843.1468323-5-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth Message-Id: <20220925113032.1949844-8-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/boot-serial-test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c index 2f99d71cab..72310ba30e 100644 --- a/tests/qtest/boot-serial-test.c +++ b/tests/qtest/boot-serial-test.c @@ -224,14 +224,14 @@ 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"; + g_autofree char *serialtmp = NULL; + g_autofree char *codetmp = NULL; const char *codeparam = ""; const uint8_t *code = NULL; QTestState *qts; int ser_fd; - ser_fd = mkstemp(serialtmp); + ser_fd = g_file_open_tmp("qtest-boot-serial-sXXXXXX", &serialtmp, NULL); g_assert(ser_fd != -1); if (test->kernel) { @@ -246,7 +246,7 @@ static void test_machine(const void *data) ssize_t wlen; int code_fd; - code_fd = mkstemp(codetmp); + code_fd = g_file_open_tmp("qtest-boot-serial-cXXXXXX", &codetmp, NULL); g_assert(code_fd != -1); wlen = write(code_fd, code, test->codesize); g_assert(wlen == test->codesize); From patchwork Wed Sep 28 07:18:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991919 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 7BE53C04A95 for ; Wed, 28 Sep 2022 09:19:51 +0000 (UTC) Received: from localhost ([::1]:38866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTEM-0002q2-Dn for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:19:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLU-0000wo-5A for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23108) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLS-0008SD-HG for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZoEDCSw4xYTrv72BG6q3jqBdnLXfwig/ukmMFjh8lXg=; b=fzlziSgKDZRBczROlOjAvp8CcacG9kv8yIxEJp2pMAGzEt7uzf5jAKPkDEUhBzp4ykGhB6 HV0c5WmAvt98UPhMWHsUQzOz2p//oshywWOVzU52jLQ+TnymXIyAqsGZNn0xE3gvRVEh4A Hd0Rc/OhH+SAAvFdJTka8XJRujg9sTo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-646-pxV-hzn5N1WkSc6iKvnDpw-1; Wed, 28 Sep 2022 03:18:56 -0400 X-MC-Unique: pxV-hzn5N1WkSc6iKvnDpw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C489101CC67; Wed, 28 Sep 2022 07:18:56 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C1AE40C83BB; Wed, 28 Sep 2022 07:18:55 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 05/37] tests/qtest: cxl-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:11 +0200 Message-Id: <20220928071843.1468323-6-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_dir_make_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-9-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/cxl-test.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/qtest/cxl-test.c b/tests/qtest/cxl-test.c index 2e14da7dee..cbe0fb549b 100644 --- a/tests/qtest/cxl-test.c +++ b/tests/qtest/cxl-test.c @@ -93,10 +93,9 @@ 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"; - const char *tmpfs; + g_autofree const char *tmpfs = NULL; - tmpfs = g_mkdtemp(template); + tmpfs = g_dir_make_tmp("cxl-test-XXXXXX", NULL); g_string_printf(cmdline, QEMU_PXB_CMD QEMU_RP QEMU_T3D, tmpfs, tmpfs); @@ -107,10 +106,9 @@ 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"; - const char *tmpfs; + g_autofree const char *tmpfs = NULL; - tmpfs = g_mkdtemp(template); + tmpfs = g_dir_make_tmp("cxl-test-XXXXXX", NULL); g_string_printf(cmdline, QEMU_PXB_CMD QEMU_2RP QEMU_2T3D, tmpfs, tmpfs, tmpfs, tmpfs); @@ -122,10 +120,9 @@ 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"; - const char *tmpfs; + g_autofree const char *tmpfs = NULL; - tmpfs = g_mkdtemp(template); + tmpfs = g_dir_make_tmp("cxl-test-XXXXXX", NULL); g_string_printf(cmdline, QEMU_2PXB_CMD QEMU_4RP QEMU_4T3D, tmpfs, tmpfs, tmpfs, tmpfs, tmpfs, tmpfs, From patchwork Wed Sep 28 07:18:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991704 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 57DB7C04A95 for ; Wed, 28 Sep 2022 07:36:15 +0000 (UTC) Received: from localhost ([::1]:55730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odRc6-0001rR-1E for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 03:36:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLS-0000vi-RX for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLQ-0008Rr-JG for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349539; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nsT/MYvq1C+hW8KNERyVSGCrtj4yc5rro7ngvowcej4=; b=S6qa1ONbvyfqCTHm85lXP6f9UmTF3gtYyHglRp19VMM5n/pdpl3Gj/IfPEQW2qSYNsHaYT YsGfFX2jmCA0wVXtIcF28WjyL/TPP/ulinQaHd9v7S5k7nvEo8Lyjr0J8YpTIzUzTqGs4P kJGrgMoB15XZAjD3EjUd60thpT1c4lw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-82-3p88ceqnMUCd9hbvy3899g-1; Wed, 28 Sep 2022 03:18:58 -0400 X-MC-Unique: 3p88ceqnMUCd9hbvy3899g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2447A2999B4C; Wed, 28 Sep 2022 07:18:58 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id E164A40C83BB; Wed, 28 Sep 2022 07:18:56 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 06/37] tests/qtest: fdc-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:12 +0200 Message-Id: <20220928071843.1468323-7-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-10-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/fdc-test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c index 52ade90a7d..1f9b99ad6d 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,7 +608,7 @@ int main(int argc, char **argv) int ret; /* Create a temporary raw image */ - fd = mkstemp(test_image); + fd = g_file_open_tmp("qtest.XXXXXX", &test_image, NULL); g_assert(fd >= 0); ret = ftruncate(fd, TEST_IMAGE_SIZE); g_assert(ret == 0); @@ -640,6 +640,7 @@ int main(int argc, char **argv) /* Cleanup */ qtest_end(); unlink(test_image); + g_free(test_image); return ret; } From patchwork Wed Sep 28 07:18:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991741 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 21807C32771 for ; Wed, 28 Sep 2022 08:02:13 +0000 (UTC) Received: from localhost ([::1]:52866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odS1D-0008MQ-RE for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:02:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLW-0000xL-0l for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46885) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLT-0008SO-Rp for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gRsTZD5ut4SlcZ+0GqEfXYADRhy1Qd2Fzh5xQj0mzPg=; b=J2Ga02GM9O9rD1hUKZly0WBsdDoJ4Nvq1uZFAvnY3ZV/+gFkADV+NISDPRUbQ/L/6nSdHB aHGTUgT52aPMYETuS2uYQ4nTjV6rukz6FayjtObvDtaZyZ5TjGEVXQLTxBYv2ps9x6xI1O DdUbY/DKYGrwIw9pxddi/2WWxfSSWmQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-350-5T8h2dslOyGLPeLGCo9KAg-1; Wed, 28 Sep 2022 03:18:59 -0400 X-MC-Unique: 5T8h2dslOyGLPeLGCo9KAg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9EA7B2999B48; Wed, 28 Sep 2022 07:18:59 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79B9540C83BB; Wed, 28 Sep 2022 07:18:58 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 07/37] tests/qtest: generic_fuzz: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:13 +0200 Message-Id: <20220928071843.1468323-8-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_dir_make_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-11-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/fuzz/generic_fuzz_configs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/generic_fuzz_configs.h index 0775e6702b..a825b78c14 100644 --- a/tests/qtest/fuzz/generic_fuzz_configs.h +++ b/tests/qtest/fuzz/generic_fuzz_configs.h @@ -20,8 +20,8 @@ typedef struct generic_fuzz_config { } generic_fuzz_config; static inline gchar *generic_fuzzer_virtio_9p_args(void){ - char tmpdir[] = "/tmp/qemu-fuzz.XXXXXX"; - g_assert_nonnull(g_mkdtemp(tmpdir)); + g_autofree char *tmpdir = g_dir_make_tmp("qemu-fuzz.XXXXXX", NULL); + g_assert_nonnull(tmpdir); return g_strdup_printf("-machine q35 -nodefaults " "-device virtio-9p,fsdev=hshare,mount_tag=hshare " From patchwork Wed Sep 28 07:18:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991796 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 BCE6CC04A95 for ; Wed, 28 Sep 2022 08:32:51 +0000 (UTC) Received: from localhost ([::1]:51454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSUs-0001sh-DK for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:32:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLh-0000yL-Nk for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36216) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLW-0008Sd-LB for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nmcRQxWNZIRXhqqU/q+zGbE9O3Xdmft09Sq/zrDJ8co=; b=Q/yz4L2oPGVT+tyg3GtVH41cTih0ayRmjp3hYPWVWkIT/Z9zrkiGC8IqK6WPH4qFSv2JIX KC3QDFDbf7v7grvIY5pwcnDfz+mtejM4Y7BbTQ7KvrBI0clvRcryGT2Ugbn1l9L5yWDcVr 2eIjMo/DEuC6SbLNcUo5ydP76k4vkyQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-584-bElRwiI4OT2Ffu8GmHhOaQ-1; Wed, 28 Sep 2022 03:19:01 -0400 X-MC-Unique: bElRwiI4OT2Ffu8GmHhOaQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A3F1882823; Wed, 28 Sep 2022 07:19:01 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D79240C83BB; Wed, 28 Sep 2022 07:18:59 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 08/37] tests/qtest: virtio_blk_fuzz: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:14 +0200 Message-Id: <20220928071843.1468323-9-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-12-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/fuzz/virtio_blk_fuzz.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/fuzz/virtio_blk_fuzz.c b/tests/qtest/fuzz/virtio_blk_fuzz.c index 236d078cc8..a9fb9ecf6c 100644 --- a/tests/qtest/fuzz/virtio_blk_fuzz.c +++ b/tests/qtest/fuzz/virtio_blk_fuzz.c @@ -181,10 +181,10 @@ 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; /* Create a temporary raw image */ - fd = mkstemp(t_path); + fd = g_file_open_tmp("qtest.XXXXXX", &t_path, NULL); g_assert_cmpint(fd, >=, 0); ret = ftruncate(fd, TEST_IMAGE_SIZE); g_assert_cmpint(ret, ==, 0); From patchwork Wed Sep 28 07:18:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991810 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 E8EB4C04A95 for ; Wed, 28 Sep 2022 08:41:42 +0000 (UTC) Received: from localhost ([::1]:41214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSdS-0008HL-1O for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:41:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLh-0000yM-OA for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:29207) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLX-0008Sq-43 for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349546; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d7S+a/NPPz5Pdw3vVRItqYkq+YsyiaI0EzdUXzDOmMg=; b=TXECj1a777byUxBv9iU8Dm++ksY5bS2vhxAqRc8c0bJM7UGm32gVw2ex3DG2OgcwGgEYE4 Vc2WBVWe9jZiQs2Ez/Ss1DCIbYHmP4YyzOLc7m9acdYnZ2LDWGK+YPq6PriOAF1uOqC+aK 4KEXO9s8qGS2T4FE1Ok054EFYsjNK8k= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-yFTQ52xrNlW8B2Zr7Tv2ag-1; Wed, 28 Sep 2022 03:19:03 -0400 X-MC-Unique: yFTQ52xrNlW8B2Zr7Tv2ag-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E2123811E67; Wed, 28 Sep 2022 07:19:02 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id C916340C83BB; Wed, 28 Sep 2022 07:19:01 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 09/37] tests/qtest: ide-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:15 +0200 Message-Id: <20220928071843.1468323-10-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-14-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/ide-test.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index 5bcb75a7e5..25302be6dc 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,12 +1015,12 @@ int main(int argc, char **argv) int ret; /* Create temporary blkdebug instructions */ - fd = mkstemp(debug_path); + fd = g_file_open_tmp("qtest-blkdebug.XXXXXX", &debug_path, NULL); g_assert(fd >= 0); close(fd); /* Create a temporary raw image */ - fd = mkstemp(tmp_path); + fd = g_file_open_tmp("qtest.XXXXXX", &tmp_path, NULL); g_assert(fd >= 0); ret = ftruncate(fd, TEST_IMAGE_SIZE); g_assert(ret == 0); @@ -1049,7 +1049,9 @@ int main(int argc, char **argv) /* Cleanup */ unlink(tmp_path); + g_free(tmp_path); unlink(debug_path); + g_free(debug_path); return ret; } From patchwork Wed Sep 28 07:18:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991745 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 54F62C04A95 for ; Wed, 28 Sep 2022 08:14:58 +0000 (UTC) Received: from localhost ([::1]:42776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSDY-0006Wx-QQ for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:14:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLh-0000yP-OY for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:46869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLa-0008TI-E5 for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349549; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D9FLL6FSCHGyvQHSVgUQjkD9HZeeRLUKjgpMC/By/Eo=; b=gDlY+lwj2Za34vU+9wQ3M7h2EomAGkcoaQeKJsQmPLbIIrgNgBjWUo6Ly9jGiIO6ng8UK/ zOI0rfGxxTWWRwGX20K67WotYUC1b8qx84N0x+58rwHgTUIc+MwWG5mTswArXwcTix+hTs JFIxVAwXasPiIPDgIitS4EKIQGULccU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-75-0-ARupMbPvCIiwW9NPKsmw-1; Wed, 28 Sep 2022 03:19:04 -0400 X-MC-Unique: 0-ARupMbPvCIiwW9NPKsmw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5F154868A21; Wed, 28 Sep 2022 07:19:04 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5303140C83BB; Wed, 28 Sep 2022 07:19:03 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 10/37] tests/qtest: vhost-user-blk-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:16 +0200 Message-Id: <20220928071843.1468323-11-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_get_tmp_dir() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-18-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/vhost-user-blk-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); From patchwork Wed Sep 28 07:18:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991792 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 99C91C04A95 for ; Wed, 28 Sep 2022 08:24:08 +0000 (UTC) Received: from localhost ([::1]:52862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSMR-0004Kl-PB for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:24:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLh-0000yN-Ng for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40079) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLY-0008TB-R5 for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CzF0Gr+rnt43R6ngltYl2vSGN3la25xAMhez/ygFCvk=; b=KwvCXoXUUpEEQsBE9udseHQ4M82zrMjWk10Mpq7GCmW4GuzkBkLg5nlXn8st5r+qij9lIJ Q416Ilgm2XJGDeam4XU/d1Tgaqdkh/Axy1VXOB5jFHumjrZo/dMr8PdWvvjAFtAxBHKJbp x+z2jb0mC2ljQEWcxVwT0FY2FCFmCT8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-93-uzVz7fujN9Ky9sqnhgnX-Q-1; Wed, 28 Sep 2022 03:19:06 -0400 X-MC-Unique: uzVz7fujN9Ky9sqnhgnX-Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E01B0882820; Wed, 28 Sep 2022 07:19:05 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id B42C440C83BB; Wed, 28 Sep 2022 07:19:04 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 11/37] tests/qtest: virtio-blk-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:17 +0200 Message-Id: <20220928071843.1468323-12-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-20-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/virtio-blk-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/virtio-blk-test.c b/tests/qtest/virtio-blk-test.c index dc5eed31c8..19c01f808b 100644 --- a/tests/qtest/virtio-blk-test.c +++ b/tests/qtest/virtio-blk-test.c @@ -49,10 +49,10 @@ 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; /* Create a temporary raw image */ - fd = mkstemp(t_path); + fd = g_file_open_tmp("qtest.XXXXXX", &t_path, NULL); g_assert_cmpint(fd, >=, 0); ret = ftruncate(fd, TEST_IMAGE_SIZE); g_assert_cmpint(ret, ==, 0); From patchwork Wed Sep 28 07:18:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991957 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 AA466C32771 for ; Wed, 28 Sep 2022 09:36:09 +0000 (UTC) Received: from localhost ([::1]:33690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTU8-0006k8-Ga for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:36:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLh-0000yQ-Oj for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58447) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLa-0008TP-Oo for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KXRCW//bY6nAjGO76dMuQ3l8tE0Jqz23zyP9s+wwXEo=; b=HrrwNgw+lsFTQcTGjQCA0QMnqGW9tqoS2TLFyN90k7d3+8tfnl7IFoI4vJCCw87ConbygE FHMaTMQHL+GjuWJFIBSOq9GFwHe5jPo4uPjS9JU/SeodRdE/UlKvnZMQJBOU74/GprXtNb Lb9zIzt4P4v89QmpM6c3OXKW2GIaGQk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-611-7Zm9VCxYPIiGnwP1NPuCxg-1; Wed, 28 Sep 2022 03:19:08 -0400 X-MC-Unique: 7Zm9VCxYPIiGnwP1NPuCxg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A2CC6868A21; Wed, 28 Sep 2022 07:19:07 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F86540C83BB; Wed, 28 Sep 2022 07:19:06 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 12/37] tests/qtest: virtio-scsi-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:18 +0200 Message-Id: <20220928071843.1468323-13-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-21-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/virtio-scsi-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/virtio-scsi-test.c b/tests/qtest/virtio-scsi-test.c index 8ceb12aacd..ceaa7f2415 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"; + g_autofree char *tmp_path = NULL; int fd; int ret; @@ -282,7 +282,7 @@ static void test_iothread_attach_node(void *obj, void *data, vs = qvirtio_scsi_init(scsi->vdev); /* Create a temporary qcow2 overlay*/ - fd = mkstemp(tmp_path); + fd = g_file_open_tmp("qtest.XXXXXX", &tmp_path, NULL); g_assert(fd >= 0); close(fd); From patchwork Wed Sep 28 07:18:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991949 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 729C7C04A95 for ; Wed, 28 Sep 2022 09:28:19 +0000 (UTC) Received: from localhost ([::1]:48080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTMY-0000qr-9J for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:28:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLh-0000yR-PB for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53518) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLd-0008Tt-NZ for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rkz4eAcNK9l5w17uw7T4P7FC90vfCuJmxhWJJAstGqk=; b=eeKA0yhh9klDf/ut6TxbOe2Jm/esq1eNwUEJOG8rii5UTT2mYTCtxfUcNxOal1tKgl1WMp fps+zj1D4Z8ViwiAvpGPdp6/B6FtFeqM7cWUvEmJytTQkjNcucUsLOTkx4avuXwdpLXVbV mqlt3tPRxouy0mDK20A2PvNplzYp7rw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-371-bVF1rKzMNxiX6QBIS52sIA-1; Wed, 28 Sep 2022 03:19:09 -0400 X-MC-Unique: bVF1rKzMNxiX6QBIS52sIA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1767E185A792; Wed, 28 Sep 2022 07:19:09 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFF7940C83C5; Wed, 28 Sep 2022 07:19:07 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 13/37] tests/qtest: libqtest: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:19 +0200 Message-Id: <20220928071843.1468323-14-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 qtest library was written to use hardcoded /tmp directory for temporary files. Update to use g_get_tmp_dir() and g_dir_make_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-22-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/libqtest.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 7c9fc07de4..d8ffa0e7b1 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,10 +392,12 @@ 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"; + g_autofree char *sock_dir = NULL; + char *sock_path; QTestState *qts; - g_assert_true(g_mkdtemp(sock_dir) != NULL); + sock_dir = g_dir_make_tmp("qtest-serial-XXXXXX", NULL); + g_assert_true(sock_dir != NULL); sock_path = g_strdup_printf("%s/sock", sock_dir); sock_fd_init = init_socket(sock_path); From patchwork Wed Sep 28 07:18:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991742 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 9480AC32771 for ; Wed, 28 Sep 2022 08:03:14 +0000 (UTC) Received: from localhost ([::1]:56100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odS2D-0000V0-IW for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:03:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLm-0000ym-Lz for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21168) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLh-0008UE-1T for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349555; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i0YznsIzHmGPhqkaGSdouJT+RzkCcPK63D9jyeY1UD0=; b=Y5twolEoi19efYRfb4O/kLFoLa9G3AwCzKKepyFm+N4MFduvnO1UcZqB3N2ICGKDV7z0IQ EEv6igOW/pgwHcrSp/5QQHarZDU7BLxXCN+6xF4m1k8gDQRE6VIU8WqOMmvW1Gr95McODg fyqrK+X5Ixn9caQ6a+GB4jNDlkP5dvo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-664-HLNbarwSN3ebGQH6-V6Gtw-1; Wed, 28 Sep 2022 03:19:11 -0400 X-MC-Unique: HLNbarwSN3ebGQH6-V6Gtw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AD9803C01D9D; Wed, 28 Sep 2022 07:19:10 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91AD440C83BB; Wed, 28 Sep 2022 07:19:09 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 14/37] tests/unit: test-image-locking: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:20 +0200 Message-Id: <20220928071843.1468323-15-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-23-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/unit/test-image-locking.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/test-image-locking.c b/tests/unit/test-image-locking.c index ba057bd66c..a47299c247 100644 --- a/tests/unit/test-image-locking.c +++ b/tests/unit/test-image-locking.c @@ -76,10 +76,10 @@ 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"; + g_autofree char *img_path = NULL; uint64_t perm, shared_perm; - int fd = mkstemp(img_path); + int fd = g_file_open_tmp("qtest.XXXXXX", &img_path, NULL); assert(fd >= 0); perm = BLK_PERM_WRITE | BLK_PERM_CONSISTENT_READ; @@ -117,10 +117,10 @@ static void test_image_locking_basic(void) static void test_set_perm_abort(void) { BlockBackend *blk1, *blk2; - char img_path[] = "/tmp/qtest.XXXXXX"; + g_autofree char *img_path = NULL; uint64_t perm, shared_perm; int r; - int fd = mkstemp(img_path); + int fd = g_file_open_tmp("qtest.XXXXXX", &img_path, NULL); assert(fd >= 0); perm = BLK_PERM_WRITE | BLK_PERM_CONSISTENT_READ; From patchwork Wed Sep 28 07:18:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991736 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 8A60EC04A95 for ; Wed, 28 Sep 2022 07:49:50 +0000 (UTC) Received: from localhost ([::1]:35732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odRpF-0002iO-9V for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 03:49:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLh-0000yS-Oi for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:41154) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLf-0008U4-29 for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dePdyRTl62AvVB7TLSqcw8+czymOGMtmr0veNvoXg5I=; b=HWk14JcderdlDKS4vwLGb5D52iQV6KwieYIqvCeTcIJD4hlmHmO9BpXgx7y+NyaJ3LLsJD kskTGs9r8AL9wk7Sr+RD02QCgQkEdg2CrBQqI7V5KjEdj+WZ8peMMtKyi2CVR+YF2IqwAW n7liy1ntWqQ0Z6ZG9zuOGSQWK1pYWy8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-15-igu8rn8JODeS2t7rOQ3usA-1; Wed, 28 Sep 2022 03:19:13 -0400 X-MC-Unique: igu8rn8JODeS2t7rOQ3usA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A134F3C01D96; Wed, 28 Sep 2022 07:19:12 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3942C40C83BB; Wed, 28 Sep 2022 07:19:10 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 15/37] tests/unit: test-qga: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:21 +0200 Message-Id: <20220928071843.1468323-16-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_get_tmp_dir() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-24-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/unit/test-qga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c index b6ea7c7304..b4e0a14573 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"); + 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); From patchwork Wed Sep 28 07:18:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12992018 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 0CC54C32771 for ; Wed, 28 Sep 2022 09:48:09 +0000 (UTC) Received: from localhost ([::1]:46404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTfk-0004kf-Qm for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:48:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLn-0000z4-Sx for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40426) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLk-0008UK-GS for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349556; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9tbOptUO7BPTl9A94ErlpwGGSueTk4Wb42SVl8eTydY=; b=B8gZlHVTfssUPOre/I5pw3AxSWxro/m03Qyxk0trCcgViAU/JAVKIbyhB6zc+aTcgpKUuJ UKjKrt9MDVb3KgxVvGBw/DtR6dkHlmykZZDcVx3ALEzMwDevYYeFHMj9Y+Ot5zUwx3RhZN kEPKN42I5tSvp4ZxnCmiJPVPaPr4pok= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-153-51Fz_IPOPTegRjPto-zxWA-1; Wed, 28 Sep 2022 03:19:15 -0400 X-MC-Unique: 51Fz_IPOPTegRjPto-zxWA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B14E31C20AF0; Wed, 28 Sep 2022 07:19:14 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11C3C40C83BB; Wed, 28 Sep 2022 07:19:12 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 16/37] tests: vhost-user-bridge: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:22 +0200 Message-Id: <20220928071843.1468323-17-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-25-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/vhost-user-bridge.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index 9b1dab2f28..fecdf915e7 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -631,7 +631,6 @@ static void *notifier_thread(void *arg) static void vubr_host_notifier_setup(VubrDev *dev) { - char template[] = "/tmp/vubr-XXXXXX"; pthread_t thread; size_t length; void *addr; @@ -639,7 +638,7 @@ vubr_host_notifier_setup(VubrDev *dev) length = qemu_real_host_page_size() * VHOST_USER_BRIDGE_MAX_QUEUES; - fd = mkstemp(template); + fd = g_file_open_tmp("vubr-XXXXXX", NULL, NULL); if (fd < 0) { vubr_die("mkstemp()"); } From patchwork Wed Sep 28 07:18:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991874 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 50C4DC04A95 for ; Wed, 28 Sep 2022 08:58:03 +0000 (UTC) Received: from localhost ([::1]:56216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odStG-000446-3Q for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:58:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLq-00010I-CE for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57249) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLm-0008UV-Gh for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8sqrbAh9YbIpZcl1GEUv3IkCM+lHs5Japl0w/cbqeH0=; b=K/g3KFTzgsWxW/LMGexilV+3CWZKQNFaN/AdYwE/mOXhmujk3EFfovn2JP3pDnzpCo3CFU LYMK8Sg7dvRkIyx1ivouHAI5gAntPUc/Uuo7FZlOl/ep7M1J6ruGauyoYPcAape6VgM522 PjXZjc4c0Pcqn5YqBmoBiNnx7yrxipA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-220-_Mel49NWPG2MrdPrrtztkg-1; Wed, 28 Sep 2022 03:19:16 -0400 X-MC-Unique: _Mel49NWPG2MrdPrrtztkg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5873E1C20AEC; Wed, 28 Sep 2022 07:19:16 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27C1140C83BB; Wed, 28 Sep 2022 07:19:14 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 17/37] tests/qtest: Skip running virtio-net-test cases that require socketpair() for win32 Date: Wed, 28 Sep 2022 09:18:23 +0200 Message-Id: <20220928071843.1468323-18-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 of the virtio-net-test test cases require socketpair() to do the test setup. Skip them for win32. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-29-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/virtio-net-test.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c index 6ded252901..dff43f0f60 100644 --- a/tests/qtest/virtio-net-test.c +++ b/tests/qtest/virtio-net-test.c @@ -165,8 +165,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; @@ -286,6 +284,8 @@ static void *virtio_net_test_setup(GString *cmd_line, void *arg) return sv; } +#endif /* _WIN32 */ + static void large_tx(void *obj, void *data, QGuestAllocator *t_alloc) { QVirtioNet *dev = obj; @@ -319,16 +319,15 @@ static void *virtio_net_test_setup_nosocket(GString *cmd_line, void *arg) static void register_virtio_net_test(void) { - QOSGraphTestOptions opts = { - .before = virtio_net_test_setup, - }; + QOSGraphTestOptions opts = { 0 }; - qos_add_test("hotplug", "virtio-net-pci", hotplug, &opts); #ifndef _WIN32 + opts.before = virtio_net_test_setup; + qos_add_test("hotplug", "virtio-net-pci", hotplug, &opts); 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); +#endif /* These tests do not need a loopback backend. */ opts.before = virtio_net_test_setup_nosocket; From patchwork Wed Sep 28 07:18:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991859 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 D6BE7C32771 for ; Wed, 28 Sep 2022 08:50:20 +0000 (UTC) Received: from localhost ([::1]:57154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSln-0006JI-Oy for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:50:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLo-0000z9-4h for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:26196) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLm-0008UX-FU for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ve8BTFEJ8SlwZ9GsTrGk7OwwXRhwG2Tbjp5rgi+qtRk=; b=IEm8MEbKGWpcK4s5gLsh8JNinFqmnX097VYCXVt3mufGvM+FMhKDNT1NtCtgdcbar7ETmI aRwR0LzgCuOaez1KkTLg+8S2zTZEAn9XhVAKGoHj6TsFfVomu2CLT6I4m8qibLin0vyxd6 9zKPXD4ULExirIOMZbUM9HA6+36rccc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-589-FP2VrOwcOza9_7ti-gf-HA-1; Wed, 28 Sep 2022 03:19:18 -0400 X-MC-Unique: FP2VrOwcOza9_7ti-gf-HA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EE356811E67; Wed, 28 Sep 2022 07:19:17 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD68D40C83D9; Wed, 28 Sep 2022 07:19:16 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 18/37] tests/qtest: Build test-filter-{mirror, redirector} cases for posix only Date: Wed, 28 Sep 2022 09:18:24 +0200 Message-Id: <20220928071843.1468323-19-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 Message-Id: <20220925113032.1949844-30-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/meson.build | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index e910cb32ca..455f1bbb7e 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -39,9 +39,14 @@ qtests_pci = \ qtests_cxl = \ (config_all_devices.has_key('CONFIG_CXL') ? ['cxl-test'] : []) +qtests_filter = \ + (slirp.found() ? ['test-netfilter'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ + (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + qtests_i386 = \ - (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \ - (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ + (slirp.found() ? ['pxe-test'] : []) + \ + qtests_filter + \ (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 +100,7 @@ qtests_i386 = \ 'vmgenid-test', 'migration-test', 'test-x86-cpuid-compat', - 'numa-test', - 'test-filter-redirector' + 'numa-test' ] if dbus_display @@ -120,30 +124,25 @@ endif qtests_x86_64 = qtests_i386 qtests_alpha = ['boot-serial-test'] + \ - ['test-filter-mirror', 'test-filter-redirector'] + \ - (slirp.found() ? ['test-netfilter'] : []) + \ + qtests_filter + \ (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'] + \ - (slirp.found() ? ['test-netfilter'] : []) + \ + qtests_filter + \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) qtests_m68k = ['boot-serial-test'] + \ - ['test-filter-mirror', 'test-filter-redirector'] + \ - (slirp.found() ? ['test-netfilter'] : []) + qtests_filter qtests_microblaze = ['boot-serial-test'] + \ - ['test-filter-mirror', 'test-filter-redirector'] + \ - (slirp.found() ? ['test-netfilter'] : []) + qtests_filter qtests_microblazeel = qtests_microblaze qtests_mips = \ - ['test-filter-mirror', 'test-filter-redirector'] + \ - (slirp.found() ? ['test-netfilter'] : []) + \ + qtests_filter + \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) @@ -152,8 +151,7 @@ qtests_mips64 = qtests_mips qtests_mips64el = qtests_mips qtests_ppc = \ - ['test-filter-mirror', 'test-filter-redirector'] + \ - (slirp.found() ? ['test-netfilter'] : []) + \ + qtests_filter + \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_M48T59') ? ['m48t59-test'] : []) + \ (config_all_devices.has_key('CONFIG_TCG') ? ['prom-env-test'] : []) + \ @@ -174,13 +172,11 @@ 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'] + \ - (slirp.found() ? ['test-netfilter'] : []) + qtests_filter qtests_sparc64 = \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ - (slirp.found() ? ['test-netfilter'] : []) + \ - ['test-filter-mirror', 'test-filter-redirector'] + \ + qtests_filter + \ ['prom-env-test', 'boot-serial-test'] qtests_npcm7xx = \ From patchwork Wed Sep 28 07:18:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991734 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 611F4C32771 for ; Wed, 28 Sep 2022 07:46:55 +0000 (UTC) Received: from localhost ([::1]:54048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odRmP-0008OQ-3n for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 03:46:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLs-00010u-H2 for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:21887) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLr-0008VM-0X for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fS0HFYuay2FaG6jezA4xu47Chtmh+TOfClxLJ6MIUFw=; b=H6hBO213QdyvzOvhQFWA3hpmX8EDWsSnOUxLvkNSL293eQXh2dwBUxlk4R3ZOdkDndo4SO Fc5B0FxrpeDOqxGzvCDDPbl2+hxIGmWU+vrj53HfxLD4DbsshOsR7xPvswAT9XCp4r0Svi 4Co7Oo8C69SOVsPN9QZt2V/JNz9ZEeM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-381-EksNxqiMNGiKDW-GHajsMQ-1; Wed, 28 Sep 2022 03:19:19 -0400 X-MC-Unique: EksNxqiMNGiKDW-GHajsMQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B5231C20AEF; Wed, 28 Sep 2022 07:19:19 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D86440C83BB; Wed, 28 Sep 2022 07:19:18 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng Subject: [PULL 19/37] tests/qtest: qmp-test: Skip running test_qmp_oob for win32 Date: Wed, 28 Sep 2022 09:18:25 +0200 Message-Id: <20220928071843.1468323-20-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 Message-Id: <20220925113032.1949844-31-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/qmp-test.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c index bf7304c7dc..23b2a37942 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[] = "/tmp/qmp-test-XXXXXX"; @@ -277,6 +279,8 @@ static void test_qmp_oob(void) qtest_quit(qts); } +#endif /* _WIN32 */ + /* Preconfig tests */ static void test_qmp_preconfig(void) @@ -336,7 +340,10 @@ int main(int argc, char *argv[]) g_test_init(&argc, &argv, NULL); qtest_add_func("qmp/protocol", test_qmp_protocol); +#ifndef _WIN32 + /* This case calls mkfifo() which does not exist on 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 Sep 28 07:18:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991892 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 C0846C32771 for ; Wed, 28 Sep 2022 09:09:31 +0000 (UTC) Received: from localhost ([::1]:50720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odT4M-0001lQ-GT for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:09:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLt-00012O-AC for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39408) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLr-0008VQ-FD for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NzLTNtj1QpJ9n1/eExxjBSPKEbT7n5YpjTjN2RWiNFs=; b=Zzoa1Q0DO+vCXVxJs0oziRyL/yK18YeJd7wRQ9x9ILKoZfATvK9J7uhZMQzl3k/7rTu22g OF1U0teL8AuHtoqwq2GfeBj4a742qJm4etRq9PQRqbHnC5DfFwoqw/69q8+h/+zrLcWEvZ PoARNXhxw8RC4CidWkSnQIzgFbaEkns= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-266-YBDkhqwHPUSIA4ozGPkWMA-1; Wed, 28 Sep 2022 03:19:23 -0400 X-MC-Unique: YBDkhqwHPUSIA4ozGPkWMA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 17083185A79C; Wed, 28 Sep 2022 07:19:23 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCA2740C83D9; Wed, 28 Sep 2022 07:19:19 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng Subject: [PULL 20/37] tests/qtest: libqtest: Adapt global_qtest declaration for win32 Date: Wed, 28 Sep 2022 09:18:26 +0200 Message-Id: <20220928071843.1468323-21-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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. However Windows does provide a trick to declare a variable to be a common symbol, via __declspec(selectany) [1]. It does not provide the "strong override weak" effect but we don't need it in our use case anyway. So let's use it for win32. [1] https://docs.microsoft.com/en-us/cpp/cpp/selectany Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Reviewed-by: Thomas Huth Message-Id: <20220925113032.1949844-33-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/libqtest-single.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qtest/libqtest-single.h b/tests/qtest/libqtest-single.h index 4e7d0ae1dc..851724cbcb 100644 --- a/tests/qtest/libqtest-single.h +++ b/tests/qtest/libqtest-single.h @@ -13,7 +13,11 @@ #include "libqtest.h" +#ifndef _WIN32 QTestState *global_qtest __attribute__((common, weak)); +#else +__declspec(selectany) QTestState *global_qtest; +#endif /** * qtest_start: From patchwork Wed Sep 28 07:18:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991790 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 8D6B4C32771 for ; Wed, 28 Sep 2022 08:17:10 +0000 (UTC) Received: from localhost ([::1]:51228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSFf-0007AT-Hr for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:17:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLv-00014q-7n for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34885) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLt-0008Vd-7i for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+QLQjP6pIJ6eaMa4W1rUwBiMUhKhefteCR6Kw9OXt+w=; b=Ljf7DfrXPd0aS+T9CvLjq5rcyu3IpJm1alVpki1RsKfEJ/ZdDt9YLexoBXssCPlzycKydK 8wdGJ2OBFl2F1rQfe4wrzVO/K4YmE3ehmZ+gppNiQDQWh58RCKIWbKUlHvMUAz8tsiAnGG MeDKp/k9cs/r8kEheCVoJBhhDZntA3c= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-404-hy00STpMP3CfeXs0qu-zIQ-1; Wed, 28 Sep 2022 03:19:25 -0400 X-MC-Unique: hy00STpMP3CfeXs0qu-zIQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EF50029AB402; Wed, 28 Sep 2022 07:19:24 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F2D740C83C5; Wed, 28 Sep 2022 07:19:23 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 21/37] tests/qtest: libqtest: Exclude the *_fds APIs for win32 Date: Wed, 28 Sep 2022 09:18:27 +0200 Message-Id: <20220928071843.1468323-22-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 Message-Id: <20220925113032.1949844-35-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- 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 d8ffa0e7b1..5c4a509c58 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -592,17 +592,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) { @@ -611,6 +614,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) { @@ -620,6 +624,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, ...) { @@ -631,6 +636,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, ...) { @@ -1327,6 +1333,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; @@ -1346,6 +1353,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 Sep 28 07:18:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991793 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 88DFFC32771 for ; Wed, 28 Sep 2022 08:24:30 +0000 (UTC) Received: from localhost ([::1]:46198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSMn-00050Z-Ez for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:24:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLx-00015R-6g for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLv-0008Vz-IG for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349571; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KzE561aL0CLDS1WEU8W/QraRdzWpPvLgwlDfs/9CCGI=; b=dViwxZqUJ/WRDLdDFkPdT9rpmWbkmsdXZ7wkCjhCHKqlc/i3WkzHAPNzGcffMNKwbjLlRH vo6sHDFJT6HGPrIOm4XO70udtAyuU98D/Uc2BP/EuQYpYJ/bhYu2I6+1mOSnTC2T5xGyPK HSNRX0PmVCRKlC5K0uJWJzc2/4wfJ6A= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-438-58mFwwBGO0m4AeCS-ZjjLw-1; Wed, 28 Sep 2022 03:19:27 -0400 X-MC-Unique: 58mFwwBGO0m4AeCS-ZjjLw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C7D6F811E81; Wed, 28 Sep 2022 07:19:26 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F96240C83BB; Wed, 28 Sep 2022 07:19:25 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 22/37] tests/qtest: {ahci, ide}-test: Use relative path for temporary files for win32 Date: Wed, 28 Sep 2022 09:18:28 +0200 Message-Id: <20220928071843.1468323-23-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 Reviewed-by: Marc-André Lureau Reviewed-by: Thomas Huth Message-Id: <20220925113032.1949844-38-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/ahci-test.c | 21 ++++++++++++++++++--- tests/qtest/ide-test.c | 20 ++++++++++++++++++-- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index 1d5929d8c3..66652fed04 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -1833,7 +1833,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; @@ -1871,8 +1871,22 @@ 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 */ - fd = g_file_open_tmp("qtest.XXXXXX", &tmp_path, NULL); + tmp_path = g_strdup_printf("%s/qtest.XXXXXX", base); + fd = g_mkstemp(tmp_path); g_assert(fd >= 0); if (have_qemu_img()) { imgfmt = "qcow2"; @@ -1889,7 +1903,8 @@ int main(int argc, char **argv) close(fd); /* Create temporary blkdebug instructions */ - fd = g_file_open_tmp("qtest-blkdebug.XXXXXX", &debug_path, NULL); + debug_path = g_strdup_printf("%s/qtest-blkdebug.XXXXXX", base); + fd = g_mkstemp(debug_path); g_assert(fd >= 0); close(fd); diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index 25302be6dc..5e3e28aea2 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -1011,16 +1011,32 @@ 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 */ - fd = g_file_open_tmp("qtest-blkdebug.XXXXXX", &debug_path, NULL); + debug_path = g_strdup_printf("%s/qtest-blkdebug.XXXXXX", base); + fd = g_mkstemp(debug_path); g_assert(fd >= 0); close(fd); /* Create a temporary raw image */ - fd = g_file_open_tmp("qtest.XXXXXX", &tmp_path, NULL); + tmp_path = g_strdup_printf("%s/qtest.XXXXXX", base); + fd = g_mkstemp(tmp_path); g_assert(fd >= 0); ret = ftruncate(fd, TEST_IMAGE_SIZE); g_assert(ret == 0); From patchwork Wed Sep 28 07:18:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991841 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 12CC0C04A95 for ; Wed, 28 Sep 2022 08:43:00 +0000 (UTC) Received: from localhost ([::1]:56022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSeg-0000X3-MJ for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:42:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM2-00016E-W8 for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47976) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM1-000054-Dc for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349576; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CJhyWf8VOIPFc/8+4MV56CGViqzkStB9MarF3b5Sfoo=; b=Cto8fLMnzPHpiFyCJ9J3pQ06QgdpuRkuaN9C16Szgo+58eHJDbSjY0GcopqIKYj7KAmCZ7 fF0HyeN9lBje7It6Wg0HDnceUmb5R92IOEdNoIFbz4lZsfj9WxSJcDJZNOronxSoDA9QTi oyPVzqyzy2wo6nNNOE5jz6Mov13ClaU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-580-3iMRJNxPPwCX3uhxBoXjkQ-1; Wed, 28 Sep 2022 03:19:31 -0400 X-MC-Unique: 3iMRJNxPPwCX3uhxBoXjkQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E0CA0101A528; Wed, 28 Sep 2022 07:19:30 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38E0A40C83BB; Wed, 28 Sep 2022 07:19:26 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S . Tsirkin" Subject: [PULL 23/37] tests/qtest: bios-tables-test: Adapt the case for win32 Date: Wed, 28 Sep 2022 09:18:29 +0200 Message-Id: <20220928071843.1468323-24-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 Acked-by: Michael S. Tsirkin Message-Id: <20220925113032.1949844-39-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- 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 46a46fe0aa..2ebeb530b2 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 Sep 28 07:18:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991797 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 EF024C32771 for ; Wed, 28 Sep 2022 08:33:27 +0000 (UTC) Received: from localhost ([::1]:33434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSVR-0002nM-UC for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:33:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM1-000167-6t for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47590) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRLz-0008WR-Kv for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349575; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dnNF3FFScfyEYJiYD6u6YrdL/GDgiWdz4n2QFjmMin4=; b=eQaJ+WCrFc98eLUVthuztIDcfjFwnXIr4VBo8pISup3IVlJKh7npEXGo2ef3GjaFZAk36a epwPAGr8jVoJctifbX8l+xGBnaAgvsaauXKhGxOkxUvNlOvwYHWTmnCuw/zCqfFYH/miiL 4hwrBbiiQZQyOszj6TMSXtxl9mE6D4M= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-178-ZcYS1yirNBqhI7ciL10apA-1; Wed, 28 Sep 2022 03:19:32 -0400 X-MC-Unique: ZcYS1yirNBqhI7ciL10apA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 87E801C20AF0; Wed, 28 Sep 2022 07:19:32 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CFE340C83BB; Wed, 28 Sep 2022 07:19:31 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 24/37] tests/qtest: migration-test: Disable IO redirection for win32 Date: Wed, 28 Sep 2022 09:18:30 +0200 Message-Id: <20220928071843.1468323-25-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 don't bother adding IO redirection to the command line. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-40-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/migration-test.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 4728d528bb..3db1177377 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -647,7 +647,16 @@ static int test_migrate_start(QTestState **from, QTestState **to, } if (!getenv("QTEST_LOG") && args->hide_stderr) { +#ifndef _WIN32 ignore_stderr = "2>/dev/null"; +#else + /* + * On Windows the QEMU executable is created via CreateProcess() and + * IO redirection does not work, so don't bother adding IO redirection + * to the command line. + */ + ignore_stderr = ""; +#endif } else { ignore_stderr = ""; } From patchwork Wed Sep 28 07:18:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991875 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 E8A08C04A95 for ; Wed, 28 Sep 2022 08:58:15 +0000 (UTC) Received: from localhost ([::1]:51754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odStS-0004dK-21 for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:58:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM9-000190-Q3 for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48265) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM4-00005k-DV for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HI/VfznO4UQL0HIy+S9kEIJ2JLBmNqz4yZVlxkh6YTo=; b=a185CCzzTIt/zA7qSTGYU4629JhkI7uixlugrg63DZBurbEBJU0Zmj4jmNjpk+4p6jp9ep 4JvuaOQsNycUVcZlbfLPy+KOzyFDwF7zrwWcv0IKA6jUIcnGW+EUTgqdc6uVdLdjNlZUsS /mCgSW3vu/6pojApLYt/gMp1SpmSwg8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-640-uN94-AHnM32axM_88FVTHA-1; Wed, 28 Sep 2022 03:19:34 -0400 X-MC-Unique: uN94-AHnM32axM_88FVTHA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43ABB882821; Wed, 28 Sep 2022 07:19:34 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB67340C83BB; Wed, 28 Sep 2022 07:19:32 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 25/37] tests/qtest: ide-test: Open file in binary mode Date: Wed, 28 Sep 2022 09:18:31 +0200 Message-Id: <20220928071843.1468323-26-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-41-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/ide-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index 5e3e28aea2..4ea89c26c9 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 Sep 28 07:18:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991860 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 46C0CC32771 for ; Wed, 28 Sep 2022 08:51:32 +0000 (UTC) Received: from localhost ([::1]:41302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSmx-000773-7L for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:51:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM7-00018C-NS for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:22460) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM4-00005h-IT for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zSZoX2Io63krnoBhRHtWcDZ1L8thJgpeD+q7WPJ8WIM=; b=VQECap4FOq52OYvLeg7N/h8k1zxNELJfEjYTMl1Em7d8LTbqFfUDII37LID0Ga2e8ehBbu sDQrebnI3pmbOW9UtY+jP5pT+Xrf2IJ2NIk1OWuVfv0IKQ5bYEFamWnv64JAhzlOHIOVbT sVPq3E2nXAkXvUTA5aRBxiOWvBPhpso= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-655-UGA1zQrjMZuYVBP9Bx5DiQ-1; Wed, 28 Sep 2022 03:19:36 -0400 X-MC-Unique: UGA1zQrjMZuYVBP9Bx5DiQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CA2C5868A21; Wed, 28 Sep 2022 07:19:35 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8BC1940C83BB; Wed, 28 Sep 2022 07:19:34 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Xuzhou Cheng , Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 26/37] tests/qtest: virtio-net-failover: Disable migration tests for win32 Date: Wed, 28 Sep 2022 09:18:32 +0200 Message-Id: <20220928071843.1468323-27-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 Reviewed-by: Marc-André Lureau Message-Id: <20220925113032.1949844-42-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- 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 Sep 28 07:18:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991744 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 341BCC04A95 for ; Wed, 28 Sep 2022 08:11:21 +0000 (UTC) Received: from localhost ([::1]:34224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSA2-0004Hc-Gi for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:11:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM9-00018z-Pc for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:24654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM5-00005r-Kn for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wz+tV55f6JGd6+DT7U2gMJM8YM5pasl4rLidgPRaDtY=; b=UeIvCIMCeYHwPloXsrWgJAcaRpqabPcRglsohJcqxpqRlsrEM7PpYhnM838GaM0QlgjigU B0mCOdmcGuKYhC3PD9ePdDu6pKJtypfa/yIOq+xZj0bDQDwrkkVsw131a3DVU2VwW/z9t9 JHeLaabkCiNowph6R+Z5sFcdlOUBEq0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-657-T1xOSgiqO2O0zks2gkHaRg-1; Wed, 28 Sep 2022 03:19:37 -0400 X-MC-Unique: T1xOSgiqO2O0zks2gkHaRg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7CACF101CC67; Wed, 28 Sep 2022 07:19:37 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B65140C83BB; Wed, 28 Sep 2022 07:19:36 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 27/37] tests/qtest: microbit-test: Fix socket access for win32 Date: Wed, 28 Sep 2022 09:18:33 +0200 Message-Id: <20220928071843.1468323-28-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 Message-Id: <20220925113032.1949844-45-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- 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 Sep 28 07:18:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991893 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 47F37C04A95 for ; Wed, 28 Sep 2022 09:09:52 +0000 (UTC) Received: from localhost ([::1]:38878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odT4h-0002PM-8H for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:09:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM9-000193-RH for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM7-00006J-IY for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A6lylWEVzM1bPmim+OJ7MiExdxqOuyQXFQ8H5ZIwpYE=; b=YSOJDQ/n9R1EXUH4kuXXidUud+Q8Y7OfCuXRgMZHbtrpUjhXAsevTmhbihehZsp/+rhMKr XYxGx7JOYkCyk4E4SDtj5qZTrsJ2aG7vOTHKd1ifGzgg6kClewtj+ScGb8pmXe+Dpplv1B qR+ImpdOctKhCSYSXXK5ycl3kbJavKc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-44-LvCET8oXONinA3mJnp2hQw-1; Wed, 28 Sep 2022 03:19:39 -0400 X-MC-Unique: LvCET8oXONinA3mJnp2hQw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2B0F882822; Wed, 28 Sep 2022 07:19:38 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id D65E040C83BB; Wed, 28 Sep 2022 07:19:37 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 28/37] tests/qtest: libqtest: Replace the call to close a socket with closesocket() Date: Wed, 28 Sep 2022 09:18:34 +0200 Message-Id: <20220928071843.1468323-29-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 Message-Id: <20220925113032.1949844-46-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- 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 5c4a509c58..4f4b2d6477 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -97,7 +97,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; } @@ -108,7 +108,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; } @@ -421,8 +421,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 Sep 28 07:18:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991740 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 6158FC32771 for ; Wed, 28 Sep 2022 07:58:18 +0000 (UTC) Received: from localhost ([::1]:34478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odRxP-000674-Cv for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 03:58:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM9-000192-Qt for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:41678) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM7-00006G-Fd for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FqK53HiLqubGe4i5AWK6z/x4b/Cp9RLfAtOKktGCY0U=; b=RsJiiR7jFsIOPC+SvTDS3MYCWXC0ETE4xtuFIUrfFLbnLBfzxskBpCA3UxjDe0znxc8PMz 7YO0kv5MwjCgh8bNVBapsdE+gxtX05u7co3kb/msG71oqMeQLP0p+evX0TlqI5izqvum81 8JPGOmOPLmnfPp+YPYoIJzjm0HN6cE8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-607-UcX4zyptMTe3hDRUgN8bjA-1; Wed, 28 Sep 2022 03:19:41 -0400 X-MC-Unique: UcX4zyptMTe3hDRUgN8bjA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7985811E67; Wed, 28 Sep 2022 07:19:40 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id E659B40C83BB; Wed, 28 Sep 2022 07:19:39 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng Subject: [PULL 29/37] tests/qtest: migration-test: Skip running some TLS cases for win32 Date: Wed, 28 Sep 2022 09:18:35 +0200 Message-Id: <20220928071843.1468323-30-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 migration test cases use TLS to communicate, but they fail on Windows with the following error messages: qemu-system-x86_64: TLS handshake failed: Insufficient credentials for that request. qemu-system-x86_64: TLS handshake failed: Error in the pull function. query-migrate shows failed migration: TLS handshake failed: Error in the pull function. Disable them temporarily. Signed-off-by: Bin Meng Message-Id: <20220925113032.1949844-51-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/migration-test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 3db1177377..0d153d6b5e 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1402,6 +1402,7 @@ static void test_precopy_unix_dirty_ring(void) } #ifdef CONFIG_GNUTLS +#ifndef _WIN32 static void test_precopy_unix_tls_psk(void) { g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); @@ -1414,6 +1415,7 @@ static void test_precopy_unix_tls_psk(void) test_precopy_common(&args); } +#endif /* _WIN32 */ #ifdef CONFIG_TASN1 static void test_precopy_unix_tls_x509_default_host(void) @@ -1522,6 +1524,7 @@ static void test_precopy_tcp_plain(void) } #ifdef CONFIG_GNUTLS +#ifndef _WIN32 static void test_precopy_tcp_tls_psk_match(void) { MigrateCommon args = { @@ -1532,6 +1535,7 @@ static void test_precopy_tcp_tls_psk_match(void) test_precopy_common(&args); } +#endif /* _WIN32 */ static void test_precopy_tcp_tls_psk_mismatch(void) { @@ -1929,6 +1933,7 @@ static void test_multifd_tcp_zstd(void) #endif #ifdef CONFIG_GNUTLS +#ifndef _WIN32 static void * test_migrate_multifd_tcp_tls_psk_start_match(QTestState *from, QTestState *to) @@ -1936,6 +1941,7 @@ test_migrate_multifd_tcp_tls_psk_start_match(QTestState *from, test_migrate_precopy_tcp_multifd_start_common(from, to, "none"); return test_migrate_tls_psk_start_match(from, to); } +#endif /* _WIN32 */ static void * test_migrate_multifd_tcp_tls_psk_start_mismatch(QTestState *from, @@ -1987,6 +1993,7 @@ test_migrate_multifd_tls_x509_start_reject_anon_client(QTestState *from, } #endif /* CONFIG_TASN1 */ +#ifndef _WIN32 static void test_multifd_tcp_tls_psk_match(void) { MigrateCommon args = { @@ -1996,6 +2003,7 @@ static void test_multifd_tcp_tls_psk_match(void) }; test_precopy_common(&args); } +#endif /* _WIN32 */ static void test_multifd_tcp_tls_psk_mismatch(void) { @@ -2492,8 +2500,10 @@ int main(int argc, char **argv) qtest_add_func("/migration/precopy/unix/plain", test_precopy_unix_plain); qtest_add_func("/migration/precopy/unix/xbzrle", test_precopy_unix_xbzrle); #ifdef CONFIG_GNUTLS +#ifndef _WIN32 qtest_add_func("/migration/precopy/unix/tls/psk", test_precopy_unix_tls_psk); +#endif if (has_uffd) { /* @@ -2519,8 +2529,10 @@ int main(int argc, char **argv) qtest_add_func("/migration/precopy/tcp/plain", test_precopy_tcp_plain); #ifdef CONFIG_GNUTLS +#ifndef _WIN32 qtest_add_func("/migration/precopy/tcp/tls/psk/match", test_precopy_tcp_tls_psk_match); +#endif qtest_add_func("/migration/precopy/tcp/tls/psk/mismatch", test_precopy_tcp_tls_psk_mismatch); #ifdef CONFIG_TASN1 @@ -2564,8 +2576,10 @@ int main(int argc, char **argv) test_multifd_tcp_zstd); #endif #ifdef CONFIG_GNUTLS +#ifndef _WIN32 qtest_add_func("/migration/multifd/tcp/tls/psk/match", test_multifd_tcp_tls_psk_match); +#endif qtest_add_func("/migration/multifd/tcp/tls/psk/mismatch", test_multifd_tcp_tls_psk_mismatch); #ifdef CONFIG_TASN1 From patchwork Wed Sep 28 07:18:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991791 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 B0DF8C04A95 for ; Wed, 28 Sep 2022 08:21:42 +0000 (UTC) Received: from localhost ([::1]:38118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odSK5-00026D-BW for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 04:21:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRMA-000194-Uq for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:31762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRM9-00006Z-Gi for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1qXEcD/SBKEsuw/jUzKcn9WAGw4NyQ3oIjID60bGZ+8=; b=Zn6N9PLJTPKlOPbACT5ieSWMBpJjKGL40I6qxHwzDvxy4WtlODs5lQFlWVkvc7cD3l3utL TDvur9ZkPua3wA015LQPuW2cFjEjJOPanTQ6Nari1cPBWlCg44D+YezvyV2YUb2vKGk00I 961Yss6WfQBK56Jrg/KJK8srbuz+2Lw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-367-qTW14VzPMB-u2DsRt_MU7A-1; Wed, 28 Sep 2022 03:19:42 -0400 X-MC-Unique: qTW14VzPMB-u2DsRt_MU7A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C7F31185A794; Wed, 28 Sep 2022 07:19:41 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE7FE40C83BB; Wed, 28 Sep 2022 07:19:40 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng Subject: [PULL 30/37] .gitlab-ci.d/windows.yml: Display meson test logs Date: Wed, 28 Sep 2022 09:18:36 +0200 Message-Id: <20220928071843.1468323-31-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 CI fails we don't know what causes the failure. Displaying the meson test logs can be helpful. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth Message-Id: <20220925113032.1949844-53-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- .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 86a4339c48..ba59844d12 100644 --- a/.gitlab-ci.d/windows.yml +++ b/.gitlab-ci.d/windows.yml @@ -61,7 +61,7 @@ msys2-64bit: - .\msys64\usr\bin\bash -lc './configure --target-list=x86_64-softmmu --enable-capstone --without-default-devices' - .\msys64\usr\bin\bash -lc 'make' - - .\msys64\usr\bin\bash -lc 'make check' + - .\msys64\usr\bin\bash -lc 'make check || { cat build/meson-logs/testlog.txt; exit 1; } ;' msys2-32bit: extends: .shared_msys2_builder @@ -94,4 +94,4 @@ msys2-32bit: - cd output - ..\msys64\usr\bin\bash -lc "../configure --target-list=ppc64-softmmu" - ..\msys64\usr\bin\bash -lc 'make' - - ..\msys64\usr\bin\bash -lc 'make check' + - ..\msys64\usr\bin\bash -lc 'make check || { cat meson-logs/testlog.txt; exit 1; } ;' From patchwork Wed Sep 28 07:18:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991901 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 A0DBFC6FA90 for ; Wed, 28 Sep 2022 09:15:09 +0000 (UTC) Received: from localhost ([::1]:47096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odT9o-0007ur-Ja for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:15:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRME-0001B5-Js for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:28691) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRMB-00007L-Fg for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349586; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8AxJNbrXnXM74YtdDwjHtrcpQnMCAsAxLyt81poLNuY=; b=F+Re9L3/mYHFCWIn1vdkRd6ge5dBNo758hsnSbOLF6J4zV/0ZJ0DaygkMj8cFfvVxVrVvL VXianItJ8wxgxAWyJJ8RO7VoiMVkmWFXkf9TDlBfXIMlA7mU1qMfrqHYi3zJaEZzon7RVJ VBIaYmAslRUU8lILpqrtgdwlWJvInJw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-82-EWKPv9FzOHu8VfGKMXVKUQ-1; Wed, 28 Sep 2022 03:19:43 -0400 X-MC-Unique: EWKPv9FzOHu8VfGKMXVKUQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A42B857FAB; Wed, 28 Sep 2022 07:19:43 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21E3340C83BB; Wed, 28 Sep 2022 07:19:41 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Michael Labiuk Subject: [PULL 31/37] tests/x86: Move common code to function in device-plug-test Date: Wed, 28 Sep 2022 09:18:37 +0200 Message-Id: <20220928071843.1468323-32-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: Michael Labiuk Move common code for device removing to function. Signed-off-by: Michael Labiuk Message-Id: <20220920104842.605530-2-michael.labiuk@virtuozzo.com> Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- tests/qtest/device-plug-test.c | 42 ++++++++++++++-------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index a1fb99c8ff..e595b45b66 100644 --- a/tests/qtest/device-plug-test.c +++ b/tests/qtest/device-plug-test.c @@ -61,6 +61,18 @@ static void wait_device_deleted_event(QTestState *qtest, const char *id) } } +static void process_device_remove(QTestState *qtest, const char *id) +{ + /* + * Request device removal. As the guest is not running, the request won't + * be processed. However during system reset, the removal will be + * handled, removing the device. + */ + device_del(qtest, id); + system_reset(qtest); + wait_device_deleted_event(qtest, id); +} + static void test_pci_unplug_request(void) { const char *arch = qtest_get_arch(); @@ -73,14 +85,7 @@ static void test_pci_unplug_request(void) QTestState *qtest = qtest_initf("%s -device virtio-mouse-pci,id=dev0", machine_addition); - /* - * Request device removal. As the guest is not running, the request won't - * be processed. However during system reset, the removal will be - * handled, removing the device. - */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); qtest_quit(qtest); } @@ -98,14 +103,7 @@ static void test_pci_unplug_json_request(void) "%s -device \"{'driver': 'virtio-mouse-pci', 'id': 'dev0'}\"", machine_addition); - /* - * Request device removal. As the guest is not running, the request won't - * be processed. However during system reset, the removal will be - * handled, removing the device. - */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); qtest_quit(qtest); } @@ -128,9 +126,7 @@ static void test_spapr_cpu_unplug_request(void) "-device power9_v2.0-spapr-cpu-core,core-id=1,id=dev0"); /* similar to test_pci_unplug_request */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); qtest_quit(qtest); } @@ -144,9 +140,7 @@ static void test_spapr_memory_unplug_request(void) "-device pc-dimm,id=dev0,memdev=mem0"); /* similar to test_pci_unplug_request */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); qtest_quit(qtest); } @@ -158,9 +152,7 @@ static void test_spapr_phb_unplug_request(void) qtest = qtest_initf("-device spapr-pci-host-bridge,index=1,id=dev0"); /* similar to test_pci_unplug_request */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); qtest_quit(qtest); } From patchwork Wed Sep 28 07:18:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991902 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 2E096C32771 for ; Wed, 28 Sep 2022 09:16:35 +0000 (UTC) Received: from localhost ([::1]:39922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTBC-0008J7-0o for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:16:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRME-0001Av-IY for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:24155) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRMB-00007D-Fb for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349586; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C766JYsfMX7Nzr3hwAlukL4TK2ArgI7v4YmcFnFKGOA=; b=RAR/6G+oEKrVkuVg8E+9+Z67EyUZFiGAhFTbJuCcqIEsSEeD4qvF6aWLu7K6Bx4tswl0E5 o5ZokcqspkDiQz/RO1R1IwZT/k4eYT/B1clB5ONRtAYvZzmO2Gu58/UFPsr/8izlrHCBDl 2mLcxI3QY+DzFlZ85hcsU1CaVoIwyRE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-511-trs4QZTSMl64dZVfFx9llQ-1; Wed, 28 Sep 2022 03:19:44 -0400 X-MC-Unique: trs4QZTSMl64dZVfFx9llQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 49101185A79C; Wed, 28 Sep 2022 07:19:44 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64F7D40C83BB; Wed, 28 Sep 2022 07:19:43 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng Subject: [PULL 32/37] tests/qtest: hd-geo-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:38 +0200 Message-Id: <20220928071843.1468323-33-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Message-Id: <20220927110632.1973965-13-bmeng.cn@gmail.com> Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- tests/qtest/hd-geo-test.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index 413cf964c0..ba772f4d7a 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -27,16 +27,16 @@ static char *create_test_img(int secs) { - char *template = strdup("/tmp/qtest.XXXXXX"); + char *template; int fd, ret; - fd = mkstemp(template); + fd = g_file_open_tmp("qtest.XXXXXX", &template, NULL); g_assert(fd >= 0); ret = ftruncate(fd, (off_t)secs * 512); close(fd); if (ret) { - free(template); + g_free(template); template = NULL; } @@ -422,9 +422,8 @@ 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"; - char *raw_path = strdup(template); - char *qcow2_path = strdup(template); + g_autofree char *raw_path = NULL; + char *qcow2_path; char cmd[100 + 2 * PATH_MAX]; uint8_t buf[512] = {}; int i, ret, fd, offset; @@ -468,7 +467,7 @@ static char *create_qcow2_with_mbr(MBRpartitions mbr, uint64_t sectors) offset += 0x10; } - fd = mkstemp(raw_path); + fd = g_file_open_tmp("qtest.XXXXXX", &raw_path, NULL); g_assert(fd >= 0); close(fd); @@ -478,7 +477,7 @@ static char *create_qcow2_with_mbr(MBRpartitions mbr, uint64_t sectors) g_assert(ret == sizeof(buf)); close(fd); - fd = mkstemp(qcow2_path); + fd = g_file_open_tmp("qtest.XXXXXX", &qcow2_path, NULL); g_assert(fd >= 0); close(fd); @@ -506,7 +505,6 @@ static char *create_qcow2_with_mbr(MBRpartitions mbr, uint64_t sectors) free(qemu_img_abs_path); unlink(raw_path); - free(raw_path); return qcow2_path; } @@ -714,7 +712,7 @@ static void test_override(TestArgs *args, CHSResult expected[]) for (i = 0; i < args->n_drives; i++) { unlink(args->drives[i]); - free(args->drives[i]); + g_free(args->drives[i]); } g_free(args->drives); g_strfreev(args->argv); @@ -867,7 +865,7 @@ static void test_override_scsi_hot_unplug(void) for (i = 0; i < args->n_drives; i++) { unlink(args->drives[i]); - free(args->drives[i]); + g_free(args->drives[i]); } g_free(args->drives); g_strfreev(args->argv); @@ -927,7 +925,7 @@ static void test_override_virtio_hot_unplug(void) for (i = 0; i < args->n_drives; i++) { unlink(args->drives[i]); - free(args->drives[i]); + g_free(args->drives[i]); } g_free(args->drives); g_strfreev(args->argv); @@ -987,7 +985,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]); } } From patchwork Wed Sep 28 07:18:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991956 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 D2268C32771 for ; Wed, 28 Sep 2022 09:32:06 +0000 (UTC) Received: from localhost ([::1]:51170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTQD-00044a-SM for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:32:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRMF-0001Bz-RT for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58577) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRME-00007a-5V for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x9a/iLkvV9nX/Z9hqOhap4cH95/5W49ebk7XBIO4w1A=; b=EzT/OBPKWyXdTRAtc7gmzbQMCHCjkoXwc0HjP+dUeEM4hkKR6WUwAjak4BiYRo5B7Wxwup rBgNe0uTpbv5KoacQMouo61e9+7bJSHzISYLI3d88wbR29XXWl8jcXx9SbnWhifmKzY9Fw nu/+7EwuCLJ9tC49Coo1yhvf9hyCkyU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-161-sXvwVTk-NQKz_Kzk6VMZgw-1; Wed, 28 Sep 2022 03:19:46 -0400 X-MC-Unique: sXvwVTk-NQKz_Kzk6VMZgw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4A311882820; Wed, 28 Sep 2022 07:19:46 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03BDE40C83BB; Wed, 28 Sep 2022 07:19:44 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 33/37] tests/qtest: pflash-cfi02-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:39 +0200 Message-Id: <20220928071843.1468323-34-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Message-Id: <20220927110632.1973965-16-bmeng.cn@gmail.com> Reviewed-by: Marc-André Lureau Signed-off-by: Thomas Huth --- tests/qtest/pflash-cfi02-test.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/qtest/pflash-cfi02-test.c b/tests/qtest/pflash-cfi02-test.c index 7fce614b64..0b52c2ca5c 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,14 @@ static const FlashConfig configuration[] = { int main(int argc, char **argv) { - int fd = mkstemp(image_path); - if (fd == -1) { - g_printerr("Failed to create temporary file %s: %s\n", image_path, - strerror(errno)); - exit(EXIT_FAILURE); - } + GError *err = NULL; + int fd = g_file_open_tmp("qtest.XXXXXX", &image_path, &err); + g_assert_no_error(err); + 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); From patchwork Wed Sep 28 07:18:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12991937 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 3823CC32771 for ; Wed, 28 Sep 2022 09:25:44 +0000 (UTC) Received: from localhost ([::1]:39410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTK3-0006Z4-7z for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:25:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRMF-0001By-On for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:24244) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRME-00008q-6f for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349589; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IkPb1wyoRfWJVk/j9+EPkP7duMGO4u4DTcVAUzqzg+Y=; b=DHQOwvaloiqihCWJe6Mf1BSL+Aa6FM7A9n3b/NsbpUPAUtOh5O7BebHGuuJyUixm1xjfJN YjlL8YeyRu7bFhEdruyN93dDvS0qxH+lqFh28q7yxsZ7sjBXdqTTOamcuCEXhQF5zlJhqN QWbj5QrnGY1bN6FyC2SLbXY8urqmlus= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-poBs2slVPj2q_4rcxveRig-1; Wed, 28 Sep 2022 03:19:48 -0400 X-MC-Unique: poBs2slVPj2q_4rcxveRig-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A8E0E882820; Wed, 28 Sep 2022 07:19:47 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94D1440C83BB; Wed, 28 Sep 2022 07:19:46 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 34/37] tests/qtest: qmp-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:40 +0200 Message-Id: <20220928071843.1468323-35-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_dir_make_tmp() for a portable implementation. Signed-off-by: Bin Meng Message-Id: <20220927110632.1973965-17-bmeng.cn@gmail.com> Reviewed-by: Marc-André Lureau Signed-off-by: Thomas Huth --- tests/qtest/qmp-test.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c index 23b2a37942..22957fa49c 100644 --- a/tests/qtest/qmp-test.c +++ b/tests/qtest/qmp-test.c @@ -163,14 +163,15 @@ 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) { - if (!g_mkdtemp(tmpdir)) { - g_error("g_mkdtemp: %s", strerror(errno)); - } + GError *err = NULL; + tmpdir = g_dir_make_tmp("qmp-test-XXXXXX", &err); + g_assert_no_error(err); + fifo_name = g_strdup_printf("%s/fifo", tmpdir); if (mkfifo(fifo_name, 0666)) { g_error("mkfifo: %s", strerror(errno)); @@ -181,6 +182,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) From patchwork Wed Sep 28 07:18:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12992040 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 7DBE4C32771 for ; Wed, 28 Sep 2022 09:59:12 +0000 (UTC) Received: from localhost ([::1]:51464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTqR-0004c3-CE for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:59:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRMI-0001D5-FI for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50969) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRMG-00009T-U4 for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+GVsz4o/JuBb4gzbbJxB/v0brom9e0El5e5/9SiPkBE=; b=cUxxz+cS5ruB8ktPVt5SJF5v2WLNwQW0VQtbr5vY6pAV8Tcgi/dDAkEd0Jew9Q/TGAxfow V5nsVMDKfQnz605LI+HtOAMWVNnWdxR6Ud37PkKKw/jc381CKLX3917lnChpMdyecnv4yj gv8EHUwCVGkGC6WU8Ko5McIp0HKqzGY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-350-cvlKrjxPMOqPs573w3Tv0A-1; Wed, 28 Sep 2022 03:19:49 -0400 X-MC-Unique: cvlKrjxPMOqPs573w3Tv0A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 52D3A857FB0; Wed, 28 Sep 2022 07:19:49 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1BA6240C83BB; Wed, 28 Sep 2022 07:19:47 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 35/37] tests/qtest: vhost-user-test: Avoid using hardcoded /tmp Date: Wed, 28 Sep 2022 09:18:41 +0200 Message-Id: <20220928071843.1468323-36-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This case was written to use hardcoded /tmp directory for temporary files. Update to use g_dir_make_tmp() for a portable implementation. Signed-off-by: Bin Meng Message-Id: <20220927110632.1973965-19-bmeng.cn@gmail.com> Reviewed-by: Marc-André Lureau Signed-off-by: Thomas Huth --- tests/qtest/vhost-user-test.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index d7d6cfc9bd..84498941a6 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -482,8 +482,8 @@ 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"; - const char *tmpfs; + g_autofree const char *tmpfs = NULL; + GError *err = NULL; server->context = g_main_context_new(); server->loop = g_main_loop_new(server->context, FALSE); @@ -491,9 +491,11 @@ 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 = g_mkdtemp(template); + tmpfs = g_dir_make_tmp("vhost-test-XXXXXX", &err); if (!tmpfs) { - g_test_message("g_mkdtemp on path (%s): %s", template, strerror(errno)); + g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs, + err->message); + g_error_free(err); } g_assert(tmpfs); From patchwork Wed Sep 28 07:18:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12992037 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 862EFC04A95 for ; Wed, 28 Sep 2022 09:53:23 +0000 (UTC) Received: from localhost ([::1]:52348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTko-0008HL-IR for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:53:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRMN-0001EM-Ga for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRML-0000A0-KR for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349597; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B+IC1umu97akBFliso5U2R0JE92XccKU7LWEx4ShM7M=; b=cUxNJ45se8Ivfe+Y0kVLwNdp9E0kRcs9fEhxw9AC+Xxj+06DniOmUExD66pynLuRYaJiBc im5IUl1ja5gMttVUrGV448n3t4Z5fNA9Fw5C1rldpvW/XD2v9ZzfMJ3AkIxf8c0KrJ0PzN +ZVnUWTsumq2t+qkJaw6aHi/zZRdvfI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-204-ZqrNtnSGNRSVAfKPDrJiZQ-1; Wed, 28 Sep 2022 03:19:51 -0400 X-MC-Unique: ZqrNtnSGNRSVAfKPDrJiZQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0A897185A7A3; Wed, 28 Sep 2022 07:19:51 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id E791240C83BB; Wed, 28 Sep 2022 07:19:49 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 36/37] tests/qtest: boot-serial-test: Close the serial file before starting QEMU Date: Wed, 28 Sep 2022 09:18:42 +0200 Message-Id: <20220928071843.1468323-37-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 This qtest executable created a serial chardev file to be passed to the QEMU executable. The serial file was created by g_file_open_tmp(), which internally opens the file with FILE_SHARE_WRITE security attribute on Windows. Based on [1], there is only one case that allows the first call to CreateFile() with GENERIC_READ & FILE_SHARE_WRITE, and second call to CreateFile() with GENERIC_WRITE & FILE_SHARE_READ. All other combinations require FILE_SHARE_WRITE in the second call. But there is no way for the second call (in this case the QEMU executable) to know what combination was passed to the first call, unless FILE_SHARE_WRITE is passed to the second call. Two processes shouldn't share the same file for writing with a chardev. Let's close the serial file before starting QEMU. [1] https://docs.microsoft.com/en-us/windows/win32/fileio/creating-and-opening-files Signed-off-by: Bin Meng Message-Id: <20220927110632.1973965-40-bmeng.cn@gmail.com> Reviewed-by: Marc-André Lureau Signed-off-by: Thomas Huth --- tests/qtest/boot-serial-test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c index 72310ba30e..b216519b62 100644 --- a/tests/qtest/boot-serial-test.c +++ b/tests/qtest/boot-serial-test.c @@ -233,6 +233,7 @@ static void test_machine(const void *data) ser_fd = g_file_open_tmp("qtest-boot-serial-sXXXXXX", &serialtmp, NULL); g_assert(ser_fd != -1); + close(ser_fd); if (test->kernel) { code = test->kernel; @@ -266,6 +267,8 @@ static void test_machine(const void *data) unlink(codetmp); } + ser_fd = open(serialtmp, O_RDONLY); + g_assert(ser_fd != -1); if (!check_guest_output(qts, test, ser_fd)) { g_error("Failed to find expected string. Please check '%s'", serialtmp); From patchwork Wed Sep 28 07:18:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12992011 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 3E165C32771 for ; Wed, 28 Sep 2022 09:42:53 +0000 (UTC) Received: from localhost ([::1]:50848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTaZ-00029a-Uz for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:42:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRMM-0001EK-Ig for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45107) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odRMK-00009u-SD for qemu-devel@nongnu.org; Wed, 28 Sep 2022 03:19:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664349596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Hra87o8UVtUzNTwCxIUYrCnAaY3HBPraaZ79GxQLksQ=; b=R+xNVcCuf7wcbEHSkeq6KR2PoUSg6rWG1mrFV3ZT8TB+W622ivYrLs5Roc0/2G6v9Ye/A2 Ho3TiI7Ik2KwGNJ5AqMuAAdbEwh+6/E6iGK8aGup8lMrF/l2CKM5jm0lZV2B2lREcVGAdr aKI8QwS6WAd5oiNH7twSBjsknrpTVac= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-TySussQ1MRumGaL5z-6HcA-1; Wed, 28 Sep 2022 03:19:52 -0400 X-MC-Unique: TySussQ1MRumGaL5z-6HcA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43770811E87; Wed, 28 Sep 2022 07:19:52 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EDD440C83BB; Wed, 28 Sep 2022 07:19:51 +0000 (UTC) From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 37/37] docs/devel: testing: Document writing portable test cases Date: Wed, 28 Sep 2022 09:18:43 +0200 Message-Id: <20220928071843.1468323-38-thuth@redhat.com> In-Reply-To: <20220928071843.1468323-1-thuth@redhat.com> References: <20220928071843.1468323-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 Message-Id: <20220927110632.1973965-55-bmeng.cn@gmail.com> Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- docs/devel/testing.rst | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index aea5b42356..fbb98faabe 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -81,6 +81,36 @@ QTest cases can be executed with make check-qtest +Writing portable test cases +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Both unit tests and qtests can run on POSIX hosts as well as Windows hosts. +Care must be taken when writing portable test cases that can be built and run +successfully on various hosts. The following list shows some best practices: + +* Use portable APIs from glib whenever necessary, e.g.: g_setenv(), + g_mkdtemp(), g_mkdir(). +* 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 delimiter ":" 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. + QAPI schema tests ~~~~~~~~~~~~~~~~~