All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] resulttool: Enable report for single result file
@ 2019-04-02  6:38 Yeoh Ee Peng
  2019-04-02  6:38 ` [PATCH 2/2] resulttool/merge: Enable turn off testseries configuration creation Yeoh Ee Peng
  0 siblings, 1 reply; 2+ messages in thread
From: Yeoh Ee Peng @ 2019-04-02  6:38 UTC (permalink / raw)
  To: openembedded-core

Current validation check function inside resulttool disallow the
report for single result file although the underlying library
was able to handle both directory and file as source input to report.
Removed the validation check as it was no longer needed and to
enable report for single result file.

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
---
 scripts/resulttool | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/scripts/resulttool b/scripts/resulttool
index 5a89e1c..18ac101 100755
--- a/scripts/resulttool
+++ b/scripts/resulttool
@@ -51,13 +51,6 @@ import resulttool.report
 import resulttool.manualexecution
 logger = scriptutils.logger_create('resulttool')
 
-def _validate_user_input_arguments(args):
-    if hasattr(args, "source_dir"):
-        if not os.path.isdir(args.source_dir):
-            logger.error('source_dir argument need to be a directory : %s' % args.source_dir)
-            return False
-    return True
-
 def main():
     parser = argparse_oe.ArgumentParser(description="OEQA test result manipulation tool.",
                                         epilog="Use %(prog)s <subcommand> --help to get help on a specific command")
@@ -80,9 +73,6 @@ def main():
     elif args.quiet:
         logger.setLevel(logging.ERROR)
 
-    if not _validate_user_input_arguments(args):
-        return -1
-
     try:
         ret = args.func(args, logger)
     except argparse_oe.ArgumentUsageError as ae:
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] resulttool/merge: Enable turn off testseries configuration creation
  2019-04-02  6:38 [PATCH 1/2] resulttool: Enable report for single result file Yeoh Ee Peng
@ 2019-04-02  6:38 ` Yeoh Ee Peng
  0 siblings, 0 replies; 2+ messages in thread
From: Yeoh Ee Peng @ 2019-04-02  6:38 UTC (permalink / raw)
  To: openembedded-core

Testseries configuration has important implication to report and
regression. Enable turn off testseries configuration creation
during results merge.

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
---
 scripts/lib/resulttool/merge.py       | 13 +++++++------
 scripts/lib/resulttool/resultutils.py | 10 +++++-----
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/scripts/lib/resulttool/merge.py b/scripts/lib/resulttool/merge.py
index 3e4b7a3..5fffb54 100644
--- a/scripts/lib/resulttool/merge.py
+++ b/scripts/lib/resulttool/merge.py
@@ -18,15 +18,15 @@ import resulttool.resultutils as resultutils
 
 def merge(args, logger):
     if os.path.isdir(args.target_results):
-        results = resultutils.load_resultsdata(args.target_results, configmap=resultutils.store_map)
-        resultutils.append_resultsdata(results, args.base_results, configmap=resultutils.store_map)
+        results = resultutils.load_resultsdata(args.target_results, configmap=resultutils.store_map, add_testseries=args.off_add_testseries)
+        resultutils.append_resultsdata(results, args.base_results, configmap=resultutils.store_map, add_testseries=args.off_add_testseries)
         resultutils.save_resultsdata(results, args.target_results)
     else:
-        results = resultutils.load_resultsdata(args.base_results, configmap=resultutils.flatten_map)
+        results = resultutils.load_resultsdata(args.base_results, configmap=resultutils.flatten_map, add_testseries=args.off_add_testseries)
         if os.path.exists(args.target_results):
-            resultutils.append_resultsdata(results, args.target_results, configmap=resultutils.flatten_map)
+            resultutils.append_resultsdata(results, args.target_results, configmap=resultutils.flatten_map, add_testseries=args.off_add_testseries)
         resultutils.save_resultsdata(results, os.path.dirname(args.target_results), fn=os.path.basename(args.target_results))
-
+    logger.info('Merged results to %s' % os.path.dirname(args.target_results))
     return 0
 
 def register_commands(subparsers):
@@ -39,4 +39,5 @@ def register_commands(subparsers):
                               help='the results file/directory to import')
     parser_build.add_argument('target_results',
                               help='the target file or directory to merge the base_results with')
-
+    parser_build.add_argument('-o', '--off-add-testseries', action='store_false',
+                              help='turn off add testseries configuration to results')
diff --git a/scripts/lib/resulttool/resultutils.py b/scripts/lib/resulttool/resultutils.py
index 153f2b8..4318ee7 100644
--- a/scripts/lib/resulttool/resultutils.py
+++ b/scripts/lib/resulttool/resultutils.py
@@ -42,7 +42,7 @@ store_map = {
 #
 # 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, add_testseries=True):
     if type(f) is str:
         with open(f, "r") as filedata:
             data = json.load(filedata)
@@ -51,7 +51,7 @@ 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"]:
+        if add_testseries and "TESTSERIES" not in data[res]["configuration"]:
             data[res]["configuration"]["TESTSERIES"] = os.path.basename(os.path.dirname(f))
         testtype = data[res]["configuration"].get("TEST_TYPE")
         if testtype not in configmap:
@@ -72,16 +72,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, add_testseries=True):
     results = {}
     if os.path.isfile(source):
-        append_resultsdata(results, source, configmap)
+        append_resultsdata(results, source, configmap, add_testseries)
         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, add_testseries)
     return results
 
 def filter_resultsdata(results, resultid):
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-02  7:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02  6:38 [PATCH 1/2] resulttool: Enable report for single result file Yeoh Ee Peng
2019-04-02  6:38 ` [PATCH 2/2] resulttool/merge: Enable turn off testseries configuration creation Yeoh Ee Peng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.