code wiki / (root) / nx_site_release_prepare_cli_gate_t256.nx

nx_site_release_prepare_cli_gate_t256.nx source

↩ module page · 23 lines · 1313 B

1import "nx_site_publish_prepare_lib_t256.nx" 2import "nx_tool_run.nx" 3import "nx_gate_verdict.nx" 4func main(argc:i64,argv:*i64)->i64{ 5 if argc!=9{return 2} 6 let executable:*i64=sys_mmap(16) as *i64 7 if rm_artifact(argv[1] as *u8,argv[3] as *u8,argv[2] as *u8,executable)!=0{return 3} 8 sys_munmap(executable[0] as *u8,executable[1]+1) 9 let timeout:i64=pb_sized_bytes(argv[7] as *u8);if timeout<0{return 2} 10 let av:*i64=sys_mmap(5*8) as *i64 11 av[0]=argv[1];av[1]="prepare-release" as *u8 as i64;av[2]=argv[5];av[3]=argv[6];av[4]=0 12 let out:*u8=sys_mmap(PB_CONFCAP);let len:*i64=sys_mmap(8) as *i64 13 let rc:i64=tr_run_capture_cwd(argv[1] as *u8,av,out,PB_CONFCAP,len,timeout,argv[4] as *u8) 14 if len[0]<=0||len[0]>=PB_CONFCAP{return 4} 15 if fsx_write(argv[8] as *u8,out,len[0])!=len[0]{return 4} 16 fsx_puts(out) 17 let c:*i64=gv_ctr() 18 gv_check("actual ELF prepare returns ready",rc==0,c) 19 gv_check("actual ELF emits machine readable preparation",fsx_find(out,len[0],"site-release-preparation/v1")>=0,c) 20 gv_check("actual ELF does not claim served identity",fsx_find(out,len[0],"\"served_identity\":null")>=0,c) 21 gv_check("actual ELF reports no publication",fsx_find(out,len[0],"\"publication_writes\":0")>=0,c) 22 return gv_verdict("RELEASE-PREPARE-CLI",c,"actual candidate ELF; read-only existing registry observation") 23}