[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <caf314b0-c090-26e6-3593-cb23aab1cbe3@gmail.com>
Date: Sun, 9 Aug 2020 20:41:24 +0530
From: Arpitha Raghunandan <98.arpi@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: brendanhiggins@...gle.com, skhan@...uxfoundation.org,
kunit-dev@...glegroups.com, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] lib: Convert test_hexdump.c to KUnit
On 06/08/20 3:35 pm, Andy Shevchenko wrote:
> On Thu, Aug 06, 2020 at 03:14:40PM +0530, Arpitha Raghunandan wrote:
>> Converts test lib/test_hexdump.c to KUnit.
>> More information about KUnit can be found at
>> https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html.
>> KUnit provides a common framework for unit tests in the kernel.
>
> ...
>
>> - if (memcmp(test, real, TEST_HEXDUMP_BUF_SIZE)) {
>> - pr_err("Len: %zu row: %d group: %d\n", len, rowsize, groupsize);
>> - pr_err("Result: '%s'\n", real);
>> - pr_err("Expect: '%s'\n", test);
>> - failed_tests++;
>> - }
>> + KUNIT_EXPECT_EQ(kunittest, 0, memcmp(test, real, TEST_HEXDUMP_BUF_SIZE));
>
>
> Ah, can you explain how user will see now what is being expected and what is in
> reality in the buffer? I'm not gonna accept such changes without showing in
> explicitly that user is not going to suffer of this change.
>
I have sent another patch replacing KUNIT_EXPECT_EQ() with KUNIT_EXPECT_EQ_MSG() and KUNIT_EXPECT_NE() with KUNIT_EXPECT_NE_MSG(). These methods log what is being expected and what is in reality in the buffer in case of test failure similar to the original test.
Powered by blists - more mailing lists