diff options
-rw-r--r-- | lib/sbi/objects.mk | 6 | ||||
-rw-r--r-- | lib/sbi/sbi_console.c | 6 | ||||
-rw-r--r-- | lib/sbi/tests/objects.mk | 8 | ||||
-rw-r--r-- | lib/sbi/tests/sbi_bitmap_test.c (renamed from lib/sbi/sbi_bitmap_test.c) | 0 | ||||
-rw-r--r-- | lib/sbi/tests/sbi_console_test.c (renamed from lib/sbi/sbi_console_test.c) | 8 | ||||
-rw-r--r-- | lib/sbi/tests/sbi_unit_test.c (renamed from lib/sbi/sbi_unit_test.c) | 0 | ||||
-rw-r--r-- | lib/sbi/tests/sbi_unit_tests.carray (renamed from lib/sbi/sbi_unit_tests.carray) | 0 |
7 files changed, 14 insertions, 14 deletions
diff --git a/lib/sbi/objects.mk b/lib/sbi/objects.mk index 2bed7f3..5d06d25 100644 --- a/lib/sbi/objects.mk +++ b/lib/sbi/objects.mk @@ -11,12 +11,6 @@ libsbi-objs-y += riscv_asm.o libsbi-objs-y += riscv_atomic.o libsbi-objs-y += riscv_hardfp.o libsbi-objs-y += riscv_locks.o -libsbi-objs-$(CONFIG_SBIUNIT) += sbi_unit_test.o -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 d1229d0..d3ec461 100644 --- a/lib/sbi/sbi_console.c +++ b/lib/sbi/sbi_console.c @@ -472,7 +472,7 @@ const struct sbi_console_device *sbi_console_get_device(void) void sbi_console_set_device(const struct sbi_console_device *dev) { - if (!dev || console_dev) + if (!dev) return; console_dev = dev; @@ -488,7 +488,3 @@ int sbi_console_init(struct sbi_scratch *scratch) return rc; } - -#ifdef CONFIG_SBIUNIT -#include "sbi_console_test.c" -#endif diff --git a/lib/sbi/tests/objects.mk b/lib/sbi/tests/objects.mk new file mode 100644 index 0000000..5ce188a --- /dev/null +++ b/lib/sbi/tests/objects.mk @@ -0,0 +1,8 @@ +libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_test.o +libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_tests.o + +carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += bitmap_test_suite +libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_bitmap_test.o + +carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += console_test_suite +libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_console_test.o diff --git a/lib/sbi/sbi_bitmap_test.c b/lib/sbi/tests/sbi_bitmap_test.c index d2c3599..d2c3599 100644 --- a/lib/sbi/sbi_bitmap_test.c +++ b/lib/sbi/tests/sbi_bitmap_test.c diff --git a/lib/sbi/sbi_console_test.c b/lib/sbi/tests/sbi_console_test.c index 29f4ac1..72db253 100644 --- a/lib/sbi/sbi_console_test.c +++ b/lib/sbi/tests/sbi_console_test.c @@ -3,6 +3,8 @@ * * Author: Ivan Orlov <ivan.orlov0322@gmail.com> */ +#include <sbi/riscv_locks.h> +#include <sbi/sbi_console.h> #include <sbi/sbi_unit_test.h> #define TEST_CONSOLE_BUF_LEN 1024 @@ -32,13 +34,13 @@ static const struct sbi_console_device test_console_dev = { /* Mock the console device */ static inline void test_console_begin(const struct sbi_console_device *device) { - old_dev = console_dev; - console_dev = device; + old_dev = sbi_console_get_device(); + sbi_console_set_device(device); } static inline void test_console_end(void) { - console_dev = old_dev; + sbi_console_set_device(old_dev); } static void putc_test(struct sbiunit_test_case *test) diff --git a/lib/sbi/sbi_unit_test.c b/lib/sbi/tests/sbi_unit_test.c index 1987838..1987838 100644 --- a/lib/sbi/sbi_unit_test.c +++ b/lib/sbi/tests/sbi_unit_test.c diff --git a/lib/sbi/sbi_unit_tests.carray b/lib/sbi/tests/sbi_unit_tests.carray index 8d6069b..8d6069b 100644 --- a/lib/sbi/sbi_unit_tests.carray +++ b/lib/sbi/tests/sbi_unit_tests.carray |