diff options
Diffstat (limited to 'poky/meta/lib')
-rw-r--r-- | poky/meta/lib/oe/classextend.py | 2 | ||||
-rw-r--r-- | poky/meta/lib/oe/copy_buildsystem.py | 8 | ||||
-rw-r--r-- | poky/meta/lib/oe/sstatesig.py | 8 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/core/case.py | 49 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/core/utils/concurrencytest.py | 2 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/binutils.py | 11 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/gcc.py | 9 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/glibc.py | 7 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/imagefeatures.py | 3 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/oescripts.py | 58 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/runtime_test.py | 2 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/wic.py | 6 |
12 files changed, 140 insertions, 25 deletions
diff --git a/poky/meta/lib/oe/classextend.py b/poky/meta/lib/oe/classextend.py index e25122e815..f02fbe9fba 100644 --- a/poky/meta/lib/oe/classextend.py +++ b/poky/meta/lib/oe/classextend.py @@ -24,6 +24,8 @@ class ClassExtender(object): if not subs.startswith(self.extname): return "virtual/" + self.extname + "-" + subs return name + if name.startswith("/"): + return name if not name.startswith(self.extname): return self.extname + "-" + name return name diff --git a/poky/meta/lib/oe/copy_buildsystem.py b/poky/meta/lib/oe/copy_buildsystem.py index cb663b21c6..31a84f5b06 100644 --- a/poky/meta/lib/oe/copy_buildsystem.py +++ b/poky/meta/lib/oe/copy_buildsystem.py @@ -177,7 +177,7 @@ def generate_locked_sigs(sigfile, d): tasks = ['%s:%s' % (v[2], v[1]) for v in depd.values()] bb.parse.siggen.dump_lockedsigs(sigfile, tasks) -def prune_lockedsigs(excluded_tasks, excluded_targets, lockedsigs, pruned_output): +def prune_lockedsigs(excluded_tasks, excluded_targets, lockedsigs, onlynative, pruned_output): with open(lockedsigs, 'r') as infile: bb.utils.mkdirhier(os.path.dirname(pruned_output)) with open(pruned_output, 'w') as f: @@ -187,7 +187,11 @@ def prune_lockedsigs(excluded_tasks, excluded_targets, lockedsigs, pruned_output if line.endswith('\\\n'): splitval = line.strip().split(':') if not splitval[1] in excluded_tasks and not splitval[0] in excluded_targets: - f.write(line) + if onlynative: + if 'nativesdk' in splitval[0]: + f.write(line) + else: + f.write(line) else: f.write(line) invalue = False diff --git a/poky/meta/lib/oe/sstatesig.py b/poky/meta/lib/oe/sstatesig.py index 0c7a6f5ed8..50d80bf51a 100644 --- a/poky/meta/lib/oe/sstatesig.py +++ b/poky/meta/lib/oe/sstatesig.py @@ -262,13 +262,9 @@ class SignatureGeneratorOEEquivHash(bb.siggen.SignatureGeneratorUniHashMixIn, Si def init_rundepcheck(self, data): super().init_rundepcheck(data) - autostart = data.getVar('BB_HASHSERVE') - if autostart: - self.server = "http://" + autostart - else: - self.server = data.getVar('SSTATE_HASHEQUIV_SERVER') + self.server = data.getVar('BB_HASHSERVE') if not self.server: - bb.fatal("OEEquivHash requires SSTATE_HASHEQUIV_SERVER or BB_HASHSERVE to be set") + bb.fatal("OEEquivHash requires BB_HASHSERVE to be set") self.method = data.getVar('SSTATE_HASHEQUIV_METHOD') if not self.method: bb.fatal("OEEquivHash requires SSTATE_HASHEQUIV_METHOD to be set") diff --git a/poky/meta/lib/oeqa/core/case.py b/poky/meta/lib/oeqa/core/case.py index aca144e9dc..180635ac6c 100644 --- a/poky/meta/lib/oeqa/core/case.py +++ b/poky/meta/lib/oeqa/core/case.py @@ -4,6 +4,8 @@ # SPDX-License-Identifier: MIT # +import base64 +import zlib import unittest from oeqa.core.exception import OEQAMissingVariable @@ -49,3 +51,50 @@ class OETestCase(unittest.TestCase): for d in self.decorators: d.tearDownDecorator() self.tearDownMethod() + +class OEPTestResultTestCase: + """ + Mix-in class to provide functions to make interacting with extraresults for + the purposes of storing ptestresult data. + """ + @staticmethod + def _compress_log(log): + logdata = log.encode("utf-8") + logdata = zlib.compress(logdata) + logdata = base64.b64encode(logdata).decode("utf-8") + return {"compressed" : logdata} + + def ptest_rawlog(self, log): + if not hasattr(self, "extraresults"): + self.extraresults = {"ptestresult.sections" : {}} + self.extraresults["ptestresult.rawlogs"] = {"log" : self._compress_log(log)} + + def ptest_section(self, section, duration = None, log = None, logfile = None, exitcode = None): + if not hasattr(self, "extraresults"): + self.extraresults = {"ptestresult.sections" : {}} + + sections = self.extraresults.get("ptestresult.sections") + if section not in sections: + sections[section] = {} + + if log is not None: + sections[section]["log"] = self._compress_log(log) + elif logfile is not None: + with open(logfile, "r") as f: + sections[section]["log"] = self._compress_log(f.read()) + + if duration is not None: + sections[section]["duration"] = duration + if exitcode is not None: + sections[section]["exitcode"] = exitcode + + def ptest_result(self, section, test, result): + if not hasattr(self, "extraresults"): + self.extraresults = {"ptestresult.sections" : {}} + + sections = self.extraresults.get("ptestresult.sections") + if section not in sections: + sections[section] = {} + resultname = "ptestresult.{}.{}".format(section, test) + self.extraresults[resultname] = {"status" : result} + diff --git a/poky/meta/lib/oeqa/core/utils/concurrencytest.py b/poky/meta/lib/oeqa/core/utils/concurrencytest.py index fa6fa34b0e..6293cf94ec 100644 --- a/poky/meta/lib/oeqa/core/utils/concurrencytest.py +++ b/poky/meta/lib/oeqa/core/utils/concurrencytest.py @@ -216,7 +216,7 @@ def removebuilddir(d): while delay and os.path.exists(d + "/bitbake.lock"): time.sleep(1) delay = delay - 1 - bb.utils.prunedir(d) + bb.utils.prunedir(d, ionice=True) def fork_for_tests(concurrency_num, suite): result = [] diff --git a/poky/meta/lib/oeqa/selftest/cases/binutils.py b/poky/meta/lib/oeqa/selftest/cases/binutils.py index 9bc752040f..821f52f5a8 100644 --- a/poky/meta/lib/oeqa/selftest/cases/binutils.py +++ b/poky/meta/lib/oeqa/selftest/cases/binutils.py @@ -4,6 +4,7 @@ import sys import re import logging from oeqa.core.decorator import OETestTag +from oeqa.core.case import OEPTestResultTestCase from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars @@ -15,7 +16,7 @@ def parse_values(content): break @OETestTag("toolchain-user", "toolchain-system") -class BinutilsCrossSelfTest(OESelftestTestCase): +class BinutilsCrossSelfTest(OESelftestTestCase, OEPTestResultTestCase): def test_binutils(self): self.run_binutils("binutils") @@ -36,14 +37,14 @@ class BinutilsCrossSelfTest(OESelftestTestCase): bitbake("{0} -c check".format(recipe)) - ptestsuite = "binutils-{}".format(suite) if suite != "binutils" else suite - self.extraresults = {"ptestresult.sections" : {ptestsuite : {}}} - sumspath = os.path.join(builddir, suite, "{0}.sum".format(suite)) if not os.path.exists(sumspath): sumspath = os.path.join(builddir, suite, "testsuite", "{0}.sum".format(suite)) + logpath = os.path.splitext(sumspath)[0] + ".log" + ptestsuite = "binutils-{}".format(suite) if suite != "binutils" else suite + self.ptest_section(ptestsuite, logfile = logpath) with open(sumspath, "r") as f: for test, result in parse_values(f): - self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} + self.ptest_result(ptestsuite, test, result) diff --git a/poky/meta/lib/oeqa/selftest/cases/gcc.py b/poky/meta/lib/oeqa/selftest/cases/gcc.py index 2c25b5904c..5a917b9c44 100644 --- a/poky/meta/lib/oeqa/selftest/cases/gcc.py +++ b/poky/meta/lib/oeqa/selftest/cases/gcc.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: MIT import os from oeqa.core.decorator import OETestTag +from oeqa.core.case import OEPTestResultTestCase from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars, runqemu, Command @@ -11,7 +12,7 @@ def parse_values(content): yield i[len(v) + 2:].strip(), v break -class GccSelfTestBase(OESelftestTestCase): +class GccSelfTestBase(OESelftestTestCase, OEPTestResultTestCase): def check_skip(self, suite): targets = get_bb_var("RUNTIMETARGET", "gcc-runtime").split() if suite not in targets: @@ -41,20 +42,20 @@ class GccSelfTestBase(OESelftestTestCase): bb_vars = get_bb_vars(["B", "TARGET_SYS"], recipe) builddir, target_sys = bb_vars["B"], bb_vars["TARGET_SYS"] - self.extraresults = {"ptestresult.sections" : {}} for suite in suites: sumspath = os.path.join(builddir, "gcc", "testsuite", suite, "{0}.sum".format(suite)) if not os.path.exists(sumspath): # check in target dirs 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 - self.extraresults["ptestresult.sections"][ptestsuite] = {} + self.ptest_section(ptestsuite, logfile = logpath) with open(sumspath, "r") as f: for test, result in parse_values(f): - self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} + self.ptest_result(ptestsuite, test, result) def run_check_emulated(self, *args, **kwargs): # build core-image-minimal with required packages diff --git a/poky/meta/lib/oeqa/selftest/cases/glibc.py b/poky/meta/lib/oeqa/selftest/cases/glibc.py index 2e42485dd6..c687f6ef93 100644 --- a/poky/meta/lib/oeqa/selftest/cases/glibc.py +++ b/poky/meta/lib/oeqa/selftest/cases/glibc.py @@ -2,6 +2,7 @@ import os import contextlib from oeqa.core.decorator import OETestTag +from oeqa.core.case import OEPTestResultTestCase from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars, runqemu, Command from oeqa.utils.nfs import unfs_server @@ -13,7 +14,7 @@ def parse_values(content): yield i[len(v) + 2:].strip(), v break -class GlibcSelfTestBase(OESelftestTestCase): +class GlibcSelfTestBase(OESelftestTestCase, OEPTestResultTestCase): def run_check(self, ssh = None): # configure ssh target features = [] @@ -31,10 +32,10 @@ class GlibcSelfTestBase(OESelftestTestCase): builddir = get_bb_var("B", "glibc-testsuite") ptestsuite = "glibc-user" if ssh is None else "glibc" - self.extraresults = {"ptestresult.sections" : {ptestsuite : {}}} + self.ptest_section(ptestsuite) with open(os.path.join(builddir, "tests.sum"), "r") as f: for test, result in parse_values(f): - self.extraresults["ptestresult.{}.{}".format(ptestsuite, test)] = {"status" : result} + self.ptest_result(ptestsuite, test, result) def run_check_emulated(self): with contextlib.ExitStack() as s: diff --git a/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py b/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py index afc629f29c..8213d63e37 100644 --- a/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py +++ b/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py @@ -161,7 +161,8 @@ class ImageFeatures(OESelftestTestCase): sysroot = get_bb_var('STAGING_DIR_NATIVE', 'core-image-minimal') result = runCmd('qemu-img info --output json %s' % image_path, native_sysroot=sysroot) - self.assertTrue(json.loads(result.output).get('format') == itype) + self.assertTrue(json.loads(result.output).get('format') == itype, + msg="Could not parse '%s'" % result.output) def test_long_chain_conversion(self): """ diff --git a/poky/meta/lib/oeqa/selftest/cases/oescripts.py b/poky/meta/lib/oeqa/selftest/cases/oescripts.py index 7770b66a26..c169885cf3 100644 --- a/poky/meta/lib/oeqa/selftest/cases/oescripts.py +++ b/poky/meta/lib/oeqa/selftest/cases/oescripts.py @@ -3,10 +3,12 @@ # import os +import shutil import unittest from oeqa.selftest.case import OESelftestTestCase from oeqa.selftest.cases.buildhistory import BuildhistoryBase from oeqa.utils.commands import Command, runCmd, bitbake, get_bb_var, get_test_layer +from oeqa.utils import CommandError class BuildhistoryDiffTests(BuildhistoryBase): @@ -63,3 +65,59 @@ class OEPybootchartguyTests(OEScriptTests): runCmd('%s/pybootchartgui/pybootchartgui.py %s -o %s/charts -f pdf' % (self.scripts_dir, self.buildstats, self.tmpdir)) self.assertTrue(os.path.exists(self.tmpdir + "/charts.pdf")) +class OEGitproxyTests(OESelftestTestCase): + + scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') + + def test_oegitproxy_help(self): + try: + res = runCmd('%s/oe-git-proxy --help' % self.scripts_dir, assert_error=False) + self.assertTrue(False) + except CommandError as e: + self.assertEqual(2, e.retcode) + + def run_oegitproxy(self, custom_shell=None): + os.environ['SOCAT'] = shutil.which("echo") + os.environ['ALL_PROXY'] = "https://proxy.example.com:3128" + os.environ['NO_PROXY'] = "*.example.com,.no-proxy.org,192.168.42.0/24,127.*.*.*" + + if custom_shell is None: + prefix = '' + else: + prefix = custom_shell + ' ' + + # outside, use the proxy + res = runCmd('%s%s/oe-git-proxy host.outside-example.com 9418' % + (prefix,self.scripts_dir)) + self.assertIn('PROXY:', res.output) + # match with wildcard suffix + res = runCmd('%s%s/oe-git-proxy host.example.com 9418' % + (prefix, self.scripts_dir)) + self.assertIn('TCP:', res.output) + # match just suffix + res = runCmd('%s%s/oe-git-proxy host.no-proxy.org 9418' % + (prefix, self.scripts_dir)) + self.assertIn('TCP:', res.output) + # match IP subnet + res = runCmd('%s%s/oe-git-proxy 192.168.42.42 9418' % + (prefix, self.scripts_dir)) + self.assertIn('TCP:', res.output) + # match IP wildcard + res = runCmd('%s%s/oe-git-proxy 127.1.2.3 9418' % + (prefix, self.scripts_dir)) + self.assertIn('TCP:', res.output) + + # test that * globbering is off + os.environ['NO_PROXY'] = "*" + res = runCmd('%s%s/oe-git-proxy host.example.com 9418' % + (prefix, self.scripts_dir)) + self.assertIn('TCP:', res.output) + + def test_oegitproxy_proxy(self): + self.run_oegitproxy() + + def test_oegitproxy_proxy_dash(self): + dash = shutil.which("dash") + if dash is None: + self.skipTest("No \"dash\" found on test system.") + self.run_oegitproxy(custom_shell=dash) diff --git a/poky/meta/lib/oeqa/selftest/cases/runtime_test.py b/poky/meta/lib/oeqa/selftest/cases/runtime_test.py index 20969d2c48..3f212bd0ea 100644 --- a/poky/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/poky/meta/lib/oeqa/selftest/cases/runtime_test.py @@ -191,7 +191,7 @@ class TestImage(OESelftestTestCase): features += 'TEST_SUITES = "ping ssh virgl"\n' features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n' features += 'IMAGE_INSTALL_append = " kmscube"\n' - features += 'TEST_RUNQEMUPARAMS = "gtk-gl"\n' + features += 'TEST_RUNQEMUPARAMS = "gtk gl"\n' self.write_config(features) bitbake('core-image-minimal') bitbake('-c testimage core-image-minimal') diff --git a/poky/meta/lib/oeqa/selftest/cases/wic.py b/poky/meta/lib/oeqa/selftest/cases/wic.py index fcdd55059d..ea75300406 100644 --- a/poky/meta/lib/oeqa/selftest/cases/wic.py +++ b/poky/meta/lib/oeqa/selftest/cases/wic.py @@ -632,8 +632,10 @@ class Wic2(WicTestCase): # 1:0.00MiB:200MiB:200MiB:ext4::;\n partlns = res.output.splitlines()[2:] - self.assertEqual(1, len(partlns)) - self.assertEqual("1:0.00MiB:200MiB:200MiB:ext4::;", partlns[0]) + self.assertEqual(1, len(partlns), + msg="Partition list '%s'" % res.output) + self.assertEqual("1:0.00MiB:200MiB:200MiB:ext4::;", partlns[0], + msg="Partition list '%s'" % res.output) def test_fixed_size_error(self): """ |