summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonghoon Shin <dhs.shin@samsung.com>2016-09-23 14:19:10 +0000
committerDonghoon Shin <dhs.shin@samsung.com>2016-09-23 14:19:10 +0000
commitce8712f4c3d93d3d175c024a1824ff23e7ef0ca2 (patch)
treea7c5c27e4355ae142dcf16cfd344e06d1cb68191
parenteea6240fc6ae11b3692dc09a116a8ad7c2e3f269 (diff)
downloadlitmus-ce8712f4c3d93d3d175c024a1824ff23e7ef0ca2.tar.gz
litmus-ce8712f4c3d93d3d175c024a1824ff23e7ef0ca2.tar.bz2
litmus-ce8712f4c3d93d3d175c024a1824ff23e7ef0ca2.zip
Add more logs
Change-Id: I3f36cc0703bce9d58ebea7d5923b724982707d4b
-rw-r--r--README.md10
-rw-r--r--docs/source/conf.py2
-rw-r--r--litmus/core/manager.py27
-rw-r--r--litmus/device/device.py12
-rw-r--r--litmus/device/devicemock.py16
-rw-r--r--litmus/helper/helper.py10
6 files changed, 56 insertions, 21 deletions
diff --git a/README.md b/README.md
index 614c979..8785930 100644
--- a/README.md
+++ b/README.md
@@ -5,19 +5,21 @@ Buliding & installing
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
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 5cc665f..9122838 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -23,6 +23,8 @@ sys.path.insert(0,os.path.abspath('../..'))
# -- General configuration ------------------------------------------------
+autoclass_content = 'both'
+
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
diff --git a/litmus/core/manager.py b/litmus/core/manager.py
index dc9b10b..183d8c3 100644
--- a/litmus/core/manager.py
+++ b/litmus/core/manager.py
@@ -58,10 +58,14 @@ Lightweight test manager for tizen automated testing
_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']
@@ -69,9 +73,9 @@ Lightweight test manager for tizen automated testing
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()
@@ -80,6 +84,11 @@ Lightweight test manager for tizen automated testing
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)
@@ -101,7 +110,7 @@ Lightweight test manager for tizen automated testing
: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]
@@ -148,7 +157,7 @@ Lightweight test manager for tizen automated testing
: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]
@@ -194,6 +203,7 @@ Lightweight test manager for tizen automated testing
>>> mgr.release_dut()
"""
+ logging.debug('================Release acquired DUT================')
# release all _duts if dut param is None
if not dut:
for dev in self._duts:
@@ -261,6 +271,7 @@ Lightweight test manager for tizen automated testing
>>> mgr.get_workingdir()
'/home/user/Workspace/test'
"""
+ logging.debug('============Initialize working directory============')
if workingdir:
self._workingdir = os.path.abspath(workingdir)
try:
@@ -276,8 +287,10 @@ Lightweight test manager for tizen automated testing
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.')
diff --git a/litmus/device/device.py b/litmus/device/device.py
index d804256..6c7896d 100644
--- a/litmus/device/device.py
+++ b/litmus/device/device.py
@@ -130,7 +130,8 @@ class device(object):
: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:
@@ -158,7 +159,8 @@ class device(object):
: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)
@@ -198,7 +200,8 @@ class device(object):
>>> 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.')
@@ -231,6 +234,7 @@ class device(object):
: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)
@@ -250,6 +254,7 @@ class device(object):
: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
@@ -267,6 +272,7 @@ class device(object):
: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
diff --git a/litmus/device/devicemock.py b/litmus/device/devicemock.py
index 34f8f17..8d9669c 100644
--- a/litmus/device/devicemock.py
+++ b/litmus/device/devicemock.py
@@ -68,19 +68,24 @@ class devicemock(device):
"""
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()
@@ -90,7 +95,7 @@ class devicemock(device):
: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',
@@ -112,7 +117,8 @@ class devicemock(device):
>>> 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()
diff --git a/litmus/helper/helper.py b/litmus/helper/helper.py
index cd2012d..2665a12 100644
--- a/litmus/helper/helper.py
+++ b/litmus/helper/helper.py
@@ -52,7 +52,7 @@ def tizen_snapshot_downloader(url, pattern_bin='tar.gz$',
: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]
@@ -156,7 +156,7 @@ def install_plugin(dut, script, waiting=5, timeout=180):
>>> install_plugin(dut,
script='install-set/setup')
"""
-
+ logging.debug('================Install plugins=================')
dut.on()
script_path = '/'.join(script.split('/')[:-1])
@@ -202,6 +202,12 @@ def install_plugin_from_git(dut, url, branch, script, tmpdir='repo',
"""
+ 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),