From: linuxtestproject.agent@gmail.com
To: Sachin Sant <sachinp@linux.ibm.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] mem/min_free_kbytes: Fix incorrect pass/fail accounting
Date: Wed, 8 Jul 2026 15:25:34 +0000 [thread overview]
Message-ID: <20260708152534.3979-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260708124205.7409-1-sachinp@linux.ibm.com>
Hi Sachin,
On Wed, 08 Jul 2026 18:12:05 +0530, Sachin Sant wrote:
> mem/min_free_kbytes: Fix incorrect pass/fail accounting
> @@ -57,8 +57,7 @@ static void min_free_kbytes_test(void)
> pid = SAFE_FORK();
> if (pid == 0) {
> /* startup the check monitor */
> - check_monitor();
> - exit(0);
> + exit(check_monitor());
> }
> + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
> + if (WIFEXITED(status) && WEXITSTATUS(status) == 1)
> + tst_res(TFAIL, "MemFree dropped below min_free_kbytes");
> + else
> + tst_res(TFAIL, "check_monitor child failed: %s",
> + tst_strstatus(status));
> + } else {
> + tst_res(TPASS, "min_free_kbytes test pass");
> + }
The fix works in practice, but the design trades one problem for another:
encoding pass/fail as a child exit code and interpreting it in the parent
is explicitly the pattern LTP asks to avoid.
The test already sets .forks_child = 1, so the framework's shared-memory
result propagation is active. tst_res() calls made inside check_monitor()
are automatically visible to the parent's result accounting -- no exit-code
relay needed.
> -static void check_monitor(void)
> +static int check_monitor(void)
> {
> + int violated = 0;
The 'violated' flag is fine for deciding when to emit the TINFO line, but
the TPASS/TFAIL themselves should be emitted by the child rather than
signalled through exit():
if (violated)
tst_res(TFAIL, "MemFree dropped below min_free_kbytes");
else
tst_res(TPASS, "min_free_kbytes test pass");
With that, check_monitor() returns void and the child exits 0 always.
The parent's wait block only needs to guard against truly unexpected
termination (signal, unknown non-zero exit), and must not re-emit a
TPASS/TFAIL for the violation outcome:
SAFE_KILL(pid, SIGUSR1);
SAFE_WAITPID(pid, &status, WUNTRACED | WCONTINUED);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
tst_res(TFAIL, "check_monitor child failed: %s",
tst_strstatus(status));
/* pass/fail already reported by the child */
This also solves the original double-accounting bug because the parent
no longer emits any result for the monitor outcome at all.
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-07-08 15:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 12:42 [LTP] [PATCH] mem/min_free_kbytes: Fix incorrect pass/fail accounting Sachin Sant
2026-07-08 15:25 ` linuxtestproject.agent [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-07-09 4:13 [LTP] [PATCH v2] " Sachin Sant
2026-07-09 6:52 ` [LTP] " linuxtestproject.agent
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=20260708152534.3979-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=ltp@lists.linux.it \
--cc=sachinp@linux.ibm.com \
/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.