Mercurial > paraspace
comparison paraspace/tests/injection_test.py @ 142:50d09eba5166
Fix the issue of getting negative indices for _DEX_ClassData.
- It caused by calling _optimize_classdata() at end of restore_dependencies()
while the values cames from depend_idx_rel.get_value(). The values had
been optimized.
- Solution is to get value from <child>.data_idx while unlinking.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 15 Aug 2011 10:04:12 +0800 |
parents | 90690a001172 |
children | c56c7cf32b88 |
comparison
equal
deleted
inserted
replaced
141:90690a001172 | 142:50d09eba5166 |
---|---|
743 print 'ERROR: method %d' % (idx + 1) | 743 print 'ERROR: method %d' % (idx + 1) |
744 raise | 744 raise |
745 pass | 745 pass |
746 pass | 746 pass |
747 pass | 747 pass |
748 | |
749 | |
750 ## \brief Test case for getting negative indices in _DEX_ClassDAta. | |
751 # | |
752 # It, possibly, caused by appling _optimize_classdata() at end of | |
753 # restore_dependencies(). But, value was comes from | |
754 # depend_idx_rel.get_value(). It already deoptimize the value. | |
755 # | |
756 def negative_depend_idx_rel_test(): | |
757 from paraspace.dex_deptracker import prepare_dep_decls | |
758 from paraspace.dex_deptracker import dex_sort_sorted_arrays | |
759 from paraspace.injection import inject_redir | |
760 | |
761 _install_dexfile_4_deptracker() | |
762 | |
763 all_dep_decls = prepare_dep_decls() | |
764 | |
765 srcdir = os.path.dirname(__file__) | |
766 datapath = os.path.join(srcdir, '..', '..', 'data') | |
767 | |
768 fake_path = os.path.join(datapath, 'fakefile.dex') | |
769 hello_path = os.path.join(datapath, 'helloworld.dex') | |
770 | |
771 fake_dex = dexfile.DEXFile.open(fake_path) | |
772 fake_linked = dexfile.DEXFile_linked.build_dependencies(fake_dex, | |
773 all_dep_decls) | |
774 | |
775 hello_dex = dexfile.DEXFile.open(hello_path) | |
776 hello_linked = dexfile.DEXFile_linked.build_dependencies(hello_dex, | |
777 all_dep_decls) | |
778 | |
779 inject_redir(fake_linked, 'Lcom/codemud/fakefile/fakefile;', | |
780 hello_linked, 'Ljava/io/File;', all_dep_decls) | |
781 | |
782 print len(hello_linked.classDatas.items) | |
783 hello_linked.to_str() | |
784 pass |