]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
kunit: fix display of failed expectations for strings
authorDaniel Latypov <dlatypov@google.com>
Mon, 2 Nov 2020 23:23:04 +0000 (15:23 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Dec 2020 07:51:49 +0000 (08:51 +0100)
[ Upstream commit 3084db0e0d5076cd48408274ab0911cd3ccdae88 ]

Currently the following expectation
  KUNIT_EXPECT_STREQ(test, "hi", "bye");
will produce:
  Expected "hi" == "bye", but
      "hi" == 1625079497
      "bye" == 1625079500

After this patch:
  Expected "hi" == "bye", but
      "hi" == hi
      "bye" == bye

KUNIT_INIT_BINARY_STR_ASSERT_STRUCT() was written but just mistakenly
not actually used by KUNIT_EXPECT_STREQ() and friends.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Tested-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/kunit/test.h

index 59f3144f009a5ddd93e7168da28c1e86719045a7..b68ba33c169374a60a019359b9795bf7b0f98e7d 100644 (file)
@@ -1064,7 +1064,7 @@ do {                                                                             \
        KUNIT_ASSERTION(test,                                                  \
                        strcmp(__left, __right) op 0,                          \
                        kunit_binary_str_assert,                               \
-                       KUNIT_INIT_BINARY_ASSERT_STRUCT(test,                  \
+                       KUNIT_INIT_BINARY_STR_ASSERT_STRUCT(test,              \
                                                        assert_type,           \
                                                        #op,                   \
                                                        #left,                 \