ztest: shell: add shell support

- Support for listing both testcases and testsuites
- Support for running single suites or single test cases
- Support shuffling tests and repeating execution based on command line
  arguments.

For example, build with

west build -p  -b qemu_cortex_m3  tests/kernel/sleep   -t run -- \
-DCONFIG_ZTEST_SHUFFLE=y -DCONFIG_ZTEST_SHELL=y

Following commands are available:

uart:~$ ztest
ztest - Ztest commands
Subcommands:
  run-all          :Run all tests
  shuffle          :Shuffle tests
  list-testsuites  :List all test suites
  list-testcases   :List all test cases
  run-testsuite    :Run test suite
  run-testcase     :Run testcase

shuffle accepts two arguments --suite_iter and --case_iter which allows
repeated exercution of testcases or suites.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2023-12-18 16:02:18 -05:00 committed by Carles Cufí
commit afc319e3fa
15 changed files with 426 additions and 58 deletions

View file

@ -424,7 +424,7 @@ ZTEST(fail_assume_in_test, test_to_skip)
void test_main(void)
{
ztest_run_test_suites(NULL);
ztest_run_test_suites(NULL, false, 1, 1);
/* Can't run ztest_verify_all_test_suites_ran() since some tests are
* skipped by design.
*/