[oe-commits] [openembedded-core] 01/03: resulttool/resultutils: Enable add extra configurations to results

git at git.openembedded.org git at git.openembedded.org
Tue Jun 11 21:33:37 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 9b8fb008a73925af4b9c4acb1d4b428a324a0ab6
Author: Yeoh Ee Peng <ee.peng.yeoh at intel.com>
AuthorDate: Thu Apr 4 10:30:35 2019 +0800

    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.
    
    Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/lib/resulttool/resultutils.py | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/scripts/lib/resulttool/resultutils.py b/scripts/lib/resulttool/resultutils.py
index ea4ab42..e595c18 100644
--- a/scripts/lib/resulttool/resultutils.py
+++ b/scripts/lib/resulttool/resultutils.py
@@ -42,10 +42,12 @@ def is_url(p):
     """
     return p.startswith('http://') or p.startswith('https://')
 
+extra_configvars = {'TESTSERIES': ''}
+
 #
 # Load the json file and append the results data into the provided results dict
 #
-def append_resultsdata(results, f, configmap=store_map):
+def append_resultsdata(results, f, configmap=store_map, configvars=extra_configvars):
     if type(f) is str:
         if is_url(f):
             with urllib.request.urlopen(f) as response:
@@ -61,12 +63,15 @@ def append_resultsdata(results, f, configmap=store_map):
     for res in data:
         if "configuration" not in data[res] or "result" not in data[res]:
             raise ValueError("Test results data without configuration or result section?")
-        if "TESTSERIES" not in data[res]["configuration"]:
-            data[res]["configuration"]["TESTSERIES"] = testseries
+        for config in configvars:
+            if config == "TESTSERIES" and "TESTSERIES" not in data[res]["configuration"]:
+                data[res]["configuration"]["TESTSERIES"] = testseries
+                continue
+            if config not in data[res]["configuration"]:
+                data[res]["configuration"][config] = configvars[config]
         testtype = data[res]["configuration"].get("TEST_TYPE")
         if testtype not in configmap:
             raise ValueError("Unknown test type %s" % testtype)
-        configvars = configmap[testtype]
         testpath = "/".join(data[res]["configuration"].get(i) for i in configmap[testtype])
         if testpath not in results:
             results[testpath] = {}
@@ -76,16 +81,16 @@ def append_resultsdata(results, f, configmap=store_map):
 # Walk a directory and find/load results data
 # or load directly from a file
 #
-def load_resultsdata(source, configmap=store_map):
+def load_resultsdata(source, configmap=store_map, configvars=extra_configvars):
     results = {}
     if is_url(source) or os.path.isfile(source):
-        append_resultsdata(results, source, configmap)
+        append_resultsdata(results, source, configmap, configvars)
         return results
     for root, dirs, files in os.walk(source):
         for name in files:
             f = os.path.join(root, name)
             if name == "testresults.json":
-                append_resultsdata(results, f, configmap)
+                append_resultsdata(results, f, configmap, configvars)
     return results
 
 def filter_resultsdata(results, resultid):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list