1# Copyright (c) 2016 Intel Corporation
2# SPDX-License-Identifier: Apache-2.0
3
4menu "Testing"
5
6source "subsys/testsuite/ztest/Kconfig"
7
8config TEST
9	bool "Mark project as a test"
10	# For tests, store thread names in binary and dump them on crash to
11	# ease debugging.
12	select THREAD_NAME
13	help
14	  Mark a project or an application as a test. This will enable a few
15	  test defaults.
16
17config TEST_EXTRA_STACK_SIZE
18	int "Test function extra thread stack size"
19	default 2048 if COVERAGE_GCOV
20	default 768 if XTENSA
21	default 0
22	depends on TEST
23	help
24	  Additional stack for tests on some platform where default is not
25	  enough.
26
27config HAS_COVERAGE_SUPPORT
28	bool
29	help
30	  The code coverage report generation is only available on boards
31	  with enough spare RAM to buffer the coverage data, or on boards
32	  based on the POSIX ARCH.
33
34config COVERAGE
35	bool "Create coverage data"
36	depends on HAS_COVERAGE_SUPPORT
37	help
38	  This option will build your application with the -coverage option
39	  which will generate data that can be used to create coverage reports.
40	  For more information see
41	  https://docs.zephyrproject.org/latest/guides/coverage.html
42
43config COVERAGE_GCOV
44	bool "Create Coverage data from hardware platform"
45	default y
46	depends on COVERAGE
47	depends on !NATIVE_APPLICATION
48	help
49	  This option will select the custom gcov library. The reports will
50	  be available over serial. This serial dump can be passed to
51	  gen_gcov_files.py which creates the required .gcda files. These
52	  can be read by gcov utility. For more details see gcovr.com .
53
54config COVERAGE_GCOV_HEAP_SIZE
55	int "Size of heap allocated for gcov coverage data dump"
56	default 32768 if X86 || SOC_SERIES_MPS2
57	default 16384
58	help
59	  This option configures the heap size allocated for gcov coverage
60	  data to be dumped over serial.
61
62config COVERAGE_DUMP
63	bool "Dump coverage data on exit"
64	depends on COVERAGE_GCOV
65	help
66	  Dump collected coverage information to console on exit.
67
68config TEST_USERSPACE
69	bool "Indicate that this test exercises user mode"
70	help
71	  This option indicates that a test case puts threads in user mode,
72	  and that the build system will [override and] enable USERSPACE
73	  if the platform supports it. It should be set in a .conf file on
74	  a per-test basis and is not meant to be used outside test cases.
75	  Tests with this option should also have the "userspace" filtering
76	  tag in their testcase.yaml file.
77
78	  The userspace APIs are no-ops if userspace is not enabled, so it is
79	  OK to enable this even if the test will run on platforms which do
80	  not support userspace. The test should still run on those platforms,
81	  just with all threads in supervisor mode.
82
83	  If a test *requires* that userspace be enabled in order to
84	  pass, CONFIG_ARCH_HAS_USERSPACE should be filtered in its
85	  testcase.yaml.
86
87config TEST_LOGGING_DEFAULTS
88	bool "Test case logging defaults"
89	depends on TEST
90	select LOG
91	select LOG_DEFAULT_MINIMAL
92	default y
93	help
94	  Option which implements default policy of enabling logging in
95	  minimal mode for all test cases. For tests that need alternate
96	  logging configuration, or no logging at all, disable this
97	  in the project-level defconfig.
98
99config TEST_ENABLE_USERSPACE
100	bool
101	depends on TEST_USERSPACE
102	depends on ARCH_HAS_USERSPACE
103	select USERSPACE
104	select DYNAMIC_OBJECTS
105	default y
106	help
107	  This hidden option implements the TEST_USERSPACE logic. It turns on
108	  USERSPACE when CONFIG_ARCH_HAS_USERSPACE is set and the test
109	  case itself indicates that it exercises user mode via
110	  CONFIG_TEST_USERSPACE.
111
112config TEST_USERSPACE_WITHOUT_HW_STACK_PROTECTION
113	bool "Run User Mode tests without additionally enabling stack protection"
114	depends on TEST_ENABLE_USERSPACE
115	default y if SOC_SERIES_KINETIS_KE1XF
116	help
117	  A HW platform might not have sufficient MPU/MMU capabilities to support
118	  running all test cases with User Mode and HW Stack Protection features
119	  simultaneously enabled. For this platforms we execute the User Mode-
120	  related tests without enabling HW stack protection.
121
122config TEST_HW_STACK_PROTECTION
123	bool "Hardware-based stack overflow detection if available"
124	depends on ARCH_HAS_STACK_PROTECTION
125	depends on TEST
126	select HW_STACK_PROTECTION
127	default y if !TEST_USERSPACE_WITHOUT_HW_STACK_PROTECTION
128	help
129	  This option will enable hardware-based stack protection by default
130	  for all test cases if the hardware supports it.
131
132config TEST_FLASH_DRIVERS
133	bool "Test flash drivers"
134	depends on BOARD_QEMU_X86
135	select FLASH_HAS_DRIVER_ENABLED
136	select FLASH_HAS_PAGE_LAYOUT
137	help
138	  This option will help test the flash drivers. This should be enabled
139	  only when using qemu_x86.
140
141config TEST_ARM_CORTEX_M
142	bool
143	depends on CPU_CORTEX_M
144	depends on TEST
145	default y
146	select ARM_SECURE_BUSFAULT_HARDFAULT_NMI if ARM_SECURE_FIRMWARE
147	help
148	  ARM Cortex-M configuration required when testing.
149
150	  This option is used to select stack sizes and enable features for
151	  testing.
152
153	  This option is also used to force routing
154	  BusFault, HardFault, and NMI exceptions to Secure State,
155	  when building a Secure ARMv8-M firmware. This will allow
156	  the testing suite to utilize these exceptions, in tests.
157	  Note that by default, when building with ARM_SECURE_FIRMWARE
158	  set, these exceptions are set to target the Non-Secure state.
159
160config TEST_BUSY_SIM
161	bool "Busy simulator"
162	depends on TEST
163	select ENTROPY_GENERATOR
164	select RING_BUFFER if !XOSHIRO_RANDOM_GENERATOR
165	select COUNTER
166	help
167	  It simulates cpu load by using counter device to generate interrupts
168	  with random intervals and random busy looping in the interrupt.
169
170endmenu
171