def update(args): binary_cmd = cere_configure.cere_config["run_cmd"] build_cmd = cere_configure.cere_config["build_cmd"] args.regions_file = "{0}/loops".format(var.CERE_REPLAY_PATH) args.region = None logger.info("Start graph updating") graph = load_graph() if graph == None: logger.critical("No graph to load. Did you run cere profile?") return False while(1): graph = load_graph() newLoopsToTest = False with open(args.regions_file, 'w') as f: for n, d in graph.nodes(data=True): if d['_coverage'] < args.min_coverage: d['_small'] = True if d['_valid'] and not d['_small'] and not d['_tested']: newLoopsToTest = True d['_to_test']=True f.write(d['_name']+"\n") plot(graph) save_graph(graph) if not newLoopsToTest: break else: cere_check_matching.run(args) return True
def update(args): binary_cmd = cere_configure.cere_config["run_cmd"] build_cmd = cere_configure.cere_config["build_cmd"] args.regions_file = "{0}/loops".format(var.CERE_REPLAY_PATH) args.region = None logger.info("Start graph updating") graph = load_graph() if graph == None: logger.critical("No graph to load. Did you run cere profile?") return False while (1): graph = load_graph() newLoopsToTest = False with open(args.regions_file, 'w') as f: for n, d in graph.nodes(data=True): if d['_coverage'] < args.min_coverage: d['_small'] = True if d['_valid'] and not d['_small'] and not d['_tested']: newLoopsToTest = True d['_to_test'] = True f.write(d['_name'] + "\n") plot(graph) save_graph(graph) if not newLoopsToTest: break else: cere_check_matching.run(args) return True
def update(args): binary_cmd = cere_configure.cere_config["run_cmd"] build_cmd = cere_configure.cere_config["build_cmd"] args.regions_file = "{0}/loops".format(var.CERE_REPLAY_PATH) args.region = None logger.info("Start graph updating") graph = load_graph() if graph == None: logger.critical("No graph to load. Did you run cere profile?") return False while(1): graph = load_graph() #rewind self to parents for invalid loops nodes = (list(reversed(nx.topological_sort(graph)))) for node in nodes: cancel = False if graph.node[node]['_self_coverage'] < args.min_coverage: graph.node[node]['_small'] = True #if it's an invalid node (not matching or not extracted) or if it's too small if not graph.node[node]['_valid'] or graph.node[node]['_small']: #if there is still a successor not tested, we do nothing. for successor in graph.successors(node): if not graph.node[successor]['_tested']: cancel = True if cancel: continue in_degree = graph.in_degree(node, weight='weight') #if all my parent's sons are not matching, transfert my coverage if graph.node[node]['_transfered']: continue for predecessor in graph.predecessors(node): part = round(float(graph.edge[predecessor][node]['weight'])/in_degree, 2) graph.node[predecessor]['_self_coverage'] = round(graph.node[predecessor]['_self_coverage'] + graph.node[node]['_self_coverage'] * part, 2) if graph.node[predecessor]['_self_coverage'] >= 1: graph.node[predecessor]['_small'] = False graph.node[node]['_transfered'] = True newLoopsToTest = False with open(args.regions_file, 'w') as f: for n, d in graph.nodes(data=True): cancel=False if d['_valid'] and not d['_small'] and not d['_tested']: for successor in graph.successors(n): #if a successor is not tested yet, we don't test this region if not graph.node[successor]['_tested'] and not graph.node[successor]['_small']: cancel = True if cancel: continue newLoopsToTest = True d['_to_test']=True f.write(d['_name']+"\n") save_graph(graph) plot(graph) if not newLoopsToTest: break else: cere_check_matching.run(args) return True
def update(args): binary_cmd = cere_configure.cere_config["run_cmd"] build_cmd = cere_configure.cere_config["build_cmd"] error = args.max_error args.regions_file = "{0}/loops".format(var.CERE_REPLAY_PATH) args.region = None logger.info("Start graph updating") graph = load_graph("original") if graph == None: logger.critical("No graph to load. Did you run cere profile?") return False step = 0 while (1): step = step + 1 if step != 1: #1) Something new? lines = read_csv("{0}/matching_error.csv".format( var.CERE_REPLAY_PATH)) graph = update_nodes(graph, lines, error) newLoopsToTest = False with open(args.regions_file, 'w') as f: for n, d in graph.nodes(data=True): cancel = False if d['_coverage'] < 1: d['_small'] = True if d['_valid'] and not d['_small'] and not d['_tested']: newLoopsToTest = True d['_to_test'] = True f.write(d['_name'] + "\n") if not newLoopsToTest: plot(graph, "final") save_graph(graph) break else: plot(graph, step) save_graph(graph) cere_check_matching.run(args) return True
def update(args): binary_cmd = cere_configure.cere_config["run_cmd"] build_cmd = cere_configure.cere_config["build_cmd"] error = args.max_error args.regions_file = "{0}/loops".format(var.CERE_REPLAY_PATH) args.region = None logger.info("Start graph updating") graph = load_graph("original") if graph == None: logger.critical("No graph to load. Did you run cere profile?") return False step=0 while(1): step = step + 1 if step != 1: #1) Something new? lines = read_csv("{0}/matching_error.csv".format(var.CERE_REPLAY_PATH)) graph = update_nodes(graph, lines, error) newLoopsToTest = False with open(args.regions_file, 'w') as f: for n, d in graph.nodes(data=True): cancel=False if d['_coverage'] < 1: d['_small'] = True if d['_valid'] and not d['_small'] and not d['_tested']: newLoopsToTest = True d['_to_test']=True f.write(d['_name']+"\n") if not newLoopsToTest: plot(graph, "final") save_graph(graph) break else: plot(graph, step) save_graph(graph) cere_check_matching.run(args) return True
def update(args): binary_cmd = cere_configure.cere_config["run_cmd"] build_cmd = cere_configure.cere_config["build_cmd"] error = args.max_error args.regions_file = "{0}/loops".format(var.CERE_REPLAY_PATH) args.region = None logger.info("Start graph updating") graph = load_graph("original") if graph == None: logger.critical("No graph to load. Did you run cere profile?") return False step = 0 while (1): step = step + 1 if step != 1: #1) Something new? lines = read_csv("{0}/matching_error.csv".format( var.CERE_REPLAY_PATH)) graph = update_nodes(graph, lines, error) #2) rewind self to parents for invalid loops nodes = (list(reversed(nx.topological_sort(graph)))) for node in nodes: cancel = False if graph.node[node]['_self_coverage'] < 1: graph.node[node]['_small'] = True #if it's an invalid node (not matching or not extracted) or if it's too small if not graph.node[node]['_valid'] or graph.node[node]['_small']: #if there is still a successor not tested, we do nothing. for successor in graph.successors(node): if not graph.node[successor]['_tested']: cancel = True if cancel: continue in_degree = graph.in_degree(node, weight='weight') #if all my parent's sons are not matching, transfert my coverage if graph.node[node]['_transfered']: continue for predecessor in graph.predecessors(node): part = round( float(graph.edge[predecessor][node]['weight']) / in_degree, 2) graph.node[predecessor]['_self_coverage'] = round( graph.node[predecessor]['_self_coverage'] + graph.node[node]['_self_coverage'] * part, 2) if graph.node[predecessor]['_self_coverage'] >= 1: graph.node[predecessor]['_small'] = False graph.node[node]['_transfered'] = True newLoopsToTest = False with open(args.regions_file, 'w') as f: for n, d in graph.nodes(data=True): cancel = False if d['_valid'] and not d['_small'] and not d['_tested']: for successor in graph.successors(n): #if a successor is not tested yet, we don't test this region if not graph.node[successor][ '_tested'] and not graph.node[successor][ '_small']: cancel = True if cancel: continue newLoopsToTest = True d['_to_test'] = True f.write(d['_name'] + "\n") save_graph(graph) if not newLoopsToTest: plot(graph, "final") break else: plot(graph, step) cere_check_matching.run(args) return True