From: Vitor Massaru Iha <vitor@massaru.org> To: kunit-dev@googlegroups.com Cc: linux-kernel-mentees@lists.linuxfoundation.org, brendanhiggins@google.com, linux-kselftest@vger.kernel.org Subject: [Linux-kernel-mentees] [PATCH] kunit: fix: kunit_binary_assert_format() only prints signed int Date: Wed, 19 Aug 2020 16:46:34 -0300 [thread overview] Message-ID: <20200819194634.68976-1-vitor@massaru.org> (raw) Some tests, such as overflow_kunit(), uses unsigned int, But kunit_binary_assert_format() only prints signed int, this commit also deals with the unsigned int print. Signed-off-by: Vitor Massaru Iha <vitor@massaru.org> --- lib/kunit/assert.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/kunit/assert.c b/lib/kunit/assert.c index 202f9fdeed0e..3ae90c09986a 100644 --- a/lib/kunit/assert.c +++ b/lib/kunit/assert.c @@ -104,12 +104,23 @@ void kunit_binary_assert_format(const struct kunit_assert *assert, binary_assert->left_text, binary_assert->operation, binary_assert->right_text); - string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s == %lld\n", + + if (binary_assert->left_value - 1 < 0) { + string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s == %lld\n", + binary_assert->left_text, + binary_assert->left_value); + string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s == %lld", + binary_assert->right_text, + binary_assert->right_value); + } + else { + string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s == %llu\n", binary_assert->left_text, binary_assert->left_value); - string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s == %lld", + string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s == %llu", binary_assert->right_text, binary_assert->right_value); + } } kunit_assert_print_msg(assert, stream); } base-commit: d43c7fb05765152d4d4a39a8ef957c4ea14d8847 prerequisite-patch-id: bf4b0962b0b955e4e45f5d25fece889562118158 -- 2.26.2 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next reply other threads:[~2020-08-19 19:46 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-19 19:46 Vitor Massaru Iha [this message] 2020-08-19 21:30 ` Brendan Higgins via Linux-kernel-mentees 2020-08-19 21:37 ` Vitor Massaru Iha 2020-08-19 22:00 ` Vitor Massaru Iha 2020-08-19 22:19 ` Brendan Higgins via Linux-kernel-mentees
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200819194634.68976-1-vitor@massaru.org \ --to=vitor@massaru.org \ --cc=brendanhiggins@google.com \ --cc=kunit-dev@googlegroups.com \ --cc=linux-kernel-mentees@lists.linuxfoundation.org \ --cc=linux-kselftest@vger.kernel.org \ --subject='Re: [Linux-kernel-mentees] [PATCH] kunit: fix: kunit_binary_assert_format() only prints signed int' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).