def run_once(self): kernel_ver = os.uname()[2] if utils.compare_versions(kernel_ver, self.MIN_KERNEL_VER) < 0: logging.info( 'skipping test: old kernel %s (min %s) missing module %s', kernel_ver, self.MIN_KERNEL_VER, self.OLD_MODULE_NAME) return if utils.compare_versions(kernel_ver, self.NEW_KERNEL_VER) < 0: module_name = self.OLD_MODULE_NAME else: module_name = self.NEW_MODULE_NAME utils.load_module(module_name) self._governor_paths = glob.glob(self.GOVERNOR_GLOB) self._setspeed_paths = glob.glob(self.SETSPEED_GLOB) self._cur_freq_paths = glob.glob(self.CUR_FREQ_GLOB) initial_governors = self._get_governors() initial_quiet_governor = self._get_quiet_governor() with open(self.CPUFREQ_AVAIL_GOVERNORS_PATH, 'r') as f: available_governors = set(f.readline().split()) logging.info('governors: %s', ' '.join(available_governors)) try: if 'userspace' in available_governors: self._test_userspace() else: logging.warning('testing with existing governor') self._test_all_delays() finally: self._reset_freq(initial_governors, initial_quiet_governor) utils.unload_module(module_name)
def run_once(self): kernel_ver = os.uname()[2] if utils.compare_versions(kernel_ver, self.MIN_KERNEL_VER) < 0: logging.info( 'skipping test: old kernel %s (min %s) missing module %s', kernel_ver, self.MIN_KERNEL_VER, self.MODULE_NAME) return utils.load_module(self.MODULE_NAME) self._governor_paths = glob.glob(self.GOVERNOR_GLOB) self._setspeed_paths = glob.glob(self.SETSPEED_GLOB) self._cur_freq_paths = glob.glob(self.CUR_FREQ_GLOB) initial_governors = self._get_governors() initial_quiet_governor = self._get_quiet_governor() with open(self.CPUFREQ_AVAIL_PATH, 'r') as f: available_freqs = [int(x) for x in f.readline().split()] max_freq = max(available_freqs) min_freq = min(available_freqs) logging.info('cpu frequency max %d min %d', max_freq, min_freq) freqs = [min_freq, max_freq] try: for freq in freqs: self._set_freq(freq) for usecs in self.DELAYS: self._test_udelay(usecs) self._check_freq(freq) finally: self._reset_freq(initial_governors, initial_quiet_governor) utils.unload_module(self.MODULE_NAME)
def run_once(self): """ This test will run the firmware request kernel self test (from upstream). This tests that the request_firmware() and request_firmware_nowait() kernel APIs are somewhat sane. It tries to load the empty filename ("") as well as a small toy firmware, and checks that it matches. It also makes sure a non-existent firmware cannot be found. We rerun the same test several times to increase the probability of catching errors. Needs to disable module locking so we can load test firmwares from non-standard locations (e.g., /tmp) """ num_loops = 50 module_name = "test_firmware" if not self.test_is_valid(): raise error.TestNAError( "FW test module is not available for this test") utils.load_module(module_name) if not utils.module_is_loaded(module_name): raise error.TestNAError( "FW test module is not available for this test") try: self.set_module_locking(False) logging.info("iterations: %d", num_loops) for i in range(0, num_loops): self.do_fw_test() finally: self.set_module_locking(True) utils.unload_module(module_name)
def load_zfs_modules(): if utils.load_module("zfs") == False: logging.info("zfs module has already been loaded..") else: logging.info("zfs module loaded successfully..") return SUCCESS
def run_once(self): kernel_ver = os.uname()[2] if utils.compare_versions(kernel_ver, self.MIN_KERNEL_VER) < 0: logging.info( 'skipping test: old kernel %s (min %s) missing module %s', kernel_ver, self.MIN_KERNEL_VER, self.MODULE_NAME) return utils.load_module(self.MODULE_NAME) start_rtc, start_ktime, start_error = self._get_times() logging.info( 'start rtc %d ktime %f error %f', start_rtc, start_ktime, start_error) recent_diffs = [] max_diff = 0 sum_rtc = 0 sum_diff = 0 sum_rtc_rtc = 0 sum_rtc_diff = 0 sum_diff_diff = 0 for i in xrange(self.TEST_DURATION): # Sleep some amount of time to avoid busy waiting the entire time sleep((i % 10) * 0.1) current_rtc, current_ktime, current_error = self._get_times() elapsed_rtc = current_rtc - start_rtc elapsed_ktime = current_ktime - start_ktime elapsed_diff = float(elapsed_rtc) - elapsed_ktime # Allow for inaccurate ktime off ALLOWABLE_DRIFT from elapsed RTC, # and take into account start and current error in times gathering max_error = start_error + current_error drift_threshold = elapsed_rtc * self.ALLOWABLE_DRIFT + max_error # Track rolling average and maximum diff recent_diffs.append(elapsed_diff) if len(recent_diffs) > self.DIFFS_TO_AVERAGE: recent_diffs.pop(0) rolling_diff = sum(recent_diffs) / len(recent_diffs) if abs(elapsed_diff) > abs(max_diff): max_diff = elapsed_diff # Track linear regression sum_rtc += elapsed_rtc sum_diff += elapsed_diff sum_rtc_rtc += elapsed_rtc * elapsed_rtc sum_rtc_diff += elapsed_rtc * elapsed_diff sum_diff_diff += elapsed_diff * elapsed_diff logging.info(( 'current rtc %d ktime %f error %f; elapsed rtc %d ' 'ktime %f: threshold %f diff %+f rolling %+f'), current_rtc, current_ktime, current_error, elapsed_rtc, elapsed_ktime, drift_threshold, elapsed_diff, rolling_diff) if abs(elapsed_diff) > drift_threshold: raise error.TestFail(( 'elapsed rtc %d and ktime %f diff %f ' 'is greater than threshold %f') % (elapsed_rtc, elapsed_ktime, elapsed_diff, drift_threshold)) # Dump final statistics logging.info('max_diff %f', max_diff) mean_rtc = sum_rtc / self.TEST_DURATION mean_diff = sum_diff / self.TEST_DURATION slope = ((sum_rtc_diff - sum_rtc * mean_diff) / (sum_rtc_rtc - sum_rtc * mean_rtc)) logging.info('drift %.9f', slope) utils.unload_module(self.MODULE_NAME)