From 12e5a2bd011e3fac25c4126b923aa2fe19df8d9e Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Wed, 27 Jan 2016 10:02:11 +0000 Subject: [PATCH 1/3] libs/utils/env: fix kernel/dtb deployment In case a "kernel" or "dtb" option is not specified for a certain test configuration the current code raise an exception. This patch make sure that we properly notify the user in case one of these options is not specified. Signed-off-by: Patrick Bellasi --- libs/utils/env.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/utils/env.py b/libs/utils/env.py index 06d465813..f541e1c57 100644 --- a/libs/utils/env.py +++ b/libs/utils/env.py @@ -616,13 +616,13 @@ class TestEnv(ShareState): logging.info('%14s - Deply kernel via FTFP...', 'KernelSetup') # Deply kernel in FTFP folder (madatory) - if 'kernel' not in tc: + if 'kernel' not in tc or not tc['kernel']: raise ValueError('Missing "kernel" paramtere in conf: %s', 'KernelSetup', tc) self.tftp_deploy(tc['kernel']) # Deploy DTB in TFTP folder (if provided) - if 'dtb' not in tc: + if 'dtb' not in tc or not tc['dtb']: logging.debug('%14s - DTB not provided, using exising one', 'KernelSetup') logging.debug('%14s - Current conf:\n%s', 'KernelSetup', tc) -- GitLab From 9fbd4e62f753e0e120a7e97a0f763f455198bca3 Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Wed, 27 Jan 2016 15:48:17 +0000 Subject: [PATCH 2/3] libs/utils/env: speedup reboot time Once a target is rebooted, currently we wait for a time interval which is configured to be long enough to allows all boards the actually reboot. Sometimes that time can be too short or even unnecessary long. This patch adds the support for a PING based detection of the same target being back online. The maximum timeout is increased to be 2 minutes because in general we expect a proper detection of the target before this timeout. Signed-off-by: Patrick Bellasi --- libs/utils/env.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/libs/utils/env.py b/libs/utils/env.py index f541e1c57..123353ab9 100644 --- a/libs/utils/env.py +++ b/libs/utils/env.py @@ -571,7 +571,7 @@ class TestEnv(ShareState): 'HostResolver', host, ipaddr) return (host, ipaddr) - def reboot(self, reboot_time=60): + def reboot(self, reboot_time=120): # Send remote target a reboot command if self._feature('no-reboot'): logging.warning('%14s - Reboot disabled by conf features', 'Reboot') @@ -579,9 +579,22 @@ class TestEnv(ShareState): self.target.execute('sleep 2 && reboot -f &', as_root=True) # Wait for the target to complete the reboot - logging.info('%14s - Waiting %s [s]for target to reboot...', - 'Reboot', reboot_time) - time.sleep(reboot_time) + logging.info('%14s - Waiting up to %s[s] for target [%s] to reboot...', + 'Reboot', reboot_time, self.ip) + + ping_cmd = "ping -c 1 {} >/dev/null".format(self.ip) + elapsed = 0 + start = time.time() + while elapsed <= reboot_time: + time.sleep(5) + logging.debug('%14s - Trying to connect to [%s] target...', + 'Reboot', self.ip) + if os.system(ping_cmd) == 0: + break + elapsed = time.time() - start + if elapsed > reboot_time: + logging.warning('%14s - target [%s] not reposing to PINGs, trying to continue...', + 'Reboot', self.ip) # Force re-initialization of all the devlib modules force = True -- GitLab From 301442ea44d628acfab5c3c641c2cfb2a93b1d7a Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Thu, 28 Jan 2016 11:26:53 +0000 Subject: [PATCH 3/3] tests/eas/rfc: fixup governor setup after reboot After a board reboot the target specified governor is not configured if we have: 1. multiple configurations all using the same governor 2. the governor required by these configurations is not the default one used by the board at boot time This patch fixes that issue by removing the "optimization" code which was used to track at host side the governor we (assume) be enabled in the target. Every time the cpufreq setup function is called we enforce the configuration of the governor required by the current target configuration. Signed-off-by: Patrick Bellasi --- tests/eas/rfc.py | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/tests/eas/rfc.py b/tests/eas/rfc.py index 03e726c17..77a42ea7f 100644 --- a/tests/eas/rfc.py +++ b/tests/eas/rfc.py @@ -58,7 +58,6 @@ class TestBase(unittest.TestCase): # Initialize globals cls.kernel = None cls.dtb = None - cls.governor = None cls.cgroup = None cls.print_section('Main', 'Experiments configuration') @@ -222,18 +221,15 @@ class TestBase(unittest.TestCase): @classmethod def setup_cpufreq(cls, tc): if 'cpufreq' not in tc: - logging.debug('%14s - Configuration not provided', 'CPUFreq') - return - if cls.governor == tc['cpufreq']['governor']: - return - logging.info(r'%14s - Configuring all CPUs to use [%s] governor', - 'CPUFreq', tc['cpufreq']['governor']) - try: - cpufreq = tc['cpufreq'] - except KeyError: - logging.warning(r'%14s - Using currently configured governor', + logging.warning(r'%14s - governor not specified, '\ + 'using currently configured governor', 'CPUFreq') return + + cpufreq = tc['cpufreq'] + logging.info(r'%14s - Configuring all CPUs to use [%s] governor', + 'CPUFreq', cpufreq['governor']) + if cpufreq['governor'] == 'ondemand': try: sampling_rate = cpufreq['params']['sampling_rate'] @@ -255,8 +251,6 @@ class TestBase(unittest.TestCase): ' echo {} > $CPU/cpufreq/scaling_governor; '\ 'done'\ .format(cpufreq['governor'])) - # Keep track of currently configured governor - cls.governor = cpufreq['governor'] @classmethod def setup_cgroups(cls, tc): @@ -303,13 +297,6 @@ class TestBase(unittest.TestCase): # Configure each required attribute group.set(**tc['cgroups']['conf'][kind][name]) - - @classmethod - def target_reboot(cls): - # TODO: actually reboot the target and wait for it to be back online - cls.governor = None - - @classmethod def target_configure(cls, tc): cls.print_header('TargetConfig', -- GitLab