diff --git a/libs/utils/env.py b/libs/utils/env.py index 06d465813710dbd40e61cdebeafc3731982c4f87..123353ab99c0fb23336a62bb1140d6f5c3ab00cd 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 @@ -616,13 +629,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) diff --git a/tests/eas/rfc.py b/tests/eas/rfc.py index 03e726c1760ceac63977127d1490c5c6ad16aceb..77a42ea7f4d3d8f184a8b2abd0b3d15693d059c6 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',