public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre Morel <pmorel@linux.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>, kvm@vger.kernel.org
Cc: david@redhat.com, thuth@redhat.com, cohuck@redhat.com,
	imbrenda@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH v3 1/5] s390x: css: Store CSS Characteristics
Date: Fri, 26 Feb 2021 14:38:52 +0100	[thread overview]
Message-ID: <c9935059-35d7-c995-d95d-de6a91049eeb@linux.ibm.com> (raw)
In-Reply-To: <6577ebb9-5f61-e70a-cf72-4f428b9db4f4@linux.ibm.com>



On 2/26/21 10:50 AM, Janosch Frank wrote:
> On 2/18/21 6:26 PM, Pierre Morel wrote:

>>   
>> +/*
>> + * CHSC definitions
>> + */
>> +struct chsc_header {
>> +	u16 len;
>> +	u16 code;
> 
> uint*_t types please

OK

> 
>> +};

>> +static int check_response(void *p)
>> +{
>> +	struct chsc_header *h = p;
>> +
>> +	if (h->code == CHSC_RSP_OK) {
>> +		report(1, "CHSC command completed.");
> 
> I'm not a big fan of using integer constants for boolean type arguments.

hum, right, I will rework all these reports that should not appear here
anyway

> 
>> +		return 0;
>> +	}
>> +	if (h->code > CHSC_RSP_MAX)
>> +		h->code = 0;
>> +	report(0, "Response code %04x: %s", h->code, chsc_rsp_description[h->code]);
>> +	return -1;
>> +}
>> +
>> +int chsc(void *p, uint16_t code, uint16_t len)
>> +{
>> +	struct chsc_header *h = p;
>> +	int cc;
>> +
>> +	report_prefix_push("Channel Subsystem Call");
>> +	h->code = code;
>> +	h->len = len;
>> +	cc = _chsc(p);
>> +	switch (cc) {
>> +	case 3:
>> +		report(0, "Subchannel invalid or not enabled.");
>> +		break;
>> +	case 2:
>> +		report(0, "CHSC subchannel busy.");
>> +		break;
>> +	case 1:
>> +		report(0, "Subchannel invalid or not enabled.");
>> +		break;
> 
> I don't think that this is how we want to handle error reporting in lib
> files.
> 
> Please don't use report for library error reporting if it's not needed.
> 
> Most of the times you should return an error code or simply
> abort()/assert() if for instance a library init function fails and you
> can assume that most of the test code is dependent on that librarie's
> initialization. Sometimes report_abort() is also ok.
> 
> Test code should not be part of the library if possible!

Yes, will take care of that.

>>   static struct {
>>   	const char *name;
>>   	void (*func)(void);
>>   } tests[] = {
>> +	/* The css_init test is needed to initialize the CSS Characteristics */
>> +	{ "initialize CSS (chsc)", css_init },
> 
> Is css_init() really a test or does it only setup state for further tests?

Yes it is a test too
I rework that.

> 
>>   	{ "enumerate (stsch)", test_enumerate },
>>   	{ "enable (msch)", test_enable },
>>   	{ "sense (ssch/tsch)", test_sense },
>>
> 

-- 
Pierre Morel
IBM Lab Boeblingen

  reply	other threads:[~2021-02-26 13:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 17:26 [kvm-unit-tests PATCH v3 0/5] CSS Mesurement Block Pierre Morel
2021-02-18 17:26 ` [kvm-unit-tests PATCH v3 1/5] s390x: css: Store CSS Characteristics Pierre Morel
2021-02-26  9:50   ` Janosch Frank
2021-02-26 13:38     ` Pierre Morel [this message]
2021-02-18 17:26 ` [kvm-unit-tests PATCH v3 2/5] s390x: css: simplifications of the tests Pierre Morel
2021-02-18 17:26 ` [kvm-unit-tests PATCH v3 3/5] s390x: css: implementing Set CHannel Monitor Pierre Morel
2021-02-23 13:22   ` Cornelia Huck
2021-02-23 15:43     ` Pierre Morel
2021-02-18 17:26 ` [kvm-unit-tests PATCH v3 4/5] s390x: css: testing measurement block format 0 Pierre Morel
2021-02-23 13:27   ` Cornelia Huck
2021-02-23 15:49     ` Pierre Morel
2021-02-23 16:05       ` Cornelia Huck
2021-02-18 17:26 ` [kvm-unit-tests PATCH v3 5/5] s390x: css: testing measurement block format 1 Pierre Morel
2021-02-23 13:29   ` Cornelia Huck
2021-02-23 15:52     ` Pierre Morel
2021-02-26 10:02   ` Janosch Frank
2021-02-26 13:34     ` 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=c9935059-35d7-c995-d95d-de6a91049eeb@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