diff options
author | André Draszik <adraszik@tycoint.com> | 2017-06-26 09:36:17 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-28 20:55:08 +0100 |
commit | 99e1b01cdc8323161a0cf557c793db12cf4988a1 (patch) | |
tree | 92f20484ca608ada35c8ba5ff94a6d3205a021a3 /meta/lib | |
parent | d8f13c2649ed42458c07cb86bf451fbcd49ad19d (diff) | |
download | poky-99e1b01cdc8323161a0cf557c793db12cf4988a1.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: 709f02c5cb25983090251c6237bac4fc0a295c4f)
Signed-off-by: André Draszik <adraszik@tycoint.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/archiver.py | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py index 70c7282f22..7ef92cddac 100644 --- a/meta/lib/oeqa/selftest/cases/archiver.py +++ b/meta/lib/oeqa/selftest/cases/archiver.py | |||
@@ -39,3 +39,79 @@ class Archiver(OESelftestTestCase): | |||
39 | # Check that exclude_recipe was excluded | 39 | # Check that exclude_recipe was excluded |
40 | excluded_present = len(glob.glob(src_path + '/%s-*' % exclude_recipe)) | 40 | excluded_present = len(glob.glob(src_path + '/%s-*' % exclude_recipe)) |
41 | self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % exclude_recipe) | 41 | self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % exclude_recipe) |
42 | |||
43 | |||
44 | def test_archiver_filters_by_type(self): | ||
45 | """ | ||
46 | Summary: The archiver is documented to filter on the recipe type. | ||
47 | Expected: 1. included recipe type (target) should be included | ||
48 | 2. other types should be excluded | ||
49 | Product: oe-core | ||
50 | Author: André Draszik <adraszik@tycoint.com> | ||
51 | """ | ||
52 | |||
53 | target_recipe = 'initscripts' | ||
54 | native_recipe = 'zlib-native' | ||
55 | |||
56 | features = 'INHERIT += "archiver"\n' | ||
57 | features += 'ARCHIVER_MODE[src] = "original"\n' | ||
58 | features += 'COPYLEFT_RECIPE_TYPES = "target"\n' | ||
59 | self.write_config(features) | ||
60 | |||
61 | bitbake('-c clean %s %s' % (target_recipe, native_recipe)) | ||
62 | bitbake("%s -c deploy_archives %s" % (target_recipe, native_recipe)) | ||
63 | |||
64 | bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS', 'BUILD_SYS']) | ||
65 | src_path_target = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS']) | ||
66 | src_path_native = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['BUILD_SYS']) | ||
67 | |||
68 | # Check that target_recipe was included | ||
69 | included_present = len(glob.glob(src_path_target + '/%s-*' % target_recipe)) | ||
70 | self.assertTrue(included_present, 'Recipe %s was not included.' % target_recipe) | ||
71 | |||
72 | # Check that native_recipe was excluded | ||
73 | excluded_present = len(glob.glob(src_path_native + '/%s-*' % native_recipe)) | ||
74 | self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % native_recipe) | ||
75 | |||
76 | def test_archiver_filters_by_type_and_name(self): | ||
77 | """ | ||
78 | Summary: Test that the archiver archives by recipe type, taking the | ||
79 | recipe name into account. | ||
80 | Expected: 1. included recipe type (target) should be included | ||
81 | 2. other types should be excluded | ||
82 | 3. recipe by name should be included / excluded, | ||
83 | overriding previous decision by type | ||
84 | Product: oe-core | ||
85 | Author: André Draszik <adraszik@tycoint.com> | ||
86 | """ | ||
87 | |||
88 | target_recipes = [ 'initscripts', 'zlib' ] | ||
89 | native_recipes = [ 'update-rc.d-native', 'zlib-native' ] | ||
90 | |||
91 | features = 'INHERIT += "archiver"\n' | ||
92 | features += 'ARCHIVER_MODE[src] = "original"\n' | ||
93 | features += 'COPYLEFT_RECIPE_TYPES = "target"\n' | ||
94 | features += 'COPYLEFT_PN_INCLUDE = "%s"\n' % native_recipes[1] | ||
95 | features += 'COPYLEFT_PN_EXCLUDE = "%s"\n' % target_recipes[1] | ||
96 | self.write_config(features) | ||
97 | |||
98 | bitbake('-c clean %s %s' % (' '.join(target_recipes), ' '.join(native_recipes))) | ||
99 | bitbake('-c deploy_archives %s %s' % (' '.join(target_recipes), ' '.join(native_recipes))) | ||
100 | |||
101 | bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS', 'BUILD_SYS']) | ||
102 | src_path_target = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS']) | ||
103 | src_path_native = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['BUILD_SYS']) | ||
104 | |||
105 | # Check that target_recipe[0] and native_recipes[1] were included | ||
106 | included_present = len(glob.glob(src_path_target + '/%s-*' % target_recipes[0])) | ||
107 | self.assertTrue(included_present, 'Recipe %s was not included.' % target_recipes[0]) | ||
108 | |||
109 | included_present = len(glob.glob(src_path_native + '/%s-*' % native_recipes[1])) | ||
110 | self.assertTrue(included_present, 'Recipe %s was not included.' % native_recipes[1]) | ||
111 | |||
112 | # Check that native_recipes[0] and target_recipes[1] were excluded | ||
113 | excluded_present = len(glob.glob(src_path_native + '/%s-*' % native_recipes[0])) | ||
114 | self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % native_recipes[0]) | ||
115 | |||
116 | excluded_present = len(glob.glob(src_path_target + '/%s-*' % target_recipes[1])) | ||
117 | self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % target_recipes[1]) | ||