def __init__(self, model=None): if model and utils.trim_model_name(model) in K_DEVICES: self.DFS_5G_FREQUENCIES = [] self.ALL_5G_FREQUENCIES = self.NONE_DFS_5G_FREQUENCIES self.MIX_CHANNEL_SCAN = [2412, 2437, 2462, 5180, 5200, 5240, 5745, 5765] elif model and utils.trim_model_name(model) in L_DEVICES: self.DFS_5G_FREQUENCIES = [5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5660, 5680, 5700] self.ALL_5G_FREQUENCIES = self.DFS_5G_FREQUENCIES + self.NONE_DFS_5G_FREQUENCIES elif model and utils.trim_model_name(model) in L_TAP_DEVICES: self.DFS_5G_FREQUENCIES = [5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5660, 5680, 5700, 5720] self.ALL_5G_FREQUENCIES = self.DFS_5G_FREQUENCIES + self.NONE_DFS_5G_FREQUENCIES elif model and utils.trim_model_name(model) in M_DEVICES: self.DFS_5G_FREQUENCIES = [5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, 5700] self.ALL_5G_FREQUENCIES = self.DFS_5G_FREQUENCIES + self.NONE_DFS_5G_FREQUENCIES else: self.DFS_5G_FREQUENCIES = [5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, 5700, 5720] self.ALL_5G_FREQUENCIES = self.DFS_5G_FREQUENCIES + self.NONE_DFS_5G_FREQUENCIES
def measure_and_process_result(self): """Measure the current drawn by the device for the period of self.duration, at the frequency of self.hz. If self.threshold exists, also verify that the average current of the measurement is below the acceptable threshold. """ tag = self.current_test_name result = self.mon.measure_power(self.hz, self.duration, tag=tag, offset=self.offset) asserts.assert_true(result, "Got empty measurement data set in %s." % tag) self.log.info(repr(result)) data_path = os.path.join(self.mon_data_path, "%s.txt" % tag) monsoon.MonsoonData.save_to_text_file([result], data_path) actual_current = result.average_current actual_current_str = "%.2fmA" % actual_current result_extra = {"Average Current": actual_current_str} if self.threshold: model = utils.trim_model_name(self.dut.model) asserts.assert_true(tag in self.threshold[model], "Acceptance threshold for %s is missing" % tag, extras=result_extra) acceptable_threshold = self.threshold[model][tag] asserts.assert_true( actual_current < acceptable_threshold, ("Measured average current for %s - %s - is " "higher than acceptable threshold %.2f.") % (tag, actual_current_str, acceptable_threshold), extras=result_extra) asserts.explicit_pass("Measurement finished for %s." % tag, extras=result_extra)
def measure_and_process_result(self): """Measure the current drawn by the device for the period of self.duration, at the frequency of self.hz. If self.threshold exists, also verify that the average current of the measurement is below the acceptable threshold. """ tag = self.current_test_name result = self.mon.measure_power(self.hz, self.duration, tag=tag, offset=self.offset) asserts.assert_true(result, "Got empty measurement data set in %s." % tag) self.log.info(repr(result)) data_path = os.path.join(self.mon_data_path, "%s.txt" % tag) monsoon.MonsoonData.save_to_text_file([result], data_path) actual_current = result.average_current actual_current_str = "%.2fmA" % actual_current result_extra = {"Average Current": actual_current_str} if "continuous_traffic" in tag: self.dut.adb.shell(pmc_stop_iperf_client) iperf_result = self.get_iperf_result() asserts.assert_true(iperf_result.avg_rate, "Failed to send iperf traffic", extras=result_extra) rate = "%.2fMB/s" % iperf_result.avg_rate result_extra["Average Rate"] = rate model = utils.trim_model_name(self.dut.model) if self.threshold and (model in self.threshold) and ( tag in self.threshold[model]): acceptable_threshold = self.threshold[model][tag] asserts.assert_true( actual_current < acceptable_threshold, ("Measured average current in [%s]: %s, which is " "higher than acceptable threshold %.2fmA.") % (tag, actual_current_str, acceptable_threshold), extras=result_extra) asserts.explicit_pass("Measurement finished for %s." % tag, extras=result_extra)