diff options
author | Corneliu Stoicescu <corneliux.stoicescu@intel.com> | 2014-02-28 18:59:28 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-02 17:25:28 +0000 |
commit | 6fab87e128ed48eff289d68fd2c7692b1b981c2e (patch) | |
tree | ea9b2d93bd8935697f1e526dfc57c188ba0ffd8f /meta/lib | |
parent | 0c6ee422bdb516f9ccb06f3ea570ced96e13f40b (diff) | |
download | poky-6fab87e128ed48eff289d68fd2c7692b1b981c2e.tar.gz |
oe-selftest: Fix test_sstate_cache_management_script*
Fixed tests for sstate-cache-management.sh that ware failing due to:
- recent changes to sstate-cache structure
- recent changes to the script itself
(From OE-Core rev: 17b518caf253b77101b357564f8ef9e07961f12c)
Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/sstatetests.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/meta/lib/oeqa/selftest/sstatetests.py b/meta/lib/oeqa/selftest/sstatetests.py index acc0c27835..27561cadad 100644 --- a/meta/lib/oeqa/selftest/sstatetests.py +++ b/meta/lib/oeqa/selftest/sstatetests.py | |||
@@ -105,7 +105,8 @@ class SStateTests(SStateBase): | |||
105 | 105 | ||
106 | 106 | ||
107 | # Test the sstate-cache-management script. Each element in the global_config list is used with the corresponding element in the target_config list | 107 | # Test the sstate-cache-management script. Each element in the global_config list is used with the corresponding element in the target_config list |
108 | def run_test_sstate_cache_management_script(self, target, global_config=[''], target_config=['']): | 108 | # global_config elements are expected to not generate any sstate files that would be removed by sstate-cache-management.sh (such as changing the value of MACHINE) |
109 | def run_test_sstate_cache_management_script(self, target, global_config=[''], target_config=[''], ignore_patterns=[]): | ||
109 | self.assertTrue(global_config) | 110 | self.assertTrue(global_config) |
110 | self.assertTrue(target_config) | 111 | self.assertTrue(target_config) |
111 | self.assertTrue(len(global_config) == len(target_config), msg='Lists global_config and target_config should have the same number of elements') | 112 | self.assertTrue(len(global_config) == len(target_config), msg='Lists global_config and target_config should have the same number of elements') |
@@ -119,23 +120,27 @@ class SStateTests(SStateBase): | |||
119 | # For not this only checks if random sstate tasks are handled correctly as a group. | 120 | # For not this only checks if random sstate tasks are handled correctly as a group. |
120 | # In the future we should add control over what tasks we check for. | 121 | # In the future we should add control over what tasks we check for. |
121 | 122 | ||
123 | sstate_archs_list = [] | ||
122 | expected_remaining_sstate = [] | 124 | expected_remaining_sstate = [] |
123 | for idx in range(len(target_config)): | 125 | for idx in range(len(target_config)): |
124 | self.append_config(global_config[idx]) | 126 | self.append_config(global_config[idx]) |
125 | self.append_recipeinc(target, target_config[idx]) | 127 | self.append_recipeinc(target, target_config[idx]) |
128 | sstate_arch = get_bb_var('SSTATE_PKGARCH', target) | ||
129 | if not sstate_arch in sstate_archs_list: | ||
130 | sstate_archs_list.append(sstate_arch) | ||
126 | if target_config[idx] == target_config[-1]: | 131 | if target_config[idx] == target_config[-1]: |
127 | target_sstate_before_build = self.search_sstate(target + '.*?\.tgz$') | 132 | target_sstate_before_build = self.search_sstate(target + '.*?\.tgz$') |
128 | bitbake("-cclean %s" % target) | 133 | bitbake("-cclean %s" % target) |
129 | result = bitbake(target, ignore_status=True) | 134 | result = bitbake(target, ignore_status=True) |
130 | if target_config[idx] == target_config[-1]: | 135 | if target_config[idx] == target_config[-1]: |
131 | target_sstate_after_build = self.search_sstate(target + '.*?\.tgz$') | 136 | target_sstate_after_build = self.search_sstate(target + '.*?\.tgz$') |
132 | expected_remaining_sstate += [x for x in target_sstate_after_build if x not in target_sstate_before_build] | 137 | expected_remaining_sstate += [x for x in target_sstate_after_build if x not in target_sstate_before_build if not any(pattern in x for pattern in ignore_patterns)] |
133 | self.remove_config(global_config[idx]) | 138 | self.remove_config(global_config[idx]) |
134 | self.remove_recipeinc(target, target_config[idx]) | 139 | self.remove_recipeinc(target, target_config[idx]) |
135 | self.assertEqual(result.status, 0) | 140 | self.assertEqual(result.status, 0) |
136 | 141 | ||
137 | runCmd("sstate-cache-management.sh -y --cache-dir=%s --remove-duplicated" % self.sstate_path) | 142 | runCmd("sstate-cache-management.sh -y --cache-dir=%s --remove-duplicated --extra-archs=%s" % (self.sstate_path, ','.join(map(str, sstate_archs_list)))) |
138 | actual_remaining_sstate = self.search_sstate(target + '.*?\.tgz$') | 143 | actual_remaining_sstate = [x for x in self.search_sstate(target + '.*?\.tgz$') if not any(pattern in x for pattern in ignore_patterns)] |
139 | 144 | ||
140 | actual_not_expected = [x for x in actual_remaining_sstate if x not in expected_remaining_sstate] | 145 | actual_not_expected = [x for x in actual_remaining_sstate if x not in expected_remaining_sstate] |
141 | self.assertFalse(actual_not_expected, msg="Files should have been removed but ware not: %s" % ', '.join(map(str, actual_not_expected))) | 146 | self.assertFalse(actual_not_expected, msg="Files should have been removed but ware not: %s" % ', '.join(map(str, actual_not_expected))) |
@@ -168,7 +173,7 @@ class SStateTests(SStateBase): | |||
168 | target_config.append('PR = "1"') | 173 | target_config.append('PR = "1"') |
169 | global_config.append('MACHINE = "qemux86"') | 174 | global_config.append('MACHINE = "qemux86"') |
170 | target_config.append('PR = "1"') | 175 | target_config.append('PR = "1"') |
171 | self.run_test_sstate_cache_management_script('m4', global_config, target_config) | 176 | self.run_test_sstate_cache_management_script('m4', global_config, target_config, ignore_patterns=['populate_lic']) |
172 | 177 | ||
173 | def test_sstate_cache_management_script_using_machine(self): | 178 | def test_sstate_cache_management_script_using_machine(self): |
174 | global_config = [] | 179 | global_config = [] |
@@ -177,7 +182,7 @@ class SStateTests(SStateBase): | |||
177 | target_config.append('') | 182 | target_config.append('') |
178 | global_config.append('MACHINE = "qemux86"') | 183 | global_config.append('MACHINE = "qemux86"') |
179 | target_config.append('') | 184 | target_config.append('') |
180 | self.run_test_sstate_cache_management_script('m4', global_config, target_config) | 185 | self.run_test_sstate_cache_management_script('m4', global_config, target_config, ignore_patterns=['populate_lic']) |
181 | 186 | ||
182 | 187 | ||
183 | 188 | ||