diff options
| author | André Draszik <adraszik@tycoint.com> | 2017-10-06 13:12:47 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-11-05 22:39:47 +0000 |
| commit | edae320ef563675971767a53552054932bd8561e (patch) | |
| tree | e304f3fb03e1d2ecdb04701aa0e88eb0019f05e7 /meta/lib | |
| parent | 28b8850356cb6325e0ef8cf5ed83e20a22044a9e (diff) | |
| download | poky-edae320ef563675971767a53552054932bd8561e.tar.gz | |
selftest/archiver: add tests for recipe type filtering
The archiver used to be able to filter based on COPYLEFT_RECIPE_TYPES.
Unfortunately, this got broken with the fix for
https://bugzilla.yoctoproject.org/show_bug.cgi?id=6929
in commit ae9102bda398 ("copyleft_filter.bbclass: Allow to filter on name")
Add two tests to prevent that from happening again.
(From OE-Core rev: 11064f15d7fc10b99eac4084af48a91d8b212932)
Signed-off-by: André Draszik <adraszik@tycoint.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
(cherry picked from commit 709f02c5cb25983090251c6237bac4fc0a295c4f)
Signed-off-by: André Draszik <adraszik@tycoint.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oeqa/selftest/archiver.py | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/archiver.py b/meta/lib/oeqa/selftest/archiver.py index d7f215cbf6..06b2597050 100644 --- a/meta/lib/oeqa/selftest/archiver.py +++ b/meta/lib/oeqa/selftest/archiver.py | |||
| @@ -41,3 +41,79 @@ class Archiver(oeSelfTest): | |||
| 41 | # Check that exclude_recipe was excluded | 41 | # Check that exclude_recipe was excluded |
| 42 | excluded_present = len(glob.glob(src_path + '/%s-*' % exclude_recipe)) | 42 | excluded_present = len(glob.glob(src_path + '/%s-*' % exclude_recipe)) |
| 43 | self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % exclude_recipe) | 43 | self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % exclude_recipe) |
| 44 | |||
| 45 | |||
| 46 | def test_archiver_filters_by_type(self): | ||
| 47 | """ | ||
| 48 | Summary: The archiver is documented to filter on the recipe type. | ||
| 49 | Expected: 1. included recipe type (target) should be included | ||
| 50 | 2. other types should be excluded | ||
| 51 | Product: oe-core | ||
| 52 | Author: André Draszik <adraszik@tycoint.com> | ||
| 53 | """ | ||
| 54 | |||
| 55 | target_recipe = 'initscripts' | ||
| 56 | native_recipe = 'zlib-native' | ||
| 57 | |||
| 58 | features = 'INHERIT += "archiver"\n' | ||
| 59 | features += 'ARCHIVER_MODE[src] = "original"\n' | ||
| 60 | features += 'COPYLEFT_RECIPE_TYPES = "target"\n' | ||
| 61 | self.write_config(features) | ||
| 62 | |||
| 63 | bitbake('-c clean %s %s' % (target_recipe, native_recipe)) | ||
| 64 | bitbake("%s -c deploy_archives %s" % (target_recipe, native_recipe)) | ||
| 65 | |||
| 66 | bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS', 'BUILD_SYS']) | ||
| 67 | src_path_target = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS']) | ||
| 68 | src_path_native = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['BUILD_SYS']) | ||
| 69 | |||
| 70 | # Check that target_recipe was included | ||
| 71 | included_present = len(glob.glob(src_path_target + '/%s-*' % target_recipe)) | ||
| 72 | self.assertTrue(included_present, 'Recipe %s was not included.' % target_recipe) | ||
| 73 | |||
| 74 | # Check that native_recipe was excluded | ||
| 75 | excluded_present = len(glob.glob(src_path_native + '/%s-*' % native_recipe)) | ||
| 76 | self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % native_recipe) | ||
| 77 | |||
| 78 | def test_archiver_filters_by_type_and_name(self): | ||
| 79 | """ | ||
| 80 | Summary: Test that the archiver archives by recipe type, taking the | ||
| 81 | recipe name into account. | ||
| 82 | Expected: 1. included recipe type (target) should be included | ||
| 83 | 2. other types should be excluded | ||
| 84 | 3. recipe by name should be included / excluded, | ||
| 85 | overriding previous decision by type | ||
| 86 | Product: oe-core | ||
| 87 | Author: André Draszik <adraszik@tycoint.com> | ||
| 88 | """ | ||
| 89 | |||
| 90 | target_recipes = [ 'initscripts', 'zlib' ] | ||
| 91 | native_recipes = [ 'update-rc.d-native', 'zlib-native' ] | ||
| 92 | |||
| 93 | features = 'INHERIT += "archiver"\n' | ||
| 94 | features += 'ARCHIVER_MODE[src] = "original"\n' | ||
| 95 | features += 'COPYLEFT_RECIPE_TYPES = "target"\n' | ||
| 96 | features += 'COPYLEFT_PN_INCLUDE = "%s"\n' % native_recipes[1] | ||
| 97 | features += 'COPYLEFT_PN_EXCLUDE = "%s"\n' % target_recipes[1] | ||
| 98 | self.write_config(features) | ||
| 99 | |||
| 100 | bitbake('-c clean %s %s' % (' '.join(target_recipes), ' '.join(native_recipes))) | ||
| 101 | bitbake('-c deploy_archives %s %s' % (' '.join(target_recipes), ' '.join(native_recipes))) | ||
| 102 | |||
| 103 | bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS', 'BUILD_SYS']) | ||
| 104 | src_path_target = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS']) | ||
| 105 | src_path_native = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['BUILD_SYS']) | ||
| 106 | |||
| 107 | # Check that target_recipe[0] and native_recipes[1] were included | ||
| 108 | included_present = len(glob.glob(src_path_target + '/%s-*' % target_recipes[0])) | ||
| 109 | self.assertTrue(included_present, 'Recipe %s was not included.' % target_recipes[0]) | ||
| 110 | |||
| 111 | included_present = len(glob.glob(src_path_native + '/%s-*' % native_recipes[1])) | ||
| 112 | self.assertTrue(included_present, 'Recipe %s was not included.' % native_recipes[1]) | ||
| 113 | |||
| 114 | # Check that native_recipes[0] and target_recipes[1] were excluded | ||
| 115 | excluded_present = len(glob.glob(src_path_native + '/%s-*' % native_recipes[0])) | ||
| 116 | self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % native_recipes[0]) | ||
| 117 | |||
| 118 | excluded_present = len(glob.glob(src_path_target + '/%s-*' % target_recipes[1])) | ||
| 119 | self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % target_recipes[1]) | ||
