Changeset 228 for test/pyregfi-smoketest.py
- Timestamp:
- 04/18/11 16:25:46 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/pyregfi-smoketest.py
r227 r228 5 5 import io 6 6 import time 7 import threading 7 8 import pyregfi 8 9 … … 189 190 pass 190 191 192 193 def threadIterMain(iter): 194 x = 0 195 try: 196 for k in iter: 197 #x += len(k.name) + len(k.subkeys) 198 pass 199 except Exception as e: 200 print("%s dying young: %s" % (threading.current_thread().name, repr(e))) 201 # Exceptions are thrown on iteration because python state gets out of 202 # whack. That's fine, because we're really just interested in finding 203 # segfaults. People should not use iterators without locks, but it 204 # should at least not segfault on them. 205 pass 206 print("%s finished" % threading.current_thread().name) 207 208 def iterMultithread(hive, fh): 209 num_threads = 10 210 iter = pyregfi.HiveIterator(hive) 211 threads = [] 212 for t in range(0,num_threads): 213 threads.append(threading.Thread(target=threadIterMain, args=(iter,))) 214 for t in threads: 215 t.start() 216 for t in threads: 217 t.join() 218 219 191 220 tests = { 192 221 "iterTallyNames":iterTallyNames, … … 197 226 "iterIterWalk":iterIterWalk, 198 227 "iterCallbackIO":iterCallbackIO, 228 "iterMultithread":iterMultithread, 199 229 } 200 230
Note: See TracChangeset
for help on using the changeset viewer.