Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: Dominique Leuenberger <dleuenberger@suse.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/1] select03: Fix false positive on TCONF
Date: Wed, 13 Nov 2024 16:17:01 +0100	[thread overview]
Message-ID: <20241113151701.GD162955@pevik> (raw)
In-Reply-To: <ZzS1xaQp1xKcHagu@yuki.lan>

> Hi!
> > > I think that the main mistake here is that I kept the code in
> > > tst_vbrk_() that exits the test with a return value in the case of a
> > > child processes.

> > I suppose you talk about in tst_vbrk_ (lib/tst_test.c):

> > 	if (getpid() == lib_pid)
> > 		do_exit(TTYPE_RESULT(ttype));

> That one should stay, that is the overall exit value from the test.

> There is one below that that should be replaced with exit(0).

> > > So ideal fix would be to change the test library not to
> > > do that,

> > So would you just do_exit(0) or even just exit(0)?
> > Or exit 0 for TPASS or TCONF and 1 otherwise (TBROK, TFAIL, TWARN)? Or what
> > exactly did you meant?

> Anything but the main library process would do exit(0).

Ah, thx for info. Makes sense to me.

> > Other option could be to keep library as is and have a custm functions which
> > "translate" LTP exit codes. I was thinking something like this:

> > bool tst_exit_status(int status)
> > {
> > 	if (!WEXITSTATUS(status))
> > 		return false;

> > 	if (WEXITSTATUS(status) == TPASS || WEXITSTATUS(status) == TCONF)
> > 		return true;

> > 	return false;
> > }

> > But we actually have check_child_status(pid_t pid, int status) for this:

> > static void check_child_status(pid_t pid, int status)
> > {
> > 	int ret;

> > 	if (WIFSIGNALED(status)) {
> > 		tst_brk(TBROK, "Child (%i) killed by signal %s", pid,
> > 			tst_strsig(WTERMSIG(status)));
> > 	}

> > 	if (!(WIFEXITED(status)))
> > 		tst_brk(TBROK, "Child (%i) exited abnormally", pid);

> > 	ret = WEXITSTATUS(status);
> > 	switch (ret) {
> > 	case TPASS:
> > 	case TBROK:
> > 	case TCONF:
> > 	break;
> > 	default:
> > 		tst_brk(TBROK, "Invalid child (%i) exit value %i", pid, ret);
> > 	}
> > }

> > BTW I'm surprised that there is TBROK whitelisted.

> That just checks for valid exit status.

OK. Shouldn't be here TFAIL as well (or even TWARN)?

> > > but that would require a bit more work, especially we would
> > > have to look at all WAITPID() usages in newlib tests and make sure that
> > > there are not tests that depends on such behavior. If there are none it
> > > would stil require a few changes in the test library.

> > Well, what I fear more is to broke even more tests :). But if you consider is
> > useful enough I can do the cleanup.

> The change would allow us to implement things like tst_brk(TFAIL, ...)
> and tst_brk(TPASS, ...) correctly. The problem is that the result from
> children after tst_brk() is propagated as a return value. What we need
> instead is to add an abort flag to the results structure.

Ah, now I see why you want to do it properly. Makes sense.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-11-13 15:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13 10:59 [LTP] [PATCH 1/1] select03: Fix false positive on TCONF Petr Vorel
2024-11-13 11:29 ` Wei Gao via ltp
2024-11-13 11:29 ` Avinesh Kumar
2024-11-13 13:39 ` Cyril Hrubis
2024-11-13 14:07   ` Petr Vorel
2024-11-13 14:20     ` Cyril Hrubis
2024-11-13 15:17       ` Petr Vorel [this message]
2024-11-14 11:18         ` Petr Vorel
2024-11-13 13:46 ` Martin Doucha
2024-11-13 14:04   ` Cyril Hrubis

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=20241113151701.GD162955@pevik \
    --to=pvorel@suse.cz \
    --cc=chrubis@suse.cz \
    --cc=dleuenberger@suse.com \
    --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