From 6198e4acb14bb9004920974635b132558f30d263 Mon Sep 17 00:00:00 2001 From: Donghoon Shin Date: Fri, 23 Sep 2016 09:18:37 +0900 Subject: [PATCH] Add log strings --- litmus/core/manager.py | 12 +++++++----- litmus/device/device.py | 12 +++++++++--- litmus/device/devicemock.py | 16 +++++++++++----- litmus/helper/helper.py | 10 ++++++++-- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/litmus/core/manager.py b/litmus/core/manager.py index 55e1946..183d8c3 100644 --- a/litmus/core/manager.py +++ b/litmus/core/manager.py @@ -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) 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), -- 2.34.1