def __init__(self, test, name, hash_ignore=[]): self._test = test self._testExecution = PerfRepoTestExecution() self._testExecution.set_testId(test.get_id()) self._testExecution.set_testUid(test.get_uid()) self._testExecution.set_name(name) self.set_configuration(ctl.get_configuration()) self._hash_ignore = hash_ignore
def __init__(self, testUid, name): self._testExecution = PerfRepoTestExecution() self._testExecution.set_testUid(testUid) self._testExecution.set_name(name) self.set_configuration(ctl.get_configuration()) self.set_mapping(ctl.get_mapping())
class PerfRepoResult(object): def __init__(self, testUid, name): self._testExecution = PerfRepoTestExecution() self._testExecution.set_testUid(testUid) self._testExecution.set_name(name) self.set_configuration(ctl.get_configuration()) self.set_mapping(ctl.get_mapping()) def add_value(self, val_name, value): perf_value = PerfRepoValue() perf_value.set_metricName(val_name) perf_value.set_result(value) self._testExecution.add_value(perf_value) def set_configuration(self, configuration=None): if configuration is None: configuration = ctl.get_configuration() for pair in list_to_dot(configuration, "configuration.", "machine"): self._testExecution.add_parameter(pair[0], pair[1]) def set_mapping(self, mapping=None): if mapping is None: mapping = ctl.get_mapping() for pair in list_to_dot(mapping, "mapping.", "machine"): self._testExecution.add_parameter(pair[0], pair[1]) def set_tags(self, tags): for tag in tags: self._testExecution.add_tag(tag) def get_testExecution(self): return self._testExecution
class PerfRepoResult(object): def __init__(self, test, name, hash_ignore=[]): self._test = test self._testExecution = PerfRepoTestExecution() self._testExecution.set_testId(test.get_id()) self._testExecution.set_testUid(test.get_uid()) self._testExecution.set_name(name) self.set_configuration(ctl.get_configuration()) self._hash_ignore = hash_ignore def add_value(self, val_name, value): perf_value = PerfRepoValue() perf_value.set_metricName(val_name) perf_value.set_result(value) self._testExecution.add_value(perf_value) def set_configuration(self, configuration=None): if configuration is None: configuration = ctl.get_configuration() for pair in dict_to_dot(configuration, "configuration."): self._testExecution.add_parameter(pair[0], pair[1]) def set_mapping(self, mapping=None): if mapping is None: mapping = ctl.get_mapping() for pair in list_to_dot(mapping, "mapping.", "machine"): self._testExecution.add_parameter(pair[0], pair[1]) def set_tag(self, tag): self._testExecution.add_tag(tag) def add_tag(self, tag): self.set_tag(tag) def set_tags(self, tags): for tag in tags: self.set_tag(tag) def add_tags(self, tags): self.set_tags(tags) def set_parameter(self, name, value): self._testExecution.add_parameter(name, value) def set_parameters(self, params): for name, value in params: self.set_parameter(name, value) def set_hash_ignore(self, hash_ignore): self._hash_ignore = hash_ignore def get_hash_ignore(self): return self._hash_ignore def get_testExecution(self): return self._testExecution def get_test(self): return self._test def generate_hash(self, ignore=[]): ignore.extend(self._hash_ignore) tags = self._testExecution.get_tags() params = self._testExecution.get_parameters() sha1 = hashlib.sha1() sha1.update(self._testExecution.get_testUid()) for i in sorted(tags): sha1.update(i) for i in sorted(params, key=lambda x: x[0]): skip = False for j in ignore: if re.search(j, i[0]): skip = True break if skip: continue sha1.update(i[0]) sha1.update(str(i[1])) return sha1.hexdigest()