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
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
23 sys
.path
.insert(0, '/usr/share/pdk/lib')
24 import InstallImage
, SDK
27 def iteration(process
):
30 class TestInstallImage(unittest
.TestCase
):
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
])
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'])
57 # have to delete the temporary project
58 self
.sdk
.delete_project(self
.proj_name
)
60 if os
.path
.isdir(self
.workdir
):
61 shutil
.rmtree(self
.workdir
)
64 filename
= "liveusb.bin"
65 imgLiveUsb
= InstallImage
.LiveUsbImage(self
.proj
, self
.proj
.targets
[self
.target_name
], filename
)
68 imgLiveUsb
.create_image()
69 os
.path
.join(self
.proj_path
, "targets", self
.target_name
, "fs")
71 if __name__
== '__main__':