From nobody Wed Nov 12 11:58:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1570160932; cv=none; d=zoho.com; s=zohoarc; b=ZtALrqACYzA7CxijuIhHeezzIRoCweSVYjeGrmJUmOtd2qOnD1qAXkpod/p6mlzeeDrrrlv7IGXgZKx2QYMeNMjPq/cbigWIVDgdl6FiHKUAwcIcUDHfC0Fm0IKkyixXaNnzPCAmvO/SQYO07Qw7gygOyU8+Emf1hk/lPdmwYYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570160932; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=BOOm1niXqpMTSrj7du+GgL4J4/FhumZp54yo7XFg/ak=; b=DCJG7Rmx1uO9Sj6rzh3Uj7cHRazmQTiRk7HNoD2XOxGn9qCzTBT8lntaJ27bwuhefsFFtmPRt7xoG2ifQRR5ZerNZ+NdySMPa7QU6fP+Vhn0gA8vmFC6ody1fxPKZFi+FFf6zrnSzA3r710IXccUViyNoAJ3kT8GR/268ASowFk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1570160932481973.7706074040824; Thu, 3 Oct 2019 20:48:52 -0700 (PDT) Received: from localhost ([::1]:42022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGEaJ-0007L8-DF for importer@patchew.org; Thu, 03 Oct 2019 23:48:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44075) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGEW0-0003pH-Ug for qemu-devel@nongnu.org; Thu, 03 Oct 2019 23:44:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGEVy-0001r4-Rt for qemu-devel@nongnu.org; Thu, 03 Oct 2019 23:44:24 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:6351) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iGEVx-0001js-Sf for qemu-devel@nongnu.org; Thu, 03 Oct 2019 23:44:22 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.1]) by rmmx-syy-dmz-app02-12002 (RichMail) with SMTP id 2ee25d96c007f64-b2faf; Fri, 04 Oct 2019 11:44:08 +0800 (CST) Received: from maozy-host.lan (unknown[180.108.8.156]) by rmsmtp-syy-appsvr01-12001 (RichMail) with SMTP id 2ee15d96bff81ac-a1b07; Fri, 04 Oct 2019 11:44:08 +0800 (CST) X-RM-TRANSID: 2ee25d96c007f64-b2faf X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee15d96bff81ac-a1b07 From: Mao Zhongyi To: qemu-devel@nongnu.org Subject: [PATCH v3 3/3] =?UTF-8?q?tests/migration=EF=BC=9Afix=20unreachabl?= =?UTF-8?q?e=20path=20in=20stress=20test?= Date: Fri, 4 Oct 2019 11:43:48 +0800 Message-Id: <4d7e66c152fad6230978619000766fa4d01db078.1570159624.git.maozhongyi@cmss.chinamobile.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 221.176.66.79 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tony.nguyen@bt.com, alex.bennee@linaro.org, armbru@redhat.com, Mao Zhongyi , laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" If stressone() or stress() exits it's because of a failure because the test runs forever otherwise, so change stressone type to void and stress should always return -1 to make the path of 'if (stress(ramsizeGB, ncpus) < 0)' can be reached. Signed-off-by: Mao Zhongyi --- tests/migration/stress.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/migration/stress.c b/tests/migration/stress.c index debf34359f..b0df1323bb 100644 --- a/tests/migration/stress.c +++ b/tests/migration/stress.c @@ -167,7 +167,7 @@ static unsigned long long now(void) return (tv.tv_sec * 1000ull) + (tv.tv_usec / 1000ull); } =20 -static int stressone(unsigned long long ramsizeMB) +static void stressone(unsigned long long ramsizeMB) { size_t pagesPerMB =3D 1024 * 1024 / PAGE_SIZE; g_autofree char *ram =3D g_malloc(ramsizeMB * 1024 * 1024); @@ -181,12 +181,12 @@ static int stressone(unsigned long long ramsizeMB) if (!ram) { fprintf(stderr, "%s (%05d): ERROR: cannot allocate %llu MB of RAM:= %s\n", argv0, gettid(), ramsizeMB, strerror(errno)); - return -1; + return; } if (!data) { fprintf(stderr, "%s (%d): ERROR: cannot allocate %d bytes of RAM: = %s\n", argv0, gettid(), PAGE_SIZE, strerror(errno)); - return -1; + return; } =20 /* We don't care about initial state, but we do want @@ -197,7 +197,7 @@ static int stressone(unsigned long long ramsizeMB) memset(ram, 0xfe, ramsizeMB * 1024 * 1024); =20 if (random_bytes(data, PAGE_SIZE) < 0) { - return -1; + return; } =20 before =3D now(); @@ -250,7 +250,7 @@ static int stress(unsigned long long ramsizeGB, int ncp= us) =20 stressone(ramsizeMB); =20 - return 0; + return -1; } =20 =20 @@ -348,6 +348,4 @@ int main(int argc, char **argv) =20 if (stress(ramsizeGB, ncpus) < 0) exit_failure(); - - exit_success(); } --=20 2.17.1