def analyze(self): analyzer = config.get("analyzer") logger.info("doing analyzing, analyzer: " + analyzer) if analyzer == "invariant": template_result = compare.parse(self.output_folder + "/output.csv") regression_result = "" try: regression_result = check_output( "Rscript ~/github/PyHelium/helium/analyzer/advancedInvariant.R " + self.output_folder + "/output.csv", shell=True, stderr=DEVNULL, ) regression_result = regression_result.decode("utf8") except CalledProcessError as e: pass result = template_result + "\n" + regression_result elif analyzer == "recursive": result = recursive_compare.compare("output.csv", self.output_folder + "/output.csv") elif analyzer == "store": # result = recursive_compare.compare('output.csv', self.output_folder+'/output.csv') store(len(self.input_spec)) result = "" else: red("unsupported analyzer") exit(1) return result
def generate_predefined_tests(self): filename = "input.csv" input_spec_len = len(self.input_spec) self.tests.clear() with open(filename) as f: lines = f.readlines() if not lines: red("no input from input file") exit(1) lines.pop(0) for line in lines: if len(line.split()) < input_spec_len: red("input.csv not enough") exit(1) self.tests.append(" ".join(line.split()[:input_spec_len]))
def build(self, doc, context, functions): """ :param doc: document of the context :param context: context nodes :param functions: functions because of the linear search up above function. functions = {call_name: node, ...} """ self.doc = doc self.context = context self.functions = functions self.inputs = io.resolve_undefined_vars(context, set()) self.resolved = {} self.unresolved = set() self.generate() self.resolve() self.generate_support() Instrumenter().instrument() compile_success = self.compile() if config.get("show_compile_result") == "true": if compile_success: green("compile success") else: red("compile error") return compile_success