diff options
author | Petri Latvala <petri.latvala@intel.com> | 2018-12-17 15:07:40 +0200 |
---|---|---|
committer | Petri Latvala <petri.latvala@intel.com> | 2018-12-20 14:10:31 +0200 |
commit | 321fe77d32fef32ef820f53924045fe6ef0cf6ed (patch) | |
tree | 2387bd5733f6c7a3932866276e76dc5debe68334 /runner/resultgen.c | |
parent | 47f5a57a81b66c21d06695e263a22b87f5a33009 (diff) |
runner: Add explicit "notrun" results for tests that were not executed
When possible, all tests we know we were going to attempt to execute
now appear in the results as "notrun". The only known case where it's
not possible to add an explicit "notrun" is when running in
multiple-mode, because "no subtests" and "run all subtests, we didn't
list them beforehand" are represented the same.
v2: Rebase and adjust to already landed json changes
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Martin Peres <martin.peres@linux.intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Acked-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'runner/resultgen.c')
-rw-r--r-- | runner/resultgen.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/runner/resultgen.c b/runner/resultgen.c index a1a91cd0..be884955 100644 --- a/runner/resultgen.c +++ b/runner/resultgen.c @@ -1034,6 +1034,44 @@ static bool parse_test_directory(int dirfd, return status; } +static void try_add_notrun_results(const struct job_list_entry *entry, + const struct settings *settings, + struct results *results) +{ + struct subtests subtests = {}; + struct json_object *current_test; + size_t i; + + if (entry->subtest_count == 0) { + char piglit_name[256]; + + /* We cannot distinguish no-subtests from run-all-subtests in multiple-mode */ + if (settings->multiple_mode) + return; + generate_piglit_name(entry->binary, NULL, piglit_name, sizeof(piglit_name)); + current_test = get_or_create_json_object(results->tests, piglit_name); + json_object_object_add(current_test, "out", json_object_new_string("")); + json_object_object_add(current_test, "err", json_object_new_string("")); + json_object_object_add(current_test, "dmesg", json_object_new_string("")); + json_object_object_add(current_test, "result", json_object_new_string("notrun")); + } + + for (i = 0; i < entry->subtest_count; i++) { + char piglit_name[256]; + + generate_piglit_name(entry->binary, entry->subtests[i], piglit_name, sizeof(piglit_name)); + current_test = get_or_create_json_object(results->tests, piglit_name); + json_object_object_add(current_test, "out", json_object_new_string("")); + json_object_object_add(current_test, "err", json_object_new_string("")); + json_object_object_add(current_test, "dmesg", json_object_new_string("")); + json_object_object_add(current_test, "result", json_object_new_string("notrun")); + add_subtest(&subtests, strdup(entry->subtests[i])); + } + + add_to_totals(entry->binary, &subtests, results); + free_subtests(&subtests); +} + static void create_result_root_nodes(struct json_object *root, struct results *results) { @@ -1123,8 +1161,8 @@ struct json_object *generate_results_json(int dirfd) snprintf(name, 16, "%zd", i); if ((testdirfd = openat(dirfd, name, O_DIRECTORY | O_RDONLY)) < 0) { - fprintf(stderr, "Warning: Cannot open result directory %s\n", name); - break; + try_add_notrun_results(&job_list.entries[i], &settings, &results); + continue; } if (!parse_test_directory(testdirfd, &job_list.entries[i], &settings, &results)) { |