Add more logs 74/89474/1
authorDonghoon Shin <dhs.shin@samsung.com>
Fri, 23 Sep 2016 14:19:10 +0000 (14:19 +0000)
committerDonghoon Shin <dhs.shin@samsung.com>
Fri, 23 Sep 2016 14:19:10 +0000 (14:19 +0000)
Change-Id: I3f36cc0703bce9d58ebea7d5923b724982707d4b

README.md
docs/source/conf.py
litmus/core/manager.py
litmus/device/device.py
litmus/device/devicemock.py
litmus/helper/helper.py

index 614c979169fa4d5748b401685253a8039c623985..8785930a20ab4cdf69356458ad0b6cce09717b74 100644 (file)
--- 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
index 5cc665fdf697359e1289a29574bd971456f5ef99..9122838c12946d0136aea16f80947db164519373 100644 (file)
@@ -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'
 
index dc9b10b07e310f00c3d33ce95a576c1a48cbb35e..183d8c3f442d43d17fcb53d29a249bab1cfd57bd 100644 (file)
@@ -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.')
index d8042560855f6a36e580a561e0aba50c4f98122e..6c7896d686c8510ce062849c669ffaa6fa5ea358 100644 (file)
@@ -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
index 34f8f17bdc50436a65283cb43adb8d827805050b..8d9669c93ec1007038763e781d958654ca05cfc5 100644 (file)
@@ -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()
 
index cd2012de9c050f8393d81c6cebbe4dba9ffc7bf3..2665a127e2b9051d610176f489c6d386b803994c 100644 (file)
@@ -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),