summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorYeoh Ee Peng <ee.peng.yeoh@intel.com>2019-04-04 10:30:35 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-12 10:54:40 +0100
commit588f4550824241aae61930bb732f56c6a3b51a9f (patch)
treeab7b302b6d948095ff15908a5a29307f9b59ab8f /scripts/lib
parenteb92c1342115eb7d5d2c746b45bdcd41dd714b83 (diff)
downloadpoky-588f4550824241aae61930bb732f56c6a3b51a9f.tar.gz
resulttool/resultutils: Enable add extra configurations to results
Current resultutils library always add "TESTSERIES" configuration to results. Enhance this to allow control of adding "TESTSERIES" configuration as well as allow adding extra configurations when needed. (From OE-Core rev: 443c0acc14ef2451b10878fc83dd11b46805daf0) Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/resulttool/resultutils.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/scripts/lib/resulttool/resultutils.py b/scripts/lib/resulttool/resultutils.py
index ea4ab42d9a..e595c185df 100644
--- a/scripts/lib/resulttool/resultutils.py
+++ b/scripts/lib/resulttool/resultutils.py
@@ -42,10 +42,12 @@ def is_url(p):
42 """ 42 """
43 return p.startswith('http://') or p.startswith('https://') 43 return p.startswith('http://') or p.startswith('https://')
44 44
45extra_configvars = {'TESTSERIES': ''}
46
45# 47#
46# Load the json file and append the results data into the provided results dict 48# Load the json file and append the results data into the provided results dict
47# 49#
48def append_resultsdata(results, f, configmap=store_map): 50def append_resultsdata(results, f, configmap=store_map, configvars=extra_configvars):
49 if type(f) is str: 51 if type(f) is str:
50 if is_url(f): 52 if is_url(f):
51 with urllib.request.urlopen(f) as response: 53 with urllib.request.urlopen(f) as response:
@@ -61,12 +63,15 @@ def append_resultsdata(results, f, configmap=store_map):
61 for res in data: 63 for res in data:
62 if "configuration" not in data[res] or "result" not in data[res]: 64 if "configuration" not in data[res] or "result" not in data[res]:
63 raise ValueError("Test results data without configuration or result section?") 65 raise ValueError("Test results data without configuration or result section?")
64 if "TESTSERIES" not in data[res]["configuration"]: 66 for config in configvars:
65 data[res]["configuration"]["TESTSERIES"] = testseries 67 if config == "TESTSERIES" and "TESTSERIES" not in data[res]["configuration"]:
68 data[res]["configuration"]["TESTSERIES"] = testseries
69 continue
70 if config not in data[res]["configuration"]:
71 data[res]["configuration"][config] = configvars[config]
66 testtype = data[res]["configuration"].get("TEST_TYPE") 72 testtype = data[res]["configuration"].get("TEST_TYPE")
67 if testtype not in configmap: 73 if testtype not in configmap:
68 raise ValueError("Unknown test type %s" % testtype) 74 raise ValueError("Unknown test type %s" % testtype)
69 configvars = configmap[testtype]
70 testpath = "/".join(data[res]["configuration"].get(i) for i in configmap[testtype]) 75 testpath = "/".join(data[res]["configuration"].get(i) for i in configmap[testtype])
71 if testpath not in results: 76 if testpath not in results:
72 results[testpath] = {} 77 results[testpath] = {}
@@ -76,16 +81,16 @@ def append_resultsdata(results, f, configmap=store_map):
76# Walk a directory and find/load results data 81# Walk a directory and find/load results data
77# or load directly from a file 82# or load directly from a file
78# 83#
79def load_resultsdata(source, configmap=store_map): 84def load_resultsdata(source, configmap=store_map, configvars=extra_configvars):
80 results = {} 85 results = {}
81 if is_url(source) or os.path.isfile(source): 86 if is_url(source) or os.path.isfile(source):
82 append_resultsdata(results, source, configmap) 87 append_resultsdata(results, source, configmap, configvars)
83 return results 88 return results
84 for root, dirs, files in os.walk(source): 89 for root, dirs, files in os.walk(source):
85 for name in files: 90 for name in files:
86 f = os.path.join(root, name) 91 f = os.path.join(root, name)
87 if name == "testresults.json": 92 if name == "testresults.json":
88 append_resultsdata(results, f, configmap) 93 append_resultsdata(results, f, configmap, configvars)
89 return results 94 return results
90 95
91def filter_resultsdata(results, resultid): 96def filter_resultsdata(results, resultid):