Add log strings
authorDonghoon Shin <dhs.shine@gmail.com>
Fri, 23 Sep 2016 00:18:37 +0000 (09:18 +0900)
committerDonghoon Shin <dhs.shine@gmail.com>
Fri, 23 Sep 2016 00:41:50 +0000 (09:41 +0900)
litmus/core/manager.py
litmus/device/device.py
litmus/device/devicemock.py
litmus/helper/helper.py

index 55e1946d95d5e8b66fe10887b91fb3010de1e9dc..183d8c3f442d43d17fcb53d29a249bab1cfd57bd 100644 (file)
@@ -66,7 +66,6 @@ Lightweight test manager for tizen automated testing
         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']
@@ -85,10 +84,10 @@ 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))
-        logging.debug('='*52)
 
     def __del__(self):
         if self._backup_cwd:
@@ -111,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]
@@ -158,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]
@@ -204,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:
@@ -271,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:
@@ -287,7 +288,8 @@ Lightweight test manager for tizen automated testing
                 self._remove_workingdir_at__del__ = True
             logging.debug('working dir: {}'.format(self._workingdir))
             if self._project_path:
-                logging.debug('copy all files in project path to workingdir')
+                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)
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),