Re: [kvm-unit-tests PATCH v8 10/12] s390x: css: stsch, enumeration test

Cornelia Huck
2020-06-10T15:54:41Z

On Tue, 9 Jun 2020 14:20:35 +0200
Pierre Morel <pmorel@linux.ibm.com> wrote:

> On 2020-06-09 09:39, Thomas Huth wrote:
> > On 08/06/2020 10.12, Pierre Morel wrote:

> >> +static void test_enumerate(void)
> >> +{
> >> + test_device_sid = css_enumerate();
> >> + if (test_device_sid & SCHID_ONE) {
> >> + report(1, "First device schid: 0x%08x", test_device_sid);
> >> + return;
> >> + }
> >> +
> >> + switch (test_device_sid) {
> >> + case 0:
> >> + report (0, "No I/O device found");
> >> + break;
> >> + default: /* 1 or 2 should never happened for STSCH */
> >> + report(0, "Unexpected cc=%d during enumeration",
> >> + test_device_sid);
> >> + return;
> >> + }
> >
> > Ok, so here is now the test failure for the cc=1 or 2 that should never
> > happen. That means currently you print out the CC for this error twice.
> > One time should be enough, either here, or use an report_abort() in the
> > css_enumerate(), I'd say.
> >
> > Anyway, can you please replace this switch statement with a "if
> > (!test_device_sid)" instead? Or do you plan to add more "case"
> > statements later?
>
> I will use the repor_abort() in the css_enumerate() so there
> is only two case, I find a channel or not, so I don't even need the
> second if :) .

Yeah, testing only for SCHID_ONE present or not makes this a lot less
confusing.