1# Copyright (c) 2016 Intel Corporation 2# SPDX-License-Identifier: Apache-2.0 3 4config ZTEST 5 bool "Zephyr testing framework" 6 select TEST 7 help 8 Enable the Zephyr testing framework. You should enable this only 9 if you're writing automated tests. 10 11if ZTEST 12 13config ZTEST_NEW_API 14 bool "Use the new Ztest API" 15 help 16 Enables the new Ztest APIs for creating suites and unit tests in 17 separate compilation units as well as the new 'rules' API. 18 19config ZTEST_STACK_SIZE 20 int "Test function thread stack size" 21 default 2048 if COVERAGE_GCOV 22 default 2048 if X86 23 default 1024 24 25config ZTEST_TEST_DELAY_MS 26 int "Delay between tests in milliseconds" 27 default 0 28 help 29 Add a delay between between tests to manage output on the console on 30 systems that can't handle the rapid output rate. 31 32config ZTEST_CPU_HOLD_TIME_MS 33 int "Time in milliseconds to hold other CPUs for 1cpu type tests" 34 default 3000 35 help 36 This option is used to specify the maximum time in milliseconds for 37 which a 1cpu type test may execute on a multicpu system. The default 38 value ought to suffice for most such tests; however slower platforms 39 (which may include simulators) may need to set this to a larger 40 value. Please be aware that increasing it for long-running test cases 41 may overload the CI system. Modify with caution. 42 43config ZTEST_FAIL_FAST 44 bool "Abort on first failing test" 45 help 46 Stop and abort on first failing test. Do not continue with other 47 tests that might be in the queue. 48 49config ZTEST_ASSERT_VERBOSE 50 int "Assertion verbosity level" 51 default 1 52 help 53 Set verbosity level for assertions. 54 Assertion verbosity levels: 55 0 Write only file and line for failed assertions 56 1 Write file, line number, function and reason for failed assertions 57 2 Log also successful assertions 58 59config ZTEST_THREAD_PRIORITY 60 int "Testing thread priority" 61 default -2 if !PREEMPT_ENABLED 62 default -1 63 help 64 Set priority of the testing thread. Default is -1 (cooperative). 65 66config ZTEST_TC_UTIL_USER_OVERRIDE 67 bool "Override tc_util.h" 68 help 69 Enable overriding defines in tc_util.h. 70 If True the user should provide tc_util_user_override.h in Zephyr's include path, 71 e.g. by adding zephyr_include_directories(project PRIVATE my_folder) to a project's CMakeLists.txt. 72 The override header may now #define the various macros and strings in tc_util.h which are 73 surrounded by #ifndef ... #endif blocks. 74 75config ZTEST_RETEST_IF_PASSED 76 bool "Reset the board to test again if the test passed" 77 select REBOOT 78 help 79 If the test passed reset the board so it is run again. This 80 may be used as an alternative to manual resets when 81 attempting to reproduce an intermittent failure. 82 83config ZTEST_FATAL_HOOK 84 bool "Using a pre-defined fatal handler and hook function" 85 help 86 Use the pre-defined common fatal error handler and a post hook to 87 do actions in your test case, this option often enabled when doing 88 error test case. Remember to add ignore_fault tag in yaml file when 89 using twister to run testing. 90 91config ZTEST_ASSERT_HOOK 92 bool "Using a pre-defined assert handler and hook function" 93 help 94 Use the pre-defined common assert fail handler and a post hook to 95 do actions in your test case, this option often enabled when doing 96 error test case. Remember to add ignore_fault tag in yaml file when 97 using twister to run testing. 98 99config ZTEST_NO_YIELD 100 bool "Do not yield to the idle thread after tests complete" 101 help 102 When the tests complete, do not yield to the idle thread and instead 103 spin in a loop. This is useful for low power mode tests, where 104 yielding to the idle thread may put the board into a low power state 105 where a debugger cannot connect to it. 106 107config ZTEST_WARN_NO_OPTIMIZATIONS 108 bool "Warn when running tests with CONFIG_NO_OPTIMIZATIONS" 109 default y if !(ARCH_POSIX || COVERAGE) 110 depends on NO_OPTIMIZATIONS 111 help 112 Print a CMake warning when building ztests with no compiler 113 optimizations. Please don't file issues when running tests that are 114 not explicitly tuned to work in this configuration. 115 116if ZTEST_NEW_API 117 118menu "ztest provided rules" 119 120config ZTEST_RULE_1CPU 121 bool "Run all the tests on a single CPU" 122 help 123 This rule will call z_test_1cpu_start before each unit test and 124 ztest_1cpu_stop after each test. 125 126endmenu 127 128config ZTEST_VERIFY_RUN_ALL 129 bool "Validates all defined tests have ran" 130 default y 131 help 132 This rule will fail the project if not all tests have been run. 133 134config ZTEST_SHUFFLE 135 bool "Shuffle the order of tests and suites" 136 select TEST_RANDOM_GENERATOR if !ENTROPY_HAS_DRIVER 137 help 138 This rule will shuffle the order of tests and test suites. 139 140if ZTEST_SHUFFLE 141config ZTEST_SHUFFLE_SUITE_REPEAT_COUNT 142 int "Number of iterations the test suite will run" 143 default 3 144 help 145 This rule will execute a test suite N number of times. The tests 146 per suite will be shuffled on each iteration. The test order will likely 147 be different per iteration. 148 149config ZTEST_SHUFFLE_TEST_REPEAT_COUNT 150 int "Number of iterations the test will run" 151 default 3 152 help 153 This rule will execute a test N number of times. The test order will 154 likely be different per iteration. 155 156endif #ZTEST_SHUFFLE 157 158config ZTEST_SUMMARY 159 bool "Display test summary" 160 default y 161 help 162 This option controls output of a test summary. 163 164config ZTEST_VERBOSE_OUTPUT 165 bool "Verbose test output" 166 default y 167 help 168 This option controls whether test output is shown verbosely or 169 no output at all. 170 171config ZTEST_VERBOSE_SUMMARY 172 bool "Verbose test summary" 173 default y 174 help 175 This option controls whether suite summary is shown verbosely or 176 just in one line. 177 178config ZTEST_FAIL_ON_ASSUME 179 bool "Fail the test run when an assumption fails" 180 default y 181 help 182 When enabled, the test binary will fail at the end if an assumption failed. This means 183 that while tests will still be marked as skipped on failed zassume calls, the final test 184 result will be shown as a failure in order to increase visibility. This precludes tests 185 that skipped with the ZTEST_EXPECT_SKIP annotation. 186 187endif # ZTEST_NEW_API 188 189config TEST_LOGGING_FLUSH_AFTER_TEST 190 bool "When enabled logs are flushed after each test case" 191 default y 192 depends on MULTITHREADING 193 194endif # ZTEST 195 196config ZTEST_MOCKING 197 bool "Mocking support functions" 198 help 199 Enable mocking support for Ztest. This allows the test to set 200 return values and expected parameters to functions. 201 202config ZTEST_PARAMETER_COUNT 203 int "Count of parameters or return values reserved" 204 default 10 205 depends on ZTEST_MOCKING 206 help 207 Maximum amount of concurrent return values / expected parameters. 208 209config ZTRESS 210 bool "Stress test framework" 211 select THREAD_RUNTIME_STATS 212 select THREAD_MONITOR 213 select TEST_RANDOM_GENERATOR if !ENTROPY_HAS_DRIVER 214 depends on !USERSPACE 215 216if ZTRESS 217 218config ZTRESS_MAX_THREADS 219 int "Maximum number of threads in ztress framework" 220 default 3 221 range 1 16 222 223config ZTRESS_STACK_SIZE 224 int "Stack size of Ztress thread" 225 default 4096 if NO_OPTIMIZATIONS 226 default 2048 227 228config ZTRESS_REPORT_PROGRESS_MS 229 int "Progress report interval (in milliseconds)" 230 default 1000 231 help 232 Use 0 to disable. 233endif # ZTRESS 234