From: Michael Halstead Date: Fri, 14 Jul 2023 17:46:13 +0000 (-0700) Subject: resulttool/resultutils: allow index generation despite corrupt json X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~339 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a9157684a6bff8406c9bb470cb2e16ee006bbe9;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git resulttool/resultutils: allow index generation despite corrupt json non-release indexes will continue to generate when test output is corrupted. Signed-off-by: Michael Halstead Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- diff --git a/scripts/lib/resulttool/resultutils.py b/scripts/lib/resulttool/resultutils.py index 7666331ba28..c5521d81bd1 100644 --- a/scripts/lib/resulttool/resultutils.py +++ b/scripts/lib/resulttool/resultutils.py @@ -58,7 +58,11 @@ def append_resultsdata(results, f, configmap=store_map, configvars=extra_configv testseries = posixpath.basename(posixpath.dirname(url.path)) else: with open(f, "r") as filedata: - data = json.load(filedata) + try: + data = json.load(filedata) + except json.decoder.JSONDecodeError: + print("Cannot decode {}. Possible corruption. Skipping.".format(f)) + data = "" testseries = os.path.basename(os.path.dirname(f)) else: data = f