blob: f2030c446dab9f621f63d1f0304a87f7ade09b62 [file] [log] [blame]
Patrick Williamsf1e5d692016-03-30 15:21:19 -05001from oeqa.selftest.base import oeSelfTest
2from oeqa.utils.commands import bitbake, get_bb_var
3from oeqa.utils.decorators import testcase
4import glob
5import os
6import shutil
7
8
9class Archiver(oeSelfTest):
10
11 @testcase(1345)
12 def test_archiver_allows_to_filter_on_recipe_name(self):
13 """
14 Summary: The archiver should offer the possibility to filter on the recipe. (#6929)
15 Expected: 1. Included recipe (busybox) should be included
16 2. Excluded recipe (zlib) should be excluded
17 Product: oe-core
18 Author: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
19 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
20 """
21
22 include_recipe = 'busybox'
23 exclude_recipe = 'zlib'
24
25 features = 'INHERIT += "archiver"\n'
26 features += 'ARCHIVER_MODE[src] = "original"\n'
27 features += 'COPYLEFT_PN_INCLUDE = "%s"\n' % include_recipe
28 features += 'COPYLEFT_PN_EXCLUDE = "%s"\n' % exclude_recipe
29
30 # Update local.conf
31 self.write_config(features)
32
33 tmp_dir = get_bb_var('TMPDIR')
34 deploy_dir_src = get_bb_var('DEPLOY_DIR_SRC')
35 target_sys = get_bb_var('TARGET_SYS')
36 src_path = os.path.join(deploy_dir_src, target_sys)
37
38 # Delete tmp directory
39 shutil.rmtree(tmp_dir)
40
41 # Build core-image-minimal
42 bitbake('core-image-minimal')
43
44 # Check that include_recipe was included
45 is_included = len(glob.glob(src_path + '/%s*' % include_recipe))
46 self.assertEqual(1, is_included, 'Recipe %s was not included.' % include_recipe)
47
48 # Check that exclude_recipe was excluded
49 is_excluded = len(glob.glob(src_path + '/%s*' % exclude_recipe))
50 self.assertEqual(0, is_excluded, 'Recipe %s was not excluded.' % exclude_recipe)