]> code.ossystems Code Review - openembedded-core.git/commitdiff
selftest/signing: Fix test_locked_signatures to use a temporary layer
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 27 Oct 2019 10:59:03 +0000 (10:59 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 7 Nov 2019 11:45:25 +0000 (11:45 +0000)
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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/cases/signing.py

index 5c4e01b2c36ce26d356273896490df57333101a0..93b15ae6814b3872413b559bdf7c93ca73e905a3 100644 (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)