Reviewers: Michael Starzinger,
Message:
PTAL.
Description:
Test runner: More fixes.
This should intercept Ctrl+C better, and also fix error messages sent by
network
peers to actually be shown.
Please review this at https://codereview.chromium.org/11036005/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M tools/testrunner/local/execution.py
M tools/testrunner/network/endpoint.py
M tools/testrunner/network/network_execution.py
M tools/testrunner/server/work_handler.py
Index: tools/testrunner/local/execution.py
diff --git a/tools/testrunner/local/execution.py
b/tools/testrunner/local/execution.py
index
fd331e239fbf7ef92db9d263a42039d85cceff9f..0d214677ede8a2b0bb674a3661eb1991a5e57aaa
100644
--- a/tools/testrunner/local/execution.py
+++ b/tools/testrunner/local/execution.py
@@ -57,6 +57,8 @@ def RunTest(job):
return (job.id, dep_output, time.time() - start_time)
output = commands.Execute(job.command, job.verbose, job.timeout)
return (job.id, output, time.time() - start_time)
+ except KeyboardInterrupt:
+ return (-1, -1, 0)
except Exception, e:
print(">>> EXCEPTION: %s" % e)
return (-1, -1, 0)
@@ -110,7 +112,9 @@ class Runner(object):
it = pool.imap_unordered(RunTest, queue, kChunkSize)
for result in it:
test_id = result[0]
- if test_id < 0:
+ if test_id < 0 or self.terminate:
+ pool.terminate()
+ pool.join()
raise BreakNowException("User pressed Ctrl+C or IO went wrong")
test = test_map[test_id]
self.indicator.AboutToRun(test)
@@ -124,6 +128,9 @@ class Runner(object):
self.succeeded += 1
self.remaining -= 1
self.indicator.HasRun(test)
+ except KeyboardInterrupt:
+ pool.terminate()
+ pool.join()
except:
pool.terminate()
pool.join()
Index: tools/testrunner/network/endpoint.py
diff --git a/tools/testrunner/network/endpoint.py
b/tools/testrunner/network/endpoint.py
index
8350feee5984051ad8c7019a647431bf0d515bac..5dc2b9f902450aab5ae996093511ff97ba76694f
100644
--- a/tools/testrunner/network/endpoint.py
+++ b/tools/testrunner/network/endpoint.py
@@ -60,7 +60,6 @@ class EndpointProgress(progress.ProgressIndicator):
self.sender_lock.acquire()
while keep_running:
time.sleep(0.1)
- t1 = time.time()
# This should be "atomic enough" without locking :-)
# (We don't care which list any new elements get appended to, as long
# as we don't lose any and the last one comes last.)
@@ -77,7 +76,10 @@ class EndpointProgress(progress.ProgressIndicator):
result = []
for t in tests:
result.append(t.PackResult())
- compression.Send(result, self.sock)
+ try:
+ compression.Send(result, self.sock)
+ except:
+ self.runner.terminate = True
for t in tests:
self.server.CompareOwnPerf(t, self.context.arch, self.context.mode)
tests = []
@@ -116,7 +118,7 @@ def Execute(workspace, ctx, tests, sock, server):
e.filename)
else:
message = "%s" % e
- compression.Send([-1, message], sock)
+ compression.Send([[-1, message]], sock)
progress_indicator.HasRun(None) # Sentinel to signal the end.
progress_indicator.sender_lock.acquire() # Released when sending is
done.
progress_indicator.sender_lock.release()
Index: tools/testrunner/network/network_execution.py
diff --git a/tools/testrunner/network/network_execution.py
b/tools/testrunner/network/network_execution.py
index
b17249dfac2bd3a5fb9cc6a2bb72444b354ab739..0cdba7ee627b348de98a7eacac06968dcfb1dbbc
100644
--- a/tools/testrunner/network/network_execution.py
+++ b/tools/testrunner/network/network_execution.py
@@ -187,8 +187,8 @@ class NetworkedRunner(execution.Runner):
test_id = data[0]
if test_id < 0:
# The peer is reporting an error.
- print("Peer %s reports error: %s" % (peer.address, data[1]))
- rec.Advance()
+ with self.lock:
+ print("Peer %s reports error: %s" % (peer.address,
data[1]))
continue
test = test_map.pop(test_id)
test.MergeResult(data)
@@ -214,7 +214,11 @@ class NetworkedRunner(execution.Runner):
self.indicator.HasRun(test)
rec.Advance()
peer.runtime = time.time() - start_time
- except Exception:
+ except KeyboardInterrupt:
+ sock.close()
+ raise
+ except Exception, e:
+ print("Got exception: %s" % e)
pass # Fall back to local execution.
else:
compression.Send([constants.UNRESPONSIVE_PEER, peer.address],
Index: tools/testrunner/server/work_handler.py
diff --git a/tools/testrunner/server/work_handler.py
b/tools/testrunner/server/work_handler.py
index
80f01781ebb37427c20ac4210dfe3638f15ddcfb..6bf7d43cf946bb523e6a2e2ac42d32475bddd150
100644
--- a/tools/testrunner/server/work_handler.py
+++ b/tools/testrunner/server/work_handler.py
@@ -76,7 +76,7 @@ class WorkHandler(SocketServer.BaseRequestHandler):
def _SendResponse(self, error_message=None):
try:
if error_message:
- compression.Send([-1, error_message], self.request)
+ compression.Send([[-1, error_message]], self.request)
compression.Send(constants.END_OF_STREAM, self.request)
return
except Exception, e:
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev