summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/signing.py
diff options
context:
space:
mode:
authorDaniel Istrate <daniel.alexandrux.istrate@intel.com>2016-02-15 15:48:01 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-28 11:32:57 +0000
commit4a2182741598eff4d8c0acee30bbf335f11615bd (patch)
treeba785356b4be0d931082471491fdc0ddbc825c9d /meta/lib/oeqa/selftest/signing.py
parent604dc1c3e6144f26566cc5096ac54f4392688c9a (diff)
downloadpoky-4a2182741598eff4d8c0acee30bbf335f11615bd.tar.gz
oeqa/selftest/signing: Added test for locked signatures
fix for [YOCTO #8706] (From OE-Core rev: 9b704ae44d9dc1d3d5c3aee6d7a5530b642070c4) Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/signing.py')
-rw-r--r--meta/lib/oeqa/selftest/signing.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/signing.py b/meta/lib/oeqa/selftest/signing.py
index c402e3709a..1e710e3cd3 100644
--- a/meta/lib/oeqa/selftest/signing.py
+++ b/meta/lib/oeqa/selftest/signing.py
@@ -6,6 +6,7 @@ import re
6import shutil 6import shutil
7import tempfile 7import tempfile
8from oeqa.utils.decorators import testcase 8from oeqa.utils.decorators import testcase
9from oeqa.utils.ftools import write_file
9 10
10 11
11class Signing(oeSelfTest): 12class Signing(oeSelfTest):
@@ -130,3 +131,50 @@ class Signing(oeSelfTest):
130 # gpg: Good signature from "testuser (nocomment) <testuser@email.com>" 131 # gpg: Good signature from "testuser (nocomment) <testuser@email.com>"
131 self.assertIn('gpg: Good signature from', ret.output, 'Package signed incorrectly.') 132 self.assertIn('gpg: Good signature from', ret.output, 'Package signed incorrectly.')
132 133
134
135class LockedSignatures(oeSelfTest):
136
137 @testcase(1420)
138 def test_locked_signatures(self):
139 """
140 Summary: Test locked signature mechanism
141 Expected: Locked signatures will prevent task to run
142 Product: oe-core
143 Author: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
144 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
145 """
146
147 test_recipe = 'ed'
148 locked_sigs_file = 'locked-sigs.inc'
149
150 self.add_command_to_tearDown('rm -f %s' % os.path.join(self.builddir, locked_sigs_file))
151
152 bitbake(test_recipe)
153 # Generate locked sigs include file
154 bitbake('-S none %s' % test_recipe)
155
156 feature = 'require %s\n' % locked_sigs_file
157 feature += 'SIGGEN_LOCKEDSIGS_CHECK_LEVEL = "warn"\n'
158 self.write_config(feature)
159
160 # Build a locked recipe
161 bitbake(test_recipe)
162
163 # Make a change that should cause the locked task signature to change
164 recipe_append_file = test_recipe + '_' + get_bb_var('PV', test_recipe) + '.bbappend'
165 recipe_append_path = os.path.join(self.testlayer_path, 'recipes-test', test_recipe, recipe_append_file)
166 feature = 'SUMMARY += "test locked signature"\n'
167
168 os.mkdir(os.path.join(self.testlayer_path, 'recipes-test', test_recipe))
169 write_file(recipe_append_path, feature)
170
171 self.add_command_to_tearDown('rm -rf %s' % os.path.join(self.testlayer_path, 'recipes-test', test_recipe))
172
173 # Build the recipe again
174 ret = bitbake(test_recipe)
175
176 # Verify you get the warning and that the real task *isn't* run (i.e. the locked signature has worked)
177 patt = r'WARNING: The %s:do_package sig \S+ changed, use locked sig \S+ to instead' % test_recipe
178 found_warn = re.search(patt, ret.output)
179
180 self.assertIsNotNone(found_warn, "Didn't find the expected warning message. Output: %s" % ret.output)