mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>,  Adrian Reber <areber@redhat.com>
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: tools/testing/selftests/clone3/clone3_set_tid.c appears to always pass?
Date: Thu, 18 Apr 2024 13:09:45 +0200	[thread overview]
Message-ID: <20240418-hiebe-bahnt-066312cb324b@brauner> (raw)
In-Reply-To: <20240417152222.GA1517581@dev-arch.thelio-3990X>

On Wed, Apr 17, 2024 at 08:22:22AM -0700, Nathan Chancellor wrote:
> Hi Christian,
> 
> I am looking at tools/testing/selftests/clone3/clone3_set_tid.c as part
> of a patch to clean up the uses of 'return ksft_exit_...();' throughout
> the selftests (as they call exit() so they do not return) and I noticed
> that it seems to always pass even when there may have been an error?
> 
>       if (waitpid(ns_pid, &status, 0) < 0) {
>           ksft_print_msg("Child returned %s\n", strerror(errno));
>           ret = -errno;
>           goto out;
>       }
> 
>       ...
>   out:
>       ret = 0;
> 
>       return !ret ? ksft_exit_pass() : ksft_exit_fail();
>   }
> 
> Should the ret and out label positions be switched? Alternatively, it
> seems like ret and out do not have that many uses, perhaps it would just
> be better to call the ksft_exit_...() directly in their respective
> paths? I am not going to touch it as part of my patch but I felt it was
> worth reporting since it appears to have been there since the
> introduction of this test in commit 41585bbeeef9 ("selftests: add tests
> for clone3() with *set_tid").

Uh, good point. Let me Cc the original author.

      reply	other threads:[~2024-04-18 11:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 15:22 Nathan Chancellor
2024-04-18 11:09 ` Christian Brauner [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=20240418-hiebe-bahnt-066312cb324b@brauner \
    --to=brauner@kernel.org \
    --cc=areber@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=nathan@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®