All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
To: qemu-devel@nongnu.org
Cc: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Subject: [PATCH 2/9] tests/migration: fix unreachable path in stress test
Date: Wed,  3 Jun 2020 16:08:57 +0800	[thread overview]
Message-ID: <20200603080904.997083-3-maozhongyi@cmss.chinamobile.com> (raw)
In-Reply-To: <20200603080904.997083-1-maozhongyi@cmss.chinamobile.com>

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 <maozhongyi@cmss.chinamobile.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
 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);
 }
 
-static int stressone(unsigned long long ramsizeMB)
+static void stressone(unsigned long long ramsizeMB)
 {
     size_t pagesPerMB = 1024 * 1024 / PAGE_SIZE;
     g_autofree char *ram = g_malloc(ramsizeMB * 1024 * 1024);
@@ -186,7 +186,7 @@ static int stressone(unsigned long long ramsizeMB)
     memset(ram, 0xfe, ramsizeMB * 1024 * 1024);
 
     if (random_bytes(data, PAGE_SIZE) < 0) {
-        return -1;
+        return;
     }
 
     before = now();
@@ -225,7 +225,7 @@ static void *stressthread(void *arg)
     return NULL;
 }
 
-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 = ramsizeGB * 1024 / ncpus;
@@ -238,8 +238,6 @@ static int stress(unsigned long long ramsizeGB, int ncpus)
     }
 
     stressone(ramsizeMB);
-
-    return 0;
 }
 
 
@@ -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);
 
-    if (stress(ramsizeGB, ncpus) < 0)
-        exit_failure();
+    stress(ramsizeGB, ncpus);
 
-    exit_success();
+    exit_failure();
 }
-- 
2.17.1





  parent reply	other threads:[~2020-06-03  8:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03  8:08 [PATCH 0/9] monitor/hmp-cmds: small improvements for migration Mao Zhongyi
2020-06-03  8:08 ` [PATCH 1/9] tests/migration: mem leak fix Mao Zhongyi
2020-06-03  8:08 ` Mao Zhongyi [this message]
2020-06-03  8:08 ` [PATCH 3/9] monitor/hmp-cmds: add units for migrate_parameters Mao Zhongyi
2020-06-03  8:08 ` [PATCH 4/9] monitor/hmp-cmds: don't silently output when running 'migrate_set_downtime' fails Mao Zhongyi
2020-06-03  8:09 ` [PATCH 5/9] monitor/hmp-cmds: delete redundant Error check before invoke hmp_handle_error() Mao Zhongyi
2020-06-11 18:52   ` Dr. David Alan Gilbert
2020-06-03  8:09 ` [PATCH 6/9] monitor/hmp-cmds: add 'goto end' to reduce duplicate code Mao Zhongyi
2020-06-11 18:56   ` Dr. David Alan Gilbert
2020-06-03  8:09 ` [PATCH 7/9] monitor/hmp-cmds: improvements for the 'info migrate' Mao Zhongyi
2020-06-11 18:57   ` Dr. David Alan Gilbert
2020-06-03  8:09 ` [PATCH 8/9] docs/xbzrle: update 'cache miss rate' and 'encoding rate' to docs Mao Zhongyi
2020-06-11 19:00   ` Dr. David Alan Gilbert
2020-06-03  8:09 ` [PATCH 9/9] migration/ram: calculate un/encoded_size only when needed Mao Zhongyi
2020-06-11 19:05   ` Dr. David Alan Gilbert
2020-06-12  3:06     ` [PATCH 9/9] migration/ram: calculate un/encoded_size only whenneeded maozy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200603080904.997083-3-maozhongyi@cmss.chinamobile.com \
    --to=maozhongyi@cmss.chinamobile.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.