From 8fca2c68cb23af43ae21cd6cc7ff0fc89b4f7c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rud=C3=A1=20Moura?= Date: Wed, 4 Feb 2015 19:02:30 -0200 Subject: [PATCH] avocado.sysinfo: Fix handling of start/stop_job_hooks. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set _DEFAULT_COMMANDS_END_JOB as the same as DEFAULT_COMMANDS_START_JOB. Set _DEFAULT_FILES_END_JOB as the same as _DEFAULT_FILES_END_JOB. Signed-off-by: Rudá Moura --- avocado/sysinfo.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/avocado/sysinfo.py b/avocado/sysinfo.py index c9d00812..5b01411e 100644 --- a/avocado/sysinfo.py +++ b/avocado/sysinfo.py @@ -47,7 +47,8 @@ _DEFAULT_COMMANDS_START_JOB = ["df -mP", "numactl --hardware show", "lscpu", "fdisk -l"] -_DEFAULT_COMMANDS_END_JOB = [] + +_DEFAULT_COMMANDS_END_JOB = _DEFAULT_COMMANDS_START_JOB _DEFAULT_FILES_START_JOB = ["/proc/cmdline", "/proc/mounts", @@ -63,7 +64,7 @@ _DEFAULT_FILES_START_JOB = ["/proc/cmdline", "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", "/sys/devices/system/clocksource/clocksource0/current_clocksource"] -_DEFAULT_FILES_END_JOB = [] +_DEFAULT_FILES_END_JOB = _DEFAULT_FILES_START_JOB _DEFAULT_COMMANDS_START_TEST = [] @@ -496,7 +497,7 @@ class SysInfo(object): def start_job_hook(self): """ - Logging hook called whenever a job starts, and again after reboot. + Logging hook called whenever a job starts. """ for log in self.start_job_loggables: log.run(pre_dir) @@ -506,9 +507,11 @@ class SysInfo(object): def end_job_hook(self): """ - Logging hook called whenever a job starts, and again after reboot. + Logging hook called whenever a job finishes. """ - post_dir = utils.path.init_dir(self.basedir, 'post') + for log in self.end_job_loggables: + log.run(self.post_dir) + # Stop daemon(s) started previously for log in self.start_job_loggables: log.run(post_dir) @@ -566,4 +569,5 @@ def collect_sysinfo(args): sysinfo_logger = SysInfo(basedir=basedir, log_packages=True) sysinfo_logger.start_job_hook() + sysinfo_logger.end_job_hook() log.info("Logged system information to %s", basedir) -- GitLab