All of lore.kernel.org
 help / color / mirror / Atom feed
From: zohar at linux.ibm.com (Mimi Zohar)
Subject: [RFC PATCH 1/2] selftests: Start shell API
Date: Mon, 08 Apr 2019 07:06:02 -0400	[thread overview]
Message-ID: <1554721562.17244.29.camel@linux.ibm.com> (raw)
In-Reply-To: <20190406214915.16914-2-pvorel@suse.cz>

Hi Petr,

On Sat, 2019-04-06 at 23:49 +0200, Petr Vorel wrote:
> kselftest.sh is a beginning of shell API.
> ATM it's a stub (target could be as rich as LTP API), containing only:
> * exit codes
> * filling TEST variable
> * logging functions
> * requiring root function
> * add script directory into PATH
> 
> Inspired by kexec functions (with some cleanup)
> and LTP.
> 
> Signed-off-by: Petr Vorel <pvorel at suse.cz>
> ---
>  tools/testing/selftests/kselftest.sh | 53 ++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
>  create mode 100644 tools/testing/selftests/kselftest.sh
> 
> diff --git a/tools/testing/selftests/kselftest.sh b/tools/testing/selftests/kselftest.sh
> new file mode 100644
> index 000000000000..519ec2707dd8
> --- /dev/null
> +++ b/tools/testing/selftests/kselftest.sh
> @@ -0,0 +1,53 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2019 Petr Vorel <pvorel at suse.cz>
> +
> +PATH="$(dirname $0):$PATH"
> +
> +KSFT_PASS=0
> +KSFT_FAIL=1
> +KSFT_XFAIL=2
> +KSFT_XPASS=3
> +KSFT_SKIP=4

The kexec tests only defined functions for PASS, FAIL, and SKIP.  What
is the difference between KSFT_FAIL and KSFT_XFAIL, and similarly
between KSFT_PASS and KSFT_XPASS?  Either here or above the functions
should be a comment.

> +
> +TEST=$(basename $0)
> +
> +ksft_info()
> +{
> +	echo "[INFO] $TEST: $1"
> +}


The "ksft_" prefix is good.

Mimi

> +ksft_pass()
> +{
> +	echo "[PASS] $TEST: $1"
> +	exit $KSFT_PASS
> +}
> +
> +ksft_fail()
> +{
> +	echo "[FAIL] $TEST: $1"
> +	exit $KSFT_FAIL
> +}
> +
> +ksft_xfail()
> +{
> +	echo "[FAIL] $TEST: $1"
> +	exit $KSFT_XFAIL
> +}

> +ksft_xpass()
> +{
> +	echo "[PASS] $TEST: $1"
> +	exit $KSFT_XPASS
> +}
> +
> +ksft_skip()
> +{
> +	echo "[SKIP] $TEST: $1"
> +	exit $KSFT_SKIP
> +}
> +
> +ksft_require_root()
> +{
> +	[ $(id -ru) -eq 0 ] || ksft_skip "requires root privileges"
> +}

WARNING: multiple messages have this Message-ID
From: zohar@linux.ibm.com (Mimi Zohar)
Subject: [RFC PATCH 1/2] selftests: Start shell API
Date: Mon, 08 Apr 2019 07:06:02 -0400	[thread overview]
Message-ID: <1554721562.17244.29.camel@linux.ibm.com> (raw)
Message-ID: <20190408110602.ZbhHgd2jbggyH2vs2EaUtiD2ejv7qM-oOMl8FPhQD14@z> (raw)
In-Reply-To: <20190406214915.16914-2-pvorel@suse.cz>

Hi Petr,

On Sat, 2019-04-06@23:49 +0200, Petr Vorel wrote:
> kselftest.sh is a beginning of shell API.
> ATM it's a stub (target could be as rich as LTP API), containing only:
> * exit codes
> * filling TEST variable
> * logging functions
> * requiring root function
> * add script directory into PATH
> 
> Inspired by kexec functions (with some cleanup)
> and LTP.
> 
> Signed-off-by: Petr Vorel <pvorel at suse.cz>
> ---
>  tools/testing/selftests/kselftest.sh | 53 ++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
>  create mode 100644 tools/testing/selftests/kselftest.sh
> 
> diff --git a/tools/testing/selftests/kselftest.sh b/tools/testing/selftests/kselftest.sh
> new file mode 100644
> index 000000000000..519ec2707dd8
> --- /dev/null
> +++ b/tools/testing/selftests/kselftest.sh
> @@ -0,0 +1,53 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2019 Petr Vorel <pvorel at suse.cz>
> +
> +PATH="$(dirname $0):$PATH"
> +
> +KSFT_PASS=0
> +KSFT_FAIL=1
> +KSFT_XFAIL=2
> +KSFT_XPASS=3
> +KSFT_SKIP=4

The kexec tests only defined functions for PASS, FAIL, and SKIP.  What
is the difference between KSFT_FAIL and KSFT_XFAIL, and similarly
between KSFT_PASS and KSFT_XPASS?  Either here or above the functions
should be a comment.

> +
> +TEST=$(basename $0)
> +
> +ksft_info()
> +{
> +	echo "[INFO] $TEST: $1"
> +}


The "ksft_" prefix is good.

Mimi

> +ksft_pass()
> +{
> +	echo "[PASS] $TEST: $1"
> +	exit $KSFT_PASS
> +}
> +
> +ksft_fail()
> +{
> +	echo "[FAIL] $TEST: $1"
> +	exit $KSFT_FAIL
> +}
> +
> +ksft_xfail()
> +{
> +	echo "[FAIL] $TEST: $1"
> +	exit $KSFT_XFAIL
> +}

> +ksft_xpass()
> +{
> +	echo "[PASS] $TEST: $1"
> +	exit $KSFT_XPASS
> +}
> +
> +ksft_skip()
> +{
> +	echo "[SKIP] $TEST: $1"
> +	exit $KSFT_SKIP
> +}
> +
> +ksft_require_root()
> +{
> +	[ $(id -ru) -eq 0 ] || ksft_skip "requires root privileges"
> +}

  reply	other threads:[~2019-04-08 11:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-06 21:49 [RFC PATCH 0/2] Kselftest shell (or even C) API pvorel
2019-04-06 21:49 ` Petr Vorel
2019-04-06 21:49 ` [RFC PATCH 1/2] selftests: Start shell API pvorel
2019-04-06 21:49   ` Petr Vorel
2019-04-08 11:06   ` zohar [this message]
2019-04-08 11:06     ` Mimi Zohar
2019-04-08 12:22     ` pvorel
2019-04-08 12:22       ` Petr Vorel
2019-04-08 11:38   ` chrubis
2019-04-08 11:38     ` Cyril Hrubis
2019-04-08 13:07     ` pvorel
2019-04-08 13:07       ` Petr Vorel
2019-04-06 21:49 ` [RFC PATCH 2/2] selftest/kexec: Use kselftest " pvorel
2019-04-06 21:49   ` Petr Vorel
2019-04-08 11:29   ` zohar
2019-04-08 11:29     ` Mimi Zohar
2019-04-08 11:43 ` [RFC PATCH 0/2] Kselftest shell (or even C) API chrubis
2019-04-08 11:43   ` Cyril Hrubis
2019-04-08 13:25   ` pvorel
2019-04-08 13:25     ` Petr Vorel
2019-04-08 12:14 ` zohar
2019-04-08 12:14   ` Mimi Zohar
2019-04-08 12:29   ` pvorel
2019-04-08 12:29     ` Petr Vorel

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=1554721562.17244.29.camel@linux.ibm.com \
    --to=unknown@example.com \
    --subject='Re: [RFC PATCH 1/2] selftests: Start shell API' \
    /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

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.