All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Orlov <ivan.orlov0322@gmail.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v2 5/5] lib: tests: Add sbi_console test
Date: Sun, 18 Feb 2024 20:54:28 +0000	[thread overview]
Message-ID: <f89b60f4-5cfc-45cd-acba-944543632530@gmail.com> (raw)
In-Reply-To: <b55c0465e280bbd774f21ba3937ced5bb4c66cf7.camel@126.com>

On 2/18/24 05:34, Xiang W wrote:
> ? 2024-02-15???? 16:16 +0000?Ivan Orlov???
>> Add the test suite covering some of the functions from
>> lib/sbi/sbi_console.c: putc, puts and printf. The test covers a variety
>> of format specifiers for printf and different strings and characters for
>> putc and puts.
>>
>> In order to do that, the test "mocks" the sbi_console_device structure
>> by setting the 'console_dev' variable to the virtual console.
>>
>> Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
>> ---
>> V1 -> V2:
>> - Rewrite using the carray functionality
>> - Replace CONSOLE_DO and CONSOLE_DO_RET macros with two inline
>> functions: one of them "mocks" the default console device, and
>> the second one restores the old console device.
>> - Fix codestyle issues (comments, etc.)
>> - Remove incorrect 'puts' test
>> - Use updated SBIUNIT_ASSERT_STREQ API
>>
>>  ?lib/sbi/objects.mk???????? |?? 1 +
>>  ?lib/sbi/sbi_console.c????? |?? 4 ++
>>  ?lib/sbi/sbi_console_test.c | 102 +++++++++++++++++++++++++++++++++++++
>>  ?3 files changed, 107 insertions(+)
>>  ?create mode 100644 lib/sbi/sbi_console_test.c
>>
>> diff --git a/lib/sbi/objects.mk b/lib/sbi/objects.mk
>> index b4c273f..9d065fa 100644
>> --- a/lib/sbi/objects.mk
>> +++ b/lib/sbi/objects.mk
>> @@ -16,6 +16,7 @@ libsbi-objs-$(CONFIG_SBIUNIT) += sbi_unit_tests.o
>>   
>>  ?libsbi-objs-$(CONFIG_SBIUNIT) += sbi_bitmap_test.o
>>  ?carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += bitmap_test_suite
>> +carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += console_test_suite
>>   
>>  ?libsbi-objs-y += sbi_ecall.o
>>  ?libsbi-objs-y += sbi_ecall_exts.o
>> diff --git a/lib/sbi/sbi_console.c b/lib/sbi/sbi_console.c
>> index ab09a5c..d1229d0 100644
>> --- a/lib/sbi/sbi_console.c
>> +++ b/lib/sbi/sbi_console.c
>> @@ -488,3 +488,7 @@ int sbi_console_init(struct sbi_scratch *scratch)
>>   
>>  ?	return rc;
>>  ?}
>> +
>> +#ifdef CONFIG_SBIUNIT
>> +#include "sbi_console_test.c"
>> +#endif
>> diff --git a/lib/sbi/sbi_console_test.c b/lib/sbi/sbi_console_test.c
>> new file mode 100644
>> index 0000000..f24b329
>> --- /dev/null
>> +++ b/lib/sbi/sbi_console_test.c
>> @@ -0,0 +1,102 @@
>> +/*
>> + * SPDX-License-Identifier: BSD-2-Clause
>> + *
>> + * Author: Ivan Orlov <ivan.orlov0322@gmail.com>
>> + */
>> +#include <sbi/sbi_unit_test.h>
>> +#include <sbi/sbi_heap.h>
> 
> sbi_heap.h is not needed.
> 

Thanks, I'll fix it in V3.

-- 
Kind regards,
Ivan Orlov



  reply	other threads:[~2024-02-18 20:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 16:16 [PATCH v2 0/5] SBIUnit: cover OpenSBI with tests Ivan Orlov
2024-02-15 16:16 ` [PATCH v2 1/5] docs: Add documentation about tests and SBIUnit Ivan Orlov
2024-02-28 13:47   ` Andrew Jones
2024-02-28 16:01     ` Ivan Orlov
2024-02-15 16:16 ` [PATCH v2 2/5] lib: Add SBIUnit testing macros and functions Ivan Orlov
2024-02-28 14:19   ` Andrew Jones
2024-02-28 16:12     ` Ivan Orlov
2024-02-28 16:30       ` Andrew Jones
2024-02-28 16:43         ` Ivan Orlov
2024-02-28 17:00           ` Andrew Jones
2024-02-28 17:10             ` Ivan Orlov
2024-02-15 16:16 ` [PATCH v2 3/5] Makefile: clean '.c' files generated by carray Ivan Orlov
2024-02-28 14:23   ` Andrew Jones
2024-02-28 16:18     ` Ivan Orlov
2024-02-28 16:32       ` Andrew Jones
2024-02-28 16:52         ` Ivan Orlov
2024-02-15 16:16 ` [PATCH v2 4/5] lib: tests: Add a test for sbi_bitmap Ivan Orlov
2024-02-28 14:28   ` Andrew Jones
2024-02-15 16:16 ` [PATCH v2 5/5] lib: tests: Add sbi_console test Ivan Orlov
2024-02-18  5:34   ` Xiang W
2024-02-18 20:54     ` Ivan Orlov [this message]
2024-02-28 14:33   ` Andrew Jones

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=f89b60f4-5cfc-45cd-acba-944543632530@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.