# SPDX-License-Identifier: GPL-2.0-only

menuconfig TEST
	bool "Testing"

if TEST

source "test/self/Kconfig"

config FUZZ
	bool "fuzz tests"
	select RAMDISK_BLK
	select DISK
	help
	  Say y here to add include fuzz tests into barebox.
	  These need to be exercised either via command or
	  by libfuzzer

config FUZZ_EXTERNAL
	bool "link against libfuzzer"
	depends on SANDBOX && CC_IS_CLANG
	help
	  LibFuzzer is an in-process, coverage-guided, evolutionary fuzzing
	  engine. It can be linked against barebox on the sandbox
	  architecture to feed fuzzed inputs into the fuzz tests.

if FUZZ

config FUZZ_INSECURE_PARTIAL_DIGEST
	bool "accept partial checksums and digests during fuzzing"
	depends on INSECURE
	help
	  Coverage-guided fuzzing cannot realistically mutate its way
	  through a CRC, hash or signature check, so fuzz tests stop at
	  the integrity gate instead of reaching the parser behind it.

	  Say y here to compare only the lowest bit of selected checksums
	  and digests, which makes the protected code reachable while
	  keeping the rejection path live for half of all inputs.

	  This deliberately weakens integrity checks and must not be
	  enabled outside fuzzing.

config CMD_FUZZ
	bool "fuzz command"
	depends on COMMAND_SUPPORT
	default y
	help
	  Command to run enabled barebox fuzz tests on fixed input.
	  If run without arguments, all tests are run.

	  This is mostly useful for debugging, use FUZZ_EXTERNAL
	  to have fuzzed inputs be bed automatically .

	  Usage: fuzz [-ls] -f FILE [test]

	  Options:
	    -l        list registered fuzz tests
	    -f FILE   use FILE as fuzz input
	    -s SIZE   read only SIZE bytes from file

endif

config TEST_KEY_RSA2048
	bool
	help
	  This is selected by crypto test code that needs a RSA2048 public
	  key. The key added by this option is stand-alone, i.e., it is
	  not part of the key ring and won't be consulted for FIT image
	  verification.

endif
