Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/boards/intel_adsp/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,9 @@ config LOG_FUNC_NAME_PREFIX_DBG

config LOG_TIMESTAMP_64BIT
default y

# Zephyr / debugging
# ----------------------------------------

config ZTEST
default SOF_BOOT_TEST_SUPPORTED && SOF_BOOT_TEST_ALLOWED
1 change: 1 addition & 0 deletions app/boards/intel_adsp_ace15_mtpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS=y
CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS=y
CONFIG_ZEPHYR_TWB_SCHEDULER=y
CONFIG_COLD_STORE_EXECUTE_DRAM=y
CONFIG_SOF_BOOT_TEST_SUPPORTED=n

# SOF / loadable modules
CONFIG_INTEL_MODULES=y
Expand Down
7 changes: 4 additions & 3 deletions app/debug_overlay.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CONFIG_DEBUG=y
CONFIG_ASSERT=y

# Disabled until DSP panic #8621 is fixed
# CONFIG_ZTEST=y
# CONFIG_SOF_BOOT_TEST=y
CONFIG_ZTEST_NO_YIELD=n
CONFIG_ZTEST_SUMMARY=n
CONFIG_SOF_BOOT_TEST_ALLOWED=y
CONFIG_TEST_EXTRA_STACK_SIZE=7168

CONFIG_DAI_VERBOSE_GLITCH_WARNINGS=y

Expand Down
1 change: 0 additions & 1 deletion app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ static int sof_app_main(void)
void test_main(void)
{
sof_app_main();
k_sleep(K_FOREVER);
}
#else
int main(void)
Expand Down
11 changes: 11 additions & 0 deletions src/include/sof/boot_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,24 @@
#ifndef __SOF_BOOT_TEST_H__
#define __SOF_BOOT_TEST_H__

#if !CONFIG_LIBRARY
#include <zephyr/logging/log.h>
#else
#define LOG_ERR(...) do {} while (0)
#endif
#include <stdbool.h>

#if CONFIG_SOF_BOOT_TEST
#define TEST_RUN_ONCE(fn, ...) do { \
static bool once; \
if (!once) { \
once = true; \
fn(__VA_ARGS__); \
} \
} while (0)
#else
#define TEST_RUN_ONCE(fn, ...) do {} while (0)
#endif

#define TEST_CHECK_RET(ret, testname) do { \
if ((ret) < 0) { \
Expand All @@ -25,4 +34,6 @@
} \
} while (0)

void sof_run_boot_tests(void);

#endif
6 changes: 0 additions & 6 deletions src/ipc/ipc4/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <sof/audio/buffer.h>
#include <sof/audio/component_ext.h>
#include <sof/audio/pipeline.h>
#include <sof/boot_test.h>
#include <sof/common.h>
#include <sof/ipc/topology.h>
#include <sof/ipc/common.h>
Expand All @@ -39,11 +38,6 @@
#include <rtos/kernel.h>
#include <sof/lib_manager.h>

#if CONFIG_SOF_BOOT_TEST
/* CONFIG_SOF_BOOT_TEST depends on Zephyr */
#include <zephyr/ztest.h>
#endif

#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
Expand Down
4 changes: 4 additions & 0 deletions src/ipc/ipc4/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#endif

#include <stdint.h>
#include <sof/boot_test.h>
#include <sof/lib/uuid.h>
#include <sof/ipc/common.h>
#include <ipc4/base_fw.h>
Expand Down Expand Up @@ -152,6 +153,9 @@ int ipc4_logging_enable_logs(bool first_block,
LOG_WRN("Too small aging timer value, limiting to %u\n",
mtrace_aging_timer);
}

/* Logs enabled, this is the best place to run boot-tests */
TEST_RUN_ONCE(sof_run_boot_tests);
} else {
k_work_flush_delayable(&log_work, &ipc4_log_work_sync);
adsp_mtrace_log_init(NULL);
Expand Down
14 changes: 13 additions & 1 deletion zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,21 @@ config CROSS_CORE_STREAM
can be processed on different cores, however, each stream
is processed entirely on single core.

config SOF_BOOT_TEST_ALLOWED
bool "Enable SOF boot-time testing"
help
boot-time testing enabled if supported by the platform

config SOF_BOOT_TEST_SUPPORTED
bool "Platform supports boot-time testing"
default y
help
boot-time testing supported by the platform

config SOF_BOOT_TEST
bool "enable SOF run-time testing"
bool
depends on ZTEST
default y
help
Run tests during boot. This enables an SOF boot-time self-test. When
enabled, the resulting image will run a number of self-tests when the
Expand Down
4 changes: 1 addition & 3 deletions zephyr/boot_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ LOG_MODULE_REGISTER(sof_boot_test, LOG_LEVEL_DBG);

ZTEST_SUITE(sof_boot, NULL, NULL, NULL, NULL, NULL);

void sys_run_boot_tests(void)
void sof_run_boot_tests(void)
{
ztest_run_all(NULL, false, 1, 1);
}
SYS_INIT(sys_run_boot_tests, APPLICATION, 99);

5 changes: 2 additions & 3 deletions zephyr/test/vmh.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ static void test_vmh_multiple_allocs(struct vmh_heap *heap, int num_allocs,
{
void *ptrs[num_allocs];
uint32_t alloc_size;
bool success;
int ret;

/* Perform multiple allocations */
Expand Down Expand Up @@ -192,7 +191,7 @@ static void test_vmh_alloc_free(bool allocating_continuously)
/* Test case for vmh_alloc and vmh_free with and without config */
static void test_heap_creation(void)
{
test_vmh_init_and_free_heap(NULL, 0, false, true);
test_vmh_init_and_free_heap(NULL, false, true);

/* Try to setup with pre defined heap config */
struct vmh_heap_config config = {0};
Expand All @@ -205,7 +204,7 @@ static void test_heap_creation(void)

config.block_bundles_table[1].number_of_blocks = 512;

test_vmh_init_and_free_heap(&config, 0, false, true);
test_vmh_init_and_free_heap(&config, false, true);
}

/* Test case for alloc/free on configured heap */
Expand Down
Loading