kunit: test: Log the correct filter string in executor_test
authorDavid Gow <davidgow@google.com>
Wed, 21 Feb 2024 09:27:14 +0000 (17:27 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 27 Feb 2024 22:25:50 +0000 (15:25 -0700)
KUnit's executor_test logs the filter string in KUNIT_ASSERT_EQ_MSG(),
but passed a random character from the filter, rather than the whole
string.

This was found by annotating KUNIT_ASSERT_EQ_MSG() to let gcc validate
the format string.

Fixes: 76066f93f1df ("kunit: add tests for filtering attributes")
Signed-off-by: David Gow <davidgow@google.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Rae Moar <rmoar@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/executor_test.c

index 22d4ee86dbedde1c477ee1cd1ed68cbc2b999d23..3f7f967e3688ee0de7e0e883c858bee2c2e9f683 100644 (file)
@@ -129,7 +129,7 @@ static void parse_filter_attr_test(struct kunit *test)
                        GFP_KERNEL);
        for (j = 0; j < filter_count; j++) {
                parsed_filters[j] = kunit_next_attr_filter(&filter, &err);
-               KUNIT_ASSERT_EQ_MSG(test, err, 0, "failed to parse filter '%s'", filters[j]);
+               KUNIT_ASSERT_EQ_MSG(test, err, 0, "failed to parse filter from '%s'", filters);
        }
 
        KUNIT_EXPECT_STREQ(test, kunit_attr_filter_name(parsed_filters[0]), "speed");