summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlitmus/cmds/cmd_adhoc.py2
-rw-r--r--litmus/device/device.py38
-rw-r--r--litmus/device/devicestandalone.py10
-rw-r--r--tools/litmus54
4 files changed, 65 insertions, 39 deletions
diff --git a/litmus/cmds/cmd_adhoc.py b/litmus/cmds/cmd_adhoc.py
index 46dd1c3..7c38824 100755
--- a/litmus/cmds/cmd_adhoc.py
+++ b/litmus/cmds/cmd_adhoc.py
@@ -16,7 +16,7 @@
import os
import sys
from litmus.core.util import call
-from litmus.cmd import sdb_does_exist
+from litmus.cmds import sdb_does_exist
def main(args):
diff --git a/litmus/device/device.py b/litmus/device/device.py
index 811f14c..f9337d6 100644
--- a/litmus/device/device.py
+++ b/litmus/device/device.py
@@ -141,6 +141,8 @@ class device(object):
try:
self.off(1)
self._cutter.on(powercut_delay)
+ self._uart.close()
+ self._uart.open()
self._wait_uart_shell_login_prompt()
self._login_uart_shell()
self._set_sdb_deviceid()
@@ -456,10 +458,25 @@ class device(object):
if self._uart.isOpen():
self._uart.close()
+ def _close_open_uart(self):
+ """docstring for close_open_uart"""
+ retrycnt = 0
+ while retrycnt < 10:
+ retrycnt += 1
+ try:
+ self._uart.close()
+ self._uart.open()
+ except:
+ time.sleep(0.1)
+
def _thread_for_enter_download_mode(self, cmd, count):
"""docstring for thread_for_enter_download_mode"""
for loop in range(count*20):
- self._uart.write(self._enterkey)
+ try:
+ self._uart.write(self._enterkey)
+ except serial.SerialException as err:
+ logging.debug(err)
+ self._close_open_uart()
time.sleep(0.05)
self._uart.write(cmd)
for loop in range(2):
@@ -497,7 +514,7 @@ class device(object):
for l in filenames:
cmd += ' {}'.format(l)
logging.debug(cmd)
- ret = call(cmd.split(), timeout=600)
+ ret = call(cmd, shell=True, timeout=600)
if ret:
raise Exception('Thor error.')
@@ -524,20 +541,19 @@ class device(object):
def _heimdall(self, filenames, busaddr, devaddr, partition_bin_mappings):
"""docstring for _heimdall"""
filenames = convert_single_item_to_list(filenames)
- tar_cmd = ['tar', 'xvfz']
+ tar_cmd = 'tar xvfz'
for l in filenames:
- tar_cmd.append(l)
+ tar_cmd += ' {}'.format(l)
logging.debug(tar_cmd)
- call(tar_cmd, timeout=30)
+ call(tar_cmd, shell=True, timeout=30)
- heimdall_cmd = ['heimdall', 'flash', '--usbbus', busaddr,
- '--usbdevaddr', devaddr]
+ heimdall_cmd = 'heimdall flash --usbbus {0} --usbdevaddr {1}'.format(busaddr, devaddr)
for key, elem in partition_bin_mappings.items():
- heimdall_cmd.append('--{}'.format(key))
- heimdall_cmd.append(elem)
+ heimdall_cmd += ' --{}'.format(key)
+ heimdall_cmd += ' {}'.format(elem)
logging.debug(heimdall_cmd)
- ret = call(heimdall_cmd, timeout=600)
+ ret = call(heimdall_cmd, shell=True, timeout=600)
if ret:
raise Exception('Heimdall error.')
@@ -648,7 +664,7 @@ class device(object):
def sdb_root_on(self):
"""docstring for sdb_root_on"""
- logging.debug('=================sdb root on for {}================='
+ logging.debug('=================sdb root on for {}=================='
.format(self.get_name()))
call('sdb -s {} root on'.format(self.get_id()).split(), timeout=10)
time.sleep(0.5)
diff --git a/litmus/device/devicestandalone.py b/litmus/device/devicestandalone.py
index 99ed73f..ad1b033 100644
--- a/litmus/device/devicestandalone.py
+++ b/litmus/device/devicestandalone.py
@@ -37,6 +37,11 @@ class devicestandalone(device):
else:
self._id = self._find_device_id()
+ if 'usbid' in kwargs:
+ self._usbid = kwargs['usbid']
+ else:
+ self._usbid = None
+
self._manager = kwargs['manager']
def _release(self):
@@ -130,7 +135,10 @@ class devicestandalone(device):
self.run_cmd('reboot -f download', timeout=20)
time.sleep(waiting)
if flasher == 'lthor':
- busid = self._find_usb_busid()
+ if self._usbid == None:
+ busid = self._find_usb_busid()
+ else:
+ busid = self._usbid
self._release_global_lock()
self._lthor(filenames=filenames, busid=busid)
elif flasher == 'heimdall':
diff --git a/tools/litmus b/tools/litmus
index 5c7b31d..e79b056 100644
--- a/tools/litmus
+++ b/tools/litmus
@@ -46,10 +46,10 @@ def subparser(func):
def adhoc_parser(parser):
"""run litmus project which is not imported.
- This will help you to run test project with Continous Integration systems.
- If you use seperated worker node for testing, just copy litmus project to
- worker node and use this command. If not, you have to import litmus project
- on worker node before run it.
+ This will run litmus project which is not imported help you to use CI for
+ testing. If you use seperated worker node of CI for running test project,
+ just copy project directory to worker node and use this command. If not,
+ you have to import litmus project on worker node before run it.
Examples:
$ litmus adhoc <project_path>
@@ -64,11 +64,11 @@ def adhoc_parser(parser):
@subparser
def mk_parser(parser):
- """make new litmus project
+ """make new litmus project.
- This will create a new directory and copy default templates.
+ This will create a new directory for project and copy default templates.
You can locate more files and test scripts under this project directory
- and run your own test script with project name.
+ and run it with project name.
Examples:
$ litmus mk <project_name>
@@ -81,7 +81,7 @@ def mk_parser(parser):
@subparser
def rm_parser(parser):
- """remove litmus project
+ """remove litmus project.
This will remove both of your litmus project and project directory from
your host. WARNING: You can not recover your test project sources after
@@ -96,14 +96,14 @@ def rm_parser(parser):
@subparser
def run_parser(parser):
- """run litmus project
+ """run litmus project.
This will run your litmus project. Project entry point is userscript.py in
your project directory. You can pass argument to project with -p option.
You can also set working directory with -d option. If you don't set working
directory then litmus creates a temporary directory under /tmp and run test
- on it, and remove it if test has done. hence you have to use -d option
- if you want to keep test result.
+ on it, and remove it if test has done. Hence you have to use -d option to
+ keep test result and workspace.
Examples:
$ litmus run <project_name>
@@ -118,11 +118,10 @@ def run_parser(parser):
@subparser
def ls_parser(parser):
- """list all litmus projects
+ """list all litmus projects.
- This will list all litmus projects. Default project list locate under
- ~/.litmus/projects. If you want to use your custom project list then use
- - p option with main command.
+ This will list all litmus projects on your host. Default project list is
+ located in ~/.litmus/projects.
Examples:
$ litmus ls
@@ -132,14 +131,17 @@ def ls_parser(parser):
@subparser
def dev_parser(parser):
- """list all devices from topology configuration
+ """list all devices from topology configuration.
+
+ This will list all available test devices in topology configuration.
+ If you want to run test with real device, you have to set up topology
+ configuration. Default topology file is located in ~/.litmus/topology.
+
+ Topology file example for standalone_tm1 is:
- If you want to run test with real device, you have to configure topology.
- Default topology file path is ~/.litmus/topology.
- Topology file example for standalone_tm1 is
[TM1_001]
dev_type = standalone_tm1
- serialno = 012345678
+ serialno = 01234TEST
Examples:
$ litmus dev
@@ -149,7 +151,7 @@ def dev_parser(parser):
@subparser
def gt_parser(parser):
- """generate topology configuration
+ """generate topology configuration.
This is a helper to generate topology configuration for non-standalone
devices. non-standalone device means that device is controlled by external
@@ -165,11 +167,11 @@ def gt_parser(parser):
@subparser
def cp_parser(parser):
- """copy litmus project
+ """copy litmus project.
This will create new litmus project from existed one. New project has
duplicated project directory from origin project and does not use default
- template. If you need duplicated project from old one, this will be useful.
+ template for project.
Examples:
$ litmus cp <origin project name> <new project name>
@@ -182,10 +184,10 @@ def cp_parser(parser):
@subparser
def imp_parser(parser):
- """import litmus project
+ """import litmus project.
- You sometimes need to run litmus project authored by others. This command
- will import project and you can use run subcommand after import it.
+ This command will import litmus project. Import means that add new project
+ authored by others into project list on your host.
Examples:
$ litmus imp <project name>