]> code.ossystems Code Review - openembedded-core.git/commitdiff
resulttool/store: Enable add EXECUTED_BY config to results
authorYeoh Ee Peng <ee.peng.yeoh@intel.com>
Thu, 4 Apr 2019 02:30:36 +0000 (10:30 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 12 Jun 2019 09:53:53 +0000 (10:53 +0100)
Current results stored does not have information needed to trace who
executed the tests. Enable store to add EXECUTED_BY configuration
to results file in order to track who executed the tests.

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/resulttool/store.py

index 06505aecc05c75ec7504bde69a080d28b4aaae21..79c83dd8b7e6b1a6f7bddf9afdaa44f8f65a7db3 100644 (file)
@@ -21,16 +21,19 @@ import oeqa.utils.gitarchive as gitarchive
 def store(args, logger):
     tempdir = tempfile.mkdtemp(prefix='testresults.')
     try:
+        configvars = resultutils.extra_configvars.copy()
+        if args.executed_by:
+            configvars['EXECUTED_BY'] = args.executed_by
         results = {}
         logger.info('Reading files from %s' % args.source)
         if resultutils.is_url(args.source) or os.path.isfile(args.source):
-            resultutils.append_resultsdata(results, args.source)
+            resultutils.append_resultsdata(results, args.source, configvars=configvars)
         else:
             for root, dirs,  files in os.walk(args.source):
                 for name in files:
                     f = os.path.join(root, name)
                     if name == "testresults.json":
-                        resultutils.append_resultsdata(results, f)
+                        resultutils.append_resultsdata(results, f, configvars=configvars)
                     elif args.all:
                         dst = f.replace(args.source, tempdir + "/")
                         os.makedirs(os.path.dirname(dst), exist_ok=True)
@@ -93,4 +96,6 @@ def register_commands(subparsers):
                               help='include all files, not just testresults.json files')
     parser_build.add_argument('-e', '--allow-empty', action='store_true',
                               help='don\'t error if no results to store are found')
+    parser_build.add_argument('-x', '--executed-by', default='',
+                              help='add executed-by configuration to each result file')