@@ -65,11 +65,6 @@ class KernelDropCaches:
runCmd2(cmd, data=input_data)
-def str_to_fn(string):
- """Convert string to a sanitized filename"""
- return re.sub(r'(\W+)', '-', string, flags=re.LOCALE)
-
-
class ResultsJsonEncoder(json.JSONEncoder):
"""Extended encoder for build perf test results"""
unix_epoch = datetime.utcfromtimestamp(0)
@@ -99,9 +99,7 @@ class OETestDataDepends(OETestDecorator):
def setUpDecorator(self):
for v in self.td_depends:
- try:
- value = self.case.td[v]
- except KeyError:
+ if v not in self.case.td:
raise OEQAMissingVariable("Test case need %s variable but"\
" isn't into td" % v)
@@ -198,17 +198,6 @@ def outSideTestaddSkip(self, offset, line):
subunit._OutSideTest.addSkip = outSideTestaddSkip
-#
-# A dummy structure to add to io.StringIO so that the .buffer object
-# is available and accepts writes. This allows unittest with buffer=True
-# to interact ok with subunit which wants to access sys.stdout.buffer.
-#
-class dummybuf:
- def __init__(self, parent):
- self.p = parent
- def write(self, data):
- self.p.write(data.decode("utf-8"))
-
#
# Taken from testtools.ConncurrencyTestSuite but modified for OE use
#
@@ -64,12 +64,6 @@ def getCaseModule(test_case):
"""
return test_case.__module__
-def getCaseClass(test_case):
- """
- Returns test case class name.
- """
- return test_case.__class__.__name__
-
def getCaseID(test_case):
"""
Returns test case complete id.
@@ -113,7 +113,6 @@ class OESDKTestContextExecutor(OETestContextExecutor):
def _get_sdk_environs(sdk_dir):
sdk_env = {}
- environ_pattern = sdk_dir + '/environment-setup-*'
full_sdk_env = glob.glob(sdk_dir + '/environment-setup-*')
for env in full_sdk_env:
m = re.search('environment-setup-(.*)', env)
@@ -50,15 +50,6 @@ def metadata_from_bb():
info_dict['config'][var] = data_dict[var]
return info_dict
-def metadata_from_data_store(d):
- """ Returns test's metadata as OrderedDict.
-
- Data will be collected from the provided data store.
- """
- # TODO: Getting metadata from the data store would
- # be useful when running within bitbake.
- pass
-
def git_rev_info(path):
"""Get git revision information as a dict"""
info = OrderedDict()
deleted file mode 100644
@@ -1,144 +0,0 @@
-#
-# Copyright (C) 2013 Intel Corporation
-#
-# SPDX-License-Identifier: MIT
-#
-
-# Provides a class for automating build tests for projects
-
-import os
-import re
-import bb.utils
-import subprocess
-import tempfile
-from abc import ABCMeta, abstractmethod
-
-class BuildProject(metaclass=ABCMeta):
-
- def __init__(self, d, uri, foldername=None, tmpdir=None):
- self.d = d
- self.uri = uri
- self.archive = os.path.basename(uri)
- self.tempdirobj = None
- if not tmpdir:
- tmpdir = self.d.getVar('WORKDIR')
- if not tmpdir:
- self.tempdirobj = tempfile.TemporaryDirectory(prefix='buildproject-')
- tmpdir = self.tempdirobj.name
- self.localarchive = os.path.join(tmpdir, self.archive)
- if foldername:
- self.fname = foldername
- else:
- self.fname = re.sub(r'\.tar\.bz2$|\.tar\.gz$|\.tar\.xz$', '', self.archive)
-
- # Download self.archive to self.localarchive
- def _download_archive(self):
- dl_dir = self.d.getVar("DL_DIR")
- if dl_dir and os.path.exists(os.path.join(dl_dir, self.archive)):
- bb.utils.copyfile(os.path.join(dl_dir, self.archive), self.localarchive)
- return
-
- exportvars = ['HTTP_PROXY', 'http_proxy',
- 'HTTPS_PROXY', 'https_proxy',
- 'FTP_PROXY', 'ftp_proxy',
- 'FTPS_PROXY', 'ftps_proxy',
- 'NO_PROXY', 'no_proxy',
- 'ALL_PROXY', 'all_proxy',
- 'SOCKS5_USER', 'SOCKS5_PASSWD']
-
- env = os.environ.copy()
- for var in exportvars:
- val = self.d.getVar(var)
- if val:
- env[var] = val
-
- cmd = ['wget', '-O', self.localarchive, self.uri]
- subprocess.check_output(cmd, env=env)
-
- # This method should provide a way to run a command in the desired environment.
- @abstractmethod
- def _run(self, cmd):
- pass
-
- # The timeout parameter of target.run is set to 0 to make the ssh command
- # run with no timeout.
- def run_configure(self, configure_args='', extra_cmds=''):
- return self._run('cd %s; %s ./configure %s' % (self.targetdir, extra_cmds, configure_args))
-
- def run_make(self, make_args=''):
- return self._run('cd %s; make %s' % (self.targetdir, make_args))
-
- def run_install(self, install_args=''):
- return self._run('cd %s; make install %s' % (self.targetdir, install_args))
-
- def clean(self):
- if self.tempdirobj:
- self.tempdirobj.cleanup()
- self._run('rm -rf %s' % self.targetdir)
- subprocess.check_call(['rm', '-f', self.localarchive])
-
-class TargetBuildProject(BuildProject):
-
- def __init__(self, target, d, uri, foldername=None):
- self.target = target
- self.targetdir = "~/"
- BuildProject.__init__(self, d, uri, foldername)
-
- def download_archive(self):
-
- self._download_archive()
-
- (status, output) = self.target.copy_to(self.localarchive, self.targetdir)
- if status != 0:
- raise Exception("Failed to copy archive to target, output: %s" % output)
-
- (status, output) = self.target.run('tar xf %s%s -C %s' % (self.targetdir, self.archive, self.targetdir))
- if status != 0:
- raise Exception("Failed to extract archive, output: %s" % output)
-
- #Change targetdir to project folder
- self.targetdir = self.targetdir + self.fname
-
- # The timeout parameter of target.run is set to 0 to make the ssh command
- # run with no timeout.
- def _run(self, cmd):
- return self.target.run(cmd, 0)[0]
-
-
-class SDKBuildProject(BuildProject):
-
- def __init__(self, testpath, sdkenv, d, uri, foldername=None):
- self.sdkenv = sdkenv
- self.testdir = testpath
- self.targetdir = testpath
- bb.utils.mkdirhier(testpath)
- self.datetime = d.getVar('DATETIME')
- self.testlogdir = d.getVar("TEST_LOG_DIR")
- bb.utils.mkdirhier(self.testlogdir)
- self.logfile = os.path.join(self.testlogdir, "sdk_target_log.%s" % self.datetime)
- BuildProject.__init__(self, d, uri, foldername, tmpdir=testpath)
-
- def download_archive(self):
-
- self._download_archive()
-
- cmd = ['tar', 'xf', self.targetdir + self.archive, '-C', self.targetdir]
- subprocess.check_output(cmd)
-
- #Change targetdir to project folder
- self.targetdir = os.path.join(self.targetdir, self.fname)
-
- def run_configure(self, configure_args='', extra_cmds=' gnu-configize; '):
- return super().run_configure(configure_args=(configure_args or '$CONFIGURE_FLAGS'), extra_cmds=extra_cmds)
-
- def run_install(self, install_args=''):
- return super().run_install(install_args=(install_args or "DESTDIR=%s/../install" % self.targetdir))
-
- def log(self, msg):
- if self.logfile:
- with open(self.logfile, "a") as f:
- f.write("%s\n" % msg)
-
- def _run(self, cmd):
- self.log("Running . %s; " % self.sdkenv + cmd)
- return subprocess.check_call(". %s; " % self.sdkenv + cmd, shell=True)
Drop code nothing uses: - utils/targetbuild.py, an older copy of the BuildProject classes which are now in utils/buildproject.py, runtime/utils and sdk/utils - str_to_fn() in buildperf, which also always raised ValueError as re.LOCALE can't be used with str patterns - the dummybuf class in concurrencytest - getCaseClass() in core/utils/test.py - the empty metadata_from_data_store() stub - an unused variable in sdk/context.py and an unused assignment in the OETestDataDepends check AI-Generated: Uses Claude Opus 5.5 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- meta/lib/oeqa/buildperf/base.py | 5 - meta/lib/oeqa/core/decorator/data.py | 4 +- meta/lib/oeqa/core/utils/concurrencytest.py | 11 -- meta/lib/oeqa/core/utils/test.py | 6 - meta/lib/oeqa/sdk/context.py | 1 - meta/lib/oeqa/utils/metadata.py | 9 -- meta/lib/oeqa/utils/targetbuild.py | 144 -------------------- 7 files changed, 1 insertion(+), 179 deletions(-) delete mode 100644 meta/lib/oeqa/utils/targetbuild.py