def test_cpyext_translates(monkeypatch): def from_ref(space, ref): # XXX: avoid 'assert isinstance(w_type, W_TypeObject)' from the # original from_ref, just return w_some_obj return space.w_object monkeypatch.setattr(pyobject, 'from_ref', from_ref) checkmodule('cpyext', '_rawffi', translate_startup=False)
def main(argv): if len(argv) != 2: print >> sys.stderr, __doc__ sys.exit(2) modname = argv[1] if modname in ('-h', '--help'): print >> sys.stderr, __doc__ sys.exit(0) if modname.startswith('-'): print >> sys.stderr, "Bad command line" print >> sys.stderr, __doc__ sys.exit(1) if os.path.sep in modname: if os.path.basename(modname) == '': modname = os.path.dirname(modname) if os.path.basename(os.path.dirname(modname)) != 'module': print >> sys.stderr, "Must give '../module/xxx', or just 'xxx'." sys.exit(1) modname = os.path.basename(modname) try: checkmodule(modname) except Exception, e: import traceback, pdb traceback.print_exc() pdb.post_mortem(sys.exc_info()[2]) return 1
def test_checkmodule(): # we need to ignore GcCollectStepStats, else checkmodule fails. I think # this happens because W_GcCollectStepStats.__init__ is only called from # GcCollectStepHookAction.perform() and the fake objspace doesn't know # about those: so, perform() is never annotated and the annotator thinks # W_GcCollectStepStats has no attributes checkmodule('gc', ignore=['GcCollectStepStats'])
def main(argv): if len(argv) != 2: print >> sys.stderr, __doc__ sys.exit(2) modname = argv[1] if modname in ('-h', '--help'): print >> sys.stderr, __doc__ sys.exit(0) if modname.startswith('-'): print >> sys.stderr, "Bad command line" print >> sys.stderr, __doc__ sys.exit(1) if os.path.sep in modname: if os.path.basename(modname) == '': modname = os.path.dirname(modname) if os.path.basename(os.path.dirname(modname)) != 'module': print >> sys.stderr, "Must give '../module/xxx', or just 'xxx'." sys.exit(1) modname = os.path.basename(modname) try: checkmodule(modname) except Exception: import traceback, pdb traceback.print_exc() pdb.post_mortem(sys.exc_info()[2]) return 1 else: print 'Passed.' return 0
def test_checkmodule(): # XXX: PyTraceback usage in these methods blows up checkmodule def descr_gettraceback(self, space): return space.w_None def descr_settraceback(self, space, w_newtraceback): pass W_BaseException.descr_gettraceback = descr_gettraceback W_BaseException.descr_settraceback = descr_settraceback W_BaseException.typedef.add_entries( __traceback__=GetSetProperty(descr_gettraceback, descr_settraceback)) checkmodule('_io')
def test_checkmodule(): # prepare_file_argument() is not working without translating the _file # module too def dummy_prepare_file_argument(space, fileobj): return lltype.nullptr(rffi.CCHARP.TO) old = ctypeptr.prepare_file_argument try: ctypeptr.prepare_file_argument = dummy_prepare_file_argument # checkmodule('_cffi_backend') # finally: ctypeptr.prepare_file_argument = old
def test_checkmodule(): # prepare_file_argument() is not working without translating the _file # module too def dummy_prepare_file_argument(space, fileobj): # call load_cffi1_module() too, from a random place like here cffi1_module.load_cffi1_module(space, "foo", "foo", 42) return lltype.nullptr(rffi.CCHARP.TO) old = ctypeptr.prepare_file_argument try: ctypeptr.prepare_file_argument = dummy_prepare_file_argument # checkmodule('_cffi_backend') # finally: ctypeptr.prepare_file_argument = old
def test_checkmodule(): # prepare_file_argument() is not working without translating the _file # module too def dummy_prepare_file_argument(space, fileobj): # call pypy_init_embedded_cffi_module() from a random place like here # --- this calls load_cffi1_module(), too embedding.pypy_init_embedded_cffi_module( rffi.cast(rffi.INT, embedding.EMBED_VERSION_MIN), 42) return lltype.nullptr(rffi.CCHARP.TO) old = ctypeptr.prepare_file_argument try: ctypeptr.prepare_file_argument = dummy_prepare_file_argument # checkmodule('_cffi_backend') # finally: ctypeptr.prepare_file_argument = old
def main(argv): try: assert len(argv) in (2, 4) if len(argv) == 2: backend = 'cli' modname = argv[1] if modname in ('-h', '--help'): print >> sys.stderr, __doc__ sys.exit(0) if modname.startswith('-'): print >> sys.stderr, "Bad command line" print >> sys.stderr, __doc__ sys.exit(1) else: _, b, backend, modname = argv assert b == '-b' except AssertionError: print >> sys.stderr, __doc__ sys.exit(2) else: checkmodule(modname, backend, interactive=True) print 'Module compiled succesfully'
def test_checkmodule(): DUMMY_CPYEXT_STRUCT = make_cpyext_struct() def extra_func(space): state = space.fromcache(State) state.setup() attach_dict_strategy(space) p = lltype.malloc(DUMMY_CPYEXT_STRUCT, flavor='raw') lltype.free(p, flavor='raw') W_TypeObject(space, 'foo', [], {}).hasmro = False rpython_opts = {'translation.gc': 'boehm'} # it isn't possible to ztranslate cpyext easily, so we check _hpy_universal # WITHOUT the cpyext parts pypy_opts = {'objspace.std.withliststrategies': False, 'objspace.hpy_cpyext_API': False} checkmodule('_hpy_universal', extra_func=extra_func, c_compile=True, rpython_opts=rpython_opts, pypy_opts=pypy_opts, show_pdbplus=False, )
def test_dotnet(): # the only module known to pass checkmodule is _dotnet so far py.test.skip('fixme') checkmodule('_dotnet', 'cli')
def test_cpyext_translates(): checkmodule('cpyext', '_rawffi')
def test_checkmodule(): checkmodule('_multiprocess')
def test_checkmodule(): checkmodule('gc')
def test_posix_translates(): checkmodule('posix')
def test_dotnet(): # the only module known to pass checkmodule is _dotnet so far py.test.skip("fixme") checkmodule("_dotnet", "cli")
def test_checkmodule(): checkmodule('pwd')
def test_checkmodule(): checkmodule('time')
def test_checkmodule(): checkmodule("gc")
def test_checkmodule(): checkmodule('_io')
def test__codecs_translates(): checkmodule('_codecs')
def test_faulthandler_translates(): import pypy.module._vmprof.interp_vmprof # register_code_object_class() checkmodule('faulthandler')
def test_checkmodule(): checkmodule('_multiprocessing')
def test_checkmodule(): checkmodule('_socket')
def test_checkmodule(): checkmodule('struct')
def test_cpyext_translates(): checkmodule('cpyext', '_rawffi', translate_startup=False)
def test__ssl_translates(): checkmodule('_ssl')
def test_checkmodule(): checkmodule('_random')
def test_checkmodule(): checkmodule('_bisect')
def test_posixsubprocess_translates(): checkmodule('_posixsubprocess')
def test_checkmodule(): checkmodule("_csv")
def test_checkmodule(): checkmodule('_csv')
def test_faulthandler_translates(): import pypy.module._vmprof.interp_vmprof # register_code_object_class() checkmodule("faulthandler")
def test__ffi_translates(): checkmodule('_ffi', '_rawffi')
def test_select_translates(): checkmodule('select')
def test_checkmodule(): checkmodule('array')
def test_numpy_translates(): # XXX: If there are signatures floating around this might explode. This fix # is ugly. signature.known_sigs.clear() checkmodule('micronumpy')
def test_checkmodule(): checkmodule('_hashlib')
def test_pypyjit_translates(): checkmodule('pypyjit')
def test_checkmodule(): checkmodule('itertools')