public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Pierre Morel <pmorel@linux.ibm.com>
Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com,
	thuth@redhat.com, cohuck@redhat.com
Subject: Re: [kvm-unit-tests PATCH v2 3/8] s390x: css: simplify skipping tests on no device
Date: Thu, 25 Mar 2021 16:21:34 +0100	[thread overview]
Message-ID: <20210325162134.3f2f3f9e@ibm-vm> (raw)
In-Reply-To: <1616665147-32084-4-git-send-email-pmorel@linux.ibm.com>

On Thu, 25 Mar 2021 10:39:02 +0100
Pierre Morel <pmorel@linux.ibm.com> wrote:

> We will lhave to test if a device is present for every tests
> in the future.
> Let's provide a macro to check if the device is present and
> to skip the tests if it is not.
> 
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>  s390x/css.c | 27 +++++++++++----------------
>  1 file changed, 11 insertions(+), 16 deletions(-)
> 
> diff --git a/s390x/css.c b/s390x/css.c
> index c340c53..16723f6 100644
> --- a/s390x/css.c
> +++ b/s390x/css.c
> @@ -27,6 +27,13 @@ static int test_device_sid;
>  static struct senseid *senseid;
>  struct ccw1 *ccw;
>  
> +#define NODEV_SKIP(dev) do {
> 	\
> +				if (!(dev)) {
> 	\
> +					report_skip("No
> device");	\
> +					return;
> 		\
> +				}
> 	\
> +			} while (0)

I wonder if you can add for example which device is not present (might
help with debugging)

in any case:

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

>  static void test_enumerate(void)
>  {
>  	test_device_sid = css_enumerate();
> @@ -41,10 +48,7 @@ static void test_enable(void)
>  {
>  	int cc;
>  
> -	if (!test_device_sid) {
> -		report_skip("No device");
> -		return;
> -	}
> +	NODEV_SKIP(test_device_sid);
>  
>  	cc = css_enable(test_device_sid, IO_SCH_ISC);
>  
> @@ -62,10 +66,7 @@ static void test_sense(void)
>  	int ret;
>  	int len;
>  
> -	if (!test_device_sid) {
> -		report_skip("No device");
> -		return;
> -	}
> +	NODEV_SKIP(test_device_sid);
>  
>  	ret = css_enable(test_device_sid, IO_SCH_ISC);
>  	if (ret) {
> @@ -218,10 +219,7 @@ static void test_schm_fmt0(void)
>  	struct measurement_block_format0 *mb0;
>  	int shared_mb_size = 2 * sizeof(struct
> measurement_block_format0); 
> -	if (!test_device_sid) {
> -		report_skip("No device");
> -		return;
> -	}
> +	NODEV_SKIP(test_device_sid);
>  
>  	/* Allocate zeroed Measurement block */
>  	mb0 = alloc_io_mem(shared_mb_size, 0);
> @@ -289,10 +287,7 @@ static void test_schm_fmt1(void)
>  {
>  	struct measurement_block_format1 *mb1;
>  
> -	if (!test_device_sid) {
> -		report_skip("No device");
> -		return;
> -	}
> +	NODEV_SKIP(test_device_sid);
>  
>  	if
> (!css_test_general_feature(CSSC_EXTENDED_MEASUREMENT_BLOCK)) {
> report_skip("Extended measurement block not available");


  reply	other threads:[~2021-03-25 16:05 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25  9:38 [kvm-unit-tests PATCH v2 0/8] Testing SSCH, CSCH and HSCH for errors Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 1/8] s390x: lib: css: disabling a subchannel Pierre Morel
2021-03-25 14:52   ` Claudio Imbrenda
2021-03-25 16:10     ` Pierre Morel
2021-03-26  8:26   ` Janosch Frank
2021-03-26  9:02     ` Pierre Morel
2021-03-29  8:00   ` Thomas Huth
2021-03-29 12:33     ` Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 2/8] s390x: lib: css: SCSW bit definitions Pierre Morel
2021-03-25 15:00   ` Claudio Imbrenda
2021-03-25 16:13     ` Pierre Morel
2021-03-29  8:09   ` Thomas Huth
2021-03-29 12:25     ` Pierre Morel
2021-03-30 11:49   ` Cornelia Huck
2021-03-30 12:59     ` Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 3/8] s390x: css: simplify skipping tests on no device Pierre Morel
2021-03-25 15:21   ` Claudio Imbrenda [this message]
2021-03-25 16:21     ` Pierre Morel
2021-03-26  8:41   ` Janosch Frank
2021-03-26  9:04     ` Pierre Morel
2021-03-29  8:19   ` Thomas Huth
2021-03-29 12:39     ` Pierre Morel
2021-03-29 12:50     ` Pierre Morel
2021-03-30 11:52       ` Cornelia Huck
2021-03-30 12:58         ` Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 4/8] s390x: lib: css: separate wait for IRQ and check I/O completion Pierre Morel
2021-03-25 15:24   ` Claudio Imbrenda
2021-03-25 16:23     ` Pierre Morel
2021-03-29  8:21   ` Thomas Huth
2021-03-29 11:00     ` Pierre Morel
2021-03-30 11:57   ` Cornelia Huck
2021-03-30 12:57     ` Pierre Morel
2021-04-01  8:24   ` Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 5/8] s390x: lib: css: add SCSW ctrl expectations to " Pierre Morel
2021-03-25 15:40   ` Claudio Imbrenda
2021-03-29  8:27   ` Thomas Huth
2021-03-29  8:32     ` Thomas Huth
2021-03-29 11:01       ` Pierre Morel
2021-03-29 11:02     ` Pierre Morel
2021-03-30 12:10   ` Cornelia Huck
2021-03-30 12:54     ` Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 6/8] s390x: css: testing ssch error response Pierre Morel
2021-03-25 16:02   ` Claudio Imbrenda
2021-03-25 17:23     ` Pierre Morel
2021-03-26 10:41     ` Pierre Morel
2021-03-26 10:58       ` Claudio Imbrenda
2021-03-29  7:42         ` Pierre Morel
2021-03-30 13:01           ` Pierre Morel
2021-03-29  9:40   ` Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 7/8] s390x: css: testing halt subchannel Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 8/8] s390x: css: testing clear subchannel Pierre Morel

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=20210325162134.3f2f3f9e@ibm-vm \
    --to=imbrenda@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pmorel@linux.ibm.com \
    --cc=thuth@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox