On 5/20/24 22:12, Rae Moar wrote:
On Thu, May 16, 2024 at 11:17 PM Ivan Orlov ivan.orlov0322@gmail.com wrote:
There are multiple assertion formatting functions in the `assert.c` file, which are not covered with tests yet. Implement the KUnit test for these functions.
The test consists of 11 test cases for the following functions:
- 'is_literal'
- 'is_str_literal'
- 'kunit_assert_prologue', test case for multiple assert types
- 'kunit_assert_print_msg'
- 'kunit_unary_assert_format'
- 'kunit_ptr_not_err_assert_format'
- 'kunit_binary_assert_format'
- 'kunit_binary_ptr_assert_format'
- 'kunit_binary_str_assert_format'
- 'kunit_assert_hexdump'
- 'kunit_mem_assert_format'
The test aims at maximizing the branch coverage for the assertion formatting functions.
As you can see, it covers some of the static helper functions as well, so mark the static functions in `assert.c` as 'VISIBLE_IF_KUNIT' and conditionally export them with EXPORT_SYMBOL_IF_KUNIT. Add the corresponding definitions to `assert.h`.
Build the assert test when CONFIG_KUNIT_TEST is enabled, similar to how it is done for the string stream test.
Signed-off-by: Ivan Orlov ivan.orlov0322@gmail.com
Hi! This looks great to me!
Reviewed-by: Rae Moar rmoar@google.com
Hi Rae,
Thank you so much for the review and sorry for the late reply :)