On 3/8/21 3:41 PM, Thomas Huth wrote:
On 08/03/2021 15.13, Pierre Morel wrote:
On 3/1/21 4:00 PM, Janosch Frank wrote:
On 3/1/21 12:47 PM, Pierre Morel wrote:
In order to ease the writing of tests based on:
...snip...
-static void test_sense(void)
+static bool do_test_sense(void)
{
struct ccw1 *ccw;
+ bool success = false;
That is a very counter-intuitive name, something like "retval" might be
better.
You're free to use the normal int returns but unfortunately you can't
use the E* error constants like ENOMEM.
hum, I had retval and changed it to success on a proposition of Thomas...
I find it more intuitive as a bool since this function succeed or
fail, no half way and is used for the reporting.
other opinion?
I'd say either "static int ..." + retval (with 0 for success), or
"static bool ..." and "success" (with true for success) ... but "bool" +
"retval" sounds confusing to me.
Thomas
Hum, OK, I think I see were the unsatisfation about this function comes
from. (I do not like it either)
Slowly understanding the benefit of assert() and report_abort() in the
tests cases I will rework this part and do not change the test_senseid()
test.
I will introduce a sense_id() function when needing to do I/O in the
fmt0 test, asserting in this function that all parts already checked in
the preceding tests are functional.
This makes all much shorter and cleaner.
Regards,
Pierre
--
Pierre Morel
IBM Lab Boeblingen