summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/wic.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/wic.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index cfee9d1e71..36ee5e5a14 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -65,27 +65,24 @@ class WicTestCase(OESelftestTestCase):
65 """Wic test class.""" 65 """Wic test class."""
66 66
67 image_is_ready = False 67 image_is_ready = False
68 native_sysroot = None
69 wicenv_cache = {} 68 wicenv_cache = {}
70 69
71 def setUpLocal(self): 70 def setUpLocal(self):
72 """This code is executed before each test method.""" 71 """This code is executed before each test method."""
73 self.resultdir = self.builddir + "/wic-tmp/" 72 self.resultdir = self.builddir + "/wic-tmp/"
74 super(WicTestCase, self).setUpLocal() 73 super(WicTestCase, self).setUpLocal()
75 if not self.native_sysroot:
76 Wic.native_sysroot = get_bb_var('STAGING_DIR_NATIVE', 'wic-tools')
77 74
78 # Do this here instead of in setUpClass as the base setUp does some 75 # Do this here instead of in setUpClass as the base setUp does some
79 # clean up which can result in the native tools built earlier in 76 # clean up which can result in the native tools built earlier in
80 # setUpClass being unavailable. 77 # setUpClass being unavailable.
81 if not Wic.image_is_ready: 78 if not WicTestCase.image_is_ready:
82 if get_bb_var('USE_NLS') == 'yes': 79 if get_bb_var('USE_NLS') == 'yes':
83 bitbake('wic-tools') 80 bitbake('wic-tools')
84 else: 81 else:
85 self.skipTest('wic-tools cannot be built due its (intltool|gettext)-native dependency and NLS disable') 82 self.skipTest('wic-tools cannot be built due its (intltool|gettext)-native dependency and NLS disable')
86 83
87 bitbake('core-image-minimal') 84 bitbake('core-image-minimal')
88 Wic.image_is_ready = True 85 WicTestCase.image_is_ready = True
89 86
90 rmtree(self.resultdir, ignore_errors=True) 87 rmtree(self.resultdir, ignore_errors=True)
91 88
@@ -94,6 +91,16 @@ class WicTestCase(OESelftestTestCase):
94 rmtree(self.resultdir, ignore_errors=True) 91 rmtree(self.resultdir, ignore_errors=True)
95 super(WicTestCase, self).tearDownLocal() 92 super(WicTestCase, self).tearDownLocal()
96 93
94 def _get_image_env_path(self, image):
95 """Generate and obtain the path to <image>.env"""
96 if image not in WicTestCase.wicenv_cache:
97 self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status)
98 bb_vars = get_bb_vars(['STAGING_DIR', 'MACHINE'], image)
99 stdir = bb_vars['STAGING_DIR']
100 machine = bb_vars['MACHINE']
101 WicTestCase.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata')
102 return WicTestCase.wicenv_cache[image]
103
97class Wic(WicTestCase): 104class Wic(WicTestCase):
98 105
99 @OETestID(1552) 106 @OETestID(1552)
@@ -534,16 +541,6 @@ class Wic2(WicTestCase):
534 self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct"))) 541 self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct")))
535 self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct.bmap"))) 542 self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct.bmap")))
536 543
537 def _get_image_env_path(self, image):
538 """Generate and obtain the path to <image>.env"""
539 if image not in self.wicenv_cache:
540 self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status)
541 bb_vars = get_bb_vars(['STAGING_DIR', 'MACHINE'], image)
542 stdir = bb_vars['STAGING_DIR']
543 machine = bb_vars['MACHINE']
544 self.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata')
545 return self.wicenv_cache[image]
546
547 @OETestID(1347) 544 @OETestID(1347)
548 def test_image_env(self): 545 def test_image_env(self):
549 """Test generation of <image>.env files.""" 546 """Test generation of <image>.env files."""
@@ -683,9 +680,11 @@ class Wic2(WicTestCase):
683 680
684 wicimg = wicout[0] 681 wicimg = wicout[0]
685 682
683 native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "wic-tools")
684
686 # verify partition size with wic 685 # verify partition size with wic
687 res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg, 686 res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg,
688 native_sysroot=self.native_sysroot) 687 native_sysroot=native_sysroot)
689 688
690 # parse parted output which looks like this: 689 # parse parted output which looks like this:
691 # BYT;\n 690 # BYT;\n