summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/sstate.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-12 11:29:27 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-13 17:35:22 +0000
commita4c484b8cb2ec0eb82b8b0855532cadedb2fac97 (patch)
treee8e90bed5085d2c27f0c5ae690f565aa4165688d /meta/lib/oeqa/selftest/cases/sstate.py
parent4eb546cf1c2780b7870ba4d6e1a51bd096987fe8 (diff)
downloadpoky-a4c484b8cb2ec0eb82b8b0855532cadedb2fac97.tar.gz
oeqa/selftest/sstate: Merge sstate test class with tests themselves
Having this base class as a separate file is just confusing. Merge with the rest of the test code. (From OE-Core rev: 977522a3b063225e22e2fd04b8265a4595606db2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/sstate.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/sstate.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/meta/lib/oeqa/selftest/cases/sstate.py b/meta/lib/oeqa/selftest/cases/sstate.py
deleted file mode 100644
index e73bb94884..0000000000
--- a/meta/lib/oeqa/selftest/cases/sstate.py
+++ /dev/null
@@ -1,66 +0,0 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7import datetime
8import os
9import re
10
11from oeqa.selftest.case import OESelftestTestCase
12from oeqa.utils.commands import get_bb_vars
13
14
15class SStateBase(OESelftestTestCase):
16
17 def setUpLocal(self):
18 super(SStateBase, self).setUpLocal()
19 self.temp_sstate_location = None
20 needed_vars = ['SSTATE_DIR', 'NATIVELSBSTRING', 'TCLIBC', 'TUNE_ARCH',
21 'TOPDIR', 'TARGET_VENDOR', 'TARGET_OS']
22 bb_vars = get_bb_vars(needed_vars)
23 self.sstate_path = bb_vars['SSTATE_DIR']
24 self.hostdistro = bb_vars['NATIVELSBSTRING']
25 self.tclibc = bb_vars['TCLIBC']
26 self.tune_arch = bb_vars['TUNE_ARCH']
27 self.topdir = bb_vars['TOPDIR']
28 self.target_vendor = bb_vars['TARGET_VENDOR']
29 self.target_os = bb_vars['TARGET_OS']
30 self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro)
31
32 # Creates a special sstate configuration with the option to add sstate mirrors
33 def config_sstate(self, temp_sstate_location=False, add_local_mirrors=[]):
34 self.temp_sstate_location = temp_sstate_location
35
36 if self.temp_sstate_location:
37 temp_sstate_path = os.path.join(self.builddir, "temp_sstate_%s" % datetime.datetime.now().strftime('%Y%m%d%H%M%S'))
38 config_temp_sstate = "SSTATE_DIR = \"%s\"" % temp_sstate_path
39 self.append_config(config_temp_sstate)
40 self.track_for_cleanup(temp_sstate_path)
41 bb_vars = get_bb_vars(['SSTATE_DIR', 'NATIVELSBSTRING'])
42 self.sstate_path = bb_vars['SSTATE_DIR']
43 self.hostdistro = bb_vars['NATIVELSBSTRING']
44 self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro)
45
46 if add_local_mirrors:
47 config_set_sstate_if_not_set = 'SSTATE_MIRRORS ?= ""'
48 self.append_config(config_set_sstate_if_not_set)
49 for local_mirror in add_local_mirrors:
50 self.assertFalse(os.path.join(local_mirror) == os.path.join(self.sstate_path), msg='Cannot add the current sstate path as a sstate mirror')
51 config_sstate_mirror = "SSTATE_MIRRORS += \"file://.* file:///%s/PATH\"" % local_mirror
52 self.append_config(config_sstate_mirror)
53
54 # Returns a list containing sstate files
55 def search_sstate(self, filename_regex, distro_specific=True, distro_nonspecific=True):
56 result = []
57 for root, dirs, files in os.walk(self.sstate_path):
58 if distro_specific and re.search(r"%s/%s/[a-z0-9]{2}/[a-z0-9]{2}$" % (self.sstate_path, self.hostdistro), root):
59 for f in files:
60 if re.search(filename_regex, f):
61 result.append(f)
62 if distro_nonspecific and re.search(r"%s/[a-z0-9]{2}/[a-z0-9]{2}$" % self.sstate_path, root):
63 for f in files:
64 if re.search(filename_regex, f):
65 result.append(f)
66 return result