diff options
| -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]) | ||
