211 lines
21 KiB
Python
211 lines
21 KiB
Python
import json,os,subprocess,tempfile,unittest,sys
|
|
from pathlib import Path
|
|
LOG_DISCONNECT_ONLY="--log-disconnect-only" in sys.argv
|
|
if LOG_DISCONNECT_ONLY:sys.argv.remove("--log-disconnect-only")
|
|
AREA_TRIGGER_ONLY="--area-trigger-only" in sys.argv
|
|
if AREA_TRIGGER_ONLY:sys.argv.remove("--area-trigger-only")
|
|
LOGOUT_ONLY="--logout-only" in sys.argv
|
|
if LOGOUT_ONLY:sys.argv.remove("--logout-only")
|
|
BANK_ONLY="--bank-only" in sys.argv
|
|
if BANK_ONLY:sys.argv.remove("--bank-only")
|
|
ROOT=Path(__file__).resolve().parents[1]
|
|
OUT=ROOT/("runtime/continuation-20261025/first-zone35-entry/normal-exit/focused-log-disconnect-capture-boundary" if LOG_DISCONNECT_ONLY else "runtime/continuation-20261025/first-zone35-entry/normal-exit/focused-area-trigger-capture-boundary" if AREA_TRIGGER_ONLY else "runtime/rea-system-jobs-20261022/exit-game-current1188465-20261024/focused-capture-boundary" if LOGOUT_ONLY else "runtime/rea-system-jobs-20261022/bank-request-private-capture-20261024/focused-boundary" if BANK_ONLY else "runtime/rea-system-jobs-20261022/inspect-request-private-capture-20261024/focused-boundary")
|
|
|
|
def function(source,signature):
|
|
start=source.index(signature);begin=source.index("{",start);depth=1;end=begin+1
|
|
while depth:
|
|
if source[end]=="{":depth+=1
|
|
elif source[end]=="}":depth-=1
|
|
end+=1
|
|
return source[start:end]
|
|
|
|
class PrivateControlBoundary(unittest.TestCase):
|
|
def test_actual_producer_and_transport_sink(self):
|
|
OUT.mkdir(parents=True,exist_ok=True)
|
|
pe=(ROOT/"native/wine_pipe_host.c").read_text();session=(ROOT/"native/session.cpp").read_text()
|
|
init=function(pe,"static void init(struct gw_wire_call*")
|
|
producer=function(pe,"static void private_capture_notice_input(uint32_t kind,uint32_t opcode,uint32_t bytes,const unsigned char* body){")
|
|
legacy=function(session,'extern "C" int gw_native_transport_private_capture(')
|
|
sink=function(session,'extern "C" int gw_native_transport_private_capture_body(')
|
|
caller="private_capture_notice_input(1,opcode,v->bytes-4,v->data+4);"
|
|
assert pe.count(caller)==1
|
|
code=r'''#include "private_gameplay_capture.hpp"
|
|
#include "session.h"
|
|
#define _Static_assert static_assert
|
|
#include "wine_pipe_host.h"
|
|
#undef _Static_assert
|
|
#include "gateway/protocol.hpp"
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <iterator>
|
|
#include <stdexcept>
|
|
struct TestWorld {struct {uint64_t guid=91;} selected;};
|
|
struct gw_native_transport {PrivateGameplayCapture private_capture;TestWorld* world;bool scope=true;};
|
|
static bool private_gameplay_scope(const gw_native_transport* t){return t&&t->scope;}
|
|
struct gw_pipe_control gw_wire_pipe_data{};
|
|
struct gw_pipe_world_control gw_wire_world_data{};
|
|
struct private_capture_status {uint32_t abi,size,configured,error;uint64_t records,bytes;};
|
|
static private_capture_status gw_wire_private_capture{1,32,0,0,0,0};
|
|
static gw_native_transport* active;
|
|
static unsigned calls=0,last_input=0;
|
|
static unsigned long GetEnvironmentVariableA(const char* name,char* buffer,unsigned long capacity){(void)buffer;(void)capacity;const char* p=std::getenv(name);return p&&*p?unsigned(std::strlen(p)+1):0;}
|
|
@SESSION@
|
|
static int call(struct gw_wire_call* c){
|
|
++calls;last_input=c->input_bytes;
|
|
c->result=gw_native_transport_private_capture_body(active,c->index,c->opcode,c->build,c->input,c->input_bytes,c->output,c->capacity,&c->required);return c->result;
|
|
}
|
|
@INIT@
|
|
@PRODUCER@
|
|
static void expect(bool value,const char* text){if(!value)throw std::runtime_error(text);}
|
|
static std::string read(const char* path){std::ifstream f(path);return std::string(std::istreambuf_iterator<char>(f),{});}
|
|
static void from_view(const gw_pipe_view* v){uint32_t opcode=uint32_t(v->data[0])|(uint32_t(v->data[1])<<8)|(uint32_t(v->data[2])<<16)|(uint32_t(v->data[3])<<24);@CALLER@}
|
|
int main(int argc,char** argv){try{
|
|
expect(argc==3,"args");const bool enabled=std::string(argv[1])=="enabled";
|
|
if(enabled)setenv("GW_PRIVATE_GAMEPLAY_CAPTURE",argv[2],1);else unsetenv("GW_PRIVATE_GAMEPLAY_CAPTURE");
|
|
TestWorld world;gw_native_transport transport;transport.world=&world;active=&transport;
|
|
uint8_t framed[24]={0x30,0,0x44,0};for(unsigned i=4;i<24;++i)framed[i]=uint8_t(i);
|
|
gw_pipe_view view{framed,nullptr,24,0,0};
|
|
gw_wire_pipe_data.world_auth=1;gw_wire_world_data.self_create=1;
|
|
if(!enabled){if(@LOG_DISCONNECT_ONLY@){framed[0]=7;framed[1]=0;framed[2]=0x46;view.bytes=8;}if(@AREA_TRIGGER_ONLY@){framed[0]=0x8a;framed[1]=0;framed[2]=0x3e;view.bytes=9;}if(@LOGOUT_ONLY@){framed[0]=0x74;framed[1]=0;framed[2]=0x3f;view.bytes=5;}if(@BANK_ONLY@){framed[0]=2;framed[1]=0;framed[2]=0x41;view.bytes=7;}from_view(&view);private_capture_notice_input(1,@BANK_ONLY@?0x410002:0x3f00ce,@BANK_ONLY@?3:9,framed+4);expect(calls==0&&transport.private_capture.count()==0&&!std::filesystem::exists(argv[2]),"disabled recorder touched input/file");std::cout<<"PASS disabled producer\n";return 0;}
|
|
|
|
if(@LOG_DISCONNECT_ONLY@){
|
|
framed[0]=7;framed[1]=0;framed[2]=0x46;framed[3]=0;view.bytes=8;
|
|
const uint8_t opaque[4]={0xa1,0xb2,0xc3,0xd4};std::memcpy(framed+4,opaque,4);
|
|
gw_wire_pipe_data.world_auth=0;transport.scope=false;from_view(&view);expect(last_input==0&&transport.private_capture.count()==0,"telemetry unauth gate");
|
|
gw_wire_pipe_data.world_auth=1;gw_wire_world_data.self_create=0;from_view(&view);expect(last_input==0&&transport.private_capture.count()==0,"telemetry self-create gate");
|
|
gw_wire_world_data.self_create=1;from_view(&view);expect(last_input==4&&transport.private_capture.count()==0,"telemetry core scope gate");
|
|
transport.scope=true;world.selected.guid=0;from_view(&view);expect(transport.private_capture.count()==0,"telemetry owner gate");world.selected.guid=91;
|
|
private_capture_notice_input(1,0x460007,0,framed+4);expect(last_input==0,"telemetry empty producer");
|
|
private_capture_notice_input(1,0x460007,3,framed+4);expect(last_input==0,"telemetry short producer");
|
|
private_capture_notice_input(1,0x460007,5,framed+4);expect(last_input==0,"telemetry long producer");
|
|
from_view(&view);expect(last_input==4,"telemetry exact specimen missing");
|
|
std::memset(framed+4,0xee,4);from_view(&view);auto saved=read(argv[2]);
|
|
size_t n=0,pos=0;while((pos=saved.find("body_hex",pos))!=std::string::npos){++n;++pos;}
|
|
expect(n==1&&saved.find("a1b2c3d4")!=std::string::npos&&saved.find("eeeeeeee")==std::string::npos,"telemetry one specimen and synchronous ownership");
|
|
expect(saved.find("\"body_omitted\":true")!=std::string::npos,"telemetry later reports not metadata only");
|
|
auto before=transport.private_capture.count();uint32_t required=0;
|
|
for(auto size:{1u,3u,5u})expect(gw_native_transport_private_capture_body(active,1,0x460007,size,framed+4,size,nullptr,0,&required)==-1,"telemetry exact-four sink refusal");
|
|
expect(gw_native_transport_private_capture_body(active,0,0x460007,4,framed+4,4,nullptr,0,&required)==-1,"telemetry kind refusal");
|
|
expect(gw_native_transport_private_capture_body(active,1,0x460008,4,framed+4,4,nullptr,0,&required)==-1,"telemetry neighbor sink refusal");
|
|
expect(gw_native_transport_private_capture_body(active,1,0x460007,4,nullptr,4,nullptr,0,&required)==-1,"telemetry null body refusal");
|
|
expect(gw_native_transport_private_capture_body(active,1,0x460007,4,framed+4,3,nullptr,0,&required)==-1,"telemetry declared-size refusal");
|
|
expect(transport.private_capture.count()==before,"telemetry malformed body persisted");
|
|
private_capture_notice_input(1,0x460008,4,framed+4);expect(last_input==0,"telemetry neighbor producer refusal");
|
|
uint8_t other=0xa1;for(auto opcode:{0x440030u,0x3f00ceu,0x410002u,0x410000u,0x3f0074u})private_capture_notice_input(1,opcode,1,&other);
|
|
uint8_t area[5]={107,0,0,0,0xc0};private_capture_notice_input(1,0x3e008a,5,area);area[4]=0x40;private_capture_notice_input(1,0x3e008a,5,area);
|
|
saved=read(argv[2]);n=0;pos=0;while((pos=saved.find("body_hex",pos))!=std::string::npos){++n;++pos;}expect(n==7,"telemetry consumed other independent specimen slots");
|
|
struct stat info{};expect(stat(argv[2],&info)==0&&(info.st_mode&0777)==0600,"telemetry private specimen mode");
|
|
std::cout<<"PASS opaque log-disconnect producer/op42/privatefile exact4/first-only/scope/refusals; no semantics or routing change\n";return 0;
|
|
}
|
|
if(@AREA_TRIGGER_ONLY@){
|
|
framed[0]=0x8a;framed[1]=0;framed[2]=0x3e;framed[3]=0;view.bytes=9;
|
|
uint8_t first[5]={0x6d,0,0,0,0x80};std::memcpy(framed+4,first,5);
|
|
gw_wire_pipe_data.world_auth=0;transport.scope=false;from_view(&view);expect(last_input==0&&transport.private_capture.count()==0,"area unauth producer gate");
|
|
gw_wire_pipe_data.world_auth=1;gw_wire_world_data.self_create=0;from_view(&view);expect(last_input==0&&transport.private_capture.count()==0,"area self-create gate");
|
|
gw_wire_world_data.self_create=1;from_view(&view);expect(last_input==5&&transport.private_capture.count()==0,"area independent core scope");
|
|
transport.scope=true;private_capture_notice_input(1,0x3e008a,4,framed+4);expect(last_input==0,"area short producer input");
|
|
private_capture_notice_input(1,0x3e008a,6,framed+4);expect(last_input==0,"area oversize producer input");
|
|
from_view(&view);expect(last_input==5,"area first opaque specimen missing");
|
|
std::memset(framed+4,0xee,5);auto saved=read(argv[2]);expect(saved.find("\"body_hex\":\"6d00000080\"")!=std::string::npos&&saved.find("eeeeeeeeee")==std::string::npos,"area synchronous first-buffer ownership");
|
|
std::memcpy(framed+4,first,5);framed[8]=0;from_view(&view);
|
|
std::memset(framed+4,0xee,5);from_view(&view);saved=read(argv[2]);
|
|
size_t n=0,pos=0;while((pos=saved.find("body_hex",pos))!=std::string::npos){++n;++pos;}
|
|
expect(n==2&&saved.find("6d00000000")!=std::string::npos&&saved.find("eeeeeeeeee")==std::string::npos,"area two-specimen cap and independent storage");
|
|
private_capture_notice_input(1,0x3e008b,5,framed+4);expect(last_input==0,"area neighbor body attached");
|
|
unsigned before=unsigned(transport.private_capture.count());uint32_t required=0;
|
|
expect(gw_native_transport_private_capture_body(active,1,0x3e008a,4,framed+4,4,nullptr,0,&required)==-1,"area sink exact-five refusal");
|
|
expect(gw_native_transport_private_capture_body(active,1,0x3e008a,6,framed+4,6,nullptr,0,&required)==-1,"area sink cap refusal");
|
|
expect(gw_native_transport_private_capture_body(active,1,0x3e008b,5,framed+4,5,nullptr,0,&required)==-1,"area neighbor sink refusal");
|
|
expect(transport.private_capture.count()==before,"area sink refusals wrote file");
|
|
uint8_t other=0xa1;private_capture_notice_input(1,0x440030,1,&other);saved=read(argv[2]);n=0;pos=0;while((pos=saved.find("body_hex",pos))!=std::string::npos){++n;++pos;}expect(n==3,"area consumed existing independent specimen slot");
|
|
struct stat info{};expect(stat(argv[2],&info)==0&&(info.st_mode&0777)==0600,"area specimen private file mode");
|
|
std::cout<<"PASS opaque area-trigger actualproducer/op42/privatefile two-specimen scope/lifetime/exactsize/refusal; no grammar or Sourceforward claim\n";return 0;
|
|
}
|
|
if(@LOGOUT_ONLY@){
|
|
framed[0]=0x74;framed[1]=0;framed[2]=0x3f;framed[3]=0;framed[4]=0x80;view.bytes=5;
|
|
gw_wire_pipe_data.world_auth=0;transport.scope=false;from_view(&view);expect(last_input==0&&transport.private_capture.count()==0,"logout unauth producer scope");
|
|
gw_wire_pipe_data.world_auth=1;gw_wire_world_data.self_create=0;from_view(&view);expect(last_input==0&&transport.private_capture.count()==0,"logout self-create gate");
|
|
gw_wire_world_data.self_create=1;from_view(&view);expect(last_input==1&&transport.private_capture.count()==0,"logout independent core scope");
|
|
transport.scope=true;private_capture_notice_input(1,0x3f0074,2,framed+4);expect(last_input==0,"logout producer cap");
|
|
from_view(&view);expect(last_input==1,"logout first specimen missing");framed[4]=0x7f;from_view(&view);
|
|
auto saved=read(argv[2]);expect(saved.find("\"body_hex\":\"80\"")!=std::string::npos&&saved.find("\"body_hex\":\"7f\"")==std::string::npos,"logout first synchronous byte not retained independently");
|
|
// New cross-family check only; existing specimen privacy suites remain accepted.
|
|
uint8_t other=0xa1;for(auto opcode:{0x440030u,0x3f00ceu,0x410002u,0x410000u})private_capture_notice_input(1,opcode,1,&other);
|
|
saved=read(argv[2]);size_t count=0,pos=0;while((pos=saved.find("body_hex",pos))!=std::string::npos){++count;++pos;}expect(count==4,"logout consumed an existing specimen slot");
|
|
unsigned invalid_before=unsigned(transport.private_capture.count());uint32_t required=0;
|
|
expect(gw_native_transport_private_capture_body(active,1,0x3f0074,2,framed+4,2,nullptr,0,&required)==-1,"logout sink cap");
|
|
expect(gw_native_transport_private_capture_body(active,1,0x3f0075,1,framed+4,1,nullptr,0,&required)==-1,"cancel/logout neighbor body admitted");
|
|
expect(transport.private_capture.count()==invalid_before,"logout invalid body persisted");
|
|
struct stat info{};expect(stat(argv[2],&info)==0&&(info.st_mode&0777)==0600,"logout private specimen mode");
|
|
std::cout<<"PASS Logout producer→op42→privatefile scoped max1/firstbyte/independent slots; no forwarding\n";return 0;
|
|
}
|
|
if(@BANK_ONLY@){
|
|
framed[0]=2;framed[1]=0;framed[2]=0x41;framed[3]=0;framed[4]=0;framed[5]=63;framed[6]=7;view.bytes=7;
|
|
gw_wire_pipe_data.world_auth=0;transport.scope=false;from_view(&view);expect(last_input==0&&transport.private_capture.count()==0,"bank unauth producer scope");
|
|
gw_wire_pipe_data.world_auth=1;gw_wire_world_data.self_create=0;from_view(&view);expect(last_input==0&&transport.private_capture.count()==0,"bank self-create gate");
|
|
gw_wire_world_data.self_create=1;from_view(&view);expect(last_input==3&&transport.private_capture.count()==0,"bank independent core scope");
|
|
transport.scope=true;private_capture_notice_input(1,0x410002,4,framed+4);expect(last_input==0,"bank producer cap");
|
|
from_view(&view);expect(last_input==3,"bank3B specimen not attached");std::memset(framed+4,0xdd,3);
|
|
auto saved=read(argv[2]);expect(saved.find("003f07")!=std::string::npos,"bank synchronous borrowed input lifetime");
|
|
from_view(&view);saved=read(argv[2]);expect(saved.find("dddddd")==std::string::npos&&saved.find("body_omitted")!=std::string::npos,"repeated bank body retained");
|
|
// New cross-family boundary: bank must not consume either existing specimen slot.
|
|
uint8_t other[3]={0xa1,0xa2,0xa3};private_capture_notice_input(1,0x440030,3,other);private_capture_notice_input(1,0x3f00ce,3,other);
|
|
private_capture_notice_input(1,0x410000,4,framed+4);expect(last_input==0,"WrapItem must remain metadata only");
|
|
saved=read(argv[2]);size_t count=0,pos=0;while((pos=saved.find("body_hex",pos))!=std::string::npos){++count;++pos;}expect(count==3,"bank/invite/inspect specimen slots not independent");
|
|
unsigned invalid_before=unsigned(transport.private_capture.count());uint32_t required=0;
|
|
expect(gw_native_transport_private_capture_body(active,1,0x410002,4,framed+4,4,nullptr,0,&required)==-1,"bank sink cap");
|
|
expect(gw_native_transport_private_capture_body(active,1,0x410000,5,framed+4,5,nullptr,0,&required)==-1,"WrapItem body declined");
|
|
expect(gw_native_transport_private_capture_body(active,1,0x410001,3,framed+4,3,nullptr,0,&required)==-1,"neighbor bank opcode body accepted");
|
|
private_capture_notice_input(1,0x410003,3,framed+4);expect(last_input==0,"auto-bank must remain metadata only");
|
|
expect(transport.private_capture.count()==invalid_before+1,"bank refusal or metadata behavior changed");
|
|
struct stat info{};expect(stat(argv[2],&info)==0&&(info.st_mode&0777)==0600,"private bank specimen mode");
|
|
std::cout<<"PASS Bank producer→op42→privatefile scope/cap/lifetime/independent slots\n";return 0;
|
|
}
|
|
gw_wire_pipe_data.world_auth=0;transport.scope=false;from_view(&view);expect(last_input==0&&transport.private_capture.count()==0,"unauth producer scope");
|
|
gw_wire_pipe_data.world_auth=1;gw_wire_world_data.self_create=0;from_view(&view);expect(last_input==0&&transport.private_capture.count()==0,"self-create gate");
|
|
gw_wire_world_data.self_create=1;from_view(&view);expect(last_input==20&&transport.private_capture.count()==0,"core independent authenticated scope");transport.scope=true;
|
|
framed[0]=0x76;framed[1]=1;framed[2]=0x3e;from_view(&view);expect(last_input==0,"wrong opcode body forwarded");
|
|
framed[0]=0x30;framed[1]=0;framed[2]=0x44;
|
|
private_capture_notice_input(1,0x440030,4097,framed+4);expect(last_input==0,"oversize source input attached");
|
|
unsigned before=unsigned(transport.private_capture.count());from_view(&view);expect(last_input==20&&transport.private_capture.count()==before+1,"valid capture absent");
|
|
std::memset(framed+4,0xee,20);std::string saved=read(argv[2]);expect(saved.find("0405060708090a0b0c0d0e0f1011121314151617")!=std::string::npos,"borrowed input survived as dangling span");expect(saved.find("pe-before-admission")!=std::string::npos,"stage missing");
|
|
from_view(&view);saved=read(argv[2]);size_t pos=saved.find("body_hex");expect(pos!=std::string::npos&&saved.find("body_hex",pos+1)==std::string::npos,"more than one invite body persisted");expect(saved.find("body_omitted")!=std::string::npos,"metadata defaults not retained");
|
|
unsigned invalid_before=unsigned(transport.private_capture.count());uint8_t sample=1;uint32_t required=0;
|
|
expect(gw_native_transport_private_capture_body(active,1,0x440001,1,&sample,1,nullptr,0,&required)==-1,"wrongop direct body accepted");
|
|
expect(gw_native_transport_private_capture_body(active,1,0x440030,1,nullptr,1,nullptr,0,&required)==-1,"null body accepted");
|
|
expect(gw_native_transport_private_capture_body(active,1,0x440030,4097,&sample,4097,nullptr,0,&required)==-1,"sink cap accepted");
|
|
expect(transport.private_capture.count()==invalid_before,"refusal changed private journal");
|
|
expect(gw_native_transport_private_capture(active,1,0x3e0176,7,nullptr,0,&required)==0,"old metadata ABI rejected");
|
|
|
|
// Inspect shares the exact producer/call/owned input path but is independently bounded.
|
|
framed[0]=0xce;framed[1]=0;framed[2]=0x3f;view.bytes=13;
|
|
for(unsigned i=0;i<9;++i)framed[4+i]=uint8_t(0xa0+i);
|
|
unsigned inspect_before=unsigned(transport.private_capture.count());
|
|
transport.scope=false;gw_wire_pipe_data.world_auth=0;from_view(&view);expect(last_input==0&&transport.private_capture.count()==inspect_before,"inspect unauth scope");
|
|
gw_wire_pipe_data.world_auth=1;gw_wire_world_data.self_create=0;from_view(&view);expect(last_input==0&&transport.private_capture.count()==inspect_before,"inspect self-create gate");
|
|
gw_wire_world_data.self_create=1;from_view(&view);expect(last_input==9&&transport.private_capture.count()==inspect_before,"inspect core independent scope");
|
|
transport.scope=true;private_capture_notice_input(1,0x3f00ce,19,framed+4);expect(last_input==0,"inspect producer cap");
|
|
from_view(&view);expect(last_input==9,"inspect specimen not attached");
|
|
std::memset(framed+4,0xbb,9);saved=read(argv[2]);expect(saved.find("a0a1a2a3a4a5a6a7a8")!=std::string::npos,"inspect borrowed input lifetime");
|
|
from_view(&view);saved=read(argv[2]);size_t first=saved.find("body_hex"),second=saved.find("body_hex",first+1);
|
|
expect(first!=std::string::npos&&second!=std::string::npos&&saved.find("body_hex",second+1)==std::string::npos,"inspect did not preserve one specimen per scope");
|
|
expect(saved.find("bbbbbbbbbbbbbbbbbb")==std::string::npos,"second inspect body retained");
|
|
invalid_before=unsigned(transport.private_capture.count());
|
|
expect(gw_native_transport_private_capture_body(active,1,0x3f00ce,19,framed+4,19,nullptr,0,&required)==-1,"inspect sink cap");
|
|
expect(gw_native_transport_private_capture_body(active,1,0x3f00cf,9,framed+4,9,nullptr,0,&required)==-1,"neighbor inspect opcode body accepted");
|
|
expect(transport.private_capture.count()==invalid_before,"inspect refusal wrote journal");
|
|
struct stat info{};expect(stat(argv[2],&info)==0&&(info.st_mode&0777)==0600,"private mode");
|
|
std::cout<<"PASS Invite+Inspect producer→op42→transport→privatefile scoped lifetime/cap/refusal\n";
|
|
}catch(const std::exception& e){std::cerr<<e.what()<<"\n";return 1;}return 0;}
|
|
'''
|
|
code=code.replace("@LOG_DISCONNECT_ONLY@","true" if LOG_DISCONNECT_ONLY else "false").replace("@AREA_TRIGGER_ONLY@","true" if AREA_TRIGGER_ONLY else "false").replace("@LOGOUT_ONLY@","true" if LOGOUT_ONLY else "false").replace("@BANK_ONLY@","true" if BANK_ONLY else "false").replace("@SESSION@",legacy+"\n"+sink).replace("@INIT@",init).replace("@PRODUCER@",producer).replace("@CALLER@",caller)
|
|
cpp=OUT/"actual-producer-sink-fixture.cpp";cpp.write_text(code);binary=OUT/"actual-producer-sink-fixture"
|
|
command=["c++","-std=c++20","-O0","-Wall","-Wextra","-Werror","-I",str(ROOT/"include"),"-I",str(ROOT/"native"),str(cpp),str(ROOT/"build/libgateway_protocol.a"),"-lcrypto","-lz","-pthread","-o",str(binary)]
|
|
built=subprocess.run(command,capture_output=True,text=True);(OUT/"build.log").write_text(built.stdout+built.stderr);self.assertEqual(built.returncode,0,"see private build.log")
|
|
with tempfile.TemporaryDirectory()as directory:
|
|
for mode in("enabled","disabled"):
|
|
result=subprocess.run([str(binary),mode,str(Path(directory)/(mode+".jsonl"))],capture_output=True,text=True)
|
|
(OUT/(mode+".log")).write_text(result.stdout+result.stderr);self.assertEqual(result.returncode,0,"see private "+mode+".log")
|
|
|
|
if __name__=="__main__":unittest.main()
|