From nobody Tue Feb 10 09:10:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1591171958; cv=none; d=zohomail.com; s=zohoarc; b=jp5Vk3kGINOwg8k5jcHiU3axFXnQ+XjLb92nadVH/36QOqdN+dWHP5E8k2egM5EVyxuYf6o6d2hVJRLuh5eIAsjlHobdYtgy4Czn3Sva9CiuuKZVWPMfF+U62RoaFOJpXjV2d3tM9FySqeflYshMyi4C13gRXoytawOKIgjHSqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591171958; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=GIJWRtNwhbkkqjKp29+ner2WGUl/ajMgA7a0RulzHDg=; b=YcJUZclUo0I+lFxgqfPzHMSBC/9pU+RR5EW0H06ZyjpUYz6CgmxIr9C+VTmHiTxTzfMjyJxov09//pULSlo+YBcJuUr7gTIsERvqSs+uFOsTxeyiofv3ZCH5PXIZYV7XcU918/bj4fqs/14RZvtI7wlFb3R4VEuaU2eOnD5Y49I= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591171958252234.48065182210667; Wed, 3 Jun 2020 01:12:38 -0700 (PDT) Received: from localhost ([::1]:52570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgOVo-0005Cz-NB for importer@patchew.org; Wed, 03 Jun 2020 04:12:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgOTE-0000Yl-4D for qemu-devel@nongnu.org; Wed, 03 Jun 2020 04:09:56 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:3995) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgOT9-0000Dh-R1 for qemu-devel@nongnu.org; Wed, 03 Jun 2020 04:09:55 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.15]) by rmmx-syy-dmz-app01-12001 (RichMail) with SMTP id 2ee15ed75ab36a7-8ad9a; Wed, 03 Jun 2020 16:09:24 +0800 (CST) Received: from localhost.localdomain (unknown[112.25.154.146]) by rmsmtp-syy-appsvr08-12008 (RichMail) with SMTP id 2ee85ed75aae43e-61016; Wed, 03 Jun 2020 16:09:24 +0800 (CST) X-RM-TRANSID: 2ee15ed75ab36a7-8ad9a X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee85ed75aae43e-61016 From: Mao Zhongyi To: qemu-devel@nongnu.org Subject: [PATCH 2/9] tests/migration: fix unreachable path in stress test Date: Wed, 3 Jun 2020 16:08:57 +0800 Message-Id: <20200603080904.997083-3-maozhongyi@cmss.chinamobile.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200603080904.997083-1-maozhongyi@cmss.chinamobile.com> References: <20200603080904.997083-1-maozhongyi@cmss.chinamobile.com> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=221.176.66.79; envelope-from=maozhongyi@cmss.chinamobile.com; helo=cmccmta1.chinamobile.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/03 04:09:40 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: Mao Zhongyi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 and stress type to void to make the exit_failure() as the exit function of main(). Signed-off-by: Mao Zhongyi Reviewed-by: Laurent Vivier --- tests/migration/stress.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/migration/stress.c b/tests/migration/stress.c index f9626d50ee..a062ef6b55 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); @@ -186,7 +186,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(); @@ -225,7 +225,7 @@ static void *stressthread(void *arg) return NULL; } =20 -static int stress(unsigned long long ramsizeGB, int ncpus) +static void stress(unsigned long long ramsizeGB, int ncpus) { size_t i; unsigned long long ramsizeMB =3D ramsizeGB * 1024 / ncpus; @@ -238,8 +238,6 @@ static int stress(unsigned long long ramsizeGB, int ncp= us) } =20 stressone(ramsizeMB); - - return 0; } =20 =20 @@ -335,8 +333,7 @@ int main(int argc, char **argv) fprintf(stdout, "%s (%05d): INFO: RAM %llu GiB across %d CPUs\n", argv0, gettid(), ramsizeGB, ncpus); =20 - if (stress(ramsizeGB, ncpus) < 0) - exit_failure(); + stress(ramsizeGB, ncpus); =20 - exit_success(); + exit_failure(); } --=20 2.17.1