summaryrefslogtreecommitdiff
path: root/runner/resultgen.c
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2019-10-11 14:52:55 +0300
committerPetri Latvala <petri.latvala@intel.com>2019-10-14 09:59:59 +0300
commitb7f07ac861e5cb8e015b0368cc0ee029de885326 (patch)
treedbf7a294f51c3ad5d0c5e510158e9f9acff80836 /runner/resultgen.c
parent8b026b098fb3631f2c4026266716a98a592ffadd (diff)
runner/resultgen: Handle empty outputs
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@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'runner/resultgen.c')
-rw-r--r--runner/resultgen.c5
1 files 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)