Mercurial > paraspace
comparison paraspace/tests/dexfile_test.py @ 28:5ce7ca1187b3
Pass throught markers for dex types
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 07 Jun 2011 22:57:28 +0800 |
parents | 15cb829ac442 |
children | b0cc5da28141 |
comparison
equal
deleted
inserted
replaced
27:15cb829ac442 | 28:5ce7ca1187b3 |
---|---|
125 except ImportError: | 125 except ImportError: |
126 new_dexfile = imp.load_source('dexfile', dexfile.__file__) | 126 new_dexfile = imp.load_source('dexfile', dexfile.__file__) |
127 pass | 127 pass |
128 dex_deptracker.dexfile = new_dexfile | 128 dex_deptracker.dexfile = new_dexfile |
129 dexfile = new_dexfile | 129 dexfile = new_dexfile |
130 dex_deptracker._nest_types = (dexfile.array, dexfile.cond, dexfile.switch) | |
130 pass | 131 pass |
131 | 132 |
132 | 133 |
133 def travel_dex_type_test(): | 134 def travel_dex_type_test(): |
134 from paraspace.dex_deptracker import collect_all_dep_decls | 135 from paraspace.dex_deptracker import collect_all_dep_decls |
135 from paraspace.dex_deptracker import _install_markers | 136 from paraspace.dex_deptracker import _install_markers |
136 from paraspace.dex_deptracker import _travel_dex_type | 137 from paraspace.dex_deptracker import _travel_dex_type |
137 | 138 |
138 _install_dexfile_4_deptracker() | 139 _install_dexfile_4_deptracker() |
139 | |
140 attr_infos = [attr_info | |
141 for attr_info in \ | |
142 _travel_dex_type(dexfile._DEX_AnnotationsDirectoryItem, | |
143 '_DEX_AnnotationsDirectoryItem') | |
144 ] | |
145 attr_names = set([attr_info[1] | |
146 for attr_info in attr_infos]) | |
147 print attr_names | |
148 assert '_DEX_AnnotationsDirectoryItem.classAnnotationsOff' in attr_names | |
149 assert '_DEX_AnnotationsDirectoryItem.fieldsSize' in attr_names | |
150 assert '_DEX_AnnotationsDirectoryItem.methodsSize' in attr_names | |
151 assert '_DEX_AnnotationsDirectoryItem.parametersSize' in attr_names | |
152 assert '_DEX_AnnotationsDirectoryItem.fieldAnnotationsItems' in attr_names | |
153 assert '_DEX_AnnotationsDirectoryItem.fieldAnnotationsItems.items.*' in attr_names | |
154 assert '_DEX_AnnotationsDirectoryItem.methodAnnotationsItems' in attr_names | |
155 assert '_DEX_AnnotationsDirectoryItem.parameterAnnotationsItems' in attr_names | |
156 | |
157 all_dep_decls = collect_all_dep_decls() | |
158 _install_markers(all_dep_decls) | |
159 | 140 |
160 attr_infos = [attr_info | 141 attr_infos = [attr_info |
161 for attr_info in \ | 142 for attr_info in \ |
162 _travel_dex_type(dexfile._DEX_AnnotationsDirectoryItem, | 143 _travel_dex_type(dexfile._DEX_AnnotationsDirectoryItem, |
163 '_DEX_AnnotationsDirectoryItem') | 144 '_DEX_AnnotationsDirectoryItem') |
170 assert '_DEX_AnnotationsDirectoryItem.parametersSize' in attr_names | 151 assert '_DEX_AnnotationsDirectoryItem.parametersSize' in attr_names |
171 assert '_DEX_AnnotationsDirectoryItem.fieldAnnotationsItems' in attr_names | 152 assert '_DEX_AnnotationsDirectoryItem.fieldAnnotationsItems' in attr_names |
172 assert '_DEX_AnnotationsDirectoryItem.fieldAnnotationsItems.items.*' in attr_names | 153 assert '_DEX_AnnotationsDirectoryItem.fieldAnnotationsItems.items.*' in attr_names |
173 assert '_DEX_AnnotationsDirectoryItem.methodAnnotationsItems' in attr_names | 154 assert '_DEX_AnnotationsDirectoryItem.methodAnnotationsItems' in attr_names |
174 assert '_DEX_AnnotationsDirectoryItem.parameterAnnotationsItems' in attr_names | 155 assert '_DEX_AnnotationsDirectoryItem.parameterAnnotationsItems' in attr_names |
156 | |
157 all_dep_decls = collect_all_dep_decls() | |
158 _install_markers(all_dep_decls) | |
159 | |
160 attr_infos = [attr_info | |
161 for attr_info in \ | |
162 _travel_dex_type(dexfile._DEX_AnnotationsDirectoryItem, | |
163 '_DEX_AnnotationsDirectoryItem') | |
164 ] | |
165 attr_names = set([attr_info[1] | |
166 for attr_info in attr_infos]) | |
167 assert '_DEX_AnnotationsDirectoryItem.classAnnotationsOff' in attr_names | |
168 assert '_DEX_AnnotationsDirectoryItem.fieldsSize' in attr_names | |
169 assert '_DEX_AnnotationsDirectoryItem.methodsSize' in attr_names | |
170 assert '_DEX_AnnotationsDirectoryItem.parametersSize' in attr_names | |
171 assert '_DEX_AnnotationsDirectoryItem.fieldAnnotationsItems' in attr_names | |
172 assert '_DEX_AnnotationsDirectoryItem.fieldAnnotationsItems.items.*' in attr_names | |
173 assert '_DEX_AnnotationsDirectoryItem.methodAnnotationsItems' in attr_names | |
174 assert '_DEX_AnnotationsDirectoryItem.parameterAnnotationsItems' in attr_names | |
175 pass | 175 pass |
176 | 176 |
177 | 177 |
178 def _install_markers_test(): | 178 def _install_markers_test(): |
179 from paraspace.dex_deptracker import collect_all_dep_decls | 179 from paraspace.dex_deptracker import collect_all_dep_decls |