[pypy-svn] r71819 - pypy/benchmarks/own/twisted

fijal at codespeak.net fijal at codespeak.net
Fri Mar 5 18:26:21 CET 2010


Author: fijal
Date: Fri Mar  5 18:26:20 2010
New Revision: 71819

Modified:
   pypy/benchmarks/own/twisted/benchlib.py
Log:
Better detection of running out of TCP connections


Modified: pypy/benchmarks/own/twisted/benchlib.py
==============================================================================
--- pypy/benchmarks/own/twisted/benchlib.py	(original)
+++ pypy/benchmarks/own/twisted/benchlib.py	Fri Mar  5 18:26:20 2010
@@ -4,6 +4,8 @@
 from twisted.internet import reactor
 from twisted.python import log
 
+failure = 0
+
 class Client(object):
     def __init__(self, reactor):
         self._reactor = reactor
@@ -34,9 +36,10 @@
               'in %(duration)s seconds)')
 
 def benchmark_report(acceptCount, duration, name):
+    global failure
     if acceptCount < 10:
-        reactor.stop()
-        raise Exception("Run out of TCP connections!")
+        failure = 1
+        raise Exception("Run out of TCP connections")
     print PRINT_TEMPL % {
         'stats'    : acceptCount / duration,
         'name'     : name,
@@ -77,6 +80,7 @@
     d.addErrback(log.err)
     reactor.callWhenRunning(d.addBoth, lambda ign: reactor.stop())
     reactor.run()
+    sys.exit(failure)
 
 def multidriver(*f):
     jobs = iter(f)



More information about the Pypy-commit mailing list