From: Andrew Jones Date: Tue, 5 Mar 2024 13:16:53 +0100 Subject: [PATCH 4/6] riscv: Enable gen_report() to print the wrong value in case of test failure In-Reply-To: References: <20240229124246.309304-1-cem@kernel.org> <20240229124246.309304-5-cem@kernel.org> <20240301-6bcfc030d90fa055b8192386@orel> Message-ID: <20240305-513a395546dfde01c6b08a99@orel> List-Id: To: kvm-riscv@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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