1. Change directory name with version postfix and create an orig.tar.gz
- $ mv litmus litmus-0.3.0
+ $ git clone http://github.com/dhs-shine/litmus
- $ tar cvfz litmus_0.3.0.orig.tar.gz litmus-0.3.0
+ $ tar cvfz litmus_0.3.1.orig.tar.gz litmus
1. Build a deb package with debuild
- $ cd litmus-0.3.0
+ $ cd litmus
$ debuild
2. Install the deb package using dpkg
- $ sudo dpkg -i litmus_0.3.0-1_amd64.deb
+ $ cd ..
+
+ $ sudo dpkg -i litmus_0.3.1-1_amd64.deb
Getting started
# -- General configuration ------------------------------------------------
+autoclass_content = 'both'
+
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
_remove_workingdir_at__del__ = False
def __init__(self, *args, **kwargs):
+ """
+ :param str topology: topology file path
+ :param str project_path: project path. If this is None then cwd will be used as project path
+ :param bool verbose: init logger to print all logs
+ """
super(manager, self).__init__()
self.args = args
self.kwargs = kwargs
- logging.debug(self._comment)
if 'topology' in self.kwargs and self.kwargs['topology']:
tp = self.kwargs['topology']
tp = _duts_
self._load_configs(tp)
- if 'project_name' in self.kwargs:
+ if 'project_name' in self.kwargs and self.kwargs['project_name']:
self._project_name = self.kwargs['project_name']
- if 'project_path' in self.kwargs:
+ if 'project_path' in self.kwargs and self.kwargs['project_path']:
self._project_path = self.kwargs['project_path']
else:
self._project_path = os.getcwd()
if 'verbose' in self.kwargs and self.kwargs['verbose']:
init_logger()
+ logging.debug(self._comment)
+ logging.debug('project name: {}'.format(self._project_name))
+ logging.debug('project path: {}'.format(self._project_path))
+ logging.debug('topology path: {}'.format(tp))
+
def __del__(self):
if self._backup_cwd:
os.chdir(self._backup_cwd)
:returns device: acquired device instance
"""
- logging.debug('===============Acquire an available DUT===============')
+ logging.debug('==============Acquire an available DUT==============')
candidates = [dev for dev in self._all_devices
if dev['dev_type'] == devicetype]
:returns device: acquired device instance
"""
- logging.debug('===============Acquire an available DUT===============')
+ logging.debug('==============Acquire an available DUT==============')
candidate = [dev for dev in self._all_devices
if dev['devicename'] == devicename]
>>> mgr.release_dut()
"""
+ logging.debug('================Release acquired DUT================')
# release all _duts if dut param is None
if not dut:
for dev in self._duts:
>>> mgr.get_workingdir()
'/home/user/Workspace/test'
"""
+ logging.debug('============Initialize working directory============')
if workingdir:
self._workingdir = os.path.abspath(workingdir)
try:
self._workingdir = workspace_path
self._remove_workingdir_at__del__ = True
logging.debug('working dir: {}'.format(self._workingdir))
- logging.debug('copy all files in project path to workingdir')
- copy(self._project_path, os.curdir)
+ if self._project_path:
+ logging.debug('project_path: {}'.format(self._project_path))
+ logging.debug('copy all files from project path to workingdir')
+ copy(self._project_path, os.curdir)
except Exception as e:
logging.debug(e)
raise Exception('Can\'t init workingdir.')
:param float powercut_delay: power-cut delay for cutter
"""
- logging.debug('turn on device {}'.format(self.get_name()))
+ logging.debug('=================Turn on device {}=================='
+ .format(self.get_name()))
retry_cnt = 0
while retry_cnt <= self._max_attempt_boot_retry:
try:
:param float powercut_delay: power-cut delay for cutter
"""
- logging.debug('turn off device {}'.format(self.get_name()))
+ logging.debug('=================Turn off device {}================='
+ .format(self.get_name()))
self._detach_sdb()
self._cutter.off(powercut_delay)
>>> dut.flash('platform.tar.gz')
"""
- logging.debug('flash binaries to device : {}'.format(filenames))
+ logging.debug('================Flash binaries to device============')
+ logging.debug(filenames)
if not filenames:
raise Exception('There\'s no file to flash.')
:returns str: stdout of sdb shell command
"""
+ logging.debug('================Run a command on device=============')
c = ['sdb', '-s', self.get_id(), 'shell']
c.extend(convert_single_item_to_list(command))
logging.debug(c)
:returns str: stdout of sdb push command
"""
+ logging.debug('================Push a file to device===============')
c = ['sdb', '-s', self.get_id(), 'push', src, dest]
result = check_output(c, timeout=timeout)
return result
:returns str: stdout of sdb push command
"""
+ logging.debug('================Pull a file from device=============')
c = ['sdb', '-s', self.get_id(), 'pull', src, dest]
result = check_output(c, timeout=timeout)
return result
"""
return self._id
- def on(self, powercut_delay=2):
+ def on(self, booting_time=None):
"""
Turn on the device acquired.
:param float powercut_delay: power-cut delay for cutter
"""
- logging.debug('turn on device {}'.format(self.get_name()))
+ logging.debug('=================Turn on device {}=================='
+ .format(self.get_name()))
self.start_sdb_server()
if self.is_on():
self._sdb_root_on()
self.run_cmd('reboot -f', timeout=20)
- time.sleep(self._booting_time)
+ wait_for_boot = booting_time if booting_time else self._booting_time
+ for loop in range(wait_for_boot):
+ logging.debug('Wait {} seconds......'
+ .format(wait_for_boot - loop))
+ time.sleep(1)
self.start_sdb_server()
self._sdb_root_on()
:param float powercut_delay: power-cut delay for cutter
"""
- logging.debug('turn off device {}'.format(self.get_name()))
+ logging.debug('You can\'t turn off mock type device')
def flash(self, filenames, flasher='lthor', waiting=5,
partition_bin_mappings={'BOOT': 'zImage',
>>> dut.flash('platform.tar.gz')
"""
- logging.debug('flash binaries to device : {}'.format(filenames))
+ logging.debug('================Flash binaries to device============')
+ logging.debug(filenames)
self.start_sdb_server()
:returns list: filenames of downloaded binaries
"""
-
+ logging.debug('============Download binaries from server===========')
# convert latest url to actual url
url_to_find_latest_version_number = url.split('latest')[0]
>>> install_plugin(dut,
script='install-set/setup')
"""
-
+ logging.debug('================Install plugins=================')
dut.on()
script_path = '/'.join(script.split('/')[:-1])
"""
+ logging.debug('=============Install plugins from git===============')
+ logging.debug('plugin git path : {}'.format(url))
+ logging.debug('plugin git branch : {}'.format(branch))
+ logging.debug('plugin git commitid : {}'
+ .format(commitid if commitid else 'latest'))
+ logging.debug('plugin install script : {}'.format(script))
dut.on()
call('git clone {0} {1} --branch {2}'.format(url, tmpdir, branch),