linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Anders Roxell <anders.roxell@linaro.org>
To: shuah@kernel.org
Cc: fenghua.yu@intel.com, reinette.chatre@intel.com,
	john.stultz@linaro.org,  tglx@linutronix.de,
	akpm@linux-foundation.org, nathan@kernel.org,
	 ndesaulniers@google.com, linux-kernel@vger.kernel.org,
	 linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
	llvm@lists.linux.dev,  christian@brauner.io
Subject: Re: [PATCH v3 2/2] selftests: clone3: simplify return logic in clone3_set_tid()
Date: Thu, 18 Nov 2021 11:03:25 +0100	[thread overview]
Message-ID: <CADYN=9+drOj6rVjBhB-jVQ+UXgw3ue0tz04ejHih7qRhL6Km1A@mail.gmail.com> (raw)
In-Reply-To: <20211118095852.616256-2-anders.roxell@linaro.org>

On Thu, 18 Nov 2021 at 10:58, Anders Roxell <anders.roxell@linaro.org> wrote:
>
> Use ksft_exit_* and exit instead of using goto.
>

I'm sorry, I should have added Nick to this patch, since he suggested it.

Suggested-by: Nick Desaulniers <ndesaulniers@google.com>

Cheers,
Anders

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>  tools/testing/selftests/clone3/clone3_set_tid.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/tools/testing/selftests/clone3/clone3_set_tid.c b/tools/testing/selftests/clone3/clone3_set_tid.c
> index a755fcd3af89..1b950c3c3b7c 100644
> --- a/tools/testing/selftests/clone3/clone3_set_tid.c
> +++ b/tools/testing/selftests/clone3/clone3_set_tid.c
> @@ -250,7 +250,8 @@ int main(int argc, char *argv[])
>                  * that all those tests are skipped as non-root.
>                  */
>                 ksft_cnt.ksft_xskip += ksft_plan - ksft_test_num();
> -               goto out;
> +               ksft_exit_skip(
> +                       "Please run the remaining tests as root - Exiting.\n");
>         }
>
>         /* Find the current active PID */
> @@ -371,9 +372,7 @@ int main(int argc, char *argv[])
>         close(pipe_2[1]);
>
>         if (waitpid(ns_pid, &status, 0) < 0) {
> -               ksft_print_msg("Child returned %s\n", strerror(errno));
> -               ret = -errno;
> -               goto out;
> +               ksft_exit_fail_msg("Child returned %s\n", strerror(errno));
>         }
>
>         if (!WIFEXITED(status))
> @@ -390,10 +389,6 @@ int main(int argc, char *argv[])
>                 ksft_test_result_fail(
>                         "PIDs in all namespaces not as expected (%d,%d,%d)\n",
>                         ns3, ns2, ns1);
> -out:
> -       ret = 0;
>
> -       if (ret)
> -               ksft_exit_fail();
>         ksft_exit_pass();
>  }
> --
> 2.33.0
>


  reply	other threads:[~2021-11-18 10:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03  9:47 [PATCHv2] selftests: kselftest.h: mark functions with 'noreturn' Anders Roxell
2021-11-03 18:38 ` Nick Desaulniers
2021-11-17 11:01   ` Anders Roxell
2021-11-17 13:40     ` Shuah Khan
2021-11-18  9:58     ` [PATCH v3 1/2] " Anders Roxell
2021-11-18  9:58       ` [PATCH v3 2/2] selftests: clone3: simplify return logic in clone3_set_tid() Anders Roxell
2021-11-18 10:03         ` Anders Roxell [this message]
2021-11-18 18:43           ` Nick Desaulniers
2021-11-18 18:40       ` [PATCH v3 1/2] selftests: kselftest.h: mark functions with 'noreturn' Nick Desaulniers
2021-11-18 18:41         ` Nick Desaulniers
2021-11-19 23:35       ` Shuah Khan

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='CADYN=9+drOj6rVjBhB-jVQ+UXgw3ue0tz04ejHih7qRhL6Km1A@mail.gmail.com' \
    --to=anders.roxell@linaro.org \
    --cc=akpm@linux-foundation.org \
    --cc=christian@brauner.io \
    --cc=fenghua.yu@intel.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    /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