History

Merge tag 'linux-kselftest-kunit-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull KUnit updates from Shuah Khan: "This consists of several fixes and enhancements. A few highlights: - Option --kconfig_add option allows easily tweaking kunitconfigs - make build subcommand can reconfigure if needed - doesn't error on tests without test plans - doesn't crash if no parameters are generated - defaults --jobs to # of cups - reports test parameter results as (K)TAP subtests" * tag 'linux-kselftest-kunit-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: kunit: tool: Default --jobs to number of CPUs kunit: tool: fix newly introduced typechecker errors kunit: tool: make `build` subcommand also reconfigure if needed kunit: tool: delete kunit_parser.TestResult type kunit: tool: use dataclass instead of collections.namedtuple kunit: tool: suggest using decode_stacktrace.sh on kernel crash kunit: tool: reconfigure when the used kunitconfig changes kunit: tool: revamp message for invalid kunitconfig kunit: tool: add --kconfig_add to allow easily tweaking kunitconfigs kunit: tool: move Kconfig read_from_file/parse_from_string to package-level kunit: tool: print parsed test results fully incrementally kunit: Report test parameter results as (K)TAP subtests kunit: Don't crash if no parameters are generated kunit: tool: Report an error if any test has no subtests kunit: tool: Do not error on tests without test plans kunit: add run_checks.py script to validate kunit changes Documentation: kunit: remove claims that kunit is a mocking framework kunit: tool: fix --json output for skipped tests

Linus Torvalds committed 4 years ago

Commit bf4eebf2 parents 4369b3c ad659cc13 files · +480 −204Browse files

Showing the changes to lib (1 of 13 files). Show all

Unified · Split

lib/kunit/test.c+14−11
@@ -504,25 +504,28 @@ int kunit_run_tests(struct kunit_suite *suite) · 503 unmodified lines
504504 struct kunit_result_stats param_stats = { 0 };
505505 test_case->status = KUNIT_SKIPPED;
506506
507− if (test_case->generate_params) {
507+ if (!test_case->generate_params) {
508+ /* Non-parameterised test. */
509+ kunit_run_case_catch_errors(suite, test_case, &test);
510+ kunit_update_stats(&param_stats, test.status);
511+ } else {
508512 /* Get initial param. */
509513 param_desc[0] = '\0';
510514 test.param_value = test_case->generate_params(NULL, param_desc);
511− }
515+ kunit_log(KERN_INFO, &test, KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
516+ "# Subtest: %s", test_case->name);
512517
513− do {
514− kunit_run_case_catch_errors(suite, test_case, &test);
518+ while (test.param_value) {
519+ kunit_run_case_catch_errors(suite, test_case, &test);
515520
516− if (test_case->generate_params) {
517521 if (param_desc[0] == '\0') {
518522 snprintf(param_desc, sizeof(param_desc),
519523 "param-%d", test.param_index);
520524 }
521525
522526 kunit_log(KERN_INFO, &test,
523− KUNIT_SUBTEST_INDENT
524− "# %s: %s %d - %s",
525− test_case->name,
527+ KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
528+ "%s %d - %s",
526529 kunit_status_to_ok_not_ok(test.status),
527530 test.param_index + 1, param_desc);
528531
@@ -530,11 +533,11 @@ int kunit_run_tests(struct kunit_suite *suite) · 1 unmodified line
530533 param_desc[0] = '\0';
531534 test.param_value = test_case->generate_params(test.param_value, param_desc);
532535 test.param_index++;
533− }
534536
535− kunit_update_stats(&param_stats, test.status);
537+ kunit_update_stats(&param_stats, test.status);
538+ }
539+ }
536540
537− } while (test.param_value);
538541
539542 kunit_print_test_stats(&test, param_stats);
540543

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t