diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-10-27 10:59:03 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-07 15:12:00 +0000 |
commit | 320049c05839f690cc3d6b7f89ce4e62be3fb297 (patch) | |
tree | a81af76ae7a855c1828f3011311bd66c0d93fbf2 /meta/lib | |
parent | f77b00c3f44eabcaae0b528b14f685d8dd94278e (diff) | |
download | poky-320049c05839f690cc3d6b7f89ce4e62be3fb297.tar.gz |
selftest/signing: Fix test_locked_signatures to use a temporary layer
Tests shouldn't be writing to layers during tests as this could corrupt
other tests running in parallel.
Modify the test to write the bbappend to a separate temporary layer
which is added and removed by the test. This avoids race failures
on the autobuilder.
(From OE-Core rev: 467c72ff2c9fe00c40d04d5d859d860fb267499e)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/signing.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/meta/lib/oeqa/selftest/cases/signing.py b/meta/lib/oeqa/selftest/cases/signing.py index 5c4e01b2c3..93b15ae681 100644 --- a/meta/lib/oeqa/selftest/cases/signing.py +++ b/meta/lib/oeqa/selftest/cases/signing.py | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | from oeqa.selftest.case import OESelftestTestCase | 5 | from oeqa.selftest.case import OESelftestTestCase |
6 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars | 6 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, create_temp_layer |
7 | import os | 7 | import os |
8 | import oe | 8 | import oe |
9 | import glob | 9 | import glob |
@@ -185,8 +185,6 @@ class LockedSignatures(OESelftestTestCase): | |||
185 | test_recipe = 'ed' | 185 | test_recipe = 'ed' |
186 | locked_sigs_file = 'locked-sigs.inc' | 186 | locked_sigs_file = 'locked-sigs.inc' |
187 | 187 | ||
188 | self.add_command_to_tearDown('rm -f %s' % os.path.join(self.builddir, locked_sigs_file)) | ||
189 | |||
190 | bitbake(test_recipe) | 188 | bitbake(test_recipe) |
191 | # Generate locked sigs include file | 189 | # Generate locked sigs include file |
192 | bitbake('-S none %s' % test_recipe) | 190 | bitbake('-S none %s' % test_recipe) |
@@ -198,16 +196,23 @@ class LockedSignatures(OESelftestTestCase): | |||
198 | # Build a locked recipe | 196 | # Build a locked recipe |
199 | bitbake(test_recipe) | 197 | bitbake(test_recipe) |
200 | 198 | ||
199 | templayerdir = tempfile.mkdtemp(prefix='signingqa') | ||
200 | create_temp_layer(templayerdir, 'selftestsigning') | ||
201 | runCmd('bitbake-layers add-layer %s' % templayerdir) | ||
202 | |||
201 | # Make a change that should cause the locked task signature to change | 203 | # Make a change that should cause the locked task signature to change |
202 | # Use uuid so hash equivalance server isn't triggered | 204 | # Use uuid so hash equivalance server isn't triggered |
203 | recipe_append_file = test_recipe + '_' + get_bb_var('PV', test_recipe) + '.bbappend' | 205 | recipe_append_file = test_recipe + '_' + get_bb_var('PV', test_recipe) + '.bbappend' |
204 | recipe_append_path = os.path.join(self.testlayer_path, 'recipes-test', test_recipe, recipe_append_file) | 206 | recipe_append_path = os.path.join(templayerdir, 'recipes-test', test_recipe, recipe_append_file) |
205 | feature = 'SUMMARY_${PN} = "test locked signature%s"\n' % uuid.uuid4() | 207 | feature = 'SUMMARY_${PN} = "test locked signature%s"\n' % uuid.uuid4() |
206 | 208 | ||
207 | os.mkdir(os.path.join(self.testlayer_path, 'recipes-test', test_recipe)) | 209 | os.mkdir(os.path.join(templayerdir, 'recipes-test')) |
210 | os.mkdir(os.path.join(templayerdir, 'recipes-test', test_recipe)) | ||
208 | write_file(recipe_append_path, feature) | 211 | write_file(recipe_append_path, feature) |
209 | 212 | ||
210 | self.add_command_to_tearDown('rm -rf %s' % os.path.join(self.testlayer_path, 'recipes-test', test_recipe)) | 213 | self.add_command_to_tearDown('bitbake-layers remove-layer %s' % templayerdir) |
214 | self.add_command_to_tearDown('rm -f %s' % os.path.join(self.builddir, locked_sigs_file)) | ||
215 | self.add_command_to_tearDown('rm -rf %s' % templayerdir) | ||
211 | 216 | ||
212 | # Build the recipe again | 217 | # Build the recipe again |
213 | ret = bitbake(test_recipe) | 218 | ret = bitbake(test_recipe) |