diff options
author | Jair Gonzalez <jair.de.jesus.gonzalez.plascencia@linux.intel.com> | 2016-12-13 09:53:27 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-20 15:22:16 +0000 |
commit | aa1c50a32b029620c3940efd648261cd21bdc37c (patch) | |
tree | d10e6aab12d952eb14ef40d1af6f457dc326ba10 /meta | |
parent | d0d260b0b85790ceb136dd6b0445e8e33d038f5e (diff) | |
download | poky-aa1c50a32b029620c3940efd648261cd21bdc37c.tar.gz |
selftest/wic: extending test coverage for WIC script options
The previous WIC script selftest didn't cover all of its command
line options. The following test cases were added to complete
covering them:
1552 Test wic --version
1553 Test wic help create
1554 Test wic help list
1555 Test wic list images
1556 Test wic list source-plugins
1557 Test wic listed images help
1558 Test wic debug, skip-build-check and build_rootfs
1559 Test image vars directory selection
1562 Test alternate output directory
In addition, the following test cases were assigned an ID number on
Testopia:
1560 Test creation of systemd-bootdisk image
1561 Test creation of sdimage-bootpart image
Finally, part of the test methods were rearranged to group them by
functionality, and some cleanup was made to improve the code's
compliance with PEP8 style guide.
Fixes [YOCTO 10594]
(From OE-Core rev: 3d2ac67765020885a0996ebdd97a576ba37dbec0)
(From OE-Core rev: 68cb3180c1b0dcee50812b21f98850d188d8621b)
Signed-off-by: Jair Gonzalez <jair.de.jesus.gonzalez.plascencia@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/selftest/wic.py | 246 |
1 files changed, 174 insertions, 72 deletions
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index e652fad24a..46bfb94ea9 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py | |||
@@ -37,13 +37,13 @@ class Wic(oeSelfTest): | |||
37 | """Wic test class.""" | 37 | """Wic test class.""" |
38 | 38 | ||
39 | resultdir = "/var/tmp/wic/build/" | 39 | resultdir = "/var/tmp/wic/build/" |
40 | alternate_resultdir = "/var/tmp/wic/build/alt/" | ||
40 | image_is_ready = False | 41 | image_is_ready = False |
41 | 42 | ||
42 | def setUpLocal(self): | 43 | def setUpLocal(self): |
43 | """This code is executed before each test method.""" | 44 | """This code is executed before each test method.""" |
44 | self.write_config('IMAGE_FSTYPES += " hddimg"\n' | 45 | self.write_config('IMAGE_FSTYPES += " hddimg"\n' |
45 | 'MACHINE_FEATURES_append = " efi"\n' | 46 | 'MACHINE_FEATURES_append = " efi"\n') |
46 | 'WKS_FILE = "wic-image-minimal"\n') | ||
47 | 47 | ||
48 | # Do this here instead of in setUpClass as the base setUp does some | 48 | # Do this here instead of in setUpClass as the base setUp does some |
49 | # clean up which can result in the native tools built earlier in | 49 | # clean up which can result in the native tools built earlier in |
@@ -56,10 +56,16 @@ class Wic(oeSelfTest): | |||
56 | 56 | ||
57 | rmtree(self.resultdir, ignore_errors=True) | 57 | rmtree(self.resultdir, ignore_errors=True) |
58 | 58 | ||
59 | @testcase(1552) | ||
60 | def test_version(self): | ||
61 | """Test wic --version""" | ||
62 | self.assertEqual(0, runCmd('wic --version').status) | ||
63 | |||
59 | @testcase(1208) | 64 | @testcase(1208) |
60 | def test_help(self): | 65 | def test_help(self): |
61 | """Test wic --help""" | 66 | """Test wic --help and wic -h""" |
62 | self.assertEqual(0, runCmd('wic --help').status) | 67 | self.assertEqual(0, runCmd('wic --help').status) |
68 | self.assertEqual(0, runCmd('wic -h').status) | ||
63 | 69 | ||
64 | @testcase(1209) | 70 | @testcase(1209) |
65 | def test_createhelp(self): | 71 | def test_createhelp(self): |
@@ -71,19 +77,74 @@ class Wic(oeSelfTest): | |||
71 | """Test wic list --help""" | 77 | """Test wic list --help""" |
72 | self.assertEqual(0, runCmd('wic list --help').status) | 78 | self.assertEqual(0, runCmd('wic list --help').status) |
73 | 79 | ||
80 | @testcase(1553) | ||
81 | def test_help_create(self): | ||
82 | """Test wic help create""" | ||
83 | self.assertEqual(0, runCmd('wic help create').status) | ||
84 | |||
85 | @testcase(1554) | ||
86 | def test_help_list(self): | ||
87 | """Test wic help list""" | ||
88 | self.assertEqual(0, runCmd('wic help list').status) | ||
89 | |||
90 | @testcase(1215) | ||
91 | def test_help_overview(self): | ||
92 | """Test wic help overview""" | ||
93 | self.assertEqual(0, runCmd('wic help overview').status) | ||
94 | |||
95 | @testcase(1216) | ||
96 | def test_help_plugins(self): | ||
97 | """Test wic help plugins""" | ||
98 | self.assertEqual(0, runCmd('wic help plugins').status) | ||
99 | |||
100 | @testcase(1217) | ||
101 | def test_help_kickstart(self): | ||
102 | """Test wic help kickstart""" | ||
103 | self.assertEqual(0, runCmd('wic help kickstart').status) | ||
104 | |||
105 | @testcase(1555) | ||
106 | def test_list_images(self): | ||
107 | """Test wic list images""" | ||
108 | self.assertEqual(0, runCmd('wic list images').status) | ||
109 | |||
110 | @testcase(1556) | ||
111 | def test_list_source_plugins(self): | ||
112 | """Test wic list source-plugins""" | ||
113 | self.assertEqual(0, runCmd('wic list source-plugins').status) | ||
114 | |||
115 | @testcase(1557) | ||
116 | def test_listed_images_help(self): | ||
117 | """Test wic listed images help""" | ||
118 | output = runCmd('wic list images').output | ||
119 | imageDetails = [line.split() for line in output.split('\n')] | ||
120 | imageList = [row[0] for row in imageDetails] | ||
121 | for image in imageList: | ||
122 | self.assertEqual(0, runCmd('wic list %s help' % image).status) | ||
123 | |||
124 | @testcase(1213) | ||
125 | def test_unsupported_subcommand(self): | ||
126 | """Test unsupported subcommand""" | ||
127 | self.assertEqual(1, runCmd('wic unsupported', | ||
128 | ignore_status=True).status) | ||
129 | |||
130 | @testcase(1214) | ||
131 | def test_no_command(self): | ||
132 | """Test wic without command""" | ||
133 | self.assertEqual(1, runCmd('wic', ignore_status=True).status) | ||
134 | |||
74 | @testcase(1211) | 135 | @testcase(1211) |
75 | def test_build_image_name(self): | 136 | def test_build_image_name(self): |
76 | """Test wic create directdisk --image-name core-image-minimal""" | 137 | """Test wic create directdisk --image-name core-image-minimal""" |
77 | self.assertEqual(0, runCmd("wic create directdisk " | 138 | self.assertEqual(0, runCmd("wic create directdisk " |
78 | "--image-name core-image-minimal").status) | 139 | "--image-name=core-image-minimal").status) |
79 | self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) | 140 | self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) |
80 | 141 | ||
81 | @testcase(1212) | 142 | @testcase(1212) |
82 | def test_build_artifacts(self): | 143 | def test_build_artifacts(self): |
83 | """Test wic create directdisk providing all artifacts.""" | 144 | """Test wic create directdisk providing all artifacts.""" |
84 | bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ | 145 | bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) |
85 | for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', | 146 | for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', |
86 | 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) | 147 | 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) |
87 | status = runCmd("wic create directdisk " | 148 | status = runCmd("wic create directdisk " |
88 | "-b %(staging_datadir)s " | 149 | "-b %(staging_datadir)s " |
89 | "-k %(deploy_dir_image)s " | 150 | "-k %(deploy_dir_image)s " |
@@ -96,113 +157,110 @@ class Wic(oeSelfTest): | |||
96 | def test_gpt_image(self): | 157 | def test_gpt_image(self): |
97 | """Test creation of core-image-minimal with gpt table and UUID boot""" | 158 | """Test creation of core-image-minimal with gpt table and UUID boot""" |
98 | self.assertEqual(0, runCmd("wic create directdisk-gpt " | 159 | self.assertEqual(0, runCmd("wic create directdisk-gpt " |
99 | "--image-name core-image-minimal").status) | 160 | "--image-name core-image-minimal " |
161 | ).status) | ||
100 | self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) | 162 | self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) |
101 | 163 | ||
102 | @testcase(1213) | ||
103 | def test_unsupported_subcommand(self): | ||
104 | """Test unsupported subcommand""" | ||
105 | self.assertEqual(1, runCmd('wic unsupported', | ||
106 | ignore_status=True).status) | ||
107 | |||
108 | @testcase(1214) | ||
109 | def test_no_command(self): | ||
110 | """Test wic without command""" | ||
111 | self.assertEqual(1, runCmd('wic', ignore_status=True).status) | ||
112 | |||
113 | @testcase(1215) | ||
114 | def test_help_overview(self): | ||
115 | """Test wic help overview""" | ||
116 | self.assertEqual(0, runCmd('wic help overview').status) | ||
117 | |||
118 | @testcase(1216) | ||
119 | def test_help_plugins(self): | ||
120 | """Test wic help plugins""" | ||
121 | self.assertEqual(0, runCmd('wic help plugins').status) | ||
122 | |||
123 | @testcase(1217) | ||
124 | def test_help_kickstart(self): | ||
125 | """Test wic help kickstart""" | ||
126 | self.assertEqual(0, runCmd('wic help kickstart').status) | ||
127 | |||
128 | @testcase(1264) | 164 | @testcase(1264) |
129 | def test_compress_gzip(self): | 165 | def test_compress_gzip(self): |
130 | """Test compressing an image with gzip""" | 166 | """Test compressing an image with gzip""" |
131 | self.assertEqual(0, runCmd("wic create directdisk " | 167 | self.assertEqual(0, runCmd("wic create directdisk " |
132 | "--image-name core-image-minimal " | 168 | "-e core-image-minimal " |
133 | "-c gzip").status) | 169 | "-c gzip").status) |
134 | self.assertEqual(1, len(glob(self.resultdir + \ | 170 | self.assertEqual(1, len(glob(self.resultdir + |
135 | "directdisk-*.direct.gz"))) | 171 | "directdisk-*.direct.gz"))) |
136 | 172 | ||
137 | @testcase(1265) | 173 | @testcase(1265) |
138 | def test_compress_bzip2(self): | 174 | def test_compress_bzip2(self): |
139 | """Test compressing an image with bzip2""" | 175 | """Test compressing an image with bzip2""" |
140 | self.assertEqual(0, runCmd("wic create directdisk " | 176 | self.assertEqual(0, runCmd("wic create directdisk " |
141 | "--image-name core-image-minimal " | 177 | "--image-name=core-image-minimal " |
142 | "-c bzip2").status) | 178 | "-c bzip2").status) |
143 | self.assertEqual(1, len(glob(self.resultdir + \ | 179 | self.assertEqual(1, len(glob(self.resultdir + |
144 | "directdisk-*.direct.bz2"))) | 180 | "directdisk-*.direct.bz2"))) |
145 | 181 | ||
146 | @testcase(1266) | 182 | @testcase(1266) |
147 | def test_compress_xz(self): | 183 | def test_compress_xz(self): |
148 | """Test compressing an image with xz""" | 184 | """Test compressing an image with xz""" |
149 | self.assertEqual(0, runCmd("wic create directdisk " | 185 | self.assertEqual(0, runCmd("wic create directdisk " |
150 | "--image-name core-image-minimal " | 186 | "--image-name=core-image-minimal " |
151 | "-c xz").status) | 187 | "--compress-with=xz").status) |
152 | self.assertEqual(1, len(glob(self.resultdir + \ | 188 | self.assertEqual(1, len(glob(self.resultdir + |
153 | "directdisk-*.direct.xz"))) | 189 | "directdisk-*.direct.xz"))) |
154 | 190 | ||
155 | @testcase(1267) | 191 | @testcase(1267) |
156 | def test_wrong_compressor(self): | 192 | def test_wrong_compressor(self): |
157 | """Test how wic breaks if wrong compressor is provided""" | 193 | """Test how wic breaks if wrong compressor is provided""" |
158 | self.assertEqual(2, runCmd("wic create directdisk " | 194 | self.assertEqual(2, runCmd("wic create directdisk " |
159 | "--image-name core-image-minimal " | 195 | "--image-name=core-image-minimal " |
160 | "-c wrong", ignore_status=True).status) | 196 | "-c wrong", ignore_status=True).status) |
161 | 197 | ||
198 | @testcase(1558) | ||
199 | def test_debug_skip_build_check_and_build_rootfs(self): | ||
200 | """Test wic debug, skip-build-check and build_rootfs""" | ||
201 | self.assertEqual(0, runCmd("wic create directdisk " | ||
202 | "--image-name=core-image-minimal " | ||
203 | "-D -s -f").status) | ||
204 | self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) | ||
205 | self.assertEqual(0, runCmd("wic create directdisk " | ||
206 | "--image-name=core-image-minimal " | ||
207 | "--debug " | ||
208 | "--skip-build-check " | ||
209 | "--build-rootfs").status) | ||
210 | self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) | ||
211 | |||
162 | @testcase(1268) | 212 | @testcase(1268) |
163 | def test_rootfs_indirect_recipes(self): | 213 | def test_rootfs_indirect_recipes(self): |
164 | """Test usage of rootfs plugin with rootfs recipes""" | 214 | """Test usage of rootfs plugin with rootfs recipes""" |
165 | wks = "directdisk-multi-rootfs" | 215 | wks = "directdisk-multi-rootfs" |
166 | self.assertEqual(0, runCmd("wic create %s " | 216 | self.assertEqual(0, runCmd("wic create %s " |
167 | "--image-name core-image-minimal " | 217 | "--image-name=core-image-minimal " |
168 | "--rootfs rootfs1=core-image-minimal " | 218 | "--rootfs rootfs1=core-image-minimal " |
169 | "--rootfs rootfs2=core-image-minimal" \ | 219 | "--rootfs rootfs2=core-image-minimal" |
170 | % wks).status) | 220 | % wks).status) |
171 | self.assertEqual(1, len(glob(self.resultdir + "%s*.direct" % wks))) | 221 | self.assertEqual(1, len(glob(self.resultdir + "%s*.direct" % wks))) |
172 | 222 | ||
173 | @testcase(1269) | 223 | @testcase(1269) |
174 | def test_rootfs_artifacts(self): | 224 | def test_rootfs_artifacts(self): |
175 | """Test usage of rootfs plugin with rootfs paths""" | 225 | """Test usage of rootfs plugin with rootfs paths""" |
176 | bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ | 226 | bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) |
177 | for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', | 227 | for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', |
178 | 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) | 228 | 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) |
179 | bbvars['wks'] = "directdisk-multi-rootfs" | 229 | bbvars['wks'] = "directdisk-multi-rootfs" |
180 | status = runCmd("wic create %(wks)s " | 230 | status = runCmd("wic create %(wks)s " |
181 | "-b %(staging_datadir)s " | 231 | "--bootimg-dir=%(staging_datadir)s " |
182 | "-k %(deploy_dir_image)s " | 232 | "--kernel-dir=%(deploy_dir_image)s " |
183 | "-n %(staging_dir_native)s " | 233 | "--native-sysroot=%(staging_dir_native)s " |
184 | "--rootfs-dir rootfs1=%(image_rootfs)s " | 234 | "--rootfs-dir rootfs1=%(image_rootfs)s " |
185 | "--rootfs-dir rootfs2=%(image_rootfs)s" \ | 235 | "--rootfs-dir rootfs2=%(image_rootfs)s" |
186 | % bbvars).status | 236 | % bbvars).status |
187 | self.assertEqual(0, status) | 237 | self.assertEqual(0, status) |
188 | self.assertEqual(1, len(glob(self.resultdir + \ | 238 | self.assertEqual(1, len(glob(self.resultdir + |
189 | "%(wks)s-*.direct" % bbvars))) | 239 | "%(wks)s-*.direct" % bbvars))) |
190 | 240 | ||
191 | @testcase(1346) | 241 | @testcase(1346) |
192 | def test_iso_image(self): | 242 | def test_iso_image(self): |
193 | """Test creation of hybrid iso image with legacy and EFI boot""" | 243 | """Test creation of hybrid iso image with legacy and EFI boot""" |
194 | self.assertEqual(0, runCmd("wic create mkhybridiso " | 244 | self.assertEqual(0, runCmd("wic create mkhybridiso " |
195 | "--image-name core-image-minimal").status) | 245 | "--image-name core-image-minimal" |
196 | self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.direct"))) | 246 | ).status) |
197 | self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso"))) | 247 | self.assertEqual(1, len(glob(self.resultdir + |
248 | "HYBRID_ISO_IMG-*.direct"))) | ||
249 | self.assertEqual(1, len(glob(self.resultdir + | ||
250 | "HYBRID_ISO_IMG-*.iso"))) | ||
251 | |||
252 | def __get_image_env_path(self, image): | ||
253 | """Generate and obtain the path to <image>.env""" | ||
254 | self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status) | ||
255 | stdir = get_bb_var('STAGING_DIR_TARGET', image) | ||
256 | imgdatadir = os.path.join(stdir, 'imgdata') | ||
257 | return imgdatadir | ||
198 | 258 | ||
199 | @testcase(1347) | 259 | @testcase(1347) |
200 | def test_image_env(self): | 260 | def test_image_env(self): |
201 | """Test generation of <image>.env files.""" | 261 | """Test generation of <image>.env files""" |
202 | image = 'core-image-minimal' | 262 | image = 'core-image-minimal' |
203 | self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status) | 263 | imgdatadir = self.__get_image_env_path(image) |
204 | stdir = get_bb_var('STAGING_DIR_TARGET', image) | ||
205 | imgdatadir = os.path.join(stdir, 'imgdata') | ||
206 | 264 | ||
207 | basename = get_bb_var('IMAGE_BASENAME', image) | 265 | basename = get_bb_var('IMAGE_BASENAME', image) |
208 | self.assertEqual(basename, image) | 266 | self.assertEqual(basename, image) |
@@ -220,6 +278,21 @@ class Wic(oeSelfTest): | |||
220 | self.assertTrue(var in content, "%s is not in .env file" % var) | 278 | self.assertTrue(var in content, "%s is not in .env file" % var) |
221 | self.assertTrue(content[var]) | 279 | self.assertTrue(content[var]) |
222 | 280 | ||
281 | @testcase(1559) | ||
282 | def test_image_vars_dir(self): | ||
283 | """Test image vars directory selection""" | ||
284 | image = 'core-image-minimal' | ||
285 | imgenvdir = self.__get_image_env_path(image) | ||
286 | |||
287 | self.assertEqual(0, runCmd("wic create directdisk " | ||
288 | "--image-name=%s " | ||
289 | "-v %s" | ||
290 | % (image, imgenvdir)).status) | ||
291 | self.assertEqual(0, runCmd("wic create directdisk " | ||
292 | "--image-name=%s " | ||
293 | "--vars %s" | ||
294 | % (image, imgenvdir)).status) | ||
295 | |||
223 | @testcase(1351) | 296 | @testcase(1351) |
224 | def test_wic_image_type(self): | 297 | def test_wic_image_type(self): |
225 | """Test building wic images by bitbake""" | 298 | """Test building wic images by bitbake""" |
@@ -239,7 +312,7 @@ class Wic(oeSelfTest): | |||
239 | def test_qemux86_directdisk(self): | 312 | def test_qemux86_directdisk(self): |
240 | """Test creation of qemux-86-directdisk image""" | 313 | """Test creation of qemux-86-directdisk image""" |
241 | image = "qemux86-directdisk" | 314 | image = "qemux86-directdisk" |
242 | self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ | 315 | self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" |
243 | % image).status) | 316 | % image).status) |
244 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) | 317 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) |
245 | 318 | ||
@@ -247,7 +320,8 @@ class Wic(oeSelfTest): | |||
247 | def test_mkgummidisk(self): | 320 | def test_mkgummidisk(self): |
248 | """Test creation of mkgummidisk image""" | 321 | """Test creation of mkgummidisk image""" |
249 | image = "mkgummidisk" | 322 | image = "mkgummidisk" |
250 | self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ | 323 | self.assertEqual(0, runCmd("wic create %s --image-name " |
324 | "core-image-minimal" | ||
251 | % image).status) | 325 | % image).status) |
252 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) | 326 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) |
253 | 327 | ||
@@ -255,7 +329,7 @@ class Wic(oeSelfTest): | |||
255 | def test_mkefidisk(self): | 329 | def test_mkefidisk(self): |
256 | """Test creation of mkefidisk image""" | 330 | """Test creation of mkefidisk image""" |
257 | image = "mkefidisk" | 331 | image = "mkefidisk" |
258 | self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ | 332 | self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" |
259 | % image).status) | 333 | % image).status) |
260 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) | 334 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) |
261 | 335 | ||
@@ -263,11 +337,11 @@ class Wic(oeSelfTest): | |||
263 | def test_directdisk_bootloader_config(self): | 337 | def test_directdisk_bootloader_config(self): |
264 | """Test creation of directdisk-bootloader-config image""" | 338 | """Test creation of directdisk-bootloader-config image""" |
265 | image = "directdisk-bootloader-config" | 339 | image = "directdisk-bootloader-config" |
266 | self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ | 340 | self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" |
267 | % image).status) | 341 | % image).status) |
268 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) | 342 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) |
269 | 343 | ||
270 | @testcase(1422) | 344 | @testcase(1424) |
271 | def test_qemu(self): | 345 | def test_qemu(self): |
272 | """Test wic-image-minimal under qemu""" | 346 | """Test wic-image-minimal under qemu""" |
273 | self.assertEqual(0, bitbake('wic-image-minimal').status) | 347 | self.assertEqual(0, bitbake('wic-image-minimal').status) |
@@ -275,28 +349,56 @@ class Wic(oeSelfTest): | |||
275 | with runqemu('wic-image-minimal', ssh=False) as qemu: | 349 | with runqemu('wic-image-minimal', ssh=False) as qemu: |
276 | command = "mount |grep '^/dev/' | cut -f1,3 -d ' '" | 350 | command = "mount |grep '^/dev/' | cut -f1,3 -d ' '" |
277 | status, output = qemu.run_serial(command) | 351 | status, output = qemu.run_serial(command) |
278 | self.assertEqual(1, status, 'Failed to run command "%s": %s' % (command, output)) | 352 | self.assertEqual(1, status, 'Failed to run command "%s": %s' |
353 | % (command, output)) | ||
279 | self.assertEqual(output, '/dev/root /\r\n/dev/vda3 /mnt') | 354 | self.assertEqual(output, '/dev/root /\r\n/dev/vda3 /mnt') |
280 | 355 | ||
356 | @testcase(1496) | ||
281 | def test_bmap(self): | 357 | def test_bmap(self): |
282 | """Test generation of .bmap file""" | 358 | """Test generation of .bmap file""" |
283 | image = "directdisk" | 359 | image = "directdisk" |
284 | status = runCmd("wic create %s -e core-image-minimal --bmap" % image).status | 360 | status = runCmd("wic create %s -e core-image-minimal -m" |
361 | % image).status | ||
362 | self.assertEqual(0, status) | ||
363 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) | ||
364 | self.assertEqual(1, len(glob(self.resultdir + | ||
365 | "%s-*direct.bmap" % image))) | ||
366 | status = runCmd("wic create %s -e core-image-minimal --bmap" | ||
367 | % image).status | ||
285 | self.assertEqual(0, status) | 368 | self.assertEqual(0, status) |
286 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) | 369 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) |
287 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct.bmap" % image))) | 370 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct.bmap" |
371 | % image))) | ||
288 | 372 | ||
373 | @testcase(1560) | ||
289 | def test_systemd_bootdisk(self): | 374 | def test_systemd_bootdisk(self): |
290 | """Test creation of systemd-bootdisk image""" | 375 | """Test creation of systemd-bootdisk image""" |
291 | image = "systemd-bootdisk" | 376 | image = "systemd-bootdisk" |
292 | self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ | 377 | self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" |
293 | % image).status) | 378 | % image).status) |
294 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) | 379 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) |
295 | 380 | ||
381 | @testcase(1561) | ||
296 | def test_sdimage_bootpart(self): | 382 | def test_sdimage_bootpart(self): |
297 | """Test creation of sdimage-bootpart image""" | 383 | """Test creation of sdimage-bootpart image""" |
298 | image = "sdimage-bootpart" | 384 | image = "sdimage-bootpart" |
299 | self.write_config('IMAGE_BOOT_FILES = "bzImage"\n') | 385 | self.write_config('IMAGE_BOOT_FILES = "bzImage"\n') |
300 | self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ | 386 | self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" |
301 | % image).status) | 387 | % image).status) |
302 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) | 388 | self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) |
389 | |||
390 | @testcase(1562) | ||
391 | def test_alternate_output_dir(self): | ||
392 | """Test alternate output directory""" | ||
393 | self.assertEqual(0, runCmd("wic create directdisk " | ||
394 | "-e core-image-minimal " | ||
395 | "-o %s" | ||
396 | % self.alternate_resultdir).status) | ||
397 | self.assertEqual(1, len(glob(self.alternate_resultdir + | ||
398 | "build/directdisk-*.direct"))) | ||
399 | self.assertEqual(0, runCmd("wic create mkefidisk -e " | ||
400 | "core-image-minimal " | ||
401 | "--outdir %s" | ||
402 | % self.alternate_resultdir).status) | ||
403 | self.assertEqual(1, len(glob(self.alternate_resultdir + | ||
404 | "build/mkefidisk-*direct"))) | ||