The unified diff between revisions [b6fdb89f..] and [fddcb91e..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "on_the_fly.py"
# from [1642fa6940d505fd021081a6eed9f5a93d4dc7cd]
# to [f15c421520b003282b811db3c3d00bc5d99d2965]
#
# patch "test_hooks.lua"
# from [26c8d497e4f72204748f1f00d4a4138bc83bdbaa]
# to [1ae5514e8f53c56161a69d6f6fc9c37cddf48300]
#
============================================================
--- on_the_fly.py 1642fa6940d505fd021081a6eed9f5a93d4dc7cd
+++ on_the_fly.py f15c421520b003282b811db3c3d00bc5d99d2965
@@ -5,9 +5,10 @@ from shutil import copyfile
import random
from random import choice, randint
from shutil import copyfile
-from os import environ, WEXITSTATUS
+from os import environ, fork, WEXITSTATUS, WIFSIGNALED, WIFEXITED, WTERMSIG
+import os
from popen2 import Popen3
-from signal import SIGTERM
+from signal import SIGTERM, SIGKILL
from time import sleep
TEST_BRANCH = 'benchmark-test-branch'
@@ -58,11 +59,18 @@ def monotone(db, args):
stdout = p.fromchild
lines = stdout.readlines()
w = p.wait()
- exitcode = WEXITSTATUS(w)
- if exitcode != 0:
+ exit_code = WEXITSTATUS(w)
+ if WIFSIGNALED(w):
+ exit_signal = WTERMSIG(w)
+ if exit_signal != SIGTERM and exit_signal != SIGKILL:
+ print>>stderr
+ print>>stderr, "monotone process exited with signal %d" % exit_signal
+ print>>stderr, "Command was: %s" % ' '.join(cmd)
+ exit(5)
+ elif WIFEXITED(w) and exit_code != 0:
print>>stderr
- print>>stderr, "monotone process exited with status %d" % exitcode
- print>>stderr, "cmd: %s" % ' '.join(cmd)
+ print>>stderr, "monotone process exited with status %d" % exit_code
+ print>>stderr, "Command was: %s" % ' '.join(cmd)
exit(3)
return lines
@@ -116,7 +124,7 @@ def cert_leaf_rev(db, graph, frontier):
rev = frontier.pop(randint(0,len(frontier)-1))
assert len(frontier)
- monotone(db, "automate cert %s branch %s" % (rev, TEST_BRANCH))
+ monotone(db, "cert %s branch %s" % (rev, TEST_BRANCH))
if rev in graph:
frontier += graph[rev]
del graph[rev]
@@ -132,15 +140,30 @@ def serve(db, branch):
if fork():
# parent
sleep(SERVE_WAIT)
- pid = int(file(PID_FILE).read)
+ pid = int(file(PID_FILE).read())
return pid
else:
# child
- monotone(db, 'serve --pid-file=%s %s' % (PID_FILE, TEST_BRANCH))
+ try:
+ os.remove(PID_FILE)
+ except OSError:
+ pass
+ try:
+ monotone(db, 'serve --pid-file=%s %s' % (PID_FILE, TEST_BRANCH))
+ except SystemExit, e:
+ # try and cleanup
+ try:
+ pid = int(file(PID_FILE).read())
+ os.kill(pid, SIGKILL)
+ os.remove(PID_FILE)
+ except OSError:
+ pass
+ exit(9)
+
def pull(db, branch):
- monotone(db, 'pull %S' % TEST_BRANCH)
+ monotone(db, 'pull localhost %s' % TEST_BRANCH)
def serve_pull(serve_db, pull_db):
@@ -148,7 +171,7 @@ def serve_pull(serve_db, pull_db):
pull(pull_db, TEST_BRANCH)
- os.kill(pid, SIGTERM)
+ os.kill(pid, SIGKILL)
def fresh_db(db):
monotone(db, "db init")
============================================================
--- test_hooks.lua 26c8d497e4f72204748f1f00d4a4138bc83bdbaa
+++ test_hooks.lua 1ae5514e8f53c56161a69d6f6fc9c37cddf48300
@@ -25,3 +25,11 @@ end
function get_author(branchname)
return "shootout@example.com"
end
+
+function get_netsync_read_permitted (collection, identity)
+ return true
+end
+
+function get_netsync_write_permitted (identity)
+ return true
+end