Commit 461e58f7 authored by Guido van Rossum's avatar Guido van Rossum

Add a test (checkMTStores) that runs 5 threads which each do a mixture

of small and large stores, to try and trigger bugs in the
parallel-call feature.
parent dcfb7c76
...@@ -145,3 +145,25 @@ class ThreadTests: ...@@ -145,3 +145,25 @@ class ThreadTests:
self.assertEqual(thread1.gotValueError, 1) self.assertEqual(thread1.gotValueError, 1)
self.assertEqual(thread2.gotValueError, 1) self.assertEqual(thread2.gotValueError, 1)
self.assertEqual(thread2.gotDisconnected, 1) self.assertEqual(thread2.gotDisconnected, 1)
# Run a bunch of threads doing small and large stores in parallel
def checkMTStores(self):
threads = []
for i in range(5):
t = threading.Thread(target=self.mtstorehelper)
threads.append(t)
t.start()
for t in threads:
t.join(30)
for i in threads:
self.failUnless(not t.isAlive())
# Helper for checkMTStores
def mtstorehelper(self):
name = threading.currentThread().getName()
objs = []
for i in range(10):
objs.append(MinPO("X" * 200000))
objs.append(MinPO("X"))
for obj in objs:
self._dostore(data=obj)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment