def collect_from(self, xml_path, default_configuration): run = parseLogFile(xml_path) try: self.devices[0] = run.properties['ocl_cpu_deviceName'] except Exception, e: self.devices[0] = "N/A"
def collect_xml(collection, configuration, xml_fullname): xml_fname = os.path.split(xml_fullname)[1] module = xml_fname[: xml_fname.index("_")] module_tests = collection.setdefault(module, OrderedDict()) for test in sorted(parseLogFile(xml_fullname)): test_results = module_tests.setdefault((test.shortName(), test.param()), {}) test_results[configuration] = test.get("gmean") if test.status == "run" else test.status
def collect_xml(collection, configuration, xml_fullname): xml_fname = os.path.split(xml_fullname)[1] module = xml_fname[:xml_fname.index('_')] module_tests = collection.setdefault(module, OrderedDict()) for test in sorted(parseLogFile(xml_fullname)): test_results = module_tests.setdefault( (test.shortName(), test.param()), {}) test_results[configuration] = test.get( "gmean") if test.status == 'run' else test.status
def collect_from(self, xml_path, default_configuration): run = parseLogFile(xml_path) module = run.properties['module_name'] properties = run.properties.copy() del properties['module_name'] props_key = tuple(sorted(properties.iteritems())) # dicts can't be keys if props_key in self.__config_cache: configuration = self.__config_cache[props_key] else: configuration = self.config_match_func(properties) if configuration is None: if self.include_unmatched: if default_configuration is not None: configuration = default_configuration else: configuration = Collector.__format_config_cache_key(props_key, multiline=True) self.extra_configurations.add(configuration) else: logging.warning('failed to match properties to a configuration: %s', Collector.__format_config_cache_key(props_key)) else: same_config_props = [it[0] for it in self.__config_cache.iteritems() if it[1] == configuration] if len(same_config_props) > 0: logging.warning('property set %s matches the same configuration %r as property set %s', Collector.__format_config_cache_key(props_key), configuration, Collector.__format_config_cache_key(same_config_props[0])) self.__config_cache[props_key] = configuration if configuration is None: return module_tests = self.tests.setdefault(module, {}) for test in run.tests: test_results = module_tests.setdefault((test.shortName(), test.param()), {}) new_result = test.get("gmean") if test.status == 'run' else test.status test_results[configuration] = min( test_results.get(configuration), new_result, key=lambda r: (1, r) if isinstance(r, numbers.Number) else (2,) if r is not None else (3,) ) # prefer lower result; prefer numbers to errors and errors to nothing
def collect_from(self, xml_path): run = parseLogFile(xml_path) module = run.properties["module_name"] properties = run.properties.copy() del properties["module_name"] props_key = tuple(sorted(properties.iteritems())) # dicts can't be keys if props_key in self.__config_cache: configuration = self.__config_cache[props_key] else: configuration = self.config_match_func(properties) if configuration is None: logging.warning( "failed to match properties to a configuration: %s", Collector.__format_config_cache_key(props_key) ) else: same_config_props = [it[0] for it in self.__config_cache.iteritems() if it[1] == configuration] if len(same_config_props) > 0: logging.warning( "property set %s matches the same configuration %r as property set %s", Collector.__format_config_cache_key(props_key), configuration, Collector.__format_config_cache_key(same_config_props[0]), ) self.__config_cache[props_key] = configuration if configuration is None: return module_tests = self.tests.setdefault(module, OrderedDict()) for test in run.tests: test_results = module_tests.setdefault((test.shortName(), test.param()), {}) test_results[configuration] = test.get("gmean") if test.status == "run" else test.status
for arg in args: if ("*" in arg) or ("?" in arg): flist = [os.path.abspath(f) for f in glob.glob(arg)] flist = sorted(flist, key=lambda text: str(text).replace("M", "_")) files.extend( [x for x in flist if x not in seen and not seen.add(x)]) else: fname = os.path.abspath(arg) if fname not in seen and not seen.add(fname): files.append(fname) # read all passed files test_sets = [] for arg in files: try: tests = testlog_parser.parseLogFile(arg) if options.filter: expr = re.compile(options.filter) tests = [t for t in tests if expr.search(str(t))] if options.match: tests = [t for t in tests if t.get("status") != "notrun"] if tests: test_sets.append((os.path.basename(arg), tests)) except IOError as err: sys.stderr.write("IOError reading \"" + arg + "\" - " + str(err) + os.linesep) except xml.parsers.expat.ExpatError as err: sys.stderr.write("ExpatError reading \"" + arg + "\" - " + str(err) + os.linesep) if not test_sets:
seen = set() for arg in args: if ("*" in arg) or ("?" in arg): flist = [os.path.abspath(f) for f in glob.glob(arg)] flist = sorted(flist, key= lambda text: str(text).replace("M", "_")) files.extend([ x for x in flist if x not in seen and not seen.add(x)]) else: fname = os.path.abspath(arg) if fname not in seen and not seen.add(fname): files.append(fname) # read all passed files test_sets = [] for arg in files: try: tests = testlog_parser.parseLogFile(arg) if options.filter: expr = re.compile(options.filter) tests = [t for t in tests if expr.search(str(t))] if options.match: tests = [t for t in tests if t.get("status") != "notrun"] if tests: test_sets.append((os.path.basename(arg), tests)) except IOError as err: sys.stderr.write("IOError reading \"" + arg + "\" - " + str(err) + os.linesep) except xml.parsers.expat.ExpatError as err: sys.stderr.write("ExpatError reading \"" + arg + "\" - " + str(err) + os.linesep) if not test_sets: sys.stderr.write("Error: no test data found" + os.linesep) quit()
if fname not in seen and not seen.add(fname): files.append(fname) file = os.path.abspath(fname) if not os.path.isfile(file): sys.stderr.write("IOError reading \"" + file + "\" - " + str(err) + os.linesep) parser.print_help() exit(0) fname = os.path.basename(fname) find_module_name = re.search(r'([^_]*)', fname) module_name = find_module_name.group(0) test_sets = [] try: tests = testlog_parser.parseLogFile(file) if tests: test_sets.append((os.path.basename(file), tests)) except IOError as err: sys.stderr.write("IOError reading \"" + file + "\" - " + str(err) + os.linesep) except xml.parsers.expat.ExpatError as err: sys.stderr.write("ExpatError reading \"" + file + "\" - " + str(err) + os.linesep) if not test_sets: continue # find matches setsCount = len(test_sets) test_cases = {} name_extractor = lambda name: str(name)