<feed xmlns='http://www.w3.org/2005/Atom'>
<title>opensbi.git/lib/sbi/tests, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/opensbi.git/atom/lib/sbi/tests?h=master</id>
<link rel='self' href='http://cgit.235523.xyz/opensbi.git/atom/lib/sbi/tests?h=master'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/'/>
<updated>2026-06-12T06:28:35Z</updated>
<entry>
<title>lib: sbi: add UBSan support</title>
<updated>2026-06-12T06:28:35Z</updated>
<author>
<name>Marcos Oduardo</name>
<email>marcos.oduardo@gmail.com</email>
</author>
<published>2026-05-15T16:33:21Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=7bdcf557057097ce4661238e672a514ae1e74936'/>
<id>urn:sha1:7bdcf557057097ce4661238e672a514ae1e74936</id>
<content type='text'>
UBSan (Undefined Behavior Sanitizer) is a tool implemented using
compiler instrumentation at runtime that allows checking for
statements whose output is not deterministic or defined by the C
standard. Compiling and running OpenSBI with UBSan instrumentation
will print a message in the console if any sentence performs such
an action.

Support involves two main components:
1. The UBSan implementation hooks (derived from NetBSD),
   used by the compiler to handle the check output.
2. A test suite integrated with the SBI unit test framework to
   verify correct operation at runtime.

Usage:

  make UBSAN=y PLATFORM=generic ...

The test suite is built when both UBSAN=y and CONFIG_SBIUNIT=y are
enabled.

When UBSan is enabled, FW_PAYLOAD_OFFSET may need to be increased
due to the size increase added by the instrumentation. A
value of 0x400000 has been tested.

UBSan adds runtime overhead and is intended for development builds
only, not for production.

Note: This patch marks __stack_chk_guard in sbi_init.c as a weak
symbol to prevent multiple definition errors at compile time with
UBSan instrumentation enabled. This resolves the conflict
between the .globl definitions in sbi_init.c and test_head.S.

Signed-off-by: Marcos Oduardo &lt;marcos.oduardo@gmail.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
Link: https://lore.kernel.org/r/20260515163321.2038366-1-marcos.oduardo@gmail.com
Signed-off-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: sbi_bitmap_test: add tests for bitmap_empty()</title>
<updated>2026-04-08T12:28:06Z</updated>
<author>
<name>Yu-Chien Peter Lin</name>
<email>peter.lin@sifive.com</email>
</author>
<published>2026-03-11T12:51:16Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=2257e9957103aac7df8089a59b9d4bdda7c592ce'/>
<id>urn:sha1:2257e9957103aac7df8089a59b9d4bdda7c592ce</id>
<content type='text'>
Add tests for bitmap_empty(), covers empty/non-empty bitmaps and
edge case nbits=0.

Signed-off-by: Yu-Chien Peter Lin &lt;peter.lin@sifive.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
Link: https://lore.kernel.org/r/20260311125116.1401002-2-peter.lin@sifive.com
Signed-off-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: tests: Add test for string</title>
<updated>2026-04-06T12:23:33Z</updated>
<author>
<name>Chen Pei</name>
<email>cp0613@linux.alibaba.com</email>
</author>
<published>2026-03-06T09:44:24Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=fdb78b0ec585a318ae6199c7129be389bf78091c'/>
<id>urn:sha1:fdb78b0ec585a318ae6199c7129be389bf78091c</id>
<content type='text'>
Added unit tests for various string operations using SBI unit
test framework.

Signed-off-by: Chen Pei &lt;cp0613@linux.alibaba.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
Link: https://lore.kernel.org/r/20260306094425.1918-2-cp0613@linux.alibaba.com
Signed-off-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: tests: add bitwise operations unit tests</title>
<updated>2025-03-23T15:36:25Z</updated>
<author>
<name>Dongdong Zhang</name>
<email>zhangdongdong@eswincomputing.com</email>
</author>
<published>2025-02-19T01:57:55Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=3e6bd14246286aa177754b2d2be9bf0ab90f54a9'/>
<id>urn:sha1:3e6bd14246286aa177754b2d2be9bf0ab90f54a9</id>
<content type='text'>
Added unit tests for various bitwise operations using SBI unit
test framework.

Signed-off-by: Dongdong Zhang &lt;zhangdongdong@eswincomputing.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: add tests for sbi_ecall functionality</title>
<updated>2025-03-23T11:26:54Z</updated>
<author>
<name>Akshay Behl</name>
<email>akshaybehl231@gmail.com</email>
</author>
<published>2025-03-23T11:18:51Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=0b78665a6c51a7b8b6da31e05590e6fd810d07e2'/>
<id>urn:sha1:0b78665a6c51a7b8b6da31e05590e6fd810d07e2</id>
<content type='text'>
This patch adds unit tests for verifying the sbi_ecall version,
impid handling, and extension registration functions. The tests
ensure that the extension registration and unregistration work
as expected.

Signed-off-by: Akshay Behl &lt;akshaybehl231@gmail.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>treewide: Make carray arrays const and NULL-terminated</title>
<updated>2024-11-28T11:39:17Z</updated>
<author>
<name>Samuel Holland</name>
<email>samuel.holland@sifive.com</email>
</author>
<published>2024-11-11T22:02:45Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=df1c1000014049d95d65de831f9015a2dcf9fa34'/>
<id>urn:sha1:df1c1000014049d95d65de831f9015a2dcf9fa34</id>
<content type='text'>
This allows the compiler to generate significantly better code, because
it does not have to maintain either the loop counter or loop limit. Plus
there are half as many symbols to relocate. This also simplifies passing
carray arrays to helper functions.

Signed-off-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: tests: add math test suite</title>
<updated>2024-07-23T04:47:51Z</updated>
<author>
<name>Dongdong Zhang</name>
<email>zhangdongdong@eswincomputing.com</email>
</author>
<published>2024-07-01T02:30:06Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=b7e7e660269106f0c56061c770704a5e5504a98c'/>
<id>urn:sha1:b7e7e660269106f0c56061c770704a5e5504a98c</id>
<content type='text'>
This patch introduces a new math test suite to the SBI unit
tests. The changes include:

* Updating lib/sbi/tests/objects.mk to include
  math_test_suite and sbi_math_test.o.
* Adding a new file lib/sbi/tests/sbi_math_test.c which
  contains tests for log2roundup function using various cases.

The addition of this test suite ensures that mathematical
functions are verified and work as expected.

Signed-off-by: Dongdong Zhang &lt;zhangdongdong@eswincomputing.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: tests: enhance test output with colored pass/fail messages</title>
<updated>2024-07-23T04:43:50Z</updated>
<author>
<name>Dongdong Zhang</name>
<email>zhangdongdong@eswincomputing.com</email>
</author>
<published>2024-07-01T02:17:28Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=c5c1d04346f759f16ca58e918fd394b5b4d4b176'/>
<id>urn:sha1:c5c1d04346f759f16ca58e918fd394b5b4d4b176</id>
<content type='text'>
This patch improves the readability of the SBI unit test
output by adding color-coded status messages.

Adding ANSI color codes for green (pass) and red (fail)
in sbi_unit_test.c.

Now, the test results will be displayed in green for passed
tests and red for failed tests, making it easier to quickly
distinguish between them.

Signed-off-by: Dongdong Zhang &lt;zhangdongdong@eswincomputing.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>Makefile: change to using .carray.c for carray files</title>
<updated>2024-07-04T06:41:45Z</updated>
<author>
<name>Ben Dooks</name>
<email>ben.dooks@codethink.co.uk</email>
</author>
<published>2024-07-01T14:10:59Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=fd9e8b17ed5017d2914f5fc7eb42ff24ff5c097b'/>
<id>urn:sha1:fd9e8b17ed5017d2914f5fc7eb42ff24ff5c097b</id>
<content type='text'>
We would like to clean any files generated by the carray
scripts by just searching for the filename as the current
make system turns f.carray into f.o. Change to make the
make system turn f.carray into f.carray.o

note, command to go through .mk files changing the .o
in the .mk files is:
find . -type f -name "*.carray" | xargs -t -I fname /bin/bash -x -c ' fn=`basename -s .carray fname`; echo "$fn"; sed -i `dirname fname `/objects.mk -e s/"$fn".o/"$fn".carray.o/g'

Link: https://patchwork.ozlabs.org/project/opensbi/patch/20240401213438.590209-2-ivan.orlov0322@gmail.com/
Reported-by: Ivan Orlov &lt;ivan.orlov0322@gmail.com&gt;
Suggested-by: Andrew Jones &lt;ajones@ventanamicro.com&gt;
Signed-off-by: Ben Dooks &lt;ben.dooks@codethink.co.uk&gt;
Reviewed-by: Andrew Jones &lt;ajones@ventanamicro.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: tests: Add test for spinlocks</title>
<updated>2024-05-07T05:57:30Z</updated>
<author>
<name>Ivan Orlov</name>
<email>ivan.orlov0322@gmail.com</email>
</author>
<published>2024-04-23T15:52:45Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=7b1ed968e4afc63d2ca54f6bdf1b42ef2b6576fa'/>
<id>urn:sha1:7b1ed968e4afc63d2ca54f6bdf1b42ef2b6576fa</id>
<content type='text'>
Implement the test which covers some of the functions from the
`riscv_locks.h` file. This test consists of 3 test cases:

1) For lock/unlock functions
2) Unsuccessful trylock (the lock was previously taken)
3) Successful trylock (the lock is free and can be taken)

Signed-off-by: Ivan Orlov &lt;ivan.orlov0322@gmail.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
</feed>
