public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre Morel <pmorel@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com,
	cohuck@redhat.com, imbrenda@linux.ibm.com
Subject: [kvm-unit-tests PATCH v3 03/16] s390x: css: simplify skipping tests on no device
Date: Tue,  6 Apr 2021 09:40:40 +0200	[thread overview]
Message-ID: <1617694853-6881-4-git-send-email-pmorel@linux.ibm.com> (raw)
In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com>

We will have to test if a device is present for every tests
in the future.
Let's provide separate the first tests from the test loop and
skip the remaining tests if no device is present.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 s390x/css.c | 36 ++++++++++++++----------------------
 1 file changed, 14 insertions(+), 22 deletions(-)

diff --git a/s390x/css.c b/s390x/css.c
index c340c53..17a6e1d 100644
--- a/s390x/css.c
+++ b/s390x/css.c
@@ -41,11 +41,6 @@ static void test_enable(void)
 {
 	int cc;
 
-	if (!test_device_sid) {
-		report_skip("No device");
-		return;
-	}
-
 	cc = css_enable(test_device_sid, IO_SCH_ISC);
 
 	report(cc == 0, "Enable subchannel %08x", test_device_sid);
@@ -62,11 +57,6 @@ static void test_sense(void)
 	int ret;
 	int len;
 
-	if (!test_device_sid) {
-		report_skip("No device");
-		return;
-	}
-
 	ret = css_enable(test_device_sid, IO_SCH_ISC);
 	if (ret) {
 		report(0, "Could not enable the subchannel: %08x",
@@ -218,11 +208,6 @@ 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;
-	}
-
 	/* Allocate zeroed Measurement block */
 	mb0 = alloc_io_mem(shared_mb_size, 0);
 	if (!mb0) {
@@ -289,11 +274,6 @@ static void test_schm_fmt1(void)
 {
 	struct measurement_block_format1 *mb1;
 
-	if (!test_device_sid) {
-		report_skip("No device");
-		return;
-	}
-
 	if (!css_test_general_feature(CSSC_EXTENDED_MEASUREMENT_BLOCK)) {
 		report_skip("Extended measurement block not available");
 		return;
@@ -336,8 +316,6 @@ static struct {
 	void (*func)(void);
 } tests[] = {
 	/* The css_init test is needed to initialize the CSS Characteristics */
-	{ "initialize CSS (chsc)", css_init },
-	{ "enumerate (stsch)", test_enumerate },
 	{ "enable (msch)", test_enable },
 	{ "sense (ssch/tsch)", test_sense },
 	{ "measurement block (schm)", test_schm },
@@ -352,11 +330,25 @@ int main(int argc, char *argv[])
 
 	report_prefix_push("Channel Subsystem");
 	enable_io_isc(0x80 >> IO_SCH_ISC);
+
+	report_prefix_push("initialize CSS (chsc)");
+	css_init();
+	report_prefix_pop();
+
+	report_prefix_push("enumerate (stsch)");
+	test_enumerate();
+	report_prefix_pop();
+
+	if (!test_device_sid)
+		goto end;
+
 	for (i = 0; tests[i].name; i++) {
 		report_prefix_push(tests[i].name);
 		tests[i].func();
 		report_prefix_pop();
 	}
+
+end:
 	report_prefix_pop();
 
 	return report_summary();
-- 
2.17.1


  parent reply	other threads:[~2021-04-06  7:41 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06  7:40 [kvm-unit-tests PATCH v3 00/16] s390x: Testing SSCH, CSCH and HSCH for errors Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 01/16] s390x: lib: css: disabling a subchannel Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 02/16] s390x: lib: css: SCSW bit definitions Pierre Morel
2021-04-06  7:40 ` Pierre Morel [this message]
2021-04-06 12:44   ` [kvm-unit-tests PATCH v3 03/16] s390x: css: simplify skipping tests on no device Cornelia Huck
2021-04-07 10:53     ` Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 04/16] s390x: lib: css: separate wait for IRQ and check I/O completion Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 05/16] s390x: lib: css: add SCSW ctrl expectations to " Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 06/16] s390x: lib: css: checking I/O errors Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 07/16] s390x: css: testing ssch errors Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 08/16] s390x: css: ssch check for cpa zero Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 09/16] s390x: css: ssch with mis aligned ORB Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 10/16] s390x: css: ssch checking addressing errors Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 11/16] s390x: css: No support for MIDAW Pierre Morel
2021-04-06 15:58   ` Cornelia Huck
2021-04-07 10:06     ` Pierre Morel
2021-04-07 10:14       ` Cornelia Huck
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 12/16] s390x: css: Check ORB reserved bits Pierre Morel
2021-04-06 15:51   ` Cornelia Huck
2021-04-07 10:07     ` Pierre Morel
2021-04-07 10:15       ` Cornelia Huck
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 13/16] s390x: css: checking for CSS extensions Pierre Morel
2021-04-06 15:50   ` Cornelia Huck
2021-04-07 10:42     ` Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 14/16] s390x: css: issuing SSCH when the channel is status pending Pierre Morel
2021-04-06 15:34   ` Cornelia Huck
2021-04-07 10:46     ` Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 15/16] s390x: css: testing halt subchannel Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 16/16] s390x: css: testing clear subchannel Pierre Morel
2021-04-06 12:21 ` [kvm-unit-tests PATCH v3 00/16] s390x: Testing SSCH, CSCH and HSCH for errors 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=1617694853-6881-4-git-send-email-pmorel@linux.ibm.com \
    --to=pmorel@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --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