def test_all(self, p_arity, p_type, config): conf = Confiture("config/templates/test.yaml") self.__pgm = conf.check_and_get("test/config/" + config) for pgm, data in self.__pgm.items(): # Step One: execute program with arguments cmd = "{}/{}".format(data["bin"], pgm) self.out("Launching {0} inference on {1}".format(p_arity, cmd)) p_arity.launch(cmd, data["args"].split(" ") + [" > /dev/null"], verbose=False) self.out("Launching {0} inference on {1}".format(p_type, cmd)) p_type.launch(cmd, data["args"].split(" ") + [" > /dev/null"], verbose=False) # Step Two: parse source # Create a parser object src_data = Data(self.__config["data-path"], pgm) if src_data.parse(cmd, self.__config["lib-path"], data["src"], force=False, verbose=False): src_data.dump() else: src_data.load(verbose=False) # Finally, compare source with infered results self.__accuracy["arity"].append( p_arity.get_analysis(pgm, src_data).accuracy(get=True, verbose=False)) self.__accuracy["type"].append( p_type.get_analysis(pgm, src_data).accuracy(get=True, verbose=False)) self.display()
def run(self, s, *args, **kwargs): # TODO check number of args # TODO completion on args split = s.split(" ") if len(split) == 1: binary, srcdir = split[0], None else: binary, srcdir = split pgm = os.path.basename(binary) # Check CLANG configuration config = Confiture("config/templates/clang.yaml").check_and_get("config/config.yaml") # Create a parser object data = Data(config["clang"]["data-path"], pgm) data.parse(binary, config["clang"]["lib-path"], srcdir) data.dump()
def test_all(self, p_arity, p_type, config): conf = Confiture("config/templates/test.yaml") self.__pgm = conf.check_and_get("test/config/" + config) for pgm, data in self.__pgm.items(): # Step One: execute program with arguments cmd = "{}/{}".format(data["bin"], pgm) self.out("Launching {0} inference on {1}".format(p_arity, cmd)) p_arity.launch(cmd, data["args"].split(" ") + [" > /dev/null"], verbose=False) self.out("Launching {0} inference on {1}".format(p_type, cmd)) p_type.launch(cmd, data["args"].split(" ") + [" > /dev/null"], verbose=False) # Step Two: parse source # Create a parser object src_data = Data(self.__config["data-path"], pgm) if src_data.parse(cmd, self.__config["lib-path"], data["src"], force=False, verbose=False): src_data.dump() else: src_data.load(verbose=False) # Finally, compare source with infered results self.__accuracy["arity"].append(p_arity.get_analysis(pgm, src_data).accuracy(get=True, verbose=False)) self.__accuracy["type"].append(p_type.get_analysis(pgm, src_data).accuracy(get=True, verbose=False)) self.display()
def do_parsedata(self, s): """ Parse source code to test inference results """ # TODO check number of args # TODO completion on args split = s.split(" ") if len(split) == 1: binary, srcdir = split[0], None else: binary, srcdir = split pgm = os.path.basename(binary) # Check CLANG configuration conf = Confiture("config/templates/clang.yaml") conf.check("config/config.yaml") # Create a parser object data = Data(self.config["clang"]["data-path"], pgm) data.parse(binary, self.config["clang"]["lib-path"], srcdir) data.dump()