Exemple #1
0
 def __init__(self, controllers):
     super().__init__(controllers)
     self.tests = ('test_case', )
     self.metric_1 = (
         BlackboxMetricLogger.for_test_case('my_metric_1'))
     self.metric_2 = (
         BlackboxMetricLogger.for_test_case('my_metric_2'))
 def __init__(self, controllers):
     super().__init__(controllers)
     self.a2dp_streaming = False
     self.rvr = {}
     self.bt_range_metric = BlackboxMetricLogger.for_test_case(
         metric_name='bt_range')
     self.wifi_max_atten_metric = BlackboxMetricLogger.for_test_case(
         metric_name='wifi_max_atten')
     self.wifi_min_atten_metric = BlackboxMetricLogger.for_test_case(
         metric_name='wifi_min_atten')
     self.wifi_range_metric = BlackboxMetricLogger.for_test_case(
         metric_name='wifi_range_metric')
Exemple #3
0
    def test_init_with_event(self, get_context, publisher_cls):
        metric_name = Mock()

        logger = BlackboxMetricLogger(metric_name, event=self.event)

        self.assertIsNotNone(logger.context)
        self.assertIsNotNone(logger.publisher)
Exemple #4
0
    def test_init_with_params(self):
        metric_name = Mock()
        metric_key = Mock()

        logger = BlackboxMetricLogger(metric_name, metric_key=metric_key)

        self.assertEqual(logger.metric_key, metric_key)
Exemple #5
0
    def test_default_init_attributes(self):
        metric_name = Mock()

        logger = BlackboxMetricLogger(metric_name)

        self.assertEqual(logger.metric_name, metric_name)
        self.assertIsNone(logger.metric_key)
Exemple #6
0
 def __init__(self, controllers):
     super().__init__(controllers)
     self.tests = (
         'test_case_1',
         'test_case_2',
     )
     self.metric = BlackboxMetricLogger.for_test_class('my_metric')
Exemple #7
0
    def __init__(self, controllers):

        base_test.BaseTestClass.__init__(self, controllers)
        self.power_result = BlackboxMetricLogger.for_test_case(
            metric_name='avg_power')
        self.start_meas_time = 0
        self.rockbottom_script = None
        self.img_name = ''
        self.dut = None
        self.power_logger = PowerMetricLogger.for_test_case()
        self.power_monitor = None
Exemple #8
0
    def test_end_uses_custom_metric_key(self, mock_acts_blackbox):
        result = Mock()
        mock_acts_blackbox.return_value = result
        metric_key = 'metric_key'

        logger = BlackboxMetricLogger(self.TEST_METRIC_NAME,
                                      metric_key=metric_key)
        logger.context = self.context
        logger.publisher = self.publisher
        logger._get_blackbox_identifier = self._get_blackbox_identifier
        logger.metric_value = 'foo'

        logger.end(self.event)

        expected_metric_key = '%s.%s' % (metric_key, self.TEST_METRIC_NAME)
        self.assertEqual(result.metric_key, expected_metric_key)
Exemple #9
0
    def __init__(self, controllers):
        """ Class initialization.

        Sets test parameters to initial values.
        """

        super().__init__(controllers)

        # These variables are passed to iPerf when starting data
        # traffic with the -b parameter to limit throughput on
        # the application layer.
        self.bandwidth_limit_dl = None
        self.bandwidth_limit_ul = None

        # Throughput obtained from iPerf
        self.iperf_results = {}

        # Blackbox metrics loggers

        self.dl_tput_logger = BlackboxMetricLogger.for_test_case(
            metric_name='avg_dl_tput')
        self.ul_tput_logger = BlackboxMetricLogger.for_test_case(
            metric_name='avg_ul_tput')
Exemple #10
0
 def __init__(self, controllers):
     BaseTestClass.__init__(self, controllers)
     self.power_file_paths = [
         '/vendor/etc/bluetooth_power_limits.csv',
         '/data/vendor/radio/bluetooth_power_limits.csv'
     ]
     self.sar_test_result = BlackboxMetricLogger.for_test_case(
         metric_name='pass')
     self.sar_file_name = os.path.basename(self.power_file_paths[0])
     self.power_column = 'BluetoothPower'
     self.REG_DOMAIN_DICT = {
         ('us', 'ca', 'in'): 'US',
         ('uk', 'fr', 'es', 'de', 'it', 'ie', 'sg', 'au', 'tw'): 'EU',
         ('jp', ): 'JP'
     }
Exemple #11
0
    def test_end_uses_metric_value_on_metric_value_not_none(
            self, mock_acts_blackbox):
        result = Mock()
        expected_result = Mock()
        mock_acts_blackbox.return_value = result

        logger = BlackboxMetricLogger(self.TEST_METRIC_NAME)
        logger.context = self.context
        logger.context.identifier = 'Class.test'
        logger.publisher = self.publisher
        logger.metric_value = expected_result
        logger.end(self.event)

        self.assertEqual(result.metric_value, expected_result)
Exemple #12
0
    def test_end_does_publish(self, mock_acts_blackbox, proto_metric_cls):
        result = Mock()
        mock_acts_blackbox.return_value = result
        metric_key = 'metric_key'

        logger = BlackboxMetricLogger(self.TEST_METRIC_NAME,
                                      metric_key=metric_key)
        logger.context = self.context
        logger.publisher = self.publisher
        logger._get_blackbox_identifier = self._get_blackbox_identifier
        logger.metric_value = 'foo'

        logger.end(self.event)

        proto_metric_cls.assert_called_once_with(name=self.TEST_FILE_NAME,
                                                 data=result)
        self.publisher.publish.assert_called_once_with(
            [proto_metric_cls.return_value])
Exemple #13
0
    def test_end_populates_result(self, mock_acts_blackbox):
        result = Mock()
        mock_acts_blackbox.return_value = result

        logger = BlackboxMetricLogger(self.TEST_METRIC_NAME)
        logger.context = self.context
        logger.publisher = self.publisher
        logger.context.identifier = 'Class.test'
        logger.metric_value = 'foo'

        logger.end(self.event)

        self.assertEqual(result.test_identifier, 'Class#test')
        self.assertEqual(result.metric_key,
                         '%s.%s' % ('Class#test', self.TEST_METRIC_NAME))
        self.assertEqual(result.metric_value, logger.metric_value)
Exemple #14
0
    def __init__(self, configs):
        super().__init__(configs)
        self.bt_attenuation_range = range(self.attenuation_vector['start'],
                                          self.attenuation_vector['stop'] + 1,
                                          self.attenuation_vector['step'])

        self.iperf_duration = self.audio_params['duration'] + TIME_OVERHEAD
        for level in list(
                self.static_wifi_interference['interference_level'].keys()):
            for channels in self.static_wifi_interference['channels']:
                self.generate_test_case(
                    self.static_wifi_interference['interference_level'][level],
                    channels)

        test_metrics = [
            'wifi_chan1_rssi', 'wifi_chan6_rssi', 'wifi_chan11_rssi',
            'bt_range'
        ]
        for metric in test_metrics:
            setattr(self, '{}_metric'.format(metric),
                    BlackboxMetricLogger.for_test_case(metric_name=metric))
Exemple #15
0
 def __init__(self, controllers):
     super().__init__(controllers)
     self.tests = ('test_case', )
     self.metrics = BlackboxMetricLogger.for_test_case(
         'my_metric', metric_key='my_metric_key')