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