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>
This commit is contained in:
Richard Purdie
2019-10-27 10:59:03 +00:00
parent f77b00c3f4
commit 320049c058

View File

@@ -3,7 +3,7 @@
#
from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, create_temp_layer
import os
import oe
import glob
@@ -185,8 +185,6 @@ class LockedSignatures(OESelftestTestCase):
test_recipe = 'ed'
locked_sigs_file = 'locked-sigs.inc'
self.add_command_to_tearDown('rm -f %s' % os.path.join(self.builddir, locked_sigs_file))
bitbake(test_recipe)
# Generate locked sigs include file
bitbake('-S none %s' % test_recipe)
@@ -198,16 +196,23 @@ class LockedSignatures(OESelftestTestCase):
# Build a locked recipe
bitbake(test_recipe)
templayerdir = tempfile.mkdtemp(prefix='signingqa')
create_temp_layer(templayerdir, 'selftestsigning')
runCmd('bitbake-layers add-layer %s' % templayerdir)
# Make a change that should cause the locked task signature to change
# Use uuid so hash equivalance server isn't triggered
recipe_append_file = test_recipe + '_' + get_bb_var('PV', test_recipe) + '.bbappend'
recipe_append_path = os.path.join(self.testlayer_path, 'recipes-test', test_recipe, recipe_append_file)
recipe_append_path = os.path.join(templayerdir, 'recipes-test', test_recipe, recipe_append_file)
feature = 'SUMMARY_${PN} = "test locked signature%s"\n' % uuid.uuid4()
os.mkdir(os.path.join(self.testlayer_path, 'recipes-test', test_recipe))
os.mkdir(os.path.join(templayerdir, 'recipes-test'))
os.mkdir(os.path.join(templayerdir, 'recipes-test', test_recipe))
write_file(recipe_append_path, feature)
self.add_command_to_tearDown('rm -rf %s' % os.path.join(self.testlayer_path, 'recipes-test', test_recipe))
self.add_command_to_tearDown('bitbake-layers remove-layer %s' % templayerdir)
self.add_command_to_tearDown('rm -f %s' % os.path.join(self.builddir, locked_sigs_file))
self.add_command_to_tearDown('rm -rf %s' % templayerdir)
# Build the recipe again
ret = bitbake(test_recipe)