[PATCH 4/6] riscv: Enable gen_report() to print the wrong value in case of test failure

Andrew Jones ajones at ventanamicro.com
Tue Mar 5 04:16:53 PST 2024


On Tue, Mar 05, 2024 at 09:05:31AM +0100, Carlos Maiolino wrote:
> > 
> > We want to keep the output line consistent for both pass and fail
> > in order to simplify parsing. But, since the expected value is
> > variable, depending on the SBI implementation under test, it's
> > probably best not to put the numbers in the pass/fail line, but as
> > info. So how about
> > 
> >  static void gen_report(struct sbiret *ret,
> >                         long expected_error, long expected_value)
> >  {
> >      report_info("expected (error: %ld, value: %ld), received: (error: %ld, value: %ld)",
> >                  expected_error, expected_value, ret->error, ret->value);
> >      report(ret->error == expected_error, "expected sbi.error");
> >      report(ret->value == expected_value, "expected sbi.value");
> >  }
> 
> Something just came up to my mind while implementing this.
> 
> I agree with the use of report_info() here, but I still think this could be
> under a conditional to only print it when we have something different from the
> expectations. I particularly don't see much value in printing the report_info if
> nothing unexpected, but maybe I'm wrong?

I don't mind either way. report_info() is for human readers, so parsers
should ignore them and not freak out when they appear or disappear. Not
cluttering the output by removing useless info sounds good to me, but
also not cluttering the code, by not adding unnecessary logic, sounds
good to me. So, it's up to you :-)

Thanks,
drew



More information about the kvm-riscv mailing list