- Timestamp:
- 04/05/11 11:17:41 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/pyregfi-smoketest.py
r224 r225 3 3 import sys 4 4 import gc 5 import io 5 6 import time 6 7 import pyregfi 8 7 9 8 10 def usage(): … … 15 17 # Gathers various (meaningless) statistics to exercise simple attribute access 16 18 # and to hopefully smoke out any bugs that can be identified by changing stats 17 def iterTallyNames(hive ):19 def iterTallyNames(hive, fh): 18 20 key_count = 0 19 21 key_lens = 0 … … 60 62 # to find the same key again, verifying it is the same. This test is currently 61 63 # very slow because no key caching is used. 62 def iterParentWalk(hive ):64 def iterParentWalk(hive, fh): 63 65 i = 1 64 66 for k in hive: … … 77 79 # Uses the HiveIterator to walk all keys 78 80 # Gathers various (meaningless) statistics about data/data_raw attributes 79 def iterTallyData(hive ):81 def iterTallyData(hive, fh): 80 82 data_stat = 0.0 81 83 dataraw_stat = 0.0 … … 127 129 # list dictionary access. Also builds nonsensical statistics as an excuse 128 130 # to access various base structure attributes. 129 def recurseKeyTally(hive ):131 def recurseKeyTally(hive, fh): 130 132 checkValues(hive.root) 131 133 recurseTree(hive.root, checkValues) … … 135 137 136 138 # Iterates hive gathering stats about security and classname records 137 def iterFetchRelated(hive ):139 def iterFetchRelated(hive, fh): 138 140 security_stat = 0.0 139 141 classname_stat = 0.0 … … 157 159 158 160 159 def iterIterWalk(hive ):161 def iterIterWalk(hive, fh): 160 162 sk_stat = 0.0 161 163 v_stat = 0.0 … … 183 185 184 186 185 187 def iterCallbackIO(hive, fh): 188 fh.seek(0) 189 new_fh = io.BytesIO(fh.read()) 190 new_hive = pyregfi.Hive(new_fh) 191 for k in new_hive: 192 pass 193 194 186 195 if len(sys.argv) < 2: 187 196 usage() … … 196 205 ("iterIterWalk",iterIterWalk),] 197 206 198 tests = [("iter IterWalk",iterIterWalk),]207 tests = [("iterCallbackIO",iterCallbackIO),] 199 208 200 209 … … 211 220 tstr = "'%s' on '%s'" % (tname,hname) 212 221 print("##BEGIN %s:" % tstr) 213 t(hive )222 t(hive, fh) 214 223 print("##END %s; runtime=%f; messages:" % (tstr, time.time() - teststart)) 215 224 print(pyregfi.GetLogMessages())
Note: See TracChangeset
for help on using the changeset viewer.