diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 2 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/pokybleeding.py | 32 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/recipetool.py | 33 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/sstatetests.py | 97 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/wic.py | 35 |
5 files changed, 88 insertions, 111 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 74a7727cc0..05f228f03e 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -154,7 +154,7 @@ class DevtoolTestCase(OESelftestTestCase): | |||
154 | value = invalue | 154 | value = invalue |
155 | invar = None | 155 | invar = None |
156 | elif '=' in line: | 156 | elif '=' in line: |
157 | splitline = line.split('=', 1) | 157 | splitline = re.split(r"[?+:]*=[+]?", line, 1) |
158 | var = splitline[0].rstrip() | 158 | var = splitline[0].rstrip() |
159 | value = splitline[1].strip().strip('"') | 159 | value = splitline[1].strip().strip('"') |
160 | if value.endswith('\\'): | 160 | if value.endswith('\\'): |
diff --git a/meta/lib/oeqa/selftest/cases/pokybleeding.py b/meta/lib/oeqa/selftest/cases/pokybleeding.py deleted file mode 100644 index d0940d680d..0000000000 --- a/meta/lib/oeqa/selftest/cases/pokybleeding.py +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | from oeqa.utils.commands import bitbake, get_bb_var | ||
8 | from oeqa.selftest.case import OESelftestTestCase | ||
9 | |||
10 | class PokyBleeding(OESelftestTestCase): | ||
11 | |||
12 | def test_poky_bleeding_autorev(self): | ||
13 | """ | ||
14 | Test that poky-bleeding.bbclass sets SRCREV to "AUTOINC" for recipe | ||
15 | with a single scm in SRC_URI and for recipe with two scm's in SRC_URI. | ||
16 | """ | ||
17 | |||
18 | self.assertNotEqual( get_bb_var('SRCREV', 'pseudo'), "AUTOINC") | ||
19 | |||
20 | self.assertNotEqual( get_bb_var('SRCREV', 'hello-rs'), "AUTOINC") | ||
21 | self.assertNotEqual( get_bb_var('SRCREV_hello-lib', 'hello-rs'), "AUTOINC") | ||
22 | |||
23 | features = ''' | ||
24 | INHERIT += "poky-bleeding" | ||
25 | POKY_AUTOREV_RECIPES = "hello-rs pseudo" | ||
26 | ''' | ||
27 | self.write_config(features) | ||
28 | |||
29 | self.assertEqual( get_bb_var('SRCREV', 'pseudo'), "AUTOINC") | ||
30 | |||
31 | self.assertEqual( get_bb_var('SRCREV', 'hello-rs'), "AUTOINC") | ||
32 | self.assertEqual( get_bb_var('SRCREV_hello-lib', 'hello-rs'), "AUTOINC") | ||
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 2a91f6c7ae..0bd724c8ee 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py | |||
@@ -757,13 +757,12 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
757 | 757 | ||
758 | def test_recipetool_create_go(self): | 758 | def test_recipetool_create_go(self): |
759 | # Basic test to check go recipe generation | 759 | # Basic test to check go recipe generation |
760 | self.maxDiff = None | ||
761 | |||
760 | temprecipe = os.path.join(self.tempdir, 'recipe') | 762 | temprecipe = os.path.join(self.tempdir, 'recipe') |
761 | os.makedirs(temprecipe) | 763 | os.makedirs(temprecipe) |
762 | 764 | ||
763 | recipefile = os.path.join(temprecipe, 'recipetool-go-test_git.bb') | 765 | recipefile = os.path.join(temprecipe, 'recipetool-go-test_git.bb') |
764 | deps_require_file = os.path.join(temprecipe, 'recipetool-go-test', 'recipetool-go-test-modules.inc') | ||
765 | lics_require_file = os.path.join(temprecipe, 'recipetool-go-test', 'recipetool-go-test-licenses.inc') | ||
766 | modules_txt_file = os.path.join(temprecipe, 'recipetool-go-test', 'modules.txt') | ||
767 | 766 | ||
768 | srcuri = 'https://git.yoctoproject.org/recipetool-go-test.git' | 767 | srcuri = 'https://git.yoctoproject.org/recipetool-go-test.git' |
769 | srcrev = "c3e213c01b6c1406b430df03ef0d1ae77de5d2f7" | 768 | srcrev = "c3e213c01b6c1406b430df03ef0d1ae77de5d2f7" |
@@ -771,13 +770,11 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
771 | 770 | ||
772 | result = runCmd('recipetool create -o %s %s -S %s -B %s' % (temprecipe, srcuri, srcrev, srcbranch)) | 771 | result = runCmd('recipetool create -o %s %s -S %s -B %s' % (temprecipe, srcuri, srcrev, srcbranch)) |
773 | 772 | ||
774 | self.maxDiff = None | 773 | inherits = ['go-mod', 'go-mod-update-modules'] |
775 | inherits = ['go-vendor'] | ||
776 | 774 | ||
777 | checkvars = {} | 775 | checkvars = {} |
778 | checkvars['GO_IMPORT'] = "git.yoctoproject.org/recipetool-go-test" | 776 | checkvars['GO_IMPORT'] = "git.yoctoproject.org/recipetool-go-test" |
779 | checkvars['SRC_URI'] = {'git://${GO_IMPORT};destsuffix=git/src/${GO_IMPORT};nobranch=1;name=${BPN};protocol=https', | 777 | checkvars['SRC_URI'] = {'git://${GO_IMPORT};protocol=https;nobranch=1;destsuffix=${GO_SRCURI_DESTSUFFIX}'} |
780 | 'file://modules.txt'} | ||
781 | checkvars['LIC_FILES_CHKSUM'] = { | 778 | checkvars['LIC_FILES_CHKSUM'] = { |
782 | 'file://src/${GO_IMPORT}/LICENSE;md5=4e3933dd47afbf115e484d11385fb3bd', | 779 | 'file://src/${GO_IMPORT}/LICENSE;md5=4e3933dd47afbf115e484d11385fb3bd', |
783 | 'file://src/${GO_IMPORT}/is/LICENSE;md5=62beaee5a116dd1e80161667b1df39ab' | 780 | 'file://src/${GO_IMPORT}/is/LICENSE;md5=62beaee5a116dd1e80161667b1df39ab' |
@@ -786,26 +783,16 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
786 | self._test_recipe_contents(recipefile, checkvars, inherits) | 783 | self._test_recipe_contents(recipefile, checkvars, inherits) |
787 | self.assertNotIn('Traceback', result.output) | 784 | self.assertNotIn('Traceback', result.output) |
788 | 785 | ||
786 | lics_require_file = os.path.join(temprecipe, 'recipetool-go-test-licenses.inc') | ||
787 | self.assertFileExists(lics_require_file) | ||
789 | checkvars = {} | 788 | checkvars = {} |
790 | checkvars['VENDORED_LIC_FILES_CHKSUM'] = set( | 789 | checkvars['LIC_FILES_CHKSUM'] = {'file://pkg/mod/github.com/godbus/dbus/v5@v5.1.0/LICENSE;md5=09042bd5c6c96a2b9e45ddf1bc517eed;spdx=BSD-2-Clause'} |
791 | ['file://src/${GO_IMPORT}/vendor/github.com/godbus/dbus/v5/LICENSE;md5=09042bd5c6c96a2b9e45ddf1bc517eed', | ||
792 | 'file://src/${GO_IMPORT}/vendor/github.com/matryer/is/LICENSE;md5=62beaee5a116dd1e80161667b1df39ab']) | ||
793 | self.assertTrue(os.path.isfile(lics_require_file)) | ||
794 | self._test_recipe_contents(lics_require_file, checkvars, []) | 790 | self._test_recipe_contents(lics_require_file, checkvars, []) |
795 | 791 | ||
796 | # make sure that dependencies don't mention local directory ./matryer/is | 792 | deps_require_file = os.path.join(temprecipe, 'recipetool-go-test-go-mods.inc') |
797 | dependencies = \ | 793 | self.assertFileExists(deps_require_file) |
798 | [ ('github.com/godbus/dbus','v5.1.0', 'github.com/godbus/dbus/v5', '/v5', ''), | ||
799 | ] | ||
800 | |||
801 | src_uri = set() | ||
802 | for d in dependencies: | ||
803 | src_uri.add(self._go_urifiy(*d)) | ||
804 | |||
805 | checkvars = {} | 794 | checkvars = {} |
806 | checkvars['GO_DEPENDENCIES_SRC_URI'] = src_uri | 795 | checkvars['SRC_URI'] = {'gomod://github.com/godbus/dbus/v5;version=v5.1.0;sha256sum=03dfa8e71089a6f477310d15c4d3a036d82d028532881b50fee254358e782ad9'} |
807 | |||
808 | self.assertTrue(os.path.isfile(deps_require_file)) | ||
809 | self._test_recipe_contents(deps_require_file, checkvars, []) | 796 | self._test_recipe_contents(deps_require_file, checkvars, []) |
810 | 797 | ||
811 | class RecipetoolTests(RecipetoolBase): | 798 | class RecipetoolTests(RecipetoolBase): |
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py index 487995acc3..08f94b168a 100644 --- a/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/meta/lib/oeqa/selftest/cases/sstatetests.py | |||
@@ -27,17 +27,15 @@ class SStateBase(OESelftestTestCase): | |||
27 | def setUpLocal(self): | 27 | def setUpLocal(self): |
28 | super(SStateBase, self).setUpLocal() | 28 | super(SStateBase, self).setUpLocal() |
29 | self.temp_sstate_location = None | 29 | self.temp_sstate_location = None |
30 | needed_vars = ['SSTATE_DIR', 'NATIVELSBSTRING', 'TCLIBC', 'TUNE_ARCH', | 30 | needed_vars = ['SSTATE_DIR', 'TCLIBC', 'TUNE_ARCH', |
31 | 'TOPDIR', 'TARGET_VENDOR', 'TARGET_OS'] | 31 | 'TOPDIR', 'TARGET_VENDOR', 'TARGET_OS'] |
32 | bb_vars = get_bb_vars(needed_vars) | 32 | bb_vars = get_bb_vars(needed_vars) |
33 | self.sstate_path = bb_vars['SSTATE_DIR'] | 33 | self.sstate_path = bb_vars['SSTATE_DIR'] |
34 | self.hostdistro = bb_vars['NATIVELSBSTRING'] | ||
35 | self.tclibc = bb_vars['TCLIBC'] | 34 | self.tclibc = bb_vars['TCLIBC'] |
36 | self.tune_arch = bb_vars['TUNE_ARCH'] | 35 | self.tune_arch = bb_vars['TUNE_ARCH'] |
37 | self.topdir = bb_vars['TOPDIR'] | 36 | self.topdir = bb_vars['TOPDIR'] |
38 | self.target_vendor = bb_vars['TARGET_VENDOR'] | 37 | self.target_vendor = bb_vars['TARGET_VENDOR'] |
39 | self.target_os = bb_vars['TARGET_OS'] | 38 | self.target_os = bb_vars['TARGET_OS'] |
40 | self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro) | ||
41 | 39 | ||
42 | def track_for_cleanup(self, path): | 40 | def track_for_cleanup(self, path): |
43 | if not keep_temp_files: | 41 | if not keep_temp_files: |
@@ -52,10 +50,7 @@ class SStateBase(OESelftestTestCase): | |||
52 | config_temp_sstate = "SSTATE_DIR = \"%s\"" % temp_sstate_path | 50 | config_temp_sstate = "SSTATE_DIR = \"%s\"" % temp_sstate_path |
53 | self.append_config(config_temp_sstate) | 51 | self.append_config(config_temp_sstate) |
54 | self.track_for_cleanup(temp_sstate_path) | 52 | self.track_for_cleanup(temp_sstate_path) |
55 | bb_vars = get_bb_vars(['SSTATE_DIR', 'NATIVELSBSTRING']) | 53 | self.sstate_path = get_bb_var('SSTATE_DIR') |
56 | self.sstate_path = bb_vars['SSTATE_DIR'] | ||
57 | self.hostdistro = bb_vars['NATIVELSBSTRING'] | ||
58 | self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro) | ||
59 | 54 | ||
60 | if add_local_mirrors: | 55 | if add_local_mirrors: |
61 | config_set_sstate_if_not_set = 'SSTATE_MIRRORS ?= ""' | 56 | config_set_sstate_if_not_set = 'SSTATE_MIRRORS ?= ""' |
@@ -65,8 +60,16 @@ class SStateBase(OESelftestTestCase): | |||
65 | config_sstate_mirror = "SSTATE_MIRRORS += \"file://.* file:///%s/PATH\"" % local_mirror | 60 | config_sstate_mirror = "SSTATE_MIRRORS += \"file://.* file:///%s/PATH\"" % local_mirror |
66 | self.append_config(config_sstate_mirror) | 61 | self.append_config(config_sstate_mirror) |
67 | 62 | ||
63 | def set_hostdistro(self): | ||
64 | # This needs to be read after a BuildStarted event in case it gets changed by event | ||
65 | # handling in uninative.bbclass | ||
66 | self.hostdistro = get_bb_var('NATIVELSBSTRING') | ||
67 | self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro) | ||
68 | |||
68 | # Returns a list containing sstate files | 69 | # Returns a list containing sstate files |
69 | def search_sstate(self, filename_regex, distro_specific=True, distro_nonspecific=True): | 70 | def search_sstate(self, filename_regex, distro_specific=True, distro_nonspecific=True): |
71 | self.set_hostdistro() | ||
72 | |||
70 | result = [] | 73 | result = [] |
71 | for root, dirs, files in os.walk(self.sstate_path): | 74 | for root, dirs, files in os.walk(self.sstate_path): |
72 | if distro_specific and re.search(r"%s/%s/[a-z0-9]{2}/[a-z0-9]{2}$" % (self.sstate_path, self.hostdistro), root): | 75 | if distro_specific and re.search(r"%s/%s/[a-z0-9]{2}/[a-z0-9]{2}$" % (self.sstate_path, self.hostdistro), root): |
@@ -80,55 +83,43 @@ class SStateBase(OESelftestTestCase): | |||
80 | return result | 83 | return result |
81 | 84 | ||
82 | # Test sstate files creation and their location and directory perms | 85 | # Test sstate files creation and their location and directory perms |
83 | def run_test_sstate_creation(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True, should_pass=True): | 86 | def run_test_sstate_creation(self, targets, hostdistro_specific): |
84 | self.config_sstate(temp_sstate_location, [self.sstate_path]) | 87 | self.config_sstate(True, [self.sstate_path]) |
88 | |||
89 | bitbake(['-cclean'] + targets) | ||
85 | 90 | ||
86 | if self.temp_sstate_location: | ||
87 | bitbake(['-cclean'] + targets) | ||
88 | else: | ||
89 | bitbake(['-ccleansstate'] + targets) | ||
90 | |||
91 | # We need to test that the env umask have does not effect sstate directory creation | ||
92 | # So, first, we'll get the current umask and set it to something we know incorrect | ||
93 | # See: sstate_task_postfunc for correct umask of os.umask(0o002) | ||
94 | import os | ||
95 | def current_umask(): | ||
96 | current_umask = os.umask(0) | ||
97 | os.umask(current_umask) | ||
98 | return current_umask | ||
99 | |||
100 | orig_umask = current_umask() | ||
101 | # Set it to a umask we know will be 'wrong' | 91 | # Set it to a umask we know will be 'wrong' |
102 | os.umask(0o022) | 92 | with bb.utils.umask(0o022): |
93 | bitbake(targets) | ||
103 | 94 | ||
104 | bitbake(targets) | 95 | # Distro specific files |
105 | file_tracker = [] | 96 | distro_specific_files = self.search_sstate('|'.join(map(str, targets)), True, False) |
106 | results = self.search_sstate('|'.join(map(str, targets)), distro_specific, distro_nonspecific) | 97 | |
107 | if distro_nonspecific: | 98 | # Distro non-specific |
108 | for r in results: | 99 | distro_non_specific_files = [] |
109 | if r.endswith(("_populate_lic.tar.zst", "_populate_lic.tar.zst.siginfo", "_fetch.tar.zst.siginfo", "_unpack.tar.zst.siginfo", "_patch.tar.zst.siginfo")): | 100 | results = self.search_sstate('|'.join(map(str, targets)), False, True) |
110 | continue | 101 | for r in results: |
111 | file_tracker.append(r) | 102 | if r.endswith(("_populate_lic.tar.zst", "_populate_lic.tar.zst.siginfo", "_fetch.tar.zst.siginfo", "_unpack.tar.zst.siginfo", "_patch.tar.zst.siginfo")): |
112 | else: | 103 | continue |
113 | file_tracker = results | 104 | distro_non_specific_files.append(r) |
114 | 105 | ||
115 | if should_pass: | 106 | if hostdistro_specific: |
116 | self.assertTrue(file_tracker , msg="Could not find sstate files for: %s" % ', '.join(map(str, targets))) | 107 | self.assertTrue(distro_specific_files , msg="Could not find sstate files for: %s" % ', '.join(map(str, targets))) |
108 | self.assertFalse(distro_non_specific_files, msg="Found sstate files in the wrong place for: %s (found %s)" % (', '.join(map(str, targets)), str(distro_non_specific_files))) | ||
117 | else: | 109 | else: |
118 | self.assertTrue(not file_tracker , msg="Found sstate files in the wrong place for: %s (found %s)" % (', '.join(map(str, targets)), str(file_tracker))) | 110 | self.assertTrue(distro_non_specific_files , msg="Could not find sstate files for: %s" % ', '.join(map(str, targets))) |
111 | self.assertFalse(distro_specific_files, msg="Found sstate files in the wrong place for: %s (found %s)" % (', '.join(map(str, targets)), str(distro_specific_files))) | ||
119 | 112 | ||
120 | # Now we'll walk the tree to check the mode and see if things are incorrect. | 113 | # Now we'll walk the tree to check the mode and see if things are incorrect. |
121 | badperms = [] | 114 | badperms = [] |
122 | for root, dirs, files in os.walk(self.sstate_path): | 115 | for root, dirs, files in os.walk(self.sstate_path): |
123 | for directory in dirs: | 116 | for directory in dirs: |
124 | if (os.stat(os.path.join(root, directory)).st_mode & 0o777) != 0o775: | 117 | mode = os.stat(os.path.join(root, directory)).st_mode & 0o777 |
125 | badperms.append(os.path.join(root, directory)) | 118 | if mode != 0o775: |
126 | 119 | badperms.append("%s: %s vs %s" % (os.path.join(root, directory), mode, 0o775)) | |
127 | # Return to original umask | ||
128 | os.umask(orig_umask) | ||
129 | 120 | ||
130 | if should_pass: | 121 | # Check badperms is empty |
131 | self.assertTrue(badperms , msg="Found sstate directories with the wrong permissions: %s (found %s)" % (', '.join(map(str, targets)), str(badperms))) | 122 | self.assertFalse(badperms , msg="Found sstate directories with the wrong permissions: %s (found %s)" % (', '.join(map(str, targets)), str(badperms))) |
132 | 123 | ||
133 | # Test the sstate files deletion part of the do_cleansstate task | 124 | # Test the sstate files deletion part of the do_cleansstate task |
134 | def run_test_cleansstate_task(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True): | 125 | def run_test_cleansstate_task(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True): |
@@ -153,6 +144,8 @@ class SStateBase(OESelftestTestCase): | |||
153 | 144 | ||
154 | bitbake(['-ccleansstate'] + targets) | 145 | bitbake(['-ccleansstate'] + targets) |
155 | 146 | ||
147 | self.set_hostdistro() | ||
148 | |||
156 | bitbake(targets) | 149 | bitbake(targets) |
157 | results = self.search_sstate('|'.join(map(str, [s + r'.*?\.tar.zst$' for s in targets])), distro_specific=False, distro_nonspecific=True) | 150 | results = self.search_sstate('|'.join(map(str, [s + r'.*?\.tar.zst$' for s in targets])), distro_specific=False, distro_nonspecific=True) |
158 | filtered_results = [] | 151 | filtered_results = [] |
@@ -251,17 +244,11 @@ class SStateTests(SStateBase): | |||
251 | bitbake("dbus-wait-test -c unpack") | 244 | bitbake("dbus-wait-test -c unpack") |
252 | 245 | ||
253 | class SStateCreation(SStateBase): | 246 | class SStateCreation(SStateBase): |
254 | def test_sstate_creation_distro_specific_pass(self): | 247 | def test_sstate_creation_distro_specific(self): |
255 | self.run_test_sstate_creation(['binutils-cross-'+ self.tune_arch, 'binutils-native'], distro_specific=True, distro_nonspecific=False, temp_sstate_location=True) | 248 | self.run_test_sstate_creation(['binutils-cross-'+ self.tune_arch, 'binutils-native'], hostdistro_specific=True) |
256 | |||
257 | def test_sstate_creation_distro_specific_fail(self): | ||
258 | self.run_test_sstate_creation(['binutils-cross-'+ self.tune_arch, 'binutils-native'], distro_specific=False, distro_nonspecific=True, temp_sstate_location=True, should_pass=False) | ||
259 | |||
260 | def test_sstate_creation_distro_nonspecific_pass(self): | ||
261 | self.run_test_sstate_creation(['linux-libc-headers'], distro_specific=False, distro_nonspecific=True, temp_sstate_location=True) | ||
262 | 249 | ||
263 | def test_sstate_creation_distro_nonspecific_fail(self): | 250 | def test_sstate_creation_distro_nonspecific(self): |
264 | self.run_test_sstate_creation(['linux-libc-headers'], distro_specific=True, distro_nonspecific=False, temp_sstate_location=True, should_pass=False) | 251 | self.run_test_sstate_creation(['linux-libc-headers'], hostdistro_specific=False) |
265 | 252 | ||
266 | class SStateCleanup(SStateBase): | 253 | class SStateCleanup(SStateBase): |
267 | def test_cleansstate_task_distro_specific_nonspecific(self): | 254 | def test_cleansstate_task_distro_specific_nonspecific(self): |
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index f45608172f..680f99d381 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py | |||
@@ -1021,6 +1021,18 @@ class Wic2(WicTestCase): | |||
1021 | """Test building wic images by bitbake""" | 1021 | """Test building wic images by bitbake""" |
1022 | config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ | 1022 | config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ |
1023 | 'MACHINE_FEATURES:append = " efi"\n' | 1023 | 'MACHINE_FEATURES:append = " efi"\n' |
1024 | image_recipe_append = """ | ||
1025 | do_image_wic[postfuncs] += "run_wic_cmd" | ||
1026 | run_wic_cmd() { | ||
1027 | echo "test" >> ${WORKDIR}/test.wic-cp | ||
1028 | wic cp --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${WORKDIR}/test.wic-cp ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
1029 | wic ls --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
1030 | wic rm --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/test.wic-cp | ||
1031 | wic cp --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${WORKDIR}/test.wic-cp ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
1032 | } | ||
1033 | """ | ||
1034 | self.write_recipeinc('images', image_recipe_append) | ||
1035 | |||
1024 | self.append_config(config) | 1036 | self.append_config(config) |
1025 | image = 'wic-image-minimal' | 1037 | image = 'wic-image-minimal' |
1026 | bitbake(image) | 1038 | bitbake(image) |
@@ -1029,6 +1041,11 @@ class Wic2(WicTestCase): | |||
1029 | bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image) | 1041 | bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image) |
1030 | prefix = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.' % bb_vars['IMAGE_LINK_NAME']) | 1042 | prefix = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.' % bb_vars['IMAGE_LINK_NAME']) |
1031 | 1043 | ||
1044 | sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') | ||
1045 | # check if file is there | ||
1046 | result = runCmd("wic ls %s:1/ -n %s" % (prefix+"wic", sysroot)) | ||
1047 | self.assertIn("test.wic-cp", result.output) | ||
1048 | |||
1032 | # check if we have result image and manifests symlinks | 1049 | # check if we have result image and manifests symlinks |
1033 | # pointing to existing files | 1050 | # pointing to existing files |
1034 | for suffix in ('wic', 'manifest'): | 1051 | for suffix in ('wic', 'manifest'): |
@@ -1044,7 +1061,25 @@ class Wic2(WicTestCase): | |||
1044 | config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ | 1061 | config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ |
1045 | 'MACHINE_FEATURES:append = " efi"\n' | 1062 | 'MACHINE_FEATURES:append = " efi"\n' |
1046 | self.append_config(config) | 1063 | self.append_config(config) |
1064 | image_recipe_append = """ | ||
1065 | do_image_wic[postfuncs] += "run_wic_cmd" | ||
1066 | run_wic_cmd() { | ||
1067 | echo "test" >> ${WORKDIR}/test.wic-cp | ||
1068 | wic cp --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${WORKDIR}/test.wic-cp ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
1069 | wic ls --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
1070 | wic rm --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/test.wic-cp | ||
1071 | wic cp --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${WORKDIR}/test.wic-cp ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
1072 | } | ||
1073 | """ | ||
1074 | self.write_recipeinc('images', image_recipe_append) | ||
1047 | bitbake('wic-image-minimal') | 1075 | bitbake('wic-image-minimal') |
1076 | |||
1077 | sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') | ||
1078 | bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], "wic-image-minimal") | ||
1079 | image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], bb_vars['IMAGE_LINK_NAME']) | ||
1080 | # check if file is there | ||
1081 | result = runCmd("wic ls %s:1/ -n %s" % (image_path+".wic", sysroot)) | ||
1082 | self.assertIn("test.wic-cp", result.output) | ||
1048 | self.remove_config(config) | 1083 | self.remove_config(config) |
1049 | 1084 | ||
1050 | runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'wic-image-minimal') or "" | 1085 | runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'wic-image-minimal') or "" |