OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <ajones@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH 1/4] docs: Add documentation about tests and SBIUnit
Date: Tue, 13 Feb 2024 14:51:34 +0100	[thread overview]
Message-ID: <20240213-a2478b49c77f64f9f111e96b@orel> (raw)
In-Reply-To: <12c2ecd6-0367-470f-90bf-35a805574147@gmail.com>

On Mon, Feb 12, 2024 at 09:48:02PM +0000, Ivan Orlov wrote:
> On 2/12/24 17:20, Andrew Jones wrote:
...
> > But I think we should be able to add the test suite pointer to an elf
> > section with the SBIUNIT_TEST_SUITE() macro to avoid this step.
> > 
> 
> That was an initial idea, however I faced some obstacles during the
> implementation.
> 
> I believe we would like to cover the static functions, as well as use static
> variables in the tests. In this case, we would include the test in the
> source we are covering (for instance, include "sbi_console_test.c" in
> "sbi_console.c"). If we use OpenSBI (libplatsbi.a) as a library when linking
> firmware, and firmware refers to a symbol from "sbi_console.h", it will
> automatically link the test code too. This means that firmware should have
> the test ELF section as well. Manual registration of the tests in
> 'sbi_unit.c', on the other hand, would not require any effort from the
> firmware developers if they decide to enable tests for OpenSBI.

Hmm, I see. So maybe we can use the build system's carray?

> 
> Moreover, manual test declaration will make sure that we included all of the
> tests. Otherwise, if we define the test in a separate file, it will be
> linked out unless we refer to symbols from it somewhere.

This could possibly be worked around with the linker's --whole-archive
option.

Thanks,
drew


  reply	other threads:[~2024-02-13 13:51 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
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 [this message]
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=20240213-a2478b49c77f64f9f111e96b@orel \
    --to=ajones@ventanamicro.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