def compile(self, srcfile, outfile, include_path=[], symbols={}): log.verbose("Compiling %(outfile)s from %(srcfile)s", outfile=outfile, srcfile=srcfile) path_items = self.__make_path_items(["-c"], [srcfile], outfile, include_path, symbols) output, _ = utils.exec2str(*path_items)
def __run_test(self): """ Run a test script. """ capture, rv = exec2str(self.desc.testbin.abs_str()) capture = capture.split() if len(capture) != 1: raise RuntimeError("Failed to run test, unexpected reply") no_of_tests = int(capture[0]) log.verbose("Starting test %(name)s", name=self.desc.name) assert_count = 0 assert_failed = 0 cases_fatal = 0 for i in range(no_of_tests): a_c, a_f, fatal = self.__execute_test(str(i)) assert_count += a_c assert_failed += a_f if fatal: cases_fatal += 1 log.info(" Test %(name)s completed, cases=%(casen)d (fatal=%(fatal)d), " + "Assertions total=%(assert_count)d, of which %(assert_failed)d failed", name=self.desc.name, casen=no_of_tests, fatal=cases_fatal, assert_count=assert_count, assert_failed=assert_failed)
def compile_all(self, outfile, *srcfiles, includepaths=[]): log.verbose("Compiling %(outfile)s from %(sources)s", outfile=outfile, sources=srcfiles) path_items = [self.executable] path_items.append("-o%s" % outfile) for incpath in includepaths: path_items.append("-I%s" % incpath) path_items += Path.to_strings(srcfiles) output, _ = utils.exec2str(*path_items)
def dependencies(self, srcfile, include_path=[], symbols={}): log.verbose("Dependencies for %(srcfile)s", srcfile=srcfile) path_items = self.__make_path_items(flags=['-E', '-Wp,-MM'], infiles=[srcfile], include_path=include_path, symbols=symbols) output, _ = utils.exec2str(*path_items) deps = " ".join([ l[0:-1].strip() if l.endswith("\\") else l.strip() for l in output.split("\n")[1:] ]).split() deps = [Path(dep) for dep in deps] return deps
def preprocess(self, srcfile, outfile, include_path=[], symbols={}): log.verbose("Preprocessing for %(srcfile)s", srcfile=srcfile) path_items = self.__make_path_items(["-E"], [srcfile], outfile, include_path, symbols) output, _ = utils.exec2str(*path_items)
def link(self, binfile, *objfiles): log.verbose("Linking %(binfile)s from %(objfiles)s", binfile=binfile, objfiles=", ".join(str(x) for x in objfiles)) path_items = self.__make_path_items(infiles=objfiles, outfile=binfile) output, _ = utils.exec2str(*path_items)