diff options
Diffstat (limited to 'include/test')
-rw-r--r-- | include/test/test.h | 30 | ||||
-rw-r--r-- | include/test/ut.h | 5 |
2 files changed, 31 insertions, 4 deletions
diff --git a/include/test/test.h b/include/test/test.h index 2b68331b546..3bbd77c38b5 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -20,6 +20,12 @@ * @testdev: Test device * @force_fail_alloc: Force all memory allocs to fail * @skip_post_probe: Skip uclass post-probe processing + * @fdt_chksum: crc8 of the device tree contents + * @fdt_copy: Copy of the device tree + * @fdt_size: Size of the device-tree copy + * @other_fdt: Buffer for the other FDT (UT_TESTF_OTHER_FDT) + * @other_fdt_size: Size of the other FDT (UT_TESTF_OTHER_FDT) + * @of_other: Live tree for the other FDT * @runs_per_test: Number of times to run each test (typically 1) * @expect_str: Temporary string used to hold expected string value * @actual_str: Temporary string used to hold actual string value @@ -33,6 +39,12 @@ struct unit_test_state { struct udevice *testdev; int force_fail_alloc; int skip_post_probe; + uint fdt_chksum; + void *fdt_copy; + uint fdt_size; + void *other_fdt; + int other_fdt_size; + struct device_node *of_other; int runs_per_test; char expect_str[512]; char actual_str[512]; @@ -48,8 +60,7 @@ enum { UT_TESTF_CONSOLE_REC = BIT(5), /* needs console recording */ /* do extra driver model init and uninit */ UT_TESTF_DM = BIT(6), - /* live or flat device tree, but not both in the same executable */ - UT_TESTF_LIVE_OR_FLAT = BIT(4), + UT_TESTF_OTHER_FDT = BIT(7), /* read in other device tree */ }; /** @@ -128,13 +139,24 @@ enum { */ struct udevice *testbus_get_clear_removed(void); -static inline void arch_reset_for_test(void) -{ #ifdef CONFIG_SANDBOX #include <asm/state.h> +#include <asm/test.h> +#endif +static inline void arch_reset_for_test(void) +{ +#ifdef CONFIG_SANDBOX state_reset_for_test(state_get_current()); #endif } +static inline int test_load_other_fdt(struct unit_test_state *uts) +{ + int ret = 0; +#ifdef CONFIG_SANDBOX + ret = sandbox_load_other_fdt(&uts->other_fdt, &uts->other_fdt_size); +#endif + return ret; +} #endif /* __TEST_TEST_H */ diff --git a/include/test/ut.h b/include/test/ut.h index f7d1d18f7c1..f7217aa8ac5 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -119,6 +119,11 @@ int ut_check_console_end(struct unit_test_state *uts); */ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); +/* Report a failure, with printf() string */ +#define ut_reportf(fmt, args...) \ + ut_failf(uts, __FILE__, __LINE__, __func__, "report", \ + fmt, ##args) + /* Assert that a condition is non-zero */ #define ut_assert(cond) \ if (!(cond)) { \ |