# SPDX-License-Identifier: GPL-2.0

config SELFTEST
	bool "Self-tests"
	help
	  Configures support for in-barebox testing

if SELFTEST

config CMD_SELFTEST
	bool "selftest command"
	depends on COMMAND_SUPPORT
	default y
	help
	  Command to run enabled barebox self-tests.
	  If run without arguments, all tests are run

	  Usage: selftest [-l] [tests...]

	  Options:
	    -l     list available tests

config SELFTEST_AUTORUN
	bool "Run self-tests on startup"
	help
	  Self tests are run automatically after initcalls are done,
	  but before barebox_main (shell or board-specific startup).

config SELFTEST_ENABLE_ALL
	bool "Enable all self-tests"
	select SELFTEST_PRINTF
	select SELFTEST_MALLOC
	select SELFTEST_PROGRESS_NOTIFIER
	select SELFTEST_OF_MANIPULATION
	select SELFTEST_ENVIRONMENT_VARIABLES if ENVIRONMENT_VARIABLES
	select SELFTEST_FS_RAMFS if FS_RAMFS
	select SELFTEST_DIRFD if FS_RAMFS && FS_DEVFS
	select SELFTEST_TFTP if FS_TFTP
	select SELFTEST_JSON if JSMN
	select SELFTEST_JWT if JWT
	select SELFTEST_DIGEST if DIGEST
	select SELFTEST_MMU if MMU
	select SELFTEST_STRING
	select SELFTEST_SETJMP if ARCH_HAS_SJLJ
	select SELFTEST_REGULATOR if REGULATOR_FIXED
	select SELFTEST_TEST_COMMAND if CMD_TEST
	select SELFTEST_IDR
	select SELFTEST_TLV
	select SELFTEST_DM
	help
	  Selects all self-tests compatible with current configuration

config SELFTEST_MALLOC
	bool "malloc() selftest"
	help
	  Tests barebox memory allocator

config SELFTEST_PRINTF
	bool "printf selftest"
	help
	  Tests barebox vsnprintf() functionality

config SELFTEST_OF_MANIPULATION
	bool "OF manipulation selftest"
	select OFTREE
	help
	  Tests barebox device tree manipulation functionality

config SELFTEST_PROGRESS_NOTIFIER
	bool "progress notifier selftest"

config SELFTEST_ENVIRONMENT_VARIABLES
	bool "environment variable selftest"

config SELFTEST_FS_RAMFS
	bool "ramfs selftest"
	depends on FS_RAMFS

config SELFTEST_DIRFD
	bool "dirfd selftest"
	depends on FS_RAMFS && FS_DEVFS

config SELFTEST_JSON
	bool "JSON selftest"
	depends on JSMN

config SELFTEST_JWT
	bool "JSON Web Token selftest"
	depends on JWT
	select TEST_KEY_RSA2048

config SELFTEST_MMU
	bool "MMU remapping selftest"
	select MEMTEST
	depends on MMU

config SELFTEST_DIGEST
	bool "Digest selftest"
	depends on DIGEST
	select PRINTF_HEXSTR

config SELFTEST_STRING
	bool "String library selftest"
	select VERSION_CMP

config SELFTEST_SETJMP
	bool "setjmp/longjmp library selftest"
	depends on ARCH_HAS_SJLJ

config SELFTEST_REGULATOR
	bool "Regulator selftest"
	depends on REGULATOR_FIXED
	select OF_OVERLAY

config SELFTEST_TEST_COMMAND
	bool "test command selftest"
	depends on CMD_TEST

config SELFTEST_IDR
	bool "idr selftest"
	select IDR

config SELFTEST_TLV
	bool "TLV selftest"
	select TLV
	select BASE64
	select BOARD_LXA

config SELFTEST_DM
	bool "Device mapper selftest"
	select DISK
	select DM_BLK
	select DM_BLK_LINEAR
	select RAMDISK_BLK
	help
	  Tests the available device mapper targets

endif
