def assertFindsError(self, src, experr): if GCC_VERSION >= 4009: experr = experr.replace('$(SRCFILE):12:26:', '$(SRCFILE):12:10:') experr = experr.replace('$(SRCFILE):13:25:', '$(SRCFILE):13:9:') experr = experr.replace('$(SRCFILE):13:26:', '$(SRCFILE):13:10:') experr = experr.replace('$(SRCFILE):14:26:', '$(SRCFILE):14:10:') experr = experr.replace('$(SRCFILE):14:37:', '$(SRCFILE):14:10:') experr = experr.replace('$(SRCFILE):17:26:', '$(SRCFILE):17:10:') if GCC_VERSION >= 5000: experr = experr.replace('$(SRCFILE):12:5:', '$(SRCFILE):12:12:') experr = experr.replace('$(SRCFILE):13:5:', '$(SRCFILE):13:12:') if isinstance(src, SimpleModule): sm = src else: sm = SimpleModule() sm.cu.add_defn(src) bm = BuiltModule(sm) try: bm.write_src('example') experr = experr.replace('$(SRCFILE)', bm.srcfile) self.compile_src(bm) except CompilationError: exc = sys.exc_info()[1] if experr not in exc.err: raise ExpectedErrorNotFound(experr, exc.err, bm) else: raise ExpectedErrorNotFound(experr, bm.err, bm) bm.cleanup() return bm
def assertNoErrors(self, src): if isinstance(src, SimpleModule): sm = src else: sm = SimpleModule() sm.cu.add_defn(src) bm = BuiltModule(sm) self.build_module(bm) bm.cleanup() return bm