1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-22 12:58:36 +00:00

daq: Fixed bug where an exception would be raised if merge_channles=False

This commit is contained in:
Sebastian Goscik 2015-12-15 09:39:28 +00:00
parent 9222257d79
commit 09390e7ffb

View File

@ -303,16 +303,17 @@ class Daq(Instrument):
except ConfigurationError, ex: except ConfigurationError, ex:
raise ConfigError('DAQ configuration: ' + ex.message) # Re-raise as a WA error raise ConfigError('DAQ configuration: ' + ex.message) # Re-raise as a WA error
self.grouped_suffixes = defaultdict(str) self.grouped_suffixes = defaultdict(str)
if isinstance(self.merge_channels, bool) and self.merge_channels: if isinstance(self.merge_chnnels, bool):
# Create a dict of potential prefixes and a list of their suffixes if self.merge_channels:
grouped_suffixes = {label[:-1]: label for label in sorted(self.labels) if len(label) > 1} # Create a dict of potential prefixes and a list of their suffixes
# Only merge channels if more than one channel has the same prefix and the prefixes grouped_suffixes = {label[:-1]: label for label in sorted(self.labels) if len(label) > 1}
# are consecutive letters starting with 'a'. # Only merge channels if more than one channel has the same prefix and the prefixes
self.label_map = {} # are consecutive letters starting with 'a'.
for channel, suffixes in grouped_suffixes.iteritems(): self.label_map = {}
if len(suffixes) > 1: for channel, suffixes in grouped_suffixes.iteritems():
if "".join([s[-1] for s in suffixes]) in ascii_lowercase[:len(suffixes)]: if len(suffixes) > 1:
self.label_map[channel] = suffixes if "".join([s[-1] for s in suffixes]) in ascii_lowercase[:len(suffixes)]:
self.label_map[channel] = suffixes
elif isinstance(self.merge_channels, dict): elif isinstance(self.merge_channels, dict):
# Check if given channel names match labels # Check if given channel names match labels
@ -323,7 +324,7 @@ class Daq(Instrument):
self.label_map = self.merge_channels # pylint: disable=redefined-variable-type self.label_map = self.merge_channels # pylint: disable=redefined-variable-type
self.merge_channels = True self.merge_channels = True
else: # Should never reach here else: # Should never reach here
raise AssertionError("Merge files is of invalid type") raise AssertionError("``merge_channels`` is of invalid type")
def before_overall_results_processing(self, context): def before_overall_results_processing(self, context):
if self._results: if self._results: