diff options
| -rw-r--r-- | meta/lib/oeqa/selftest/signing.py | 48 |
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 | |||
| 6 | import shutil | 6 | import shutil |
| 7 | import tempfile | 7 | import tempfile |
| 8 | from oeqa.utils.decorators import testcase | 8 | from oeqa.utils.decorators import testcase |
| 9 | from oeqa.utils.ftools import write_file | ||
| 9 | 10 | ||
| 10 | 11 | ||
| 11 | class Signing(oeSelfTest): | 12 | class 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 | |||
| 135 | class 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) | ||
