From 321fe77d32fef32ef820f53924045fe6ef0cf6ed Mon Sep 17 00:00:00 2001 From: Petri Latvala Date: Mon, 17 Dec 2018 15:07:40 +0200 Subject: 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 Cc: Martin Peres Cc: Arkadiusz Hiler Acked-by: Martin Peres Reviewed-by: Arkadiusz Hiler --- runner/resultgen.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'runner/resultgen.c') 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)) { -- cgit v1.2.3