From: Ivan Orlov <ivan.orlov0322@gmail.com>
To: opensbi@lists.infradead.org
Subject: [PATCH 2/4] lib: Add SBIUnit testing macros and functions
Date: Tue, 13 Feb 2024 14:55:21 +0000 [thread overview]
Message-ID: <43e91abd-049e-433e-a48d-0a4779232ee8@gmail.com> (raw)
In-Reply-To: <20240213-c191a5bbf346ab3ca994f464@orel>
On 2/13/24 14:00, Andrew Jones wrote:
> On Mon, Feb 12, 2024 at 10:03:52PM +0000, Ivan Orlov wrote:
>> On 2/12/24 17:36, Andrew Jones wrote:
>>> On Thu, Feb 08, 2024 at 09:50:48AM +0000, Ivan Orlov wrote:
> ...
>>>> +#define SBIUNIT_ASSERT(test, cond) do { \
>>>> + if (!(cond)) { \
>>>> + test->result = 0; \
>>>> + SBIUNIT_INFO(test, "Condition \"" #cond "\" must be true!\n"); \
>>>> + return; \
>>>
>>> Unnecessary 'return'. It's strange that an ASSERT macro doesn't result in
>>> an sbi_panic().
>>>
>>
>> I thought it would be bad if test results in hang, but if it is ok I will
>> rewrite it.
>
> I think an assert should output its message and then stop all execution.
> Asserts should only be used in situations where failures mean the
> test programmer made an improper assumption. If we don't halt the moment
> we determine the assumption is wrong, then we'll potentially generate
> passing test results, but the tests may not be testing what the test
> programmer thought they were.
>
Makes sense, so let's add the sbi_panic in version 2.
Thanks!
--
Kind regards,
Ivan Orlov
next prev parent reply other threads:[~2024-02-13 14:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 9:50 [PATCH 1/4] docs: Add documentation about tests and SBIUnit Ivan Orlov
2024-02-08 9:50 ` [PATCH 2/4] lib: Add SBIUnit testing macros and functions Ivan Orlov
2024-02-12 17:36 ` Andrew Jones
2024-02-12 22:03 ` Ivan Orlov
2024-02-13 14:00 ` Andrew Jones
2024-02-13 14:55 ` Ivan Orlov [this message]
2024-02-08 9:50 ` [PATCH 3/4] lib: tests: Add a test for sbi_bitmap Ivan Orlov
2024-02-12 18:11 ` Andrew Jones
2024-02-08 9:50 ` [PATCH 4/4] lib: tests: Add sbi_console test Ivan Orlov
2024-02-12 18:24 ` Andrew Jones
2024-02-15 14:44 ` Ivan Orlov
2024-02-15 15:13 ` Andrew Jones
2024-02-15 15:45 ` Ivan Orlov
2024-02-12 17:20 ` [PATCH 1/4] docs: Add documentation about tests and SBIUnit Andrew Jones
2024-02-12 21:48 ` Ivan Orlov
2024-02-13 13:51 ` Andrew Jones
2024-02-13 14:54 ` Ivan Orlov
2024-02-13 15:21 ` Andrew Jones
2024-02-13 15:29 ` Ivan Orlov
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=43e91abd-049e-433e-a48d-0a4779232ee8@gmail.com \
--to=ivan.orlov0322@gmail.com \
--cc=opensbi@lists.infradead.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox