From patchwork Thu Oct 6 15:19:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=VUkaCOFr; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mjx021F3Qz1yqn for ; Fri, 7 Oct 2022 02:57:05 +1100 (AEDT) Received: from localhost ([::1]:60708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTF9-0007LA-MC for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 11:57:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSey-0003x0-Lb for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:41 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:42646) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSex-0005yR-8J for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:40 -0400 Received: by mail-pj1-x1032.google.com with SMTP id l1-20020a17090a72c100b0020a6949a66aso2083292pjk.1 for ; Thu, 06 Oct 2022 08:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RLZhLFQlc54ZoIwBF61gB7xfiWSNWDubi3/EBtm1pD4=; b=VUkaCOFrL64mmvI6wCYhS3tgfZFNaHj+Od66k1dPEhrG8O3VU/UkZNX/bjN4ULIQTR 7sNV+mjFMaH+/+PTvXqjlAWu7gxNbHJq/pMvnqLmCKuAuwTbu6iCIk8KGWh4X1qGbleH tooNbDWXtj+toafiXkM6/T8W8O5t/tJRi63eUOf7UQDmUBr+OTVD1BVd7cmHdPeKgmQH lbY6BDvG0tLhji92dtkc2if9FaDnN0gRLthK0uVxA1qcTt4pU/He0sA7Z7iMAXo4ewPn PH3xQmUkDfoj35UF++eXxkvpIl82FMB9qvc4wX1V8HT//Zkgo0ZwZInKPJzdr/UVJjch N4Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RLZhLFQlc54ZoIwBF61gB7xfiWSNWDubi3/EBtm1pD4=; b=WcJQHFmXdOgYxtsUQk6KzYsMGNxGSYxI4bfRpTxIldeFDldYXuGfuL4RKQ8jBN5Bat 9vqVCVFIuw4TSLNSWwpb+K9O/Cv6O7WRXBIPh/ApOXFxJlaIoyfNRHSNmLkSPbntSCts caHxXuT5rPnFy6PwjQbAH/+OG61X7rCODRT08Z/wKC0A8p38WRsS5o7WEHqLS5BWw21P 5rXBJlenHB6czC+Cc7drXQ6JSArtytDvQJwlhF/Qk1gaPBh0AVK20WnURUdFZfJxOjt4 e5QeiXuQz+vTIw/qwiP8vjYAzQ8MpkHpVTJEuTyiq0oRQd7nA6cF1sjEtIwC4CugWzyj 0ozg== X-Gm-Message-State: ACrzQf3lvYZOdqAyK2Z4Pw9xvGvtCF0397qt9aLgRtZdIM4UAXQX5LCI vW3qytL4wdI8MTdusHAiFta2UgeO/R8= X-Google-Smtp-Source: AMsMyM401s11T3tTndWbGxt3INQYKzosx24pYskaXjTx9LqzKxYaoz6efeYUjL6BnDvr5hBIBjJp3Q== X-Received: by 2002:a17:90b:4d0d:b0:1fb:a86d:e752 with SMTP id mw13-20020a17090b4d0d00b001fba86de752mr248187pjb.120.1665069577742; Thu, 06 Oct 2022 08:19:37 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:19:37 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v5 01/18] semihosting/arm-compat-semi: Avoid using hardcoded /tmp Date: Thu, 6 Oct 2022 23:19:10 +0800 Message-Id: <20221006151927.2079583-2-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Use g_get_tmp_dir() to get the directory to use for temporary files. Signed-off-by: Bin Meng Reviewed-by: Alex Bennée --- (no changes since v1) semihosting/arm-compat-semi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index bfea9e9337..62d8bae97f 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -503,7 +503,8 @@ void do_common_semihosting(CPUState *cs) GET_ARG(0); GET_ARG(1); GET_ARG(2); - len = asprintf(&s, "/tmp/qemu-%x%02x", getpid(), (int)arg1 & 0xff); + len = asprintf(&s, "%s/qemu-%x%02x", g_get_tmp_dir(), + getpid(), (int)arg1 & 0xff); if (len < 0) { common_semi_set_ret(cs, -1); break; From patchwork Thu Oct 6 15:19:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=dN7nKpeJ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MjwxZ13xbz20Pd for ; Fri, 7 Oct 2022 02:54:58 +1100 (AEDT) Received: from localhost ([::1]:40504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTD5-0003iy-Md for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 11:54:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSf2-0003yo-VX for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:48 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:34771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSf0-0005yg-FL for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:44 -0400 Received: by mail-pl1-x62a.google.com with SMTP id n7so2028714plp.1 for ; Thu, 06 Oct 2022 08:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Gs5GKe8FO5KCXA2mO1WuiuwajzHIA5xIM/tzyVScXS0=; b=dN7nKpeJIdM8NBYJnNQM+pRuLA5C81zn9FdLb7lSdBumFHWbSPUVDZE84IGQfve+CD JUY7G2KmBt4Byba3QbyJ1Ip+OxloH3R1z1X/CTFFD1GFo5Bz+25M2TXaInb1UwqAlErd yqGQi1h55t0cxhi98ZoD0cyYOsw8QLjFgXSY0GSUu3SbUmM4pPcVNN+0Vq0YyLL/hvIY iJnY3Ot8VwcFHTyiDHZUXWr/97ySMDi3yTJHGo61IcxOGKHJh3sAZ+OdLNASin71xENN 6+dQSgamAh1n8A4MsAN/6RPHWcW8SB4GIpe94NEoJTqCNRwsLJ5DTL19+Oj+3HtPGmgl 27tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gs5GKe8FO5KCXA2mO1WuiuwajzHIA5xIM/tzyVScXS0=; b=wQDEkkdyDSmz4LHheXN7y9fSeemEd5XN532P/uF3bzGD3mOsI1drMJCKUSkCbLIAlH z3GZGAenKYClyhTKAKJ0XmiA03ZMrqf5aCjxKQ5kA9Vj6VxOe3qJeyl/Mp+1KxDfEcMt XTGy1ycoLWN266QI1BOUfKLR9+U6KpR7wFrq165fZPqJg9UsdkResCsQx8V+Tji+2Xc0 Rr/17YInG5bJn0/hdvRM8jb+HB8zH/hhvpklaTQRiSdPcITqQK4QM1Nkw0SlWQAksbp2 xjpL+AxcGNL17Rb+BY+sLhU0BTlgd63DhgBbc9aJw1jxUnCsO5/pX2zNypC0+szSXVm5 NGqA== X-Gm-Message-State: ACrzQf1iTsD2c58W60TCa6XCETdku7AY9T/K3bIpotStdqEVQwv3phDz 5NSEUzAfZV4rxIjKzdwZBYjDYLUZnjc= X-Google-Smtp-Source: AMsMyM7F1/efsc87zTIZmrbQ8YCKGUBE65czdNmKWVNVZCX6eXsT+kju9ZNiSgClXxIGqKBffeYOEQ== X-Received: by 2002:a17:902:e742:b0:17f:6a44:ee4a with SMTP id p2-20020a170902e74200b0017f6a44ee4amr5229310plf.103.1665069580070; Thu, 06 Oct 2022 08:19:40 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.19.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:19:39 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v5 02/18] tcg: Avoid using hardcoded /tmp Date: Thu, 6 Oct 2022 23:19:11 +0800 Message-Id: <20221006151927.2079583-3-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Use g_get_tmp_dir() to get the directory to use for temporary files. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Reviewed-by: Alex Bennée --- (no changes since v2) Changes in v2: - Use g_autofree to declare the variable tcg/tcg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 612a12f58f..84921b64f7 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -4729,7 +4729,8 @@ static void tcg_register_jit_int(const void *buf_ptr, size_t buf_size, /* Enable this block to be able to debug the ELF image file creation. One can use readelf, objdump, or other inspection utilities. */ { - FILE *f = fopen("/tmp/qemu.jit", "w+b"); + g_autofree char *jit = g_strdup_printf("%s/qemu.jit", g_get_tmp_dir()); + FILE *f = fopen(jit, "w+b"); if (f) { if (fwrite(img, img_size, 1, f) != img_size) { /* Avoid stupid unused return value warning for fwrite. */ From patchwork Thu Oct 6 15:19:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=ZhwhknIG; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mjx9r18WDz20Pd for ; Fri, 7 Oct 2022 03:05:34 +1100 (AEDT) Received: from localhost ([::1]:34536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTNL-0005Pf-5N for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:05:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSf5-0003yr-1Z for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:50 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:43565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSf1-0005yn-P4 for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:45 -0400 Received: by mail-pl1-x634.google.com with SMTP id z20so1980855plb.10 for ; Thu, 06 Oct 2022 08:19:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ptPSCcbuG++AcglR+Ify0H9lkcBvjcAqRFsbcccQhHg=; b=ZhwhknIGiG/U++w+Picxj+KnZGanlKXHbjEv5zgh8B0Ewn9NlLBgJRRGIdX4Dn+4bT NEuP/1meI63j9s4oXiRU54ILDT+XB5yHE8K0GBBUN4c5ZmR0S8OrcM+5wg0keBlkMveN 3Q9e8NXap44GUVxevilE1AxTsGJvs76w4IGtpXElYEYSbu5xjeyGsiEC6csEdAILNPoh WV2mcv97WCDPpEsmVLkK+nrthzFVWT0ZOWC7HrKfw0CG/B99r2t0iqzcRqohtXcG8rZG AHu6LdbY0BxgHXJbjSxpFH+2PgzHES18dJCu3fxJ2M/yRdQ5fAwId5XpWfmTk3FqamHq HBKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ptPSCcbuG++AcglR+Ify0H9lkcBvjcAqRFsbcccQhHg=; b=vzAfQRAifYcPjkiRYUl/jaiMZWpynd1ZRP4odjZbgkgRooBh9zqTxcw9lhqC40od+l YslEauuVVEsX+ilSeVGkR/zqsLIewCkj+q9d3+HppzWLYnSiyAx0l5ltPTX3u+gq/eYm UaS/N8XCVAMJ3q4FpTtWGbJ0iKR7y1fPSx9lrMQP8WyMgclrRJMfN34OSKv4Vx+nHA/u +tI8/vH7krUSi32+0pxfqyg2NHosijd8U7C7Yh/2/hVqOOqoyyqTh61xtvOz+/i0PCnB 8+zZxW0aRKBn5rin+aRQ6bsmzrdFeXyjkaLCg4fFpsYH4E6srnM2oZ0K168E7/0bgB+u FZRw== X-Gm-Message-State: ACrzQf01v7kGQh4SXa+h7qhLdsrPgioxm6xUg73tB8CSudr1EINgczKj uOvp7ac5FvpnddB2EG8/P1+KK0sP6R0= X-Google-Smtp-Source: AMsMyM4t1WBkaRwZ2pnxrjL3vOeBziQVxpXDmA0vWW+SFvDtZRAnZPukDXQCO7M5+CXqZD0WqGOMLQ== X-Received: by 2002:a17:903:509:b0:179:ffcf:d275 with SMTP id jn9-20020a170903050900b00179ffcfd275mr8754plb.150.1665069582169; Thu, 06 Oct 2022 08:19:42 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:19:41 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v5 03/18] util/qemu-sockets: Use g_get_tmp_dir() to get the directory for temporary files Date: Thu, 6 Oct 2022 23:19:12 +0800 Message-Id: <20221006151927.2079583-4-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Replace the existing logic to get the directory for temporary files with g_get_tmp_dir(), which works for win32 too. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- (no changes since v1) util/qemu-sockets.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 83f4bd6fd2..0c41ca9e42 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -919,9 +919,8 @@ static int unix_listen_saddr(UnixSocketAddress *saddr, if (saddr->path[0] || abstract) { path = saddr->path; } else { - const char *tmpdir = getenv("TMPDIR"); - tmpdir = tmpdir ? tmpdir : "/tmp"; - path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", tmpdir); + path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", + g_get_tmp_dir()); } pathlen = strlen(path); From patchwork Thu Oct 6 15:19:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Yvm7LVup; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mjx1d6gvMz1yqn for ; Fri, 7 Oct 2022 02:58:29 +1100 (AEDT) Received: from localhost ([::1]:52236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTGV-0001EL-O7 for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 11:58:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSf7-0003z5-3x for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:51 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:34771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSf4-0005yg-Qz for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:48 -0400 Received: by mail-pl1-x62a.google.com with SMTP id n7so2028899plp.1 for ; Thu, 06 Oct 2022 08:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EgL4d6VdvWsoCo8DlQTj5egD3vl1ynzfG1/OtpHXHWg=; b=Yvm7LVup3S11TcY3ioEeG2zBmfFyjypbz6jXagmGJJsUgCLyK5T+Lem8vNXuyVC34a yKSlabDg38VUVh9lcWqiaM2sXfVUmjk8cQYz9pLUX0NDNaVi6+ztjplyfJ0PHEO5juOi DPRS/HUbC4y+J9+3S+Sj4roN9Z3sYHt498hNm4EKPnViHVEcpiazKnTG+BWEgwJc7ypF FWfEIpMmxIgi6dO9UE7df30Eei4QI1FEHTtITQzmMKcG1bsC4cFfCHDLYI1FZQzKj9Zv 2ifMZfCKJKCcVwHiCwgxNIi3pEEMjRgtQoR3DgMDI1tvfSuVUqeIX3BYWB3rhErJlgE0 p5jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EgL4d6VdvWsoCo8DlQTj5egD3vl1ynzfG1/OtpHXHWg=; b=1fdAAvDZyRYh2iym2+g+f6hqy2Das0Bpm/bj70/205ij8S8N3dcuHK9obzww15Enqc o5KhfcODQ/x4AoV7UAGy+9x8T0TDNCEiMoAZzExUHfBQt8HksBLBDUA3Ha8/4x/FZefy Qgww33oBnyyJXmxfg6SqhJEStSBWlouI833fOcFZIdbCA/oVtzKlAtHF5wCa8JHBhlYS AwJn4ySMtbcShcTNxVvAbrNiffW5FUxnIHU08wWLVaWNCfhXnai8d6A0UD9yMHGdzaNo +XvyRM61/hfy5EUaZJu9wilbhPgtSo24y9E3WTZavIz5T6hgUEoOMswyCEQK3+d2YTTF BqXg== X-Gm-Message-State: ACrzQf1bK44tBbX0P9pmC9U2ic5A9bD3HkzW9DwZnfpvEpk6r4+MtAo+ /AxSPXoyH1koWNQ6+4i24/5lRIYJs78= X-Google-Smtp-Source: AMsMyM4blxQXKTL/DyEmsKuQO8c/0aXkxuvBAoovcZsUftLmdb6a5bKRBAweCxBoBR32CPDZc7K84A== X-Received: by 2002:a17:902:ce8f:b0:176:d5af:a175 with SMTP id f15-20020a170902ce8f00b00176d5afa175mr388822plg.123.1665069585216; Thu, 06 Oct 2022 08:19:45 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.19.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:19:44 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , "Dr. David Alan Gilbert" , Juan Quintela , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH v5 04/18] tests/qtest: migration-test: Avoid using hardcoded /tmp Date: Thu, 6 Oct 2022 23:19:13 +0800 Message-Id: <20221006151927.2079583-5-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.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 --- Changes in v5: - Use g_autoptr(GError) Changes in v4: - Update the error reporting by using the GError "error" argument of g_dir_make_tmp() - Remove the const from tmpfs declaration Changes in v3: - Split to a separate patch tests/qtest/migration-test.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 0d153d6b5e..ef4427ff4d 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -102,7 +102,7 @@ static bool ufd_version_check(void) #endif -static const char *tmpfs; +static char *tmpfs; /* The boot file modifies memory area in [start_address, end_address) * repeatedly. It outputs a 'B' at a fixed rate while it's still running. @@ -2451,10 +2451,10 @@ static bool kvm_dirty_ring_supported(void) int main(int argc, char **argv) { - char template[] = "/tmp/migration-test-XXXXXX"; const bool has_kvm = qtest_has_accel("kvm"); const bool has_uffd = ufd_version_check(); const char *arch = qtest_get_arch(); + g_autoptr(GError) err = NULL; int ret; g_test_init(&argc, &argv, NULL); @@ -2479,9 +2479,10 @@ int main(int argc, char **argv) return g_test_run(); } - tmpfs = g_mkdtemp(template); + tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err); if (!tmpfs) { - g_test_message("g_mkdtemp on path (%s): %s", template, strerror(errno)); + g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs, + err->message); } g_assert(tmpfs); @@ -2612,6 +2613,7 @@ int main(int argc, char **argv) g_test_message("unable to rmdir: path (%s): %s", tmpfs, strerror(errno)); } + g_free(tmpfs); return ret; } From patchwork Thu Oct 6 15:19:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=bMVRBtF3; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MjwxY33Ywz20Pd for ; Fri, 7 Oct 2022 02:54:57 +1100 (AEDT) Received: from localhost ([::1]:40502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTD5-0003eQ-8b for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 11:54:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSf9-000405-H3; Thu, 06 Oct 2022 11:19:52 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:38815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSf8-0005z4-0W; Thu, 06 Oct 2022 11:19:51 -0400 Received: by mail-pl1-x630.google.com with SMTP id x1so2003790plv.5; Thu, 06 Oct 2022 08:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mASgTbgC1fZZDNGRrUnVCNQGIWuAR0DCWfyrQC7EGTU=; b=bMVRBtF3rB9T4NqykypNCMk2ByApFkJzbP0tPQbYH9zFBXwv76pzcKh0GQsssA0fe9 84Gma0ShLPS74WDZIfb73cEu7wRi7Fl1RYG0V72ZfM3Io/ga+1TjZJPs+kkyaBsFSUZc wM/jDUWW2YC7+/WgoX3iwEuJ+RFlzdSpI/4HE/mh2SLnJyv86t9hx/SbClXPj1eOr6J7 YnBMT6yJIhj9zk1JVdjfkHFPgZ0RNx1f5mw5KG9wiZyGV/Q2ZYQgrgW6WvcbxdJR+Z/E 2BfOJXgEJtMe+KdQu96Cq1FOF6T0p3369rfOWc+A7sgxInu/4qBKib+sDWVl96N9arCx W4EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mASgTbgC1fZZDNGRrUnVCNQGIWuAR0DCWfyrQC7EGTU=; b=0eFhMYgBZFRvSnyAQm/cJh17mmS5e3Oa70Dok/rLIyP9XGvmv3rZepM3SP9FE0/ybA LRDT+b+pDLSw37ai6zULMg4ve4MpGj9c38Rhi3zCeBpk1kSAqv5V2n4UTKxqjG0h+7Im afpK7YYeD+Yt4/mRVKyMtWqmz2W+ykpWnPVEVIREXdeRxPA85o3jGm1xEuGTT09axv4I npD5QWru5Iqp4Zfea9pFeQc7S+BG7O8SxR8nxr88Xm2sYPkmnAjQTewNlxbPJpm/nb/Y NYzotps7bIn2qbS3HVSalh6/8KBaCalQaWAIbZJ6ocxhTeXQYhTuMNkaarRmrD+Xi4U8 lhPw== X-Gm-Message-State: ACrzQf0AoFIE65yqTxHE++Xl8YdTkHvunEQi4Nm1Q9UJavK+NejHvMjl 5PiylFN6eAPFasMtIXx3JoiV3X64yAk= X-Google-Smtp-Source: AMsMyM7tTZtw8TsZNcGbFjxrNfD6VzPtYHliDYnsoAWF3N0tNRJ9MsnmcXnn3GIibw40ZnJFklfqcg== X-Received: by 2002:a17:902:b907:b0:178:2898:8084 with SMTP id bf7-20020a170902b90700b0017828988084mr405257plb.140.1665069588006; Thu, 06 Oct 2022 08:19:48 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.19.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:19:47 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , Hanna Reitz , Kevin Wolf , qemu-block@nongnu.org Subject: [PATCH v5 05/18] block/vvfat: Unify the mkdir() call Date: Thu, 6 Oct 2022 23:19:14 +0800 Message-Id: <20221006151927.2079583-6-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng There is a difference in the mkdir() call for win32 and non-win32 platforms, and currently is handled in the codes with #ifdefs. glib provides a portable g_mkdir() API and we can use it to unify the codes without #ifdefs. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- (no changes since v2) Changes in v2: - Change to use g_mkdir() block/vvfat.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/block/vvfat.c b/block/vvfat.c index d6dd919683..723beef025 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include +#include #include "qapi/error.h" #include "block/block_int.h" #include "block/qdict.h" @@ -2726,13 +2727,9 @@ static int handle_renames_and_mkdirs(BDRVVVFATState* s) mapping_t* mapping; int j, parent_path_len; -#ifdef __MINGW32__ - if (mkdir(commit->path)) + if (g_mkdir(commit->path, 0755)) { return -5; -#else - if (mkdir(commit->path, 0755)) - return -5; -#endif + } mapping = insert_mapping(s, commit->param.mkdir.cluster, commit->param.mkdir.cluster + 1); From patchwork Thu Oct 6 15:19:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Mbe0YRPg; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mjx1D5fz1z1yqn for ; Fri, 7 Oct 2022 02:58:08 +1100 (AEDT) Received: from localhost ([::1]:36506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTGA-0000if-M1 for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 11:58:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfD-00046R-0m for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:55 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:52174) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfA-0005zK-WA for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:54 -0400 Received: by mail-pj1-x1035.google.com with SMTP id b15so2035049pje.1 for ; Thu, 06 Oct 2022 08:19:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gkhXgeI8VVKYUE8bIuW2cVwuIZ0uivwbyCoudHIFJ54=; b=Mbe0YRPg+SP1Yn8F5xaZMeUHbIohGr+hv2RhxllCPLRAupUWD49KZvkVZyNv2j6gDR hSjCevRlZZwHachTRd+DbyeyfEAPRYy9TwPnZ3oEZYNbHeZX4okAomdixdDebGMzSWKn qqC3VQtNpZNa4V9KPJII7RH63+88q3ywGwvchsVpx5GBBWy5zNUnUGkB0GOCeo1VD2ft 3Qpja6GUl6IlZ75SV2b7dRa3/eo5LyfBvdmksWEj09ULmZDYrtl5/n7Ll2Z9n6baR8uu Op3Cs9lIig7wCZ9RJkJTDB26GoJew+iCNo+Hxt2kLyv7uW07DAvt+8DSnqbNFqyBxHZx U7dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gkhXgeI8VVKYUE8bIuW2cVwuIZ0uivwbyCoudHIFJ54=; b=SUuV3EcX6pXzYOsF0U0r+6D6kRz0SPjfpsBSVqSFhDSpKLrHh+YiUypp5D6U8+JV+z uPW8NnLN8+vgy253LHEIrM2Dq6/tCUaKZPX7y4+WMma7QigQjZqyO408gAMqV0eJFArX Z5n/pK0KptAX04RDJobxiSIFv2iCsijmCsGZeBQKgXZvh7dQviiaLl2fnjG6H6hyCO6t 0Cp0DKuRjkInPrG9MGDdQ0tCTkfXo136U4jIg0LWg5VCQUPMmWkqag+kfMyYAfCU4C4p DJUDMAr0deTbYSMuusQxeX5MAkhWTfS4XTvsorBsxzl0KOI1+e3zaRLaDZfzuc0MPBcR YXuw== X-Gm-Message-State: ACrzQf3f/l/jUZU6KtyH7w9RkeFEz76RVc5HWpXx6vf49wblvDJesLwM rvF2CV2RSfzS88QJ7Y3xuGJY8pV9U94= X-Google-Smtp-Source: AMsMyM6aaJOd86h1SNils3iqsHhdgsqHGGQcT7WzjK6RRmZhfoiCseimrlf5L2QGhtu113jqrjLMvw== X-Received: by 2002:a17:90a:d14d:b0:205:e77d:dc91 with SMTP id t13-20020a17090ad14d00b00205e77ddc91mr11010820pjw.20.1665069590409; Thu, 06 Oct 2022 08:19:50 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:19:49 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , Christian Schoenebeck , Greg Kurz Subject: [PATCH v5 06/18] fsdev/virtfs-proxy-helper: Use g_mkdir() Date: Thu, 6 Oct 2022 23:19:15 +0800 Message-Id: <20221006151927.2079583-7-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Use g_mkdir() to create a directory on all platforms. Signed-off-by: Bin Meng Reviewed-by: Christian Schoenebeck --- (no changes since v2) Changes in v2: - Change to use g_mkdir() fsdev/virtfs-proxy-helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index 2dde27922f..5cafcd7703 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include #include #include #include @@ -639,7 +640,7 @@ static int do_create_others(int type, struct iovec *iovec) if (retval < 0) { goto err_out; } - retval = mkdir(path.data, mode); + retval = g_mkdir(path.data, mode); break; case T_SYMLINK: retval = proxy_unmarshal(iovec, offset, "ss", &oldpath, &path); From patchwork Thu Oct 6 15:19:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=CDFL2lkU; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MjxK53d3qz1yqn for ; Fri, 7 Oct 2022 03:11:53 +1100 (AEDT) Received: from localhost ([::1]:35952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTTT-0000jK-Cy for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:11:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfD-00048s-Lf for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:55 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:46060) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfC-0005zf-54 for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:55 -0400 Received: by mail-pl1-x62a.google.com with SMTP id u24so1968295plq.12 for ; Thu, 06 Oct 2022 08:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gBbYIR+cYUeZZvc5gKxNpLwekX68RaD7k9jxuyBt2nM=; b=CDFL2lkUnYs/aL+B8gu+bu5dfc9zAqr3/kDm9J2dgWQ+ALkXQvwhrFHyzOR8Yy1J6w eETYVNNiNjBV3sdl46Ed6MHNdt1DqD3e17sgM92vGjpt+7BMu3n504EWEtU0xYdOuEtT VsLQOQ8RJT+FsKnlXwKhKNPz3ro/rCjuFagUPlLeTCeogUcg5Fv8m307/FZRiqfOqQbH efu3BuQO3tz8FkxRIaAGvy3dvloz/W5sgHlZ33mExqEnw7QtOWrU2Lhk8j8EdJQ+Jzwu re7DnQWceg+UiG1mPFIC5HgtD+3sYcK3KnpUNWOZ8iOZ6yMJ8MaWHUpcha+Hm/0c/WWa 7Yeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gBbYIR+cYUeZZvc5gKxNpLwekX68RaD7k9jxuyBt2nM=; b=ZxvzDVzT/3cA3AApsRXQDjTcnwMQTsyFfLYJjMPq2ly2CYtEK5rwWIEBxQMerPXiq2 mdzLdEcDdUDoXpb/M/eqEkjviggNRRIToN33PIWJseUc369vq4iHzpM2FEE2k+P8IVyi urJa9Q7kBNKu0xPWbSfqnp07fw8jGf58i3I7LG0YVWo3KLN/2yWM8qxUJIDwERZdx/bg oAbAfV3HJ1sBEb3uIsf4Lt4EJ56r515GGnV7BTJqpADCPPeNrIODvx2htYKzkE7vlQ6k gLVG8ZRkaLc+CR8ChgWNmQDAbFM3dMVh/Nf6MrTKfX2JY5uhskfxmwgutdhSIkggExe9 lfFA== X-Gm-Message-State: ACrzQf2rzEWbTF1V0mrRVp6KTmpl9ZkqKSNxjn1FYPW7Z0bOQ14MZJ2s Hk1mvBzaLKyf6gTEMCvgveWOQVFNPIE= X-Google-Smtp-Source: AMsMyM4zFQIViAEIdpM6TMuv4ucLO8AnFYIdoIqpsSMRQi32ve/RWIXb4CvDBZ97f3jKAkC25HfMNA== X-Received: by 2002:a17:90b:2812:b0:205:cdc9:2ccf with SMTP id qb18-20020a17090b281200b00205cdc92ccfmr205932pjb.97.1665069592682; Thu, 06 Oct 2022 08:19:52 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.19.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:19:52 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , Gerd Hoffmann Subject: [PATCH v5 07/18] hw/usb: dev-mtp: Use g_mkdir() Date: Thu, 6 Oct 2022 23:19:16 +0800 Message-Id: <20221006151927.2079583-8-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Use g_mkdir() to create a directory on all platforms. Signed-off-by: Bin Meng Acked-by: Gerd Hoffmann --- (no changes since v2) Changes in v2: - Change to use g_mkdir() hw/usb/dev-mtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 5831395cef..1cac1cd435 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -14,7 +14,7 @@ #include "qemu/error-report.h" #include #include - +#include #include @@ -1622,7 +1622,7 @@ static void usb_mtp_write_data(MTPState *s, uint32_t handle) if (s->dataset.filename) { path = g_strdup_printf("%s/%s", parent->path, s->dataset.filename); if (s->dataset.format == FMT_ASSOCIATION) { - ret = mkdir(path, mask); + ret = g_mkdir(path, mask); if (!ret) { usb_mtp_queue_result(s, RES_OK, d->trans, 3, QEMU_STORAGE_ID, From patchwork Thu Oct 6 15:19:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687068 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=LCaIrLBQ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mjx1y4y4qz1yqn for ; Fri, 7 Oct 2022 02:58:46 +1100 (AEDT) Received: from localhost ([::1]:52238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTGm-0001KA-Dr for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 11:58:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfI-0004Lf-3d for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:01 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:44890) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfG-00060D-Aj for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:19:59 -0400 Received: by mail-pl1-x629.google.com with SMTP id x6so1974179pll.11 for ; Thu, 06 Oct 2022 08:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jlh3NcGL14udoTSs2qKNoQECkhWg9Im/R612Y2w5/+E=; b=LCaIrLBQ/MkpjTV9vPwh+zwVPpgdb/te0KWh0l8qC+k9xstfG8+gUgCsdxh4+OoGQC c83Qb3aIgxHB/y7tAwy1tZmzHrBr20OppPqVOXmjNKzz47dxzMlVCuzVRxBeBxGZXjtP psdpcKK7V63FhNU6sV90M2G8PHe/eXjJPfWpdyyj+VVZvcpfhfBU4nXA31wXN79Vgai8 iJ7cajA3WRP3aGn+srhOV7bWIOnkPL7rE5MN0w3mB2LD73pzv8aSs5DaaR4097XrUElS m7nG2zZV+PE3OtLH6uLNo4iHJx0wywSen+Z3mpGlz2cV83V9lIFQ6FFyCOgj2QtQ6RxB MRGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jlh3NcGL14udoTSs2qKNoQECkhWg9Im/R612Y2w5/+E=; b=XCnM8Vw8bW/odd+QETO5b96cTELEV5nb+CvkXpqcW4c6SvqgHppg58zcLcL40yI4aW Qxt2UUBlTIm5HlFqWgLyWqfUjA51FDEbdLmtsD7JdPv8C1MH+mw09GaUs9iwSqRPigvg Svh/v9uNek0LkFeljd091FBvAsuzlkLnHoujgKBNYq7llr3yxOis/JyalLiNytj4rv1g metv6P3eTHB5wRMwIyimYavx/oD5/RinCZIooyoinVtqa6oJU0eUZUo88BKacC7mIVGJ vn0pteCX5ikpitXWh3QUuvwUNL5x9iMLAUmW7fbw/4VB4fIODAcsQUtY1wQd9euWV+tM O0OQ== X-Gm-Message-State: ACrzQf3wdJP5Uwboeq8osyGv7yDnNfJlVvcJtNL4sH12lD8sX0MQ/gzT 7oYRkOnAOZ3BPOQfeTgxdWs0wcavKDQ= X-Google-Smtp-Source: AMsMyM6j6AZtxfnMhiXgxT7SGHCOAPvjb7+c2Y0yOhojQCRBfKw9Cwr6LxBfsoR6eNKXIw+MxVsw2w== X-Received: by 2002:a17:903:2616:b0:17f:8042:723a with SMTP id jd22-20020a170903261600b0017f8042723amr64788plb.106.1665069596657; Thu, 06 Oct 2022 08:19:56 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.19.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:19:56 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Xuzhou Cheng , Bin Meng , Eduardo Habkost , Laurent Vivier , Marcel Apfelbaum , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Thomas Huth , Yanan Wang Subject: [PATCH v5 08/18] accel/qtest: Support qtest accelerator for Windows Date: Thu, 6 Oct 2022 23:19:17 +0800 Message-Id: <20221006151927.2079583-9-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng Currently signal SIGIPI [=SIGUSR1] is used to kick the dummy CPU when qtest accelerator is used. However SIGUSR1 is unsupported on Windows. To support Windows, we add a QemuSemaphore CPUState::sem to kick the dummy CPU instead for Windows. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- Changes in v5: - restore to v1 version which does not touch the posix implementation include/hw/core/cpu.h | 1 + accel/dummy-cpus.c | 14 ++++++++++++-- softmmu/cpus.c | 9 +++++---- accel/meson.build | 1 + accel/qtest/meson.build | 1 + 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index f9b58773f7..8830546121 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -333,6 +333,7 @@ struct CPUState { struct QemuThread *thread; #ifdef _WIN32 HANDLE hThread; + QemuSemaphore sem; #endif int thread_id; bool running, has_waiter; diff --git a/accel/dummy-cpus.c b/accel/dummy-cpus.c index 10429fdfb2..d6a1b8d0a2 100644 --- a/accel/dummy-cpus.c +++ b/accel/dummy-cpus.c @@ -21,8 +21,6 @@ static void *dummy_cpu_thread_fn(void *arg) { CPUState *cpu = arg; - sigset_t waitset; - int r; rcu_register_thread(); @@ -32,8 +30,13 @@ static void *dummy_cpu_thread_fn(void *arg) cpu->can_do_io = 1; current_cpu = cpu; +#ifndef _WIN32 + sigset_t waitset; + int r; + sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); +#endif /* signal CPU creation */ cpu_thread_signal_created(cpu); @@ -41,6 +44,7 @@ static void *dummy_cpu_thread_fn(void *arg) do { qemu_mutex_unlock_iothread(); +#ifndef _WIN32 do { int sig; r = sigwait(&waitset, &sig); @@ -49,6 +53,9 @@ static void *dummy_cpu_thread_fn(void *arg) perror("sigwait"); exit(1); } +#else + qemu_sem_wait(&cpu->sem); +#endif qemu_mutex_lock_iothread(); qemu_wait_io_event(cpu); } while (!cpu->unplug); @@ -69,4 +76,7 @@ void dummy_start_vcpu_thread(CPUState *cpu) cpu->cpu_index); qemu_thread_create(cpu->thread, thread_name, dummy_cpu_thread_fn, cpu, QEMU_THREAD_JOINABLE); +#ifdef _WIN32 + qemu_sem_init(&cpu->sem, 0); +#endif } diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 61b27ff59d..9dd1a4dc17 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -437,18 +437,19 @@ void qemu_wait_io_event(CPUState *cpu) void cpus_kick_thread(CPUState *cpu) { -#ifndef _WIN32 - int err; - if (cpu->thread_kicked) { return; } cpu->thread_kicked = true; - err = pthread_kill(cpu->thread->thread, SIG_IPI); + +#ifndef _WIN32 + int err = pthread_kill(cpu->thread->thread, SIG_IPI); if (err && err != ESRCH) { fprintf(stderr, "qemu:%s: %s", __func__, strerror(err)); exit(1); } +#else + qemu_sem_post(&cpu->sem); #endif } diff --git a/accel/meson.build b/accel/meson.build index b9a963cf80..b21c85dc0a 100644 --- a/accel/meson.build +++ b/accel/meson.build @@ -17,4 +17,5 @@ dummy_ss.add(files( )) specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: dummy_ss) +specific_ss.add_all(when: ['CONFIG_WIN32'], if_true: dummy_ss) specific_ss.add_all(when: ['CONFIG_XEN'], if_true: dummy_ss) diff --git a/accel/qtest/meson.build b/accel/qtest/meson.build index 4c65600293..a4876fc0f2 100644 --- a/accel/qtest/meson.build +++ b/accel/qtest/meson.build @@ -1,2 +1,3 @@ qtest_module_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: files('qtest.c')) +qtest_module_ss.add(when: ['CONFIG_WIN32'], if_true: files('qtest.c')) From patchwork Thu Oct 6 15:19:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=AfEozj0u; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MjxNZ2zlYz1yqn for ; Fri, 7 Oct 2022 03:14:54 +1100 (AEDT) Received: from localhost ([::1]:60936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTWO-00052I-8D for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:14:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfL-0004R9-45 for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:03 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:41577) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfJ-00060X-70 for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:02 -0400 Received: by mail-pl1-x634.google.com with SMTP id l4so1989933plb.8 for ; Thu, 06 Oct 2022 08:20:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=80QFJRGf2wqHzaA7G6Y+Ei2sJ8fs6MA6Mk2vEP9/Fec=; b=AfEozj0u/MDqzgpUtX3ATXSs1x9GQsvF+GkLDngfVIY8ETEW3tH8/EXsal0+vFuzwI +LnFrnz2lnDjfinYhV+ih/v7SQf5BiIFA+1xv2qjt0sxVg4zszGsPO6rgeJ+LFm9vfNE pS3FznTjjD+1rC4ljFzAAzRX3ImxZxta4h5O0QJAfSdltQq+9CTozPCLr60Ug19LIYQi v/2Nq2g/6W1gfRCDsfT2I9o96ZjBWpzwo0rFluSSnjJjHwU+fwbBJJ6eMcyhHxl2WGXp AZW9cgLmX7tXjm+OtnD/zk0kUU/b5pO+qv6vEvFV+MdkiF/OcQVClfKAWcKndrFeWWXR qskQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=80QFJRGf2wqHzaA7G6Y+Ei2sJ8fs6MA6Mk2vEP9/Fec=; b=ivJSx0roxmFOXR3toRv7q/JCUDiY0/o0/XZoLc9gcKBX2WwdLRlR6wfVfSmS99y4KM 4/Xy/+B6UnJXd+c6mtsM/J2CbRgQmYs3V4qj8fwK4Ut1Icwh0ZqILMTekcitx5wVxFGL gpQUc0lAmG8QTENfpN7cGe7zfdiucsxnR8m57wyhgHM5brI0/X3Uz/aKH0BohZI5UNQR FAIBZsQSgkHcPCuOfY08dW7uEwmdzUcZ7SJHLmhN1LI4zKxi9sC5EfwXd5Ka9HDX8WSl b0EwXkvqAlIGs6DsDWNlpeJ/FhfFV+3OBDsaJIOs7bsB0WMFlW5/kbzfd+DaXU90WB7N Ezzg== X-Gm-Message-State: ACrzQf1mj7ypxUUTV5Toqy+ieyhduwkHJR7/Kesi6U7t1bBX9DxhqMAI JCDUcc72mbd4BX79mY99HrUrs+pu6iU= X-Google-Smtp-Source: AMsMyM4AwW7T5FtFCF4b8BMVLIHrYns5HvLj6Tp76SosBGyCL6PsQ8EVYeKyR7Y/rka0dGoXxKqYhA== X-Received: by 2002:a17:903:2286:b0:17f:6aeb:a474 with SMTP id b6-20020a170903228600b0017f6aeba474mr56360plh.120.1665069599707; Thu, 06 Oct 2022 08:19:59 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.19.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:19:59 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Xuzhou Cheng , Bin Meng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH v5 09/18] tests/qtest: Use send/recv for socket communication Date: Thu, 6 Oct 2022 23:19:18 +0800 Message-Id: <20221006151927.2079583-10-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng Socket communication in the libqtest and libqmp codes uses read() and write() which work on any file descriptor on *nix, and sockets in *nix are an example of a file descriptor. However sockets on Windows do not use *nix-style file descriptors, so read() and write() cannot be used on sockets on Windows. Switch over to use send() and recv() instead which work on both Windows and *nix. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- (no changes since v2) Changes in v2: - Introduce qemu_send_full() and use it include/qemu/sockets.h | 2 ++ tests/qtest/libqmp.c | 5 +++-- tests/qtest/libqtest.c | 4 ++-- util/osdep.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index 036745e586..adf2b21bd9 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -33,6 +33,8 @@ int qemu_socketpair(int domain, int type, int protocol, int sv[2]); #endif int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen); +ssize_t qemu_send_full(int s, const void *buf, size_t count) + G_GNUC_WARN_UNUSED_RESULT; int socket_set_cork(int fd, int v); int socket_set_nodelay(int fd); void qemu_socket_set_block(int fd); diff --git a/tests/qtest/libqmp.c b/tests/qtest/libqmp.c index ade26c15f0..2b08382e5d 100644 --- a/tests/qtest/libqmp.c +++ b/tests/qtest/libqmp.c @@ -23,6 +23,7 @@ #endif #include "qemu/cutils.h" +#include "qemu/sockets.h" #include "qapi/error.h" #include "qapi/qmp/json-parser.h" #include "qapi/qmp/qjson.h" @@ -36,7 +37,7 @@ typedef struct { static void socket_send(int fd, const char *buf, size_t size) { - size_t res = qemu_write_full(fd, buf, size); + ssize_t res = qemu_send_full(fd, buf, size); assert(res == size); } @@ -69,7 +70,7 @@ QDict *qmp_fd_receive(int fd) ssize_t len; char c; - len = read(fd, &c, 1); + len = recv(fd, &c, 1, 0); if (len == -1 && errno == EINTR) { continue; } diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 4f4b2d6477..8228262938 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -436,7 +436,7 @@ void qtest_quit(QTestState *s) static void socket_send(int fd, const char *buf, size_t size) { - size_t res = qemu_write_full(fd, buf, size); + ssize_t res = qemu_send_full(fd, buf, size); assert(res == size); } @@ -468,7 +468,7 @@ static GString *qtest_client_socket_recv_line(QTestState *s) ssize_t len; char buffer[1024]; - len = read(s->fd, buffer, sizeof(buffer)); + len = recv(s->fd, buffer, sizeof(buffer), 0); if (len == -1 && errno == EINTR) { continue; } diff --git a/util/osdep.c b/util/osdep.c index 60fcbbaebe..0342e754e1 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -502,6 +502,39 @@ int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen) return ret; } +/* + * A variant of send(2) which handles partial send. + * + * Return the number of bytes transferred over the socket. + * Set errno if fewer than `count' bytes are sent. + * + * This function don't work with non-blocking socket's. + * Any of the possibilities with non-blocking socket's is bad: + * - return a short write (then name is wrong) + * - busy wait adding (errno == EAGAIN) to the loop + */ +ssize_t qemu_send_full(int s, const void *buf, size_t count) +{ + ssize_t ret = 0; + ssize_t total = 0; + + while (count) { + ret = send(s, buf, count, 0); + if (ret < 0) { + if (errno == EINTR) { + continue; + } + break; + } + + count -= ret; + buf += ret; + total += ret; + } + + return total; +} + void qemu_set_hw_version(const char *version) { hw_version = version; From patchwork Thu Oct 6 15:19:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=EtSPf7z/; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MjxYj6rMvz20Pd for ; Fri, 7 Oct 2022 03:22:48 +1100 (AEDT) Received: from localhost ([::1]:36128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTdz-0002sb-Te for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:22:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfP-0004V7-Ih for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:09 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:40758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfM-000627-VE for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:07 -0400 Received: by mail-pl1-x633.google.com with SMTP id b2so1991116plc.7 for ; Thu, 06 Oct 2022 08:20:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x1FTgrQXR6uNMn6KBsxmdWGkHMmBa5ff+i5f1cGTWhw=; b=EtSPf7z/A8vVs6xX4SMasLekdLW9mdExa6dpmdfmkqSXfyvGz/XWHvYhu7UQEiwrL8 LVKSxh2miS675ApsCcSUVtXy5PSZ3x/2CjK8ZMKDePfmmEpTkJwfeMSqj25Gx3h05YSR Rw7WZha9O1TlGhrqLA0+aA17tgjnuYRp3TsSxtUo40BflbTVW75lf8EXZXXCjlJKn+i0 bb7E0Nh0J90mfE6GypPCcKBdHxdR6GlJs/r9nfg7d8MgUqXRaSCeXamdDQ08sygTlWlH HGzWz2Ea9jrJFlcRDcMQc8x3FBLO2LYkgitDWMh/P+rTVRZini2fuvGOXPRcr77u6Vh8 QF6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x1FTgrQXR6uNMn6KBsxmdWGkHMmBa5ff+i5f1cGTWhw=; b=nogFRrR+GMIkM3WXaMwU3xM44Zf/B3zSKr1Qw9A03G2k9rNDGaEZIKrlQCTeoat8mb r5w31K2w0A1GcKkn/JlsSKYWMOUB6UZfvTe5uFtH6RsRhscCYwil6MG60Mpm7CGaFa4s ZnKCENIQq68ZVba0ZIHlDoc5AVJCtvPVpu+RlyBN8slhbZMR3kZ+Tg9waTmd9qQQ3ro3 HClpwkXHa+M2YRE8H7VbpAHCwu5RK0+2t08EAYo0TEI2gqqvDzH1yuLokREpyh0VxZ1p tUA/b15Pwum920zp55pyb2jjOrh10rYsBdqAC5V34yEbJgAi6+PwWWOwiSN2ZamPNsRI qNLQ== X-Gm-Message-State: ACrzQf0PYjtYnsA3jhrpBOuwKwzd53Sd4DaU/CCNvA2Vh8y8XJEGTMCh ePC9NNXWBxHe2gow4vk7/BlW6FFdIlE= X-Google-Smtp-Source: AMsMyM5+sW4hcH+vCtFP7TGxj+CuaCAM+cb1cRFv+DKIA8YepkXFroaL4lVeyn08WWSuJg15skxeKg== X-Received: by 2002:a17:902:a707:b0:178:bd1e:e8be with SMTP id w7-20020a170902a70700b00178bd1ee8bemr5128523plq.167.1665069602340; Thu, 06 Oct 2022 08:20:02 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:20:01 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH v5 10/18] tests/qtest: libqtest: Install signal handler via signal() Date: Thu, 6 Oct 2022 23:19:19 +0800 Message-Id: <20221006151927.2079583-11-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng At present the codes uses sigaction() to install signal handler with a flag SA_RESETHAND. Such usage can be covered by the signal() API that is a simplified interface to the general sigaction() facility. Update to use signal() to install the signal handler, as it is available on Windows which we are going to support. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- Changes in v5: - Replace sighandler_t with its actual definition, since it is not available on BSD hosts tests/qtest/libqtest.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 8228262938..54e5f64f20 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -66,7 +66,7 @@ struct QTestState }; static GHookList abrt_hooks; -static struct sigaction sigact_old; +static void (*sighandler_old)(int); static int qtest_query_target_endianness(QTestState *s); @@ -179,20 +179,12 @@ static void sigabrt_handler(int signo) static void setup_sigabrt_handler(void) { - struct sigaction sigact; - - /* Catch SIGABRT to clean up on g_assert() failure */ - sigact = (struct sigaction){ - .sa_handler = sigabrt_handler, - .sa_flags = SA_RESETHAND, - }; - sigemptyset(&sigact.sa_mask); - sigaction(SIGABRT, &sigact, &sigact_old); + sighandler_old = signal(SIGABRT, sigabrt_handler); } static void cleanup_sigabrt_handler(void) { - sigaction(SIGABRT, &sigact_old, NULL); + signal(SIGABRT, sighandler_old); } static bool hook_list_is_empty(GHookList *hook_list) From patchwork Thu Oct 6 15:19:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687073 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=W3CmDdUh; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MjxK7405Qz1yqn for ; Fri, 7 Oct 2022 03:11:55 +1100 (AEDT) Received: from localhost ([::1]:33058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTTV-0000rs-8m for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:11:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfR-0004Ve-Il for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:11 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:45884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfP-0006Bw-2o for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:09 -0400 Received: by mail-pg1-x535.google.com with SMTP id r18so2109714pgr.12 for ; Thu, 06 Oct 2022 08:20:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AKumlSHvcb7ZyxfM85hH84PZtR+gkhdH2/Ps48kqWsY=; b=W3CmDdUhPRuhYKkcgeVEgvji7bLVCwJ49rVl7anzsAK7rgV8Hd++1eR6tQUvzWXWCg tDsXXCnGQ2XRwzIVBXG65psxsgAfhcerwTZLiAhS/mAhp+X4jtjihJXqjwNlKTxChvVk h0XEcfeyEg0NgNXk1V+fPPDlLzp8ullbwUnUS7HnoB/24s6eenV5ezTLakP/pQzra3c5 MgqiYnKFj3lQT/NFGBKVBFzfWL0/mnpb0TBa5m25+B/dF6E/C6VTnpVe3bkYazYV5AA/ RNN/JZSU8cqFGdYzc2ZUyQ7dSjbP9kpKvZKs3mJ6jMpXV+uDJAZCtZ30w/3WFTgi9X6B ODsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AKumlSHvcb7ZyxfM85hH84PZtR+gkhdH2/Ps48kqWsY=; b=JbMy/Gxrt6wmGkVaBpf9KNFpK0vRgvEbeSDQhfaM7DSYVcG1ybsduihc1KaminsJFu D+2qRRuX1Xfnjxz3dMSFx0gyQzVaBY9A13VxaclVzEdh1BCgzWzi2/7SO+rPd3/uI5ne rlLblRYmdjjqYpDphcv4/bfrTXInW0r9LqFcdhNa2HYa3TYkyBzOu4NufSU7CnFo/BQE GUfEVYaoQ2gTFqZUbTMzH5TPwH9IH9rbVCqpfwO4asG+T6fZ9FavsgM1A/87qJzSoCd4 z+BxTjyn3OXkJUrm/4B8LZvNO/qJVSy9Xy3SzxjAT7E3WXQ8+z39f0jFVw75TC9dfwDp et/g== X-Gm-Message-State: ACrzQf3zJZj7TLNKLLeLmLTmVLgYKH9GlUBQ+D+6r+sV7J65DDYD5eFt reWHXoFg0SscSF5KXecbHTprHmYRs1Q= X-Google-Smtp-Source: AMsMyM699e7UL0tt7TxDYQpzRYswNImufmm2+MY/TMxvwNnHJCcxT2V3SFIXta2UMOo7gqC/lcsXRQ== X-Received: by 2002:a63:1a4c:0:b0:43b:e648:a7a4 with SMTP id a12-20020a631a4c000000b0043be648a7a4mr346647pgm.7.1665069605160; Thu, 06 Oct 2022 08:20:05 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.20.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:20:04 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , Xuzhou Cheng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH v5 11/18] tests/qtest: Support libqtest to build and run on Windows Date: Thu, 6 Oct 2022 23:19:20 +0800 Message-Id: <20221006151927.2079583-12-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng At present the libqtest codes were written to depend on several POSIX APIs, including fork(), kill() and waitpid(). Unfortunately these APIs are not available on Windows. This commit implements the corresponding functionalities using win32 native APIs. With this change, all qtest cases can build successfully on a Windows host, and we can start qtest testing on Windows now. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- (no changes since v2) Changes in v2: - Move the enabling of building qtests on Windows to a separate patch to keep bisectablity - Call socket_init() unconditionally - Add a missing CloseHandle() call tests/qtest/libqtest.c | 95 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 2 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 54e5f64f20..ecd22cdb11 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -16,9 +16,11 @@ #include "qemu/osdep.h" +#ifndef _WIN32 #include #include #include +#endif /* _WIN32 */ #ifdef __linux__ #include #endif /* __linux__ */ @@ -27,6 +29,7 @@ #include "libqmp.h" #include "qemu/ctype.h" #include "qemu/cutils.h" +#include "qemu/sockets.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qjson.h" #include "qapi/qmp/qlist.h" @@ -35,6 +38,16 @@ #define MAX_IRQ 256 #define SOCKET_TIMEOUT 50 +#ifndef _WIN32 +# define CMD_EXEC "exec " +# define DEV_STDERR "/dev/fd/2" +# define DEV_NULL "/dev/null" +#else +# define CMD_EXEC "" +# define DEV_STDERR "2" +# define DEV_NULL "nul" +#endif + typedef void (*QTestSendFn)(QTestState *s, const char *buf); typedef void (*ExternalSendFn)(void *s, const char *buf); typedef GString* (*QTestRecvFn)(QTestState *); @@ -118,10 +131,19 @@ bool qtest_probe_child(QTestState *s) pid_t pid = s->qemu_pid; if (pid != -1) { +#ifndef _WIN32 pid = waitpid(pid, &s->wstatus, WNOHANG); if (pid == 0) { return true; } +#else + DWORD exit_code; + GetExitCodeProcess((HANDLE)pid, &exit_code); + if (exit_code == STILL_ACTIVE) { + return true; + } + CloseHandle((HANDLE)pid); +#endif s->qemu_pid = -1; } return false; @@ -135,13 +157,23 @@ void qtest_set_expected_status(QTestState *s, int status) void qtest_kill_qemu(QTestState *s) { pid_t pid = s->qemu_pid; +#ifndef _WIN32 int wstatus; +#else + DWORD ret, exit_code; +#endif /* Skip wait if qtest_probe_child already reaped. */ if (pid != -1) { +#ifndef _WIN32 kill(pid, SIGTERM); TFR(pid = waitpid(s->qemu_pid, &s->wstatus, 0)); assert(pid == s->qemu_pid); +#else + TerminateProcess((HANDLE)pid, s->expected_status); + ret = WaitForSingleObject((HANDLE)pid, INFINITE); + assert(ret == WAIT_OBJECT_0); +#endif s->qemu_pid = -1; } @@ -149,6 +181,7 @@ void qtest_kill_qemu(QTestState *s) * Check whether qemu exited with expected exit status; anything else is * fishy and should be logged with as much detail as possible. */ +#ifndef _WIN32 wstatus = s->wstatus; if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) != s->expected_status) { fprintf(stderr, "%s:%d: kill_qemu() tried to terminate QEMU " @@ -165,6 +198,16 @@ void qtest_kill_qemu(QTestState *s) __FILE__, __LINE__, sig, signame, dump); abort(); } +#else + GetExitCodeProcess((HANDLE)pid, &exit_code); + CloseHandle((HANDLE)pid); + if (exit_code != s->expected_status) { + fprintf(stderr, "%s:%d: kill_qemu() tried to terminate QEMU " + "process but encountered exit status %ld (expected %d)\n", + __FILE__, __LINE__, exit_code, s->expected_status); + abort(); + } +#endif } static void kill_qemu_hook_func(void *s) @@ -243,6 +286,38 @@ static const char *qtest_qemu_binary(void) return qemu_bin; } +#ifdef _WIN32 +static pid_t qtest_create_process(char *cmd) +{ + STARTUPINFO si; + PROCESS_INFORMATION pi; + BOOL ret; + + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + ZeroMemory(&pi, sizeof(pi)); + + ret = CreateProcess(NULL, /* module name */ + cmd, /* command line */ + NULL, /* process handle not inheritable */ + NULL, /* thread handle not inheritable */ + FALSE, /* set handle inheritance to FALSE */ + 0, /* No creation flags */ + NULL, /* use parent's environment block */ + NULL, /* use parent's starting directory */ + &si, /* pointer to STARTUPINFO structure */ + &pi /* pointer to PROCESS_INFORMATION structure */ + ); + if (ret == 0) { + fprintf(stderr, "%s:%d: unable to create a new process (%s)\n", + __FILE__, __LINE__, strerror(GetLastError())); + abort(); + } + + return (pid_t)pi.hProcess; +} +#endif /* _WIN32 */ + QTestState *qtest_init_without_qmp_handshake(const char *extra_args) { QTestState *s; @@ -270,6 +345,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) unlink(socket_path); unlink(qmp_socket_path); + socket_init(); sock = init_socket(socket_path); qmpsock = init_socket(qmp_socket_path); @@ -278,7 +354,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) qtest_add_abrt_handler(kill_qemu_hook_func, s); - command = g_strdup_printf("exec %s %s" + command = g_strdup_printf(CMD_EXEC "%s %s" "-qtest unix:%s " "-qtest-log %s " "-chardev socket,path=%s,id=char0 " @@ -287,7 +363,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) "%s" " -accel qtest", qemu_binary, tracearg, socket_path, - getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null", + getenv("QTEST_LOG") ? DEV_STDERR : DEV_NULL, qmp_socket_path, extra_args ?: ""); @@ -296,6 +372,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) s->pending_events = NULL; s->wstatus = 0; s->expected_status = 0; +#ifndef _WIN32 s->qemu_pid = fork(); if (s->qemu_pid == 0) { #ifdef __linux__ @@ -318,6 +395,9 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) execlp("/bin/sh", "sh", "-c", command, NULL); exit(1); } +#else + s->qemu_pid = qtest_create_process(command); +#endif /* _WIN32 */ g_free(command); s->fd = socket_accept(sock); @@ -336,9 +416,19 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args) s->irq_level[i] = false; } + /* + * Stopping QEMU for debugging is not supported on Windows. + * + * Using DebugActiveProcess() API can suspend the QEMU process, + * but gdb cannot attach to the process. Using the undocumented + * NtSuspendProcess() can suspend the QEMU process and gdb can + * attach to the process, but gdb cannot resume it. + */ +#ifndef _WIN32 if (getenv("QTEST_STOP")) { kill(s->qemu_pid, SIGSTOP); } +#endif /* ask endianness of the target */ @@ -392,6 +482,7 @@ QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd) g_assert_true(sock_dir != NULL); sock_path = g_strdup_printf("%s/sock", sock_dir); + socket_init(); sock_fd_init = init_socket(sock_path); qts = qtest_initf("-chardev socket,id=s0,path=%s -serial chardev:s0 %s", From patchwork Thu Oct 6 15:19:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687071 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=jewsg9Xy; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MjxJF1zH3z1yqn for ; Fri, 7 Oct 2022 03:11:07 +1100 (AEDT) Received: from localhost ([::1]:52810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTSh-0000Dz-9s for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:11:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfU-0004W1-K1 for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:12 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:45966) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfS-0006Co-8q for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:12 -0400 Received: by mail-pf1-x431.google.com with SMTP id 67so2303840pfz.12 for ; Thu, 06 Oct 2022 08:20:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9AFisMEhPtudU5rqA28QSZ0J20KCJlzzQQR7vCLusZI=; b=jewsg9XyWDC4WrrEA/6zGWr+cwwwCSGFCPlnzZFpiXBLAKJO2xN3imRzlpLDUSdEhD TZW+Ev5XF2hd7PNSLnxmR06hR3/2OH0bzKReEYnLeZHm5GlWjg7mj56a/evUvBBVrWji c6tB2PDA/PwxBlPUUUJkLfFnzHWF5RmYHee+yHdK7S2RsGavT7J0UkYVzBVdmnlMLvvm veADai00YXhDtDjc60k8teZrwPd41elQfe6O89XYxvAhpXBwIHBBGYgVvLDlMCN5V1zN IS1MajYZpvHxoeU6aOuQaBUhAP+P/HsN1PzQ3YgGMe2/l3d2f7VyZYp4iJqJbNVJ8J9k XBBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9AFisMEhPtudU5rqA28QSZ0J20KCJlzzQQR7vCLusZI=; b=Wmo4R9fZRri6C0JqjDEyKzgLi4TP+GPRbe8yPVSHCANfIlh7djJ7VXL/CBrmBgitG7 qXPzGzjWs4PP4YU2OapzOEU2Gtm4IETbRtUvolyxTXKa2WDTD44WtrncLybRiTmNqbsN MmzhtnjRrE0Se3XBobv4l91ImPuqKdMo/+H97sldJg8J8+Yv3bs0bGuVQx7loN2B+IKb 6D9Xf0NwJ7kRBLtpq8BC7Lh7WL6b6TK3lUVw4JXIVVz52UeJBCDTPsIdKin7Xn37UXAR lQHAWTE8t/U2o1SUxMxrLNpq7Kb/sYgZFyAIN+B707KgE1cpVeoAJNuE+YLImUxBTJRA 5zqA== X-Gm-Message-State: ACrzQf0/j00Wl3tcvr83AcPZNOx175/NQ3H/MPIFft0fS4EaC/gcH4Qo SpR3nto5itdzi/9vU6dXrOMUjEwSG/M= X-Google-Smtp-Source: AMsMyM5Y2QpKHrjZwPTgaNV7xU2imbWsJaj1n8X1q7T5UOfnOFaY3drkfkzb9VMQWYPW6t8LokdfaA== X-Received: by 2002:a63:fe13:0:b0:452:2b86:50fb with SMTP id p19-20020a63fe13000000b004522b8650fbmr330152pgh.167.1665069608431; Thu, 06 Oct 2022 08:20:08 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.20.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:20:08 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Xuzhou Cheng , Bin Meng , "Dr. David Alan Gilbert" , Juan Quintela , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH v5 12/18] tests/qtest: migration-test: Make sure QEMU process "to" exited after migration is canceled Date: Thu, 6 Oct 2022 23:19:21 +0800 Message-Id: <20221006151927.2079583-13-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Xuzhou Cheng Make sure QEMU process "to" exited before launching another target for migration in the test_multifd_tcp_cancel case. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng --- (no changes since v3) Changes in v3: - Add a usleep(1) in the busy wait loop Changes in v2: - Change to a busy wait after migration is canceled tests/qtest/migration-test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index ef4427ff4d..e5ba0e21d2 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2140,6 +2140,10 @@ static void test_multifd_tcp_cancel(void) wait_for_migration_pass(from); migrate_cancel(from); + /* Make sure QEMU process "to" exited */ + while (qtest_probe_child(to)) { + usleep(1); + } args = (MigrateStart){ .only_target = true, From patchwork Thu Oct 6 15:19:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687080 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=g0TCRu1t; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mjxhj6BGqz1yqn for ; Fri, 7 Oct 2022 03:28:52 +1100 (AEDT) Received: from localhost ([::1]:56784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTjs-00022A-3x for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:28:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfW-0004Wk-OJ for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:16 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:50969) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfU-0006DL-L1 for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:14 -0400 Received: by mail-pj1-x1030.google.com with SMTP id lx7so2082054pjb.0 for ; Thu, 06 Oct 2022 08:20:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KikajeV1rfLr6F/ZMb4ysQ02AJPYh5p4ZSc7N5x5QVQ=; b=g0TCRu1tX5TmQnyzftmAPARwwEc/wWukLQ2Q5TYzlwsvTuxMEtq9BJA/IGk9CelYkX 1mFMnpGGliSoM4lThT4mcoCDwt0FpfjGoXPWgKoMjDxzrJkJtxV1Nwciere5CSGl6HMp tEo7Gk7dzNn8AfxpGWohXNTOP/dlrq458rqGOusj28h0vjeSgQF98yms88vIYzetjmUk hXJdx5HSYe10UdU1f3qn3LWQ45Palq0pyIBw/2+qW8MHPoSeiOmXUFlLeAbtX7+dZVOb K6ajqACPA8FFihvrFTwGIg6So2mTwY4IlBKie9ZTJ4OLMd5BZTt9UMgCTqlgaFifxydf o8kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KikajeV1rfLr6F/ZMb4ysQ02AJPYh5p4ZSc7N5x5QVQ=; b=0vIWAJsZKJHHbu+QTLsguzNZsXi70woSmGmCxvjqLu9CBg95J3Ac97TsZcpi05we27 T8G18C4GkF9DTInohgqBm5RFS3kawThXMwIEYJ/QtO3me8wu8RurDg0KAzBX4KbKaBGy NvtU/H4MeaRYyMZEalKny6r26BwtB5pkTmjGVUOjpI9f8+OoJamWT5VU4H9/uaNedkZc BROhZoWEbHeRY4cJxYBKy/J8qstlj2x8OvZRyscplnWubAnKxd0Za3FZ3NpOb9GC9oby ciexxWgg5nBHkJl6kL/LiKPZSVE64WHJm8NG9u5DiBX6L3mYgbgouNsatCZ0Vk5Xm6qc yg7g== X-Gm-Message-State: ACrzQf1heqrwXl+SczUjPMUbJV8zH0QwRfsL0oq8po4P0wXmWrfu5taK qkE2s+YEvo0PK275smyDEvk2a16YSbo= X-Google-Smtp-Source: AMsMyM4pdmHWbgmlRKSB6UfcJMTJpETnSCHG3zsboCDd3qSX/jjsbmQDN1D/LNyE5RwV3N6d1E3aiQ== X-Received: by 2002:a17:903:244d:b0:178:a0eb:d4bc with SMTP id l13-20020a170903244d00b00178a0ebd4bcmr397617pls.33.1665069611116; Thu, 06 Oct 2022 08:20:11 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:20:10 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH v5 13/18] tests/qtest: libqtest: Correct the timeout unit of blocking receive calls for win32 Date: Thu, 6 Oct 2022 23:19:22 +0800 Message-Id: <20221006151927.2079583-14-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Some qtest cases don't get response from the QEMU executable under test in time on Windows. It turns out that the socket receive call got timeout before it receive the complete response. The timeout value is supposed to be set to 50 seconds via the setsockopt() call, but there is a difference among platforms. The timeout unit of blocking receive calls is measured in seconds on non-Windows platforms but milliseconds on Windows. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- (no changes since v1) tests/qtest/libqtest.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index ecd22cdb11..d52883c361 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -36,13 +36,14 @@ #include "qapi/qmp/qstring.h" #define MAX_IRQ 256 -#define SOCKET_TIMEOUT 50 #ifndef _WIN32 +# define SOCKET_TIMEOUT 50 # define CMD_EXEC "exec " # define DEV_STDERR "/dev/fd/2" # define DEV_NULL "/dev/null" #else +# define SOCKET_TIMEOUT 50000 # define CMD_EXEC "" # define DEV_STDERR "2" # define DEV_NULL "nul" @@ -103,8 +104,16 @@ static int socket_accept(int sock) struct sockaddr_un addr; socklen_t addrlen; int ret; + /* + * timeout unit of blocking receive calls is different among platfoms. + * It's in seconds on non-Windows platforms but milliseconds on Windows. + */ +#ifndef _WIN32 struct timeval timeout = { .tv_sec = SOCKET_TIMEOUT, .tv_usec = 0 }; +#else + DWORD timeout = SOCKET_TIMEOUT; +#endif if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (void *)&timeout, sizeof(timeout))) { From patchwork Thu Oct 6 15:19:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Zqjk/nph; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MjxqM1WZkz1yqk for ; Fri, 7 Oct 2022 03:34:37 +1100 (AEDT) Received: from localhost ([::1]:54842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTpS-0007uy-EV for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:34:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfa-0004XK-O3 for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:21 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:36836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfY-0006E3-MS for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:17 -0400 Received: by mail-pf1-x432.google.com with SMTP id y136so2351291pfb.3 for ; Thu, 06 Oct 2022 08:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wJ46lPbUundlzLry/XhmGks2ORwcj9XXEHBkBSD1tlY=; b=Zqjk/nphJPYClpAauW9PZi7lPE2xcLmKmrKgOj9i2xbnBlnod0tLmu38Vx6J1LZ5vd 2e+KEpLMGyCMLDDTkqjNSxBUo6FmsBX3c9cwBegnJpGmxXWjiROw0grV5++kkQJXbv54 XDzew7dFbhqYu9hXSGGEBiAZqv/Buh7gwsn/YN5WpzMIqiXRqBYWnjSWnevak9H4dy8N a8ulqXKdm9bbywc7kZfZ6Y3Cr9+DkgvhMfn+RPe7k/Tg2Jtg0GlNwCkDhckjUNYVW7Qf /CUUVoNd7bAaSYenO/QaLHzCRYOPy5n9VHsk20MJuuBjRGRYl3pFA3pnaKBzDOTlhPjN WGig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wJ46lPbUundlzLry/XhmGks2ORwcj9XXEHBkBSD1tlY=; b=N97CLYl0K5NxLglop/J2oayCNnxTCmOW1ZK6PejmHdP6wlosqgBaI+/Lv8ZoXR96XY KVniUt8pzbXZtmGhTYPwElNFf8aO4p1JJgDvd7uwN4hcpg1rN9q6ttYck7Dl+pxYhpeo LAKf8qlZMQZobS6c2x/WuQNA3j9Q5N1I/LB4+lqADfr0hPRtMpt7Dik6/vcT77H/oulm RCTPxWROOPgBqrO576xvZKWa6csGorz7yQqHVC6Arhjy9IXW2j4AoQYzyw1tsuLINSb/ tCwTM1JK9w6gav5SjnEV6PMRYlkBIuytLWiBjKkm6C9SbsinUOPBmZ+uUWyfEpRyT5lX GTJQ== X-Gm-Message-State: ACrzQf38YZRE5cYFNd5tdTMzWfl1qJzRgDc0AeQ9pdZvPfWPICimuXte Qwbc6mij2oBz2J3W9kbk14SXD0+q60o= X-Google-Smtp-Source: AMsMyM4Ecs2u/rG+40QKzlQjiaa9eXr/a2sa6QjdkAbR2XQ/KokpJwWzuEwJiA9f3ynDvwA+rH9AKg== X-Received: by 2002:a05:6a00:23ca:b0:557:a75c:b430 with SMTP id g10-20020a056a0023ca00b00557a75cb430mr37674pfc.16.1665069613292; Thu, 06 Oct 2022 08:20:13 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.20.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:20:12 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v5 14/18] io/channel-watch: Drop a superfluous '#ifdef WIN32' Date: Thu, 6 Oct 2022 23:19:23 +0800 Message-Id: <20221006151927.2079583-15-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng In the win32 version qio_channel_create_socket_watch() body there is no need to do a '#ifdef WIN32'. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- (no changes since v1) io/channel-watch.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/io/channel-watch.c b/io/channel-watch.c index 0289b3647c..89f3c8a88a 100644 --- a/io/channel-watch.c +++ b/io/channel-watch.c @@ -285,11 +285,9 @@ GSource *qio_channel_create_socket_watch(QIOChannel *ioc, GSource *source; QIOChannelSocketSource *ssource; -#ifdef WIN32 WSAEventSelect(socket, ioc->event, FD_READ | FD_ACCEPT | FD_CLOSE | FD_CONNECT | FD_WRITE | FD_OOB); -#endif source = g_source_new(&qio_channel_socket_source_funcs, sizeof(QIOChannelSocketSource)); From patchwork Thu Oct 6 15:19:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687086 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=eRCB+g2P; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mjxvc40MSz20Pd for ; Fri, 7 Oct 2022 03:38:20 +1100 (AEDT) Received: from localhost ([::1]:43932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTt4-0005S6-AD for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:38:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfm-0004aa-4K for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:36 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:37516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfa-0006EM-G4 for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:19 -0400 Received: by mail-pg1-x529.google.com with SMTP id bh13so2159716pgb.4 for ; Thu, 06 Oct 2022 08:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FMvqR5WvHSrhd6FoBOh5bPNiyVgL3g0xwaaD6f1HGpU=; b=eRCB+g2PpDfez7VPNZ001FqIWxt/NN3NZsF/gb2yRH7dF+vkLW86Sh+3BFrgqp9Djy QKSxyh18zDQNH/kLMbZYq5KIkEFli5QpVT1aa91HZ2rIbJKeD/7/L2W3IuhZ/O+HdAiH XBsPGzS7/9yWZq7Cp4g3h7qngI4jcHrJ1E7wl65CWzYgytV/yiA0HmjA15wttJ6xhuLG Be9xtEeO/mLo2imp677f4MBeftaVr4gZizZ37BUSWpAw/dwlmcJdnXd9bEInxsmaR/iu qtsHvFBE3tQtg1F0NJeJDuKQ91gKxTO4kCQEGqtX7vM8H7CJQbj0iXfuilIQgF2wdjkr oKDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FMvqR5WvHSrhd6FoBOh5bPNiyVgL3g0xwaaD6f1HGpU=; b=DIX3H5DCP0G6SwUoR/I+LDCatvR//K4KC4QQj+LO8By8XE5AcrvpKaLOHtTBqNEEs6 gmHK6jx9RZDMA6ZVdyDNxUxtxG8i5IS0rxO7wgi32eDP0ubVUOHPq+eowzHmJ6QFWch2 HOCjBXlYnKw2rbvSA7DvJ9PL9vw6bNUVgfS0vndSOZA1cTsdJ7s9b0SMKY3/wEGuNRU2 i+xNmzsIeW5qui6werp2T9tlqnuVzOwpB09t49PEk8AuL8oWVG8YLb4Mm/ZAwkZrBQk7 hfETrGjw3CWeA21Xd9ExQ/tHpZX+4S7qGaorZDjJJ+/QazH8pQmZafMfb9Xy6jygKoJU 2zYQ== X-Gm-Message-State: ACrzQf3fv5T6NOiaG3NpLBN/mk8fPYssaj2KwYEWJJI8dhyARD+21YVU auy6wOHp3yWhT9WT6pQk9DDWwqQLQ3o= X-Google-Smtp-Source: AMsMyM49DkLLwFXH+5jjyrq6oAvFg9ftXL9unjV6uOVVx4Fy8dig0b/D9yoMM/a2J2usye1WpdsSkw== X-Received: by 2002:a63:33cf:0:b0:439:f026:aab2 with SMTP id z198-20020a6333cf000000b00439f026aab2mr372812pgz.86.1665069615558; Thu, 06 Oct 2022 08:20:15 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:20:15 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v5 15/18] io/channel-watch: Drop the unnecessary cast Date: Thu, 6 Oct 2022 23:19:24 +0800 Message-Id: <20221006151927.2079583-16-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=bmeng.cn@gmail.com; helo=mail-pg1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng There is no need to do a type cast on ssource->socket as it is already declared as a SOCKET. Suggested-by: Marc-André Lureau Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- (no changes since v2) Changes in v2: - new patch: "io/channel-watch: Drop the unnecessary cast" io/channel-watch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/io/channel-watch.c b/io/channel-watch.c index 89f3c8a88a..43d38494f7 100644 --- a/io/channel-watch.c +++ b/io/channel-watch.c @@ -130,13 +130,13 @@ qio_channel_socket_source_check(GSource *source) FD_ZERO(&wfds); FD_ZERO(&xfds); if (ssource->condition & G_IO_IN) { - FD_SET((SOCKET)ssource->socket, &rfds); + FD_SET(ssource->socket, &rfds); } if (ssource->condition & G_IO_OUT) { - FD_SET((SOCKET)ssource->socket, &wfds); + FD_SET(ssource->socket, &wfds); } if (ssource->condition & G_IO_PRI) { - FD_SET((SOCKET)ssource->socket, &xfds); + FD_SET(ssource->socket, &xfds); } ssource->revents = 0; if (select(0, &rfds, &wfds, &xfds, &tv0) == 0) { From patchwork Thu Oct 6 15:19:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=dPAIlMgK; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MjxZw3y7Gz20Pd for ; Fri, 7 Oct 2022 03:23:52 +1100 (AEDT) Received: from localhost ([::1]:60352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTf3-0004bI-W9 for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:23:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfn-0004ak-AX for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:36 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:43897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfg-0006EX-Jm for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:31 -0400 Received: by mail-pf1-x435.google.com with SMTP id 204so2315089pfx.10 for ; Thu, 06 Oct 2022 08:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xIwwdkQ/UueIjTq9LmfxXmdWH0OF4K6cF8/Wmny7JFg=; b=dPAIlMgKwepgRTty/NDEoITtl0JLP7tXGdz52h4rcoo2V8w27NMAMVla/eESrJF9bX F1GjM1/ud6p45O7Vyhu8lp5AbDz8LUKfD1Hp7YrZ3AdkOv0xS2C6XFvSmIzQQ4AD3DUB Kv8PVdYE2GM7fQQp2xKtx54LF05NRJSbkjZUh/18qib4Ziede/vT2cHpOaqrvWL+ctLM vZUbPJ7AbHqwhp0anLUH6iHKSyFDNWBEHJKs3ydDYqwIFBDMNazdkQzozC8vlTuBGk+o ozibjA1O13jz2ZY8Om2Vpgk366wIhEgc3oZDsartCBc0obuB+xdJAzcl0XfF4oWmKmpC GRfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xIwwdkQ/UueIjTq9LmfxXmdWH0OF4K6cF8/Wmny7JFg=; b=IYXpFiN/daAZn6E91k7k9Z8p9naz4UBmnJjwZlBoeJQUCD65ae7I6THFJs3IuPOanx BG7mVUd9aTYMG9vZYCQaTbRKel/pP2nWQjnHg55dyPaLBe1zxevtEr1BGJCcuSlJ6sk7 5xudt82U7BorBIIAaCVdAER3d2xMqh9WpWpKz3OZP9qzrs16qqreeOoVrwqQnKDGkZUd qxB/0onGFrVv+ZK3i8KsvVhQuBvs8pBFKyyzScNhLvZ4rMDfLxY4OqYiT6f7loKAb4Cz UF2SkiIwNjxfuStEPKTHYJxvgXHAbEKTqYYQA4R0f9VRt+BQYiQl9aNiwHxiExgBdzgx pBNg== X-Gm-Message-State: ACrzQf2w+fXn+ExpV0sk0KccbtmkBoV2Ak5BjhJtSx9HA/rVpLGvHSdL W/YFptmym3Yr4594nVl+Kqu0k4kjzu0= X-Google-Smtp-Source: AMsMyM69mSTPVYipH4koxmC8nn5BpHAoul++typ5SuBdVXify7duM1KeEthiontTR73r0KKSnRlRCg== X-Received: by 2002:a63:f556:0:b0:44e:12bf:2dd8 with SMTP id e22-20020a63f556000000b0044e12bf2dd8mr360161pgk.400.1665069617726; Thu, 06 Oct 2022 08:20:17 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:20:17 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v5 16/18] io/channel-watch: Fix socket watch on Windows Date: Thu, 6 Oct 2022 23:19:25 +0800 Message-Id: <20221006151927.2079583-17-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Random failure was observed when running qtests on Windows due to "Broken pipe" detected by qmp_fd_receive(). What happened is that the qtest executable sends testing data over a socket to the QEMU under test but no response is received. The errno of the recv() call from the qtest executable indicates ETIMEOUT, due to the qmp chardev's tcp_chr_read() is never called to receive testing data hence no response is sent to the other side. tcp_chr_read() is registered as the callback of the socket watch GSource. The reason of the callback not being called by glib, is that the source check fails to indicate the source is ready. There are two socket watch sources created to monitor the same socket event object from the char-socket backend in update_ioc_handlers(). During the source check phase, qio_channel_socket_source_check() calls WSAEnumNetworkEvents() to discover occurrences of network events for the indicated socket, clear internal network event records, and reset the event object. Testing shows that if we don't reset the event object by not passing the event handle to WSAEnumNetworkEvents() the symptom goes away and qtest runs very stably. It seems we don't need to call WSAEnumNetworkEvents() at all, as we don't parse the result of WSANETWORKEVENTS returned from this API. We use select() to poll the socket status. Fix this instability by dropping the WSAEnumNetworkEvents() call. Some side notes: During the testing, I removed the following codes in update_ioc_handlers(): remove_hup_source(s); s->hup_source = qio_channel_create_watch(s->ioc, G_IO_HUP); g_source_set_callback(s->hup_source, (GSourceFunc)tcp_chr_hup, chr, NULL); g_source_attach(s->hup_source, chr->gcontext); and such change also makes the symptom go away. And if I moved the above codes to the beginning, before the call to io_add_watch_poll(), the symptom also goes away. It seems two sources watching on the same socket event object is the key that leads to the instability. The order of adding a source watch seems to also play a role but I can't explain why. Hopefully a Windows and glib expert could explain this behavior. Signed-off-by: Bin Meng --- (no changes since v1) io/channel-watch.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/io/channel-watch.c b/io/channel-watch.c index 43d38494f7..ad7c568a84 100644 --- a/io/channel-watch.c +++ b/io/channel-watch.c @@ -115,17 +115,13 @@ static gboolean qio_channel_socket_source_check(GSource *source) { static struct timeval tv0; - QIOChannelSocketSource *ssource = (QIOChannelSocketSource *)source; - WSANETWORKEVENTS ev; fd_set rfds, wfds, xfds; if (!ssource->condition) { return 0; } - WSAEnumNetworkEvents(ssource->socket, ssource->ioc->event, &ev); - FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); From patchwork Thu Oct 6 15:19:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=QhvallwT; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MjxR96lf5z1yqk for ; Fri, 7 Oct 2022 03:17:09 +1100 (AEDT) Received: from localhost ([::1]:40730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTYZ-0006o4-Qp for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:17:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfn-0004aj-Ag for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:36 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:38692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfj-0006Fy-H1 for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:30 -0400 Received: by mail-pf1-x42a.google.com with SMTP id w191so2339807pfc.5 for ; Thu, 06 Oct 2022 08:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NCD0OoweK2TuN+Pq4vH+vNDBt5GFzsQ5yHOp5dnrTlM=; b=QhvallwTJPbdxeFpM8wYgY0YdRkfi7EhU2bc9layvuheF2AAEzdP1xtXSoLSX1Pf4i bUvylpqdRpv0RhjYocIdn9KSCkFG2nsHXSuEbfXCQYTO185bmQiJhX2EVVdsuwo4wBTK wQSDBNeJ9xBY7QCGN2HrU/KDghDMOZ/eM0AKRR7Zo6a9QM0dJwIEUa6WL5BnbVOQtPO7 +GgyjPJ9rwEJ5DZu2uuFSikJNUvKL4Otjoa2EvG/LVPXR3lIQ3yh53pPGrMTliud9B1w S95fU1hn+234XNbALYD7IlDzBansnOQ6EFoX8/wZFt3dX9RJ10fHGo5QdGHp7qyweWFE W8Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NCD0OoweK2TuN+Pq4vH+vNDBt5GFzsQ5yHOp5dnrTlM=; b=T9oDP0wj6sNb0LYiSm63vqGWRalcb+XC9Vx+oGTEKsCddvd1odHGIX65km9bEAJs3C sWmiwyp3R9aXxWplCx76b0+Cv1hNd5ZiqY0OzqwXEAcXGF7q/zjq5mgxVNP68VeR000+ mfKdr+lLhLtH6eRt3FNo+wm/wZAyxvzfw3wFRAODZSjTwVu44egxOsZAuQvE19EadX8m PxWkosUR+Tk3pASLdfsgX7aBJcG6rbHVHxLrpKsLILtNFmzNk5bLH/YNK1lEV6dPC72D kyASiIdJb8CiyAaYySrwvOu7KKszHt6re0q01CkKMKyI6mvACG4tDN4qTtbIVV2t968B K/9Q== X-Gm-Message-State: ACrzQf1L1IQtFRKssCO3ZF4NyCWdbkPNhoqGvNUL8DGiVqqZeJT42U6t FODHx9x4nNBBesWTn+ExSUmg14gFOBM= X-Google-Smtp-Source: AMsMyM4ivDF41zgBTAGSnrcRRmksfF5o42/cSns1/6wjOzy/OYrDD7dgqtZY2zuoUf0Cmke75Uc/Bg== X-Received: by 2002:a05:6a00:1c5d:b0:562:7125:ff10 with SMTP id s29-20020a056a001c5d00b005627125ff10mr426894pfw.60.1665069620856; Thu, 06 Oct 2022 08:20:20 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:20:20 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , =?utf-8?q?Alex_Benn=C3=A9e?= , Beraldo Leal , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH v5 17/18] .gitlab-ci.d/windows.yml: Increase the timeout to 90 minutes Date: Thu, 6 Oct 2022 23:19:26 +0800 Message-Id: <20221006151927.2079583-18-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng commit 9f8e6cad65a6 ("gitlab-ci: Speed up the msys2-64bit job by using --without-default-devices" changed to compile QEMU with the --without-default-devices switch for the msys2-64bit job, due to the build could not complete within the project timeout (1h), and also mentioned that a bigger timeout was getting ignored on the shared Gitlab-CI Windows runners. However as of today it seems the shared Gitlab-CI Windows runners does honor the job timeout, and the runner has the timeout limit of 2h, so let's increase the timeout to 90 minutes and drop the configure switch "--without-default-devices" to get a larger build coverage. Signed-off-by: Bin Meng --- (no changes since v2) Changes in v2: - Change the timeout limit to 90 minutes .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 a3e7a37022..093276ddbc 100644 --- a/.gitlab-ci.d/windows.yml +++ b/.gitlab-ci.d/windows.yml @@ -10,7 +10,7 @@ - ${CI_PROJECT_DIR}/msys64/var/cache needs: [] stage: build - timeout: 70m + timeout: 90m before_script: - If ( !(Test-Path -Path msys64\var\cache ) ) { mkdir msys64\var\cache @@ -60,7 +60,7 @@ msys2-64bit: - $env:MSYSTEM = 'MINGW64' # Start a 64 bit Mingw environment - $env:MSYS = 'winsymlinks:native' # Enable native Windows symlink - .\msys64\usr\bin\bash -lc './configure --target-list=x86_64-softmmu - --enable-capstone --without-default-devices' + --enable-capstone' - .\msys64\usr\bin\bash -lc 'make' - .\msys64\usr\bin\bash -lc 'make check || { cat build/meson-logs/testlog.txt; exit 1; } ;' From patchwork Thu Oct 6 15:19:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1687079 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=qjc6P7Pn; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MjxZy5KwBz20Pd for ; Fri, 7 Oct 2022 03:23:54 +1100 (AEDT) Received: from localhost ([::1]:39272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogTf6-0004l2-L6 for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2022 12:23:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogSfp-0004aq-EH for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:38 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:44890) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogSfl-00060D-OY for qemu-devel@nongnu.org; Thu, 06 Oct 2022 11:20:32 -0400 Received: by mail-pl1-x629.google.com with SMTP id x6so1975325pll.11 for ; Thu, 06 Oct 2022 08:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dC57FSaNPYR/x92KSGPBjowij7AJPPetJ5174vwrMiQ=; b=qjc6P7Pn7dExSieq+WdpEoZzCWX9ODdYC4yaA5tQ4CLJQEMxIQniFxveJayg5ekwJW 33HQ/wA2uCB9chP946vuRtfT7MlXZMWkiwtH/VcI41b7/Fo1JQGjMbze3kET416twcfm 7uFxh9BmPggzv7XxIW3ySW8qe+tvKdGvYbDo7KrNs2QcqJpWmBnARaG4wZ56jVuhl/3C pncseEUBwZTUetOEUtVDlUjndlZEFso9ki2AjuBURqNityKsSl7eUdeevE7Gjx8KzjP7 8agGp1qMVZqc09zrIYaU4HWXGPnyqs4TLHRaK+c7vIQ5tppROK1XhIvQpraCkU9f+DW6 Eg+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dC57FSaNPYR/x92KSGPBjowij7AJPPetJ5174vwrMiQ=; b=x/YPcGLgxeIFkm5rZBM8hd8Z+PhqpOYta+QIqFIa1e9lA7Jc6RLKdi/XmPlNYecCjj /UWPgq1KievX1Cnh7CBpVS2IRjAsUIERfFsmM7Qv6gLGxm4znfhCBTH30e+aKcOsEyTZ WuVfNxbMXPHOLzAV3ubFmC3rLyI067SOzrCbB9h/xXr2C12Fop/UHofFZ9deQCRiznuj lLyuDV/NUxr2LRezFYGIsz4JJmQRIpQtfNuV5aE/cZN2ANxsUYdVJGQ6QfeSgeiyHBRg 2vJeyQvaslUdRmAb570WMMVLwr3ep+4a+RwxtLLt+0Pd6NbJ9+pn8tBxJbYzYC0rtbgX gcYg== X-Gm-Message-State: ACrzQf1CsDYEa252MIHnJSVUgUSKJNi8aebURJQ4wu/z7THtw9iNlM2q s/FJIcFkrYP8cimQwUhf0jemVO1wrTs= X-Google-Smtp-Source: AMsMyM4mkX3ZELJpdATdJ+upIvFSj9m9Xz+VGJD19a3WkT6J3v/Y+ahvDkV3z8Xf2daCh/NwGTk1ew== X-Received: by 2002:a17:903:4d4:b0:17f:7ecc:88e3 with SMTP id jm20-20020a17090304d400b0017f7ecc88e3mr350513plb.169.1665069623547; Thu, 06 Oct 2022 08:20:23 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id p13-20020a170902780d00b0017c37a5a2fdsm11426759pll.216.2022.10.06.08.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 08:20:23 -0700 (PDT) From: Bin Meng To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Bin Meng , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v5 18/18] tests/qtest: Enable qtest build on Windows Date: Thu, 6 Oct 2022 23:19:27 +0800 Message-Id: <20221006151927.2079583-19-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006151927.2079583-1-bmeng.cn@gmail.com> References: <20221006151927.2079583-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Now that we have fixed various test case issues as seen when running on Windows, let's enable the qtest build on Windows. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth --- (no changes since v3) Changes in v3: - Drop the host test Changes in v2: - new patch: "tests/qtest: Enable qtest build on Windows" tests/qtest/meson.build | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 455f1bbb7e..8701c3a8e7 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -1,9 +1,3 @@ -# All QTests for now are POSIX-only, but the dependencies are -# really in libqtest, not in the testcases themselves. -if not config_host.has_key('CONFIG_POSIX') - subdir_done() -endif - slow_qtests = { 'ahci-test' : 60, 'bios-tables-test' : 120,