[eeepc-i386-ubuntu-hardy-ppa] Added medibuntu.list for proprietary multimedia packages
[moblin-image-creator.eeepc.git] / unittest / testInstallImage.py
blobcba22fa7ce3f4f5ea85e6ae134eeddd1756460d6
1 #!/usr/bin/python -tt
2 # vim: ai ts=4 sts=4 et sw=4
4 # Copyright (c) 2007 Intel Corporation
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by the Free
8 # Software Foundation; version 2 of the License
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc., 59
17 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 import os, re, shutil, sys, tempfile, unittest
21 import testSdk
23 sys.path.insert(0, '/usr/share/pdk/lib')
24 import InstallImage, SDK
26 class Callback:
27 def iteration(process):
28 return
30 class TestInstallImage(unittest.TestCase):
31 def setUp(self):
32 self.workdir = tempfile.mkdtemp()
33 self.pdk_dir = os.path.join(self.workdir, 'pdk')
34 os.mkdir(self.pdk_dir)
35 testSdk.createPdkSampleDir(self.pdk_dir)
37 self.project_dir = os.path.join(self.workdir, 'project')
38 os.mkdir(self.project_dir)
40 self.sdk = SDK.SDK(path = self.pdk_dir, cb = Callback())
42 self.proj_path = os.path.join(self.project_dir, 'project_unittest')
43 self.proj_name = "unittest-281d8183ckd"
44 self.platform_name = "unittest"
46 self.proj = self.sdk.create_project(self.proj_path, self.proj_name, 'unittest project', self.sdk.platforms[self.platform_name])
47 self.proj.install()
49 self.target_name = 'unittest_target'
50 target = self.proj.create_target(self.target_name)
51 target.installFset(self.sdk.platforms[self.platform_name].fset['Core'])
53 self.proj.mount()
55 def tearDown(self):
56 self.proj.umount()
57 # have to delete the temporary project
58 self.sdk.delete_project(self.proj_name)
59 return
60 if os.path.isdir(self.workdir):
61 shutil.rmtree(self.workdir)
63 def testBasic(self):
64 filename = "liveusb.bin"
65 imgLiveUsb = InstallImage.LiveUsbImage(self.proj, self.proj.targets[self.target_name], filename)
66 imgLiveUsb.__str__()
67 imgLiveUsb.__repr__()
68 imgLiveUsb.create_image()
69 os.path.join(self.proj_path, "targets", self.target_name, "fs")
71 if __name__ == '__main__':
72 unittest.main()