public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 3/3 v2] getrusage: Cleanup and bugfix for getrusage03
Date: Fri, 18 Jun 2021 20:04:47 +0200	[thread overview]
Message-ID: <YMzgP1kOP/LgfKEU@yuki> (raw)
In-Reply-To: <021a65c83ac448e882077e7dabe1667b@huawei.com>

Hi!
Pushed, thanks.

I had to add another fix for the -i parameter.

When the test was executed in a loop it was failing on subsequent
iterations because it expects that the initiali maxrss is 100MB.

So in order to fix that I had to change the run() function, now each
test runs in its own process and starts with a child that consumes
100MB.

Diff:

diff --git a/testcases/kernel/syscalls/getrusage/getrusage03.c b/testcases/kernel/syscalls/getrusage/getrusage03.c
index f72f908dc..ef2f62a18 100644
--- a/testcases/kernel/syscalls/getrusage/getrusage03.c
+++ b/testcases/kernel/syscalls/getrusage/getrusage03.c
@@ -161,12 +161,16 @@ void (*testfunc_list[])(void) = {

 static void run(unsigned int i)
 {
-       testfunc_list[i]();
-}
+       if (!SAFE_FORK()) {
+               if (!SAFE_FORK()) {
+                       consume_mb(100);
+                       exit(0);
+               }

-static void setup(void)
-{
-       consume_mb(100);
+               SAFE_WAIT(NULL);
+
+               testfunc_list[i]();
+       }
 }

 static struct tst_test test = {
@@ -177,7 +181,6 @@ static struct tst_test test = {
        .tags = (const struct tst_tag[]) {
                {"linux-git", "1f10206cf8e9"},
        },
-       .setup = setup,
        .test = run,
        .tcnt = ARRAY_SIZE(testfunc_list),
 };

-- 
Cyril Hrubis
chrubis@suse.cz

      reply	other threads:[~2021-06-18 18:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 10:55 [LTP] [PATCH 0/3 v2] Cleanup and bugfix for getrusage03 Xie Ziyao
2021-06-17 10:55 ` [LTP] [PATCH 1/3 v2] lib: tst_process_state: Use SPDX and format alignment Xie Ziyao
2021-06-18 11:46   ` Cyril Hrubis
2021-06-17 10:55 ` [LTP] [PATCH 2/3 v2] lib: tst_process_state: Add tst_process_exit_wait() Xie Ziyao
2021-06-18 11:53   ` Cyril Hrubis
2021-06-17 10:55 ` [LTP] [PATCH 3/3 v2] getrusage: Cleanup and bugfix for getrusage03 Xie Ziyao
2021-06-18 12:20   ` Cyril Hrubis
2021-06-18 13:16     ` xieziyao
2021-06-18 18:04       ` Cyril Hrubis [this message]

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=YMzgP1kOP/LgfKEU@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox