[oe-commits] [openembedded-core] 02/02: WIP: gcc log collection and compression

git at git.openembedded.org git at git.openembedded.org
Mon Sep 9 07:40:40 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 0c872d2f1d6105327a431b3c3634b24403c21817
Author: Nathan Rossi <nathan at nathanrossi.com>
AuthorDate: Mon Sep 9 16:22:15 2019 +1000

    WIP: gcc log collection and compression
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/selftest/cases/gcc.py | 10 ++++++++++
 scripts/lib/resulttool/log.py       |  9 ++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/selftest/cases/gcc.py b/meta/lib/oeqa/selftest/cases/gcc.py
index 2c25b59..bedc90e 100644
--- a/meta/lib/oeqa/selftest/cases/gcc.py
+++ b/meta/lib/oeqa/selftest/cases/gcc.py
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier: MIT
 import os
+import base64
+import zlib
 from oeqa.core.decorator import OETestTag
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars, runqemu, Command
@@ -48,6 +50,7 @@ class GccSelfTestBase(OESelftestTestCase):
                 sumspath = os.path.join(builddir, target_sys, suite, "testsuite", "{0}.sum".format(suite))
             if not os.path.exists(sumspath): # handle libstdc++-v3 -> libstdc++
                 sumspath = os.path.join(builddir, target_sys, suite, "testsuite", "{0}.sum".format(suite.split("-")[0]))
+            logpath = os.path.splitext(sumspath)[0] + ".log"
 
             ptestsuite = "gcc-{}".format(suite) if suite != "gcc" else suite
             ptestsuite = ptestsuite + "-user" if ssh is None else ptestsuite
@@ -56,6 +59,13 @@ class GccSelfTestBase(OESelftestTestCase):
                 for test, result in parse_values(f):
                     self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result}
 
+            with open(logpath, "r") as f:
+                # store the log for the result in compressed form
+                logdata = base64.b64encode(zlib.compress(f.read().encode("utf-8"))).decode("utf-8")
+                self.extraresults["ptestresult.sections"][ptestsuite]["log"] = {
+                        "compressed" : logdata,
+                        }
+
     def run_check_emulated(self, *args, **kwargs):
         # build core-image-minimal with required packages
         default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp"]
diff --git a/scripts/lib/resulttool/log.py b/scripts/lib/resulttool/log.py
index 2352c76..d61971e 100644
--- a/scripts/lib/resulttool/log.py
+++ b/scripts/lib/resulttool/log.py
@@ -5,6 +5,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 #
 import os
+import base64
+import zlib
 import resulttool.resultutils as resultutils
 
 def show_ptest(result, ptest, logger):
@@ -39,6 +41,7 @@ def log(args, logger):
             if 'ptestresult.sections' in r:
                 for name, ptest in r['ptestresult.sections'].items():
                     if 'log' in ptest:
+                        logdata = ptest['log']
                         dest_dir = args.dump_ptest
                         if args.prepend_run:
                             dest_dir = os.path.join(dest_dir, run_name)
@@ -48,7 +51,11 @@ def log(args, logger):
                         dest = os.path.join(dest_dir, '%s.log' % name)
                         print(dest)
                         with open(dest, 'w') as f:
-                            f.write(ptest['log'])
+                            if isinstance(logdata, str):
+                                f.write(logdata)
+                            elif isinstance(logdata, dict):
+                                if "compressed" in logdata:
+                                    f.write(zlib.decompress(base64.b64decode(logdata.get("compressed").encode("utf-8"))).decode("utf-8"))
 
         if args.raw_ptest:
             if 'ptestresult.rawlogs' in r:

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


More information about the Openembedded-commits mailing list