amos 73a5240295 Batches 21 and 18: add 74 calibrated tasks (40 Bos redo, 34 HWE code-gen)
Batch 21 (20261027-A-bos-redo-21) rebuilt 40 of the 53 rejected Bos-qiao
environments: hidden assertions that ran inside the candidate's process
now run in a trusted parent that reads observations from a low-UID
worker; gold bytes are unchanged. 9 were excluded for scope (ROS2,
oversize, security core), 3 are blocked because the source requires an
exec bit the platform does not freeze, 1 lacks requests/bs4 in trace6.

Batch 18 (20261026-C-hwe-codegen-18) adds its last 34 of 134 tasks; the
first 100 landed in 2f32624d.

Claude reviewed 74/74 USABLE against current digests, canonical
families, no ID or source overlap with main, plain public docs. Only the
new task directories are taken; the stale pre-batch-20 copies of
concur-release-capsule and resource-temp-link on the batch 21 branch and
both branches' progress notes stay as main has them. Difficulty is
unmeasured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 10:23:12 +08:00

618 lines
24 KiB
Python

"""Protected independent byte model. Candidate code only runs in subprocesses."""
import hashlib
import json
from pathlib import Path
import random
import re
import shutil
import subprocess
import sys
import tempfile
FILES = ('sequence.hpp', 'sequence_internal.hpp', 'record_table.cpp',
'record_cursor.cpp', 'command_session.cpp', 'main.cpp')
MIN, MAX = -(2 ** 63), 2 ** 63 - 1
API_STATUSES = {b'OK', b'BAD', b'MISSING', b'EXISTS', b'RANGE'}
OBSERVER = r'''
#include "sequence.hpp"
#include <iostream>
#include <sstream>
#include <string>
#include <memory>
#include <type_traits>
using namespace sequence;
std::string hex(const ByteString& bytes) {
const char* digits="0123456789abcdef";
std::string out;
for (auto b:bytes) { out+=digits[b>>4]; out+=digits[b&15]; }
return out;
}
ByteString unhex(std::string s) {
ByteString out;
if (s=="-") return out;
for (std::size_t i=0;i<s.size();i+=2) out.push_back(static_cast<unsigned char>(std::stoul(s.substr(i,2),nullptr,16)));
return out;
}
std::string status(Status s) {
switch(s) {
case Status::OK:return "OK";
case Status::BAD:return "BAD";
case Status::MISSING:return "MISSING";
case Status::EXISTS:return "EXISTS";
case Status::RANGE:return "RANGE";
}
return "UNKNOWN:"+std::to_string(static_cast<std::underlying_type<Status>::type>(s));
}
int main() {
std::unique_ptr<Engine> engines[2];
std::string line;
while(std::getline(std::cin,line)) {
std::istringstream in(line);
std::string op,data;
int e=0;
std::int64_t id=0,value=0,extra=0;
in>>op;
if(op=="N") {
engines[0].reset(new Engine); engines[1].reset(new Engine);
std::cout<<"N\n"; continue;
}
in>>e>>id;
Engine& engine=*engines[e];
if(op=="P" || op=="PC") {
in>>value>>data;
auto bytes=unhex(data);
auto result=engine.put(id,value,bytes);
std::cout<<"P "<<status(result)<<'\n';
if(op=="PC") { bytes.assign(96,255); }
} else if(op=="E") std::cout<<"E "<<status(engine.erase(id))<<'\n';
else if(op=="O") std::cout<<"O "<<status(engine.open(id))<<'\n';
else if(op=="C") std::cout<<"C "<<status(engine.close(id))<<'\n';
else if(op=="G" || op=="GC") {
auto r=engine.get(id);
std::cout<<"G "<<status(r.status)<<' '<<r.id<<' '<<r.value<<' '<<r.payload.size()<<' '<<hex(r.payload)<<'\n';
if(op=="GC") { r.payload.assign(96,255); }
} else if(op=="R") {
in>>value; auto r=engine.read(id,value);
std::cout<<"R "<<status(r.status)<<' '<<r.position<<' '<<(r.eof?1:0)<<' '<<r.bytes.size()<<' '<<hex(r.bytes)<<'\n';
} else if(op=="S" || op=="T") {
auto r=[&]() {
if(op=="S") { in>>value>>extra; return engine.seek(id,value,extra); }
return engine.tell(id);
}();
std::cout<<op<<' '<<status(r.status)<<' '<<r.position<<'\n';
}
}
return 0;
}
'''
ENTRY_OBSERVER = r'''
#include "sequence.hpp"
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
std::string hex(const std::string& bytes) {
const char* digits="0123456789abcdef"; std::string out;
for(unsigned char b:bytes) { out+=digits[b>>4]; out+=digits[b&15]; }
return out;
}
void observed(char tag,std::istream& in) {
std::ostringstream out,err;
out << std::hex << std::showpos << std::showbase << std::setw(13) << std::setfill('@');
int rc=sequence::run_cli(in,out,err);
std::cout<<tag<<' '<<rc<<' '<<out.str().size()<<' '<<hex(out.str())<<' '<<err.str().size()<<' '<<hex(err.str())<<'\n';
}
int main() {
std::size_t length;
while(std::cin>>length) {
std::cin.get();
std::string data(length,'\0');
std::cin.read(data.data(),static_cast<std::streamsize>(length));
std::istringstream in(data);
observed('C',in);
in.clear();
observed('D',in);
}
return 0;
}
'''
def rendered(records):
return b''.join(('%d|%d|%d|%s\n' % (i, v, len(p), p.hex())).encode()
for i, (v, p) in sorted(records.items()))
class Model:
def __init__(self):
self.records = [{}, {}]
self.handles = [{}, {}]
def call(self, op, e, ident, *args):
rec, handles = self.records[e], self.handles[e]
status, result = 'OK', ()
if op in ('P', 'E', 'G'):
if not 0 <= ident <= 31:
status = 'BAD'
elif op == 'P':
value, payload = args
if not 0 <= value <= 1000000 or len(payload) > 96:
status = 'BAD'
else:
rec[ident] = value, bytes(payload)
elif ident not in rec:
status = 'MISSING'
elif op == 'E':
del rec[ident]
else:
result = (ident,) + rec[ident]
else:
if not 0 <= ident <= 7:
status = 'BAD'
elif op == 'R' and not 0 <= args[0] <= 4096:
status = 'BAD'
elif op == 'S' and args[1] not in (0, 1, 2):
status = 'BAD'
elif op == 'O':
if ident in handles:
status = 'EXISTS'
else:
handles[ident] = [rendered(rec), 0]
elif ident not in handles:
status = 'MISSING'
elif op == 'C':
del handles[ident]
elif op == 'T':
result = (handles[ident][1],)
elif op == 'R':
stream, position = handles[ident]
data = stream[position:position + args[0]]
position += len(data)
handles[ident][1] = position
result = (data, position, position == len(stream))
elif op == 'S':
stream, position = handles[ident]
offset, whence = args
target = (0, position, len(stream))[whence] + offset
if not 0 <= target <= len(stream):
status = 'RANGE'
else:
handles[ident][1] = target
result = (target,)
if status != 'OK':
if op == 'G':
result = (0, 0, b'')
elif op == 'R':
result = (b'', 0, False)
elif op in ('S', 'T'):
result = (0,)
return status, result
def raw(op, status, result):
if op == 'G':
ident, value, data = result
return 'G %s %d %d %d %s\n' % (status, ident, value, len(data), data.hex())
if op == 'R':
data, position, eof = result
return 'R %s %d %d %d %s\n' % (status, position, eof, len(data), data.hex())
if op in ('S', 'T'):
return '%s %s %d\n' % (op, status, result[0])
return '%s %s\n' % (op, status)
def api_scene():
model, commands, expected = Model(), [], []
def emit(op, *args):
nonlocal model
if op == 'N':
model = Model()
commands.append('N\n')
expected.append('N\n')
return
semantic = {'PC': 'P', 'GC': 'G'}.get(op, op)
text = [op] + [a.hex() or '-' if isinstance(a, bytes) else str(a) for a in args]
commands.append(' '.join(text) + '\n')
expected.append(raw(semantic, *model.call(semantic, *args)))
def observe():
for e in (0, 1):
for ident in range(32):
emit('G', e, ident)
for handle in range(8):
emit('T', e, handle)
emit('R', e, handle, 4096)
emit('R', e, handle, 4096)
def background(missing_record=None, missing_handle=None):
emit('N')
for wave in range(3):
for e in (0, 1):
for ident in range(32):
emit('P', e, ident, 101 + ident + wave * 100 + e * 1000,
bytes([ident + 1, wave + 1, e + 1]))
if wave < 2:
for handle in range(wave * 4, wave * 4 + 4):
emit('O', e, handle)
emit('S', e, handle, handle + e + 1, 0)
if missing_record is not None:
emit('E', 0, missing_record)
if missing_handle is not None:
emit('C', 0, missing_handle)
emit('N')
for e in (0, 1):
for op in ('G', 'E', 'C', 'T'):
emit(op, e, 0)
emit('R', e, 0, 1)
emit('S', e, 0, 0, 0)
emit('O', e, 0)
emit('R', e, 0, 0)
emit('R', e, 0, 4096)
for w in range(3):
emit('S', e, 0, 0, w)
emit('C', e, 0)
for e in (0, 1):
for ident in reversed(range(32)):
emit('P', e, ident, 1000000, bytes(range(96)))
emit('G', e, ident)
for handle in (0, 7):
emit('O', e, handle)
emit('R', e, handle, 4096)
emit('T', e, handle)
emit('R', e, handle, 0)
emit('T', e, handle)
emit('R', e, handle, 4096)
emit('R', e, handle, 1)
emit('C', e, handle)
emit('T', e, handle)
emit('R', e, handle, 1)
emit('S', e, handle, 0, 0)
emit('C', e, handle)
emit('O', e, handle)
emit('C', e, handle)
for ident in (0, 31):
emit('E', e, ident)
emit('G', e, ident)
emit('E', e, ident)
emit('N')
for e in (0, 1):
emit('PC', e, 0, 9, b'\x01\xff\n')
emit('GC', e, 0)
emit('G', e, 0)
emit('O', e, 0)
emit('P', e, 0, 0, b'\0' * 96)
emit('G', e, 0)
emit('P', e, 31, 1000000, b'')
emit('O', e, 7)
emit('R', e, 0, 4096)
emit('R', e, 7, 4096)
emit('C', e, 0)
emit('O', e, 0)
emit('R', e, 0, 4096)
# Every split position, with no seek between the two reads.
stream_records = {0: (0, b''), 9: (17, b'\x00\xff\x0a'), 31: (1000000, b'abcdef')}
length = len(rendered(stream_records))
for split in range(1, length):
emit('N')
for ident, (value, data) in stream_records.items():
emit('P', 0, ident, value, data)
emit('O', 0, 0)
emit('R', 0, 0, split)
emit('T', 0, 0)
emit('R', 0, 0, 0)
emit('R', 0, 0, 1)
emit('R', 0, 0, 4096)
emit('T', 0, 0)
emit('N')
for ident, (value, data) in stream_records.items():
emit('P', 0, ident, value, data)
emit('O', 0, 7)
for whence in range(3):
for target in list(range(length + 1)) + [-1, length + 1]:
base = (0, model.handles[0][7][1], length)[whence]
emit('S', 0, 7, target - base, whence)
emit('T', 0, 7)
emit('R', 0, 7, 1)
for target in (0, length, 0, length):
base = (0, model.handles[0][7][1], length)[whence]
emit('S', 0, 7, target - base, whence)
emit('T', 0, 7)
emit('R', 0, 7, 1)
errors = []
signatures = [('P', 0, [0, 1, b'x']), ('P', 1, [0, 1, b'x']),
('E', 0, [0]), ('G', 0, [0]), ('O', 0, [0]), ('C', 0, [0]),
('R', 0, [0, 1]), ('R', 1, [0, 1]),
('S', 0, [0, 1, 0]), ('S', 2, [0, 1, 0]), ('T', 0, [0])]
domains = {'P': (31, 1000000), 'E': (31,), 'G': (31,), 'O': (7,),
'C': (7,), 'R': (7, 4096), 'S': (7, MAX, 2), 'T': (7,)}
for op, index, arguments in signatures:
for bad in (-1, domains[op][index] + 1, MIN, MAX):
altered = list(arguments)
altered[index] = min(bad, MAX)
errors.append((op, altered, None, None))
for op in ('E', 'G'):
errors.append((op, [3], 3, None))
for op, arguments in [('C', [4]), ('R', [4, 1]), ('S', [4, 1, 0]), ('T', [4]),
('R', [4, -1]), ('S', [4, 0, -1])]:
errors.append((op, arguments, None, 4))
errors += [('O', [0], None, None), ('P', [0, 1, b'x' * 97], None, None)]
for whence in range(3):
for offset in (MIN, MAX, -100000, 100000):
errors.append(('S', [0, offset, whence], None, None))
for op, arguments, missing_record, missing_handle in errors:
background(missing_record, missing_handle)
emit(op, 0, *arguments)
observe()
# Fixed-seed varied mutation/read/seek combinations and all live slots.
rng = random.Random(103817)
background()
for _ in range(600):
e, handle, ident = rng.randrange(2), rng.randrange(8), rng.randrange(32)
op = rng.choice(('P', 'E', 'G', 'O', 'C', 'R', 'S', 'T'))
if op == 'P':
emit(op, e, ident, rng.randrange(1000001), rng.randbytes(rng.randrange(97)) if hasattr(rng, 'randbytes') else bytes(rng.randrange(256) for _ in range(rng.randrange(97))))
elif op in ('E', 'G'):
emit(op, e, ident)
elif op == 'R':
emit(op, e, handle, rng.choice((0, 1, 2, 7, 31, 4096)))
elif op == 'S':
emit(op, e, handle, rng.randrange(-200, 201), rng.randrange(3))
else:
emit(op, e, handle)
observe()
return ''.join(commands).encode(), ''.join(expected).encode()
def split_scene():
model = Model()
commands, expected = ['N\n'], ['N\n']
for op, arguments in [('P', (0, 31, 20, b'\x01\x02\xff')), ('O', (0, 7)),
('R', (0, 7, 4)), ('R', (0, 7, 0)), ('T', (0, 7)),
('R', (0, 7, 1)), ('R', (0, 7, 4096)), ('T', (0, 7))]:
fields = [op] + [a.hex() or '-' if isinstance(a, bytes) else str(a) for a in arguments]
commands.append(' '.join(fields) + '\n')
expected.append(raw(op, *model.call(op, *arguments)))
return ''.join(commands).encode(), ''.join(expected).encode()
VERBS = {'PUT': ('P', 5), 'ERASE': ('E', 3), 'GET': ('G', 3), 'OPEN': ('O', 3),
'CLOSE': ('C', 3), 'READ': ('R', 4), 'SEEK': ('S', 5), 'TELL': ('T', 3)}
def cli_expected(data):
model, output = Model(), []
lines = data.split(b'\n') if data else []
if data.endswith(b'\n'):
lines.pop()
for line in lines[:512]:
try:
if len(line) > 1024 or not re.fullmatch(rb'[\x20-\x7e\t]*', line):
raise ValueError()
fields = re.split(rb'[ \t]+', line.strip(b' \t'))
verb = fields[0].decode('ascii')
if verb not in VERBS or len(fields) != VERBS[verb][1]:
raise ValueError()
op = VERBS[verb][0]
numeric = fields[1:-1] if verb == 'PUT' else fields[1:]
if any(not re.fullmatch(rb'-?[0-9]+', token) for token in numeric):
raise ValueError()
values = [int(token) for token in numeric]
if any(not MIN <= value <= MAX for value in values):
raise ValueError()
if verb == 'PUT':
token = fields[-1]
if token == b'-':
payload = b''
elif len(token) % 2 or not re.fullmatch(rb'[0-9a-fA-F]+', token):
raise ValueError()
else:
payload = bytes.fromhex(token.decode())
values.append(payload)
except (ValueError, UnicodeError):
output.append(b'ERR SYNTAX\n')
continue
if values[0] not in (0, 1):
output.append(b'ERR BAD\n')
continue
status, result = model.call(op, *values)
if status != 'OK':
text = 'ERR ' + status
elif op == 'G':
ident, value, payload = result
text = 'OK REC %d %d %s' % (ident, value, payload.hex() or '-')
elif op == 'R':
payload, position, eof = result
text = 'OK DATA %d %d %s' % (position, eof, payload.hex() or '-')
elif op in ('S', 'T'):
text = 'OK POS %d' % result[0]
else:
text = 'OK'
output.append((text + '\n').encode())
if len(lines) > 512:
output.append(b'ERR LIMIT\n')
return b''.join(output)
def cli_inputs():
batches = [b'', b'PUT 0 0 9 ff\nOPEN 0 0\nREAD 0 0 1\n',
b'GET 0 0\nTELL 0 0\nGET 1 0\nTELL 1 0']
standard = ['PUT 0 0 9 ff', 'ERASE 0 0', 'GET 0 0', 'OPEN 0 0',
'CLOSE 0 0', 'READ 0 0 1', 'SEEK 0 0 1 0', 'TELL 0 0']
prefix = ['PUT 0 0 17 010203', 'PUT 1 0 21 0405', 'OPEN 0 0', 'OPEN 1 0',
'READ 0 0 2', 'READ 1 0 1', 'PUT 0 0 31 0607', 'PUT 1 0 32 0809']
probes = ['GET 0 0', 'GET 1 0', 'TELL 0 0', 'TELL 1 0', 'READ 0 0 4096', 'READ 1 0 4096']
for slot in (0, 1):
batches.append(('\n'.join(prefix + ['OPEN %d 0' % slot] + probes) + '\n').encode())
for line in standard:
parts = line.split()
mutations = [' '.join(parts[:-1]), line + ' extra']
numeric_end = len(parts) - (1 if parts[0] == 'PUT' else 0)
for index in range(1, numeric_end):
for bad in ('x', '1.0', '+1', '--1', '0x1', str(MIN), str(MAX), str(MIN - 1), str(MAX + 1), '-1', '4097', '1000001', '32', '8', '3', '2'):
changed = parts.copy()
changed[index] = bad
mutations.append(' '.join(changed))
if parts[0] == 'PUT':
for payload in ('f', 'gg', '--', '00' * 97):
mutations.append('PUT 0 0 9 ' + payload)
mutations.append('PUT 9 0 9 gg')
for mutation in mutations:
batches.append(('\n'.join(prefix + [mutation] + probes) + '\n').encode())
for slot in (0, 1):
s = str(slot)
success = [f'PUT {s} 0 7 ff', f'PUT {s} 0 0 00', f'GET {s} 0',
f'PUT {s} 31 1000000 ' + 'aB' * 96, f'GET {s} 31',
f'OPEN {s} 0', f'OPEN {s} 7', f'READ {s} 0 0', f'READ {s} 7 4096',
f'SEEK {s} 0 0 2', f'TELL {s} 0', f'READ {s} 0 1',
f'SEEK {s} 0 0 0', f'SEEK {s} 0 1 1',
f'TELL {s} 0', f'READ {s} 0 1', f'SEEK {s} 7 -216 1',
f'TELL {s} 7', f'SEEK {s} 7 216 0', f'TELL {s} 7', f'READ {s} 7 1',
f'SEEK {s} 7 -216 2', f'TELL {s} 7', f'CLOSE {s} 0', f'CLOSE {s} 7',
f'TELL {s} 0', f'TELL {s} 7', f'READ {s} 7 1',
f'ERASE {s} 0', f'ERASE {s} 31', f'GET {s} 0']
batches.append(('\n'.join(success) + '\n').encode())
batches += [b'\n', b' \t\n', b'\tPUT\t00\t-0\t000\t- \t\n GET 0 0 ',
b'put 0 0 1 ff\nGET 0 0', b'PUT 0 0 9 ff\r\nGET 0 0\n']
for bad in (b'\r', b'\v', b'\f', b'\0', b'\x80', b'\xff'):
batches.append(b'PUT 0 0 9 ff' + bad + b'\nGET 0 0\n')
for length in (1024, 1025):
batches.append(b'PUT 0 0 9 ff' + b' ' * (length - 12) + b'\nGET 0 0\n')
for count in (511, 512, 513, 519):
lines = prefix.copy()
fillers = ['GET 0 0', '???', '', 'READ 0 0 -1', 'GET 1 0']
while len(lines) < 509:
lines.append(fillers[len(lines) % len(fillers)])
# Physical 510 table mutation, 511 direct observation, 512 position
# mutation observed in READ.position, 513 a forbidden further command.
lines += ['PUT 0 0 543 00', 'GET 0 0', 'READ 0 0 1', 'PUT 0 31 678 00', 'GET 0 31']
while len(lines) < count:
lines.append('GET 0 31')
batches.append(('\n'.join(lines[:count]) + ('\n' if count % 2 else '')).encode())
covered = set()
for data in batches:
covered.update(cli_statuses(cli_expected(data)))
if covered != API_STATUSES:
raise RuntimeError('generated CLI API status coverage is incomplete')
return batches
def cli_statuses(data):
result = set()
for line in data.splitlines():
if line == b'OK' or line.startswith(b'OK '):
result.add(b'OK')
elif line.startswith(b'ERR ') and line[4:] in API_STATUSES:
result.add(line[4:])
return result
def entry_statuses(data):
result = set()
for line in data.splitlines():
fields = line.split(b' ')
if len(fields) != 6 or fields[0] != b'C':
continue
try:
payload = bytes.fromhex(fields[3].decode('ascii'))
if len(payload) == int(fields[2]):
result.update(cli_statuses(payload))
except (ValueError, UnicodeError):
continue
return result
def frame_input(batches):
inputs, outputs = [], []
for data in batches:
result = cli_expected(data)
inputs.append(str(len(data)).encode() + b'\n' + data)
outputs.append(('C 0 %d %s 0 \nD 0 0 0 \n' % (len(result), result.hex())).encode())
return b''.join(inputs), b''.join(outputs)
def digest(data):
return [len(data), hashlib.sha256(data).hexdigest()[:16]]
def main():
source = Path(sys.argv[1])
# All trusted filesystem access is completed before the first compiler.
contents = {name: (source / name).read_bytes() for name in FILES}
api_input, api_output = api_scene()
split_input, split_output = split_scene()
batches = cli_inputs()
entry_input, entry_output = frame_input(batches)
smoke = b'PUT 0 2 7 616c706861\nPUT 0 9 20 ff\nOPEN 0 0\nSEEK 0 0 -10 2\nREAD 0 0 4096\nCLOSE 0 0\n'
combined = b'\n'.join([b'PUT 0 0 8 ff', b'GET 0 0', b'OPEN 0 0', b'READ 0 0 1',
b'TELL 0 0', b'SEEK 0 0 0 0', b'CLOSE 0 0', b'ERASE 0 0'] +
[line.encode() for line in ['GET', 'READ 0 0 -1', 'nope', 'PUT 1 31 0 00', 'GET 1 31']])
scenes = [('api', './observe', api_input, api_output),
('split', './observe', split_input, split_output),
('entry', './entry', entry_input, entry_output),
('cli', './viewer', combined, cli_expected(combined)),
('smoke', './viewer', smoke, cli_expected(smoke)),
('empty', './viewer', b'', b'')]
scratch = Path(tempfile.mkdtemp(prefix='sequence-', dir=Path.cwd()))
for name, data in contents.items():
(scratch / name).write_bytes(data)
(scratch / 'observe.cpp').write_text(OBSERVER)
(scratch / 'entry.cpp').write_text(ENTRY_OBSERVER)
compiler = shutil.which('c++')
if compiler is None:
raise RuntimeError('C++17 compiler unavailable')
builds = []
for observer, target in [('observe.cpp', 'observe'), ('entry.cpp', 'entry'), ('main.cpp', 'viewer')]:
builds.append([compiler, '-std=c++17', '-O0', '-I.', 'record_table.cpp',
'record_cursor.cpp', 'command_session.cpp', observer, '-o', target])
# No filesystem accesses below this point. In-memory data and argv only.
evidence = {'v': 1, 'cwd': str(scratch), 'fields': ['id', 'pid', 'argv', 'exit', 'timeout', 'in', 'expected', 'out', 'err', 'reject'], 'rows': []}
failures = []
def execute(ident, argv, data, wanted, seconds):
process = subprocess.Popen(argv, cwd=str(scratch), stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
timed_out = False
try:
out, err = process.communicate(data, timeout=seconds)
except subprocess.TimeoutExpired:
timed_out = True
process.kill()
out, err = process.communicate()
reasons = []
if timed_out:
reasons.append('timeout')
if process.returncode != 0:
reasons.append('exit')
if not ident.startswith('b') and out != wanted:
reasons.append('stdout')
if not ident.startswith('b') and err:
reasons.append('stderr')
if ident == 'entry' and entry_statuses(out) != API_STATUSES:
reasons.append('cli_status_coverage')
evidence['rows'].append([ident, process.pid, argv, process.returncode, [seconds, timed_out],
digest(data), digest(wanted), digest(out), digest(err), reasons])
failures.extend(ident + ':' + reason for reason in reasons)
return not reasons
built = True
for index, argv in enumerate(builds):
if not execute('b%d' % index, argv, b'', b'', 25):
built = False
break
if built:
for ident, executable, data, wanted in scenes:
execute(ident, [executable], data, wanted, 15)
encoded = json.dumps(evidence, separators=(',', ':'))
if len(encoded.encode()) >= 3900:
raise RuntimeError('evidence exceeds compact 3900-byte guard: %d' % len(encoded.encode()))
sys.stderr.write(encoded + '\n')
print('FAIL ' + ','.join(failures) if failures else 'PASS')
return 1 if failures else 0
if __name__ == '__main__':
sys.exit(main())