Mercurial > paraspace
diff paraspace/tests/injection_test.py @ 132:75a31967ebee
Following the ref in resotre_dependencies()
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 09 Aug 2011 15:30:45 +0800 |
parents | 044bfc415577 |
children | b488ca519709 |
line wrap: on
line diff
--- a/paraspace/tests/injection_test.py Tue Aug 09 11:47:43 2011 +0800 +++ b/paraspace/tests/injection_test.py Tue Aug 09 15:30:45 2011 +0800 @@ -425,6 +425,9 @@ # It is possible restore_dependencies() does not following \ref ref # object to set offset value on referenced attribute. # +# It is also possible dexfile_insert_classdefs_relative() does not +# put injected objects into lists properly. +# def map_verify_error_test(): from paraspace.dex_deptracker import prepare_dep_decls from paraspace.injection import inject_redir @@ -451,7 +454,7 @@ hello_linked, 'Ljava/io/File;', all_dep_decls) for idx, item in enumerate(hello_linked.maps.items.items): - if item.type != dexfile._DEX_MapItem.name_to_types['kDexTypeTypeList']: + if item.type == dexfile._DEX_MapItem.name_to_types['kDexTypeTypeList']: break pass else: @@ -464,20 +467,28 @@ for idx, protoid in enumerate(hello_linked.protoIds.items): off = protoid.parametersOff try: - assert off >= typelist_start - assert off < typelist_stop + if off != 0: + assert off >= typelist_start + assert off < typelist_stop + pass + pass except: - print 'ERROR: protoid idx @', idx, protoid + print 'ERROR: protoid idx@%d %s 0x%x' % (idx, repr(protoid), off) + print 'start 0x%x stop 0x%x' % (typelist_start, typelist_stop) raise pass for idx, classdef in enumerate(hello_linked.classDefs.items): off = classdef.interfacesOff try: - assert off >= typelist_start - assert off < typelist_stop + if off != 0: + assert off >= typelist_start + assert off < typelist_stop + pass + pass except: - print 'ERROR: classdef idx @', idx, classdef + print 'ERROR: classdef idx@%d %s 0x%x' % (idx, repr(classdef), off) + print 'start 0x%x stop 0x%x' % (typelist_start, typelist_stop) raise pass pass