[igt-dev] [PATCH i-g-t] runner/resultgen: Handle empty outputs

Petri Latvala petri.latvala at intel.com
Fri Oct 11 11:52:55 UTC 2019


If an output (out.txt or err.txt) is completely empty, we handle the
parsing just fine as is, but we end up assuming that if journal says
we have a subtest, that subtest printed that it started. We have one
case where out.txt was empty and all other files were intact (ran out
of disk?)

All other paths that expect certain texts handle failures finding them
properly apart from subtest result processing, which happily passed
along a NULL pointer as a string to json. After handling that case,
the processing of said weird case proceeded fine and produced correct
results.

Signed-off-by: Petri Latvala <petri.latvala at intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
 runner/resultgen.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index 58b95220..46c9d8d5 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -268,8 +268,9 @@ static struct json_object *get_or_create_json_object(struct json_object *base,
 
 static void set_result(struct json_object *obj, const char *result)
 {
-	json_object_object_add(obj, "result",
-			       json_object_new_string(result));
+	if (result)
+		json_object_object_add(obj, "result",
+				       json_object_new_string(result));
 }
 
 static void add_runtime(struct json_object *obj, double time)
-- 
2.19.1



More information about the igt-dev mailing list