summaryrefslogtreecommitdiff
path: root/test/monkey9p.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/monkey9p.py')
-rw-r--r--test/monkey9p.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/monkey9p.py b/test/monkey9p.py
index c0e99fb8..ee0b0ebc 100644
--- a/test/monkey9p.py
+++ b/test/monkey9p.py
@@ -641,11 +641,11 @@ def op_write(sess, op):
ok, body = w.call(TOPEN, struct.pack('<IB', fid, mode), timeout)
res.add(open_kind(path, mode), path, ok, None if ok else body)
sizes = chunking(op.get('chunks', 'whole'), len(data), w.msize - 23)
- allowances(res, path, data, sizes, w.msize - 24)
opened = ok
sent = data
if ok:
offset = 0
+ took = []
for size in sizes:
piece = data[offset:offset + size]
ok, body = w.call(TWRITE, struct.pack('<IQI', fid, op.get('offset', offset), len(piece)) + piece, timeout)
@@ -654,8 +654,13 @@ def op_write(sess, op):
res.add('write' if mode & 3 else 'write-badfid', path, ok, None if ok else body)
offset += size
sent = data[:offset]
+ if ok:
+ took.append(size)
if not ok and op.get('stop_on_error', True):
break
+ # Misses are allowed the Twrites that succeeded: a line written a
+ # byte a Twrite is a look a byte, each its own write.
+ allowances(res, path, data[:sum(took)], took, w.msize - 24)
ok, body = w.call(TCLUNK, struct.pack('<I', fid), timeout)
res.add('clunk-write' if mode & 3 else 'clunk', path, ok, None if ok else body)
# What the open holds when it closes: the last line written, if unended.
@@ -850,11 +855,12 @@ def op_hwrite(sess, op):
fid, path, mode, off, _ = h
data = dec(op['data'])[:sess.wire.msize - 23] # one Twrite
h[4] = data
- allowances(res, path, data, [len(data)], sess.wire.msize - 24)
ok, body = sess.wire.call(TWRITE, struct.pack('<IQI', fid, off[0], len(data)) + data,
SLOW_TIMEOUT if slow(data) else TIMEOUT)
res.add('write' if mode & 3 else 'write-badfid', path, ok, None if ok else body)
if ok:
+ allowances(res, path, data, [len(data)], sess.wire.msize - 24)
+ if ok:
off[0] += len(data)
return res
@@ -1498,9 +1504,9 @@ def one_failure_rule(ctx, res):
and w[1].rstrip('/') != '/pane/new']
errs = occurrences(res.window, 'err')
msgs = occurrences(res.window, 'msg')
- # Only for a write that succeeded: a failed one logs its one err.
- failed_paths = {w[1] for w in failed}
- allowed = sum(r[3] for r in res.requests if r[0] == 'allow' and r[1] not in failed_paths)
+ # Allowed only the Twrites that succeeded (allowances): a failed one
+ # logs its one err.
+ allowed = sum(r[3] for r in res.requests if r[0] == 'allow')
# fs.md 'A write of command lines ... what is left when it closes runs at
# the close ... and its failure is in the log alone'.
closes = [r for r in res.requests if r[0] == 'close-runs']