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>
461 lines
19 KiB
Python
461 lines
19 KiB
Python
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
import random
|
|
import re
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
|
|
OBSERVER = r'''#include "group.hpp"
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include <string>
|
|
#include <memory>
|
|
#include <iomanip>
|
|
#include <locale>
|
|
static std::string unhex(const std::string& value) {
|
|
std::string result;
|
|
if (value == "-") return result;
|
|
for (std::size_t i=0; i+1<value.size(); i+=2)
|
|
result.push_back(static_cast<char>(std::stoul(value.substr(i,2),nullptr,16)));
|
|
return result;
|
|
}
|
|
static std::string hex(const std::string& value) {
|
|
const char* digits="0123456789abcdef";
|
|
std::string result;
|
|
for (unsigned char c:value) { result+=digits[c>>4]; result+=digits[c&15]; }
|
|
return result;
|
|
}
|
|
struct OddPunct : std::numpunct<char> {
|
|
char do_thousands_sep() const override { return '_'; }
|
|
std::string do_grouping() const override { return "\1"; }
|
|
};
|
|
int main(int argc, char**) {
|
|
if (argc>1) return ag::run_cli(std::cin,std::cout,std::cerr);
|
|
std::unique_ptr<ag::Registry> objects[2];
|
|
objects[0].reset(new ag::Registry);
|
|
objects[1].reset(new ag::Registry);
|
|
std::string line;
|
|
while (std::getline(std::cin,line)) {
|
|
std::istringstream words(line);
|
|
char verb; int index;
|
|
words>>verb>>index;
|
|
ag::Number a=0,b=0,c=0,d=0,e=0;
|
|
words>>a>>b>>c>>d>>e;
|
|
auto& r=*objects[index];
|
|
if (verb=='Z') {
|
|
objects[index].reset(new ag::Registry);
|
|
std::cout<<"Z "<<index<<'\n';
|
|
} else if (verb=='P' || verb=='D') {
|
|
auto v=verb=='P' ? r.publish(a,b,c,d,e) : r.remove(a,b);
|
|
std::cout<<verb<<' '<<static_cast<int>(v.code)<<' '<<v.generation<<' '<<v.published<<'\n';
|
|
} else if (verb=='R') {
|
|
auto v=r.show(a,b);
|
|
std::cout<<"R "<<static_cast<int>(v.code)<<' '<<v.generation<<' '<<v.group<<' '<<v.value<<' '<<v.writable<<'\n';
|
|
} else if (verb=='W') {
|
|
auto v=r.store(a,b,c,d);
|
|
std::cout<<"W "<<static_cast<int>(v.code)<<' '<<v.generation<<' '<<v.group<<' '<<v.value<<' '<<v.accepted<<'\n';
|
|
} else if (verb=='G') {
|
|
auto v=r.group(a,b);
|
|
std::cout<<"G "<<static_cast<int>(v.code)<<' '<<v.generation<<' '<<v.first<<' '<<v.count<<' '<<v.writable<<'\n';
|
|
} else if (verb=='L' || verb=='V') {
|
|
auto v=r.list(a);
|
|
if (verb=='V') for (auto& row:v.attributes) { row.value+=123; row.group=-9; }
|
|
std::cout<<verb<<' '<<static_cast<int>(v.code)<<' '<<v.attributes.size();
|
|
for (auto x:v.attributes) std::cout<<' '<<x.name<<' '<<x.group<<' '<<x.generation<<' '<<x.value<<' '<<x.writable;
|
|
std::cout<<'\n';
|
|
} else if (verb=='C') {
|
|
std::istringstream again(line);
|
|
std::string data; again>>verb>>index>>data;
|
|
std::istringstream input(unhex(data));
|
|
std::ostringstream output,diagnostic;
|
|
output.imbue(std::locale(std::locale::classic(),new OddPunct));
|
|
output<<std::hex<<std::showpos;
|
|
output.width(37); output.fill('*');
|
|
int rc=ag::run_cli(input,output,diagnostic);
|
|
std::string out=output.str(),err=diagnostic.str();
|
|
std::cout<<"C "<<rc<<' '<<out.size()<<':'<<hex(out)<<' '<<err.size()<<':'<<hex(err)<<'\n';
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
'''
|
|
MIN = -(2**63)
|
|
MAX = 2**63-1
|
|
NAMES = ['OK', 'RANGE', 'EXISTS', 'ABSENT', 'READONLY']
|
|
ARITY = {'publish':5, 'remove':2, 'show':2, 'store':4, 'group':2, 'list':1}
|
|
OP = {'publish':'P', 'remove':'D', 'show':'R', 'store':'W', 'group':'G', 'list':'L'}
|
|
REQUIRED = {'P':{0,1,2}, 'D':{0,1,3}, 'R':{0,1,3}, 'W':{0,1,3,4}, 'G':{0,1,3}, 'L':{0,1}}
|
|
|
|
class Model:
|
|
def __init__(self):
|
|
self.groups = {}
|
|
self.history = {}
|
|
def rows(self, parent):
|
|
return sorted((name,g,generation,value,writable)
|
|
for (p,g),(generation,first,count,writable,values) in self.groups.items() if p==parent
|
|
for name,value in values.items())
|
|
def execute(self, op, a):
|
|
p=a[0]
|
|
if op=='P':
|
|
p,g,first,count,w=a
|
|
if not (0<=p<=3 and 0<=g<=7 and 0<=first<=15 and 1<=count<=4 and first+count<=16 and w in (0,1)):
|
|
return (1,0,0)
|
|
occupied={row[0] for row in self.rows(p)}
|
|
if (p,g) in self.groups or any(n in occupied for n in range(first,first+count)):
|
|
return (2,0,0)
|
|
generation=self.history.get((p,g),0)+1
|
|
self.history[p,g]=generation
|
|
self.groups[p,g]=(generation,first,count,w,{n:0 for n in range(first,first+count)})
|
|
return (0,generation,count)
|
|
if op=='D':
|
|
p,g=a
|
|
if not (0<=p<=3 and 0<=g<=7): return (1,0,0)
|
|
group=self.groups.pop((p,g),None)
|
|
return (0,group[0],group[2]) if group else (3,0,0)
|
|
if op=='G':
|
|
p,g=a
|
|
if not (0<=p<=3 and 0<=g<=7): return (1,0,-1,0,0)
|
|
group=self.groups.get((p,g))
|
|
return (0,*group[:4]) if group else (3,0,-1,0,0)
|
|
if op in ('L','V'):
|
|
if not 0<=p<=3: return (1,[])
|
|
rows=self.rows(p)
|
|
if op=='V': rows=[(n,-9,g,v+123,w) for n,owner,g,v,w in rows]
|
|
return (0,rows)
|
|
p,name=a[:2]
|
|
if op=='R':
|
|
if not (0<=p<=3 and 0<=name<=15): return (1,0,-1,0,0)
|
|
else:
|
|
value,count=a[2:]
|
|
if not (0<=p<=3 and 0<=name<=15 and -100000<=value<=100000 and 0<=count<=64):
|
|
return (1,0,-1,0,0)
|
|
row=next((row for row in self.rows(p) if row[0]==name),None)
|
|
if row is None: return (3,0,-1,0,0)
|
|
_,owner,generation,old,writable=row
|
|
if op=='R': return (0,generation,owner,old,writable)
|
|
if not writable: return (4,0,-1,0,0)
|
|
if count>0:
|
|
self.groups[p,owner][4][name]=value
|
|
old=value
|
|
return (0,generation,owner,old,count)
|
|
|
|
api_coverage={k:set() for k in REQUIRED}
|
|
cli_coverage={k:set() for k in REQUIRED}
|
|
cli_syntax=0
|
|
cli_limits=0
|
|
success_values={context:{op:[set() for _ in range(ARITY[verb])] for verb,op in OP.items()} for context in ('api','cli')}
|
|
|
|
def success(context,op,args,result):
|
|
if result[0]==0:
|
|
for index,value in enumerate(args): success_values[context][op][index].add(value)
|
|
|
|
def raw(op, result):
|
|
if op in ('L','V'):
|
|
code,rows=result
|
|
fields=[code,len(rows)]+[x for row in rows for x in row]
|
|
else:
|
|
fields=result
|
|
return op+' '+' '.join(map(str,fields))+'\n'
|
|
|
|
def render(verb,result):
|
|
code=result[0]
|
|
if code: return 'ERR '+NAMES[code]+'\n'
|
|
if verb=='list':
|
|
return 'OK list '+str(len(result[1]))+'\n'+''.join('ATTR '+' '.join(map(str,row))+'\n' for row in result[1])
|
|
return 'OK '+verb+' '+' '.join(map(str,result[1:]))+'\n'
|
|
|
|
def cli(data):
|
|
global cli_syntax,cli_limits
|
|
model=Model()
|
|
output=[]
|
|
lines=data.split(b'\n')
|
|
if lines[-1:]==[b'']: lines.pop()
|
|
for index,line in enumerate(lines):
|
|
if index==128:
|
|
cli_limits+=1
|
|
output.append('ERR LIMIT\n')
|
|
break
|
|
words=re.split(br'[ \t]+',line.strip(b' \t'))
|
|
verb=words[0].decode('ascii','replace')
|
|
if verb not in ARITY or len(words)!=ARITY.get(verb,-1)+1:
|
|
cli_syntax+=1;output.append('ERR SYNTAX\n');continue
|
|
numbers=[]
|
|
for word in words[1:]:
|
|
if not re.fullmatch(br'[+-]?[0-9]+',word): break
|
|
n=int(word)
|
|
if n<MIN or n>MAX: break
|
|
numbers.append(n)
|
|
if len(numbers)!=ARITY[verb]:
|
|
cli_syntax+=1;output.append('ERR SYNTAX\n');continue
|
|
op=OP[verb]
|
|
result=model.execute(op,numbers)
|
|
cli_coverage[op].add(result[0])
|
|
success('cli',op,numbers,result)
|
|
output.append(render(verb,result))
|
|
return ''.join(output).encode()
|
|
|
|
class Scene:
|
|
def __init__(self):
|
|
self.commands=[]
|
|
self.expected=[]
|
|
self.models=[Model(),Model()]
|
|
def call(self,op,*args,obj=0):
|
|
self.commands.append(' '.join(map(str,[op,obj,*args]))+'\n')
|
|
if op=='Z':
|
|
self.models[obj]=Model()
|
|
self.expected.append('Z '+str(obj)+'\n')
|
|
return None
|
|
result=self.models[obj].execute(op,args)
|
|
if op in api_coverage:
|
|
api_coverage[op].add(result[0])
|
|
success('api',op,args,result)
|
|
self.expected.append(raw(op,result))
|
|
return result
|
|
def audit(self,obj=None):
|
|
if obj is None:
|
|
self.audit(0)
|
|
self.audit(1)
|
|
return
|
|
for p in range(4):
|
|
self.call('L',p,obj=obj)
|
|
for g in range(8): self.call('G',p,g,obj=obj)
|
|
for n in range(16): self.call('R',p,n,obj=obj)
|
|
def c(self,data):
|
|
if isinstance(data,str): data=data.encode()
|
|
output=cli(data)
|
|
self.commands.append('C 0 '+(data.hex() or '-')+'\n')
|
|
self.expected.append('C 0 '+str(len(output))+':'+output.hex()+' 0:\n')
|
|
def encode(self):
|
|
return ''.join(self.commands).encode(), ''.join(self.expected).encode()
|
|
|
|
|
|
def background(s):
|
|
s.call('Z')
|
|
s.call('P',0,0,4,2,1)
|
|
s.call('W',0,4,29,3)
|
|
s.call('W',0,5,-37,64)
|
|
s.call('P',0,7,12,2,0)
|
|
s.call('P',3,0,4,1,1)
|
|
s.call('W',3,4,88,2)
|
|
|
|
|
|
def make_api_scene():
|
|
s=Scene()
|
|
background(s)
|
|
s.call('P',0,0,4,2,1,obj=1)
|
|
s.call('W',0,4,-321,7,obj=1)
|
|
for _ in range(2):
|
|
s.audit(0);s.audit(1)
|
|
s.call('V',0)
|
|
s.audit()
|
|
# Successful domain endpoints with actual live attributes and direct reads.
|
|
for p in (0,3):
|
|
for g in (0,7):
|
|
for first,count in ((0,1),(15,1),(0,4),(12,4)):
|
|
for w in (0,1):
|
|
s.call('Z')
|
|
assert s.call('P',p,g,first,count,w)[0]==0
|
|
s.call('G',p,g)
|
|
s.call('L',p)
|
|
for n in range(first,first+count): s.call('R',p,n)
|
|
if w:
|
|
for val,amount in ((-100000,64),(100000,0),(100000,64),(0,1)):
|
|
assert s.call('W',p,first,val,amount)[0]==0
|
|
s.call('R',p,first)
|
|
assert s.call('D',p,g)[0]==0
|
|
s.call('R',p,first);s.call('G',p,g)
|
|
s.call('P',p,g,first,count,w)
|
|
s.call('R',p,first)
|
|
background(s)
|
|
s.call('P',0,2,3,4,1) # collision after a newly published prefix
|
|
s.audit()
|
|
s.call('P',0,2,12,2,1) # collision at offset zero, owned names survive
|
|
s.audit()
|
|
s.call('P',0,2,9,4,1) # collision at final offset
|
|
s.audit()
|
|
s.call('P',0,0,0,1,1) # duplicate group
|
|
s.audit()
|
|
s.call('W',0,12,123,1) # readonly including zero-count
|
|
s.audit()
|
|
s.call('W',0,12,0,0)
|
|
s.audit()
|
|
for op,args in [('D',[0,6]),('G',[0,6]),('R',[0,15]),('W',[0,15,99,1])]:
|
|
assert s.call(op,*args)[0]==3
|
|
s.audit()
|
|
s.call('D',0,7)
|
|
s.audit()
|
|
s.call('P',0,7,12,2,0)
|
|
s.audit()
|
|
# Invalid individual parameters, including native signed extremes, retain nonzero background.
|
|
cases={
|
|
'P':([0,2,0,1,1],[(0,3),(0,7),(0,15),(1,4),(0,1)]),
|
|
'D':([0,0],[(0,3),(0,7)]),
|
|
'G':([0,0],[(0,3),(0,7)]),
|
|
'R':([0,4],[(0,3),(0,15)]),
|
|
'W':([0,4,77,1],[(0,3),(0,15),(-100000,100000),(0,64)]),
|
|
'L':([0],[(0,3)])}
|
|
for op,(base,domains) in cases.items():
|
|
for index,(lo,hi) in enumerate(domains):
|
|
for bad in sorted({lo-1,hi+1,MIN,MAX}):
|
|
args=list(base);args[index]=bad
|
|
assert s.call(op,*args)[0]==1
|
|
s.audit()
|
|
assert s.call('P',0,2,15,2,1)[0]==1
|
|
s.audit()
|
|
# Invalid arguments win over occupied, absent and readonly states.
|
|
for op,args in [('P',[0,0,0,0,1]),('W',[0,12,100001,0]),('W',[0,15,0,65]),('D',[0,8])]:
|
|
assert s.call(op,*args)[0]==1
|
|
s.audit()
|
|
# Lifecycle interleaving, adjacent groups, no failed generation advances.
|
|
for turn in range(6):
|
|
p=turn%4
|
|
s.call('Z')
|
|
s.call('P',p,7,5,2,1)
|
|
s.call('W',p,5,turn+9,2)
|
|
s.call('P',p,0,3,3,1)
|
|
s.call('G',p,0)
|
|
s.call('D',p,7)
|
|
s.call('P',p,0,3,3,1)
|
|
s.call('G',p,0)
|
|
s.call('W',p,3,-turn-1,1)
|
|
s.call('D',p,0)
|
|
s.call('D',p,0)
|
|
s.call('P',p,0,4,4,1)
|
|
s.audit()
|
|
randomizer=random.Random(10720261027)
|
|
for index in range(160):
|
|
op=randomizer.choice(['P','D','W','R','G','L'])
|
|
p=randomizer.randrange(4);g=randomizer.randrange(8);name=randomizer.randrange(16)
|
|
args={'P':[p,g,name,randomizer.randint(1,4),randomizer.randrange(2)],
|
|
'D':[p,g],'W':[p,name,randomizer.randint(-100000,100000),randomizer.choice([0,1,64])],
|
|
'R':[p,name],'G':[p,g],'L':[p]}[op]
|
|
s.call(op,*args,obj=index%2)
|
|
if index%8==0: s.audit(index%2)
|
|
s.audit(0);s.audit(1)
|
|
return s.encode()
|
|
|
|
BASE='publish 0 0 4 2 1\nstore 0 4 29 3\nstore 0 5 -37 64\npublish 0 7 12 2 0\npublish 3 0 4 1 1\nstore 3 4 88 2\n'
|
|
INSPECT=''.join(f'list {p}\n'+''.join(f'group {p} {g}\n' for g in range(8))+''.join(f'show {p} {n}\n' for n in range(16)) for p in range(4))
|
|
|
|
def make_cli_scene():
|
|
s=Scene()
|
|
s.c(b'')
|
|
s.c('publish 0 0 2 2 1\nstore 0 2 73 2\nremove 0 0\npublish 0 0 2 2 1\nshow 0 2\n')
|
|
s.c('publish 0 0 2 2 1\ngroup 0 0\n')
|
|
# Every verb succeeds at both independent scalar domain endpoints.
|
|
for p in (0,3):
|
|
for g in (0,7):
|
|
for first,count in ((0,1),(15,1),(0,4),(12,4)):
|
|
for writable in (0,1):
|
|
lines=[f'publish {p} {g} {first} {count} {writable}',f'group {p} {g}',f'list {p}',f'show {p} {first}']
|
|
if writable:
|
|
for value,amount in ((-100000,64),(100000,0),(100000,64),(0,1)):
|
|
lines += [f'store {p} {first} {value} {amount}',f'show {p} {first}']
|
|
lines += [f'remove {p} {g}',f'publish {p} {g} {first} {count} {writable}',f'show {p} {first}']
|
|
s.c('\n'.join(lines)+'\n')
|
|
errors=['publish 0 2 3 4 1','publish 0 2 12 2 1','publish 0 2 9 4 1','publish 0 0 0 1 1',
|
|
'remove 0 6','group 0 6','show 0 15','store 0 15 99 1','store 0 12 123 1','store 0 12 0 0']
|
|
for line in errors: s.c(BASE+line+'\n'+INSPECT)
|
|
s.c(BASE+'remove 0 7\n'+INSPECT)
|
|
s.c(BASE+'remove 0 0\n'+INSPECT)
|
|
domains={
|
|
'publish':([0,2,0,1,1],[(0,3),(0,7),(0,15),(1,4),(0,1)]),
|
|
'remove':([0,0],[(0,3),(0,7)]), 'group':([0,0],[(0,3),(0,7)]),
|
|
'show':([0,4],[(0,3),(0,15)]),
|
|
'store':([0,4,77,1],[(0,3),(0,15),(-100000,100000),(0,64)]),
|
|
'list':([0],[(0,3)])}
|
|
for verb,(base,ranges) in domains.items():
|
|
for index,(lo,hi) in enumerate(ranges):
|
|
for bad in sorted({lo-1,hi+1,MIN,MAX}):
|
|
args=base.copy();args[index]=bad
|
|
s.c(BASE+verb+' '+' '.join(map(str,args))+'\n'+INSPECT)
|
|
for bad in ('bad','','9223372036854775808','-9223372036854775809','+','1.0','1\r','0\x00'):
|
|
args=list(map(str,base));args[index]=bad
|
|
s.c(BASE+verb+' '+' '.join(args)+'\n'+INSPECT)
|
|
words=[verb,*map(str,base)]
|
|
s.c(BASE+' '.join(words[:-1])+'\n'+INSPECT)
|
|
s.c(BASE+' '.join(words+['0'])+'\n'+INSPECT)
|
|
for line in ['','unknown 0','show\v0 4','SHOW 0 4','publish 0 2 15 2 1','publish 0 0 0 0 1','store 0 12 100001 0','store 0 15 0 65']:
|
|
s.c(BASE+line+'\n'+INSPECT)
|
|
s.c(' \tpublish +000 -0 000 01 01\t\nstore -0 +0 -000 064\nshow 0 0')
|
|
s.c('publish 3 7 15 1 1\nstore 3 15 -100000 64\nshow 3 15')
|
|
# Physical limit has a mixed prefix, actual mutation at line 128, then suppressed list/store.
|
|
lines=['publish 0 0 4 1 1','store 0 4 7 1','bad','','show 0','store 0 4 bad 1','show 0 15']
|
|
lines+=['show 0 4']*(127-len(lines))
|
|
lines+=['store 0 4 909 7']
|
|
assert len(lines)==128
|
|
s.c('\n'.join(lines)+'\n')
|
|
s.c('\n'.join(lines+['list 0','store 0 4 111 2','show 0 4'])+'\n')
|
|
s.c('\n'.join(lines+['list 0']))
|
|
s.c('list 0\npublish 0 0 4 1 1\ngroup 0 0\n')
|
|
for op,wanted in REQUIRED.items():
|
|
assert api_coverage[op]==wanted,(op,api_coverage[op])
|
|
assert cli_coverage[op]==wanted,(op,cli_coverage[op])
|
|
endpoint_domains={'P':[(0,3),(0,7),(0,15),(1,4),(0,1)],'D':[(0,3),(0,7)],'R':[(0,3),(0,15)],'W':[(0,3),(0,15),(-100000,100000),(0,64)],'G':[(0,3),(0,7)],'L':[(0,3)]}
|
|
for context,observed in success_values.items():
|
|
for op,domains in endpoint_domains.items():
|
|
for index,(lo,hi) in enumerate(domains):
|
|
assert {lo,hi}<=observed[op][index],(context,op,index,observed[op][index])
|
|
assert cli_syntax>0 and cli_limits==2
|
|
return s.encode()
|
|
|
|
|
|
def digest(data):
|
|
return [len(data),hashlib.sha256(data).hexdigest()[:16]]
|
|
|
|
def execute(argv,cwd,data,expected,timeout):
|
|
child=subprocess.Popen(argv,cwd=cwd,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
|
timed=False
|
|
try:
|
|
out,err=child.communicate(data,timeout=timeout)
|
|
except subprocess.TimeoutExpired:
|
|
timed=True;child.kill();out,err=child.communicate()
|
|
record={'pid':child.pid,'argv':argv,'exit':child.returncode,'timeout':timed,
|
|
'in':digest(data),'expected':digest(expected),'out':digest(out),'err':digest(err),'seconds':timeout}
|
|
return record,out,err
|
|
|
|
|
|
def main():
|
|
scenes=[('api',*make_api_scene()),('cli',*make_cli_scene())]
|
|
smoke=b'publish 0 0 2 2 1\nstore 0 2 73 2\nremove 0 0\npublish 0 0 2 2 1\nshow 0 2\n'
|
|
scenes += [('app_empty',b'',b''),('app_smoke',smoke,cli(smoke))]
|
|
candidate=Path(sys.argv[1])
|
|
scratch=Path(tempfile.mkdtemp(prefix='ag-',dir=Path.cwd()))
|
|
for name in ['group.hpp','internal.hpp','lifecycle.cpp','values.cpp','cli.cpp']:
|
|
(scratch/name).write_bytes((candidate/name).read_bytes())
|
|
(scratch/'observer.cpp').write_text(OBSERVER)
|
|
compiler=shutil.which('g++')
|
|
if not compiler:
|
|
print('compiler unavailable');return 1
|
|
# All trusted scratch IO is complete before the first compiler starts.
|
|
build=[compiler,'-std=c++17','-O2','-Wall','-Wextra','-pedantic','lifecycle.cpp','values.cpp','cli.cpp','observer.cpp','-o','observer']
|
|
records=[];reasons=[]
|
|
record,out,err=execute(build,str(scratch),b'',b'',30)
|
|
records.append(record)
|
|
if record['timeout']: reasons.append('build:timeout')
|
|
if record['exit']!=0: reasons.append('build:exit')
|
|
if not reasons:
|
|
for label,data,expected in scenes:
|
|
argv=[str(scratch/'observer')]+(['--app'] if label.startswith('app_') else [])
|
|
record,out,err=execute(argv,str(scratch),data,expected,15)
|
|
record['scene']=label
|
|
records.append(record)
|
|
if record['timeout']: reasons.append(label+':timeout')
|
|
if record['exit']!=0: reasons.append(label+':exit')
|
|
if out!=expected: reasons.append(label+':stdout')
|
|
if err: reasons.append(label+':stderr')
|
|
evidence={'cwd':str(scratch),'runs':records,'why':reasons,'api':{k:sorted(v) for k,v in api_coverage.items()},
|
|
'cli':{k:sorted(v) for k,v in cli_coverage.items()},'syntax':cli_syntax,'limits':cli_limits}
|
|
encoded=json.dumps(evidence,separators=(',',':'))
|
|
if len(encoded.encode())>=3900:
|
|
raise RuntimeError('evidence exceeds 3899 bytes')
|
|
sys.stderr.write(encoded+'\n')
|
|
print('FAIL' if reasons else 'PASS')
|
|
return bool(reasons)
|
|
|
|
if __name__=='__main__':
|
|
sys.exit(main())
|