feat: add aperture mouth candidate and early foreground permissions
Route runtime04 curve values to five source-frame lip geometries with level0 body bypass and spatial opacity1 for all other levels. Preserve the continuous decoded body clock and clean home. Request normal permissions after foreground host layout independently of network; support offline manual consent without capture or connection. Add strict 97x5 parsing, renderer and permission regressions, offline EGL shader pixel goldens and exact debug-candidate packaging. Naturalness, visible talk, device colors and perceived response remain pending.
This commit is contained in:
@@ -11,7 +11,8 @@ from pathlib import Path
|
||||
import hashlib,json
|
||||
root=Path.cwd()
|
||||
paths=list((root/'app/src/main/java').rglob('*.kt'))+list((root/'app/src/androidTest').rglob('*.kt'))+list((root/'tests').rglob('*.kt'))
|
||||
paths += [root/p for p in ('app/build.gradle','scripts/check-reply-regressions.py','scripts/check-expression-rules.sh','scripts/check-avatar-regressions.sh','scripts/check-avatar-ui.py','scripts/import-avatar-graph.py','scripts/package-avatar-safe-release.sh','scripts/package-avatar-safe-release.py','scripts/package-avatar-engineering.py','scripts/package-avatar-natural.py','scripts/package-avatar-ui.py')]
|
||||
paths += list((root/'tests/avatar-pixels').glob('*.c'))
|
||||
paths += [root/p for p in ('app/build.gradle','scripts/check-reply-regressions.py','scripts/check-expression-rules.sh','scripts/check-avatar-regressions.sh','scripts/check-avatar-ui.py','scripts/check-avatar-shader.py','scripts/import-avatar-graph.py','scripts/package-avatar-safe-release.sh','scripts/package-avatar-safe-release.py','scripts/package-avatar-engineering.py','scripts/package-avatar-natural.py','scripts/package-avatar-ui.py','scripts/package-avatar-mouth.py')]
|
||||
result={'status':'passed','jvm_entry_points':9,'uiSourceContracts':'passed','uiDeviceInstrumentation':'not_run','real_device':'pending',
|
||||
'hashes':{str(p.relative_to(root)):hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted(paths)}}
|
||||
(root/'logs/avatar-safe-061/client-tests.json').write_text(json.dumps(result,indent=2)+'\n')
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Offline real GLES2 shader pixel golden; surrogate body texture, no Android/device claim."""
|
||||
from pathlib import Path
|
||||
import argparse,hashlib,json,os,re,subprocess,tempfile
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
|
||||
def bilinear(image,x,y):
|
||||
h,w=image.shape[:2];x=np.clip(x,0,w-1);y=np.clip(y,0,h-1)
|
||||
ix=np.floor(x).astype(int);iy=np.floor(y).astype(int);jx=np.minimum(ix+1,w-1);jy=np.minimum(iy+1,h-1)
|
||||
fx=(x-ix)[...,None];fy=(y-iy)[...,None]
|
||||
return (image[iy,ix]*(1-fx)+image[iy,jx]*fx)*(1-fy)+(image[jy,ix]*(1-fx)+image[jy,jx]*fx)*fy
|
||||
|
||||
def golden(body,patch,x,y,opacity,w,h,crop):
|
||||
scale=min(w/480,h/848);left=(w-480*scale)/2;top=(h-848*scale)/2
|
||||
yy,xx=np.mgrid[:h,:w];px=(xx+.5-left)/scale;py=(yy+.5-top)/scale
|
||||
inside=(px>=0)&(px<480)&(py>=0)&(py<848)
|
||||
bx=px*(.98 if crop else 1)+(4.8 if crop else 0)-.5
|
||||
by=py*(.98 if crop else 1)+(8.48 if crop else 0)-.5
|
||||
b=bilinear(body.astype(float),bx,by)
|
||||
localx=px-x;localy=py-y;ph,pw=patch.shape[:2]
|
||||
p=bilinear(patch.astype(float),localx-.5,localy-.5)
|
||||
mask=(opacity*p[:,:,3:4]/255)*((localx>=0)&(localy>=0)&(localx<pw)&(localy<ph))[...,None]
|
||||
out=b[:,:,:3]*(1-mask)+p[:,:,:3]*mask
|
||||
out[~inside]=255
|
||||
return np.clip(np.floor(out+.5),0,255).astype(np.uint8)
|
||||
|
||||
def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--runtime',type=Path,required=True);parser.add_argument('--output',type=Path,required=True)
|
||||
args=parser.parse_args();args.output.mkdir(parents=True,exist_ok=True)
|
||||
m=json.loads((args.runtime/'manifest.json').read_text());source=(ROOT/'app/src/main/java/com/gorios/lanvoice/avatar/ContinuousBodyRenderer.kt').read_text()
|
||||
vertex=re.search(r'const val VERTEX="""([\s\S]*?)"""',source)[1]
|
||||
fragment=re.search(r'const val FRAGMENT="""([\s\S]*?)"""',source)[1]
|
||||
fragment=fragment.replace('#extension GL_OES_EGL_image_external : require','').replace('samplerExternalOES','sampler2D')
|
||||
results=[]
|
||||
with tempfile.TemporaryDirectory(prefix='avatar-gles-golden-') as temporary:
|
||||
tmp=Path(temporary);(tmp/'vertex').write_text(vertex);(tmp/'fragment').write_text(fragment)
|
||||
subprocess.run(['cc','-O2',str(ROOT/'tests/avatar-pixels/gles-golden.c'),'-lEGL','-lGLESv2','-lm','-o',str(tmp/'golden')],check=True)
|
||||
env=dict(os.environ,EGL_PLATFORM='surfaceless',LIBGL_ALWAYS_SOFTWARE='1')
|
||||
def check(body,patch,x,y,opacity,w,h,label,crop=0):
|
||||
(tmp/'body.rgba').write_bytes(body.tobytes());(tmp/'patch.rgba').write_bytes(patch.tobytes())
|
||||
p=subprocess.run([str(tmp/'golden'),str(tmp/'vertex'),str(tmp/'fragment'),str(tmp/'body.rgba'),str(tmp/'patch.rgba'),str(tmp/'out.rgba'),str(patch.shape[1]),str(patch.shape[0]),str(x),str(y),str(opacity),str(w),str(h),str(crop)],env=env,capture_output=True,text=True)
|
||||
assert p.returncode==0,p.stderr
|
||||
actual=np.frombuffer((tmp/'out.rgba').read_bytes(),np.uint8).reshape(h,w,4)[::-1,:,:3]
|
||||
expected=golden(body,patch,x,y,opacity,w,h,crop);diff=np.abs(actual.astype(int)-expected.astype(int))
|
||||
row={'case':label,'maxAbsRGB':int(diff.max()),'meanAbsRGB':float(diff.mean()),'viewport':[w,h],'bodyTransformCrop':crop,'gl':p.stdout.strip()}
|
||||
results.append(row)
|
||||
assert diff.max()<=2,row
|
||||
if opacity==0 and w==480 and h==848 and not crop:assert np.array_equal(actual,body[:,:,:3]),'Level0 must be exact decoded body'
|
||||
if label=='frame43-level2':Image.fromarray(actual[94:150,193:263]).resize((560,448)).save(args.output/'gles-frame43-level2-mouth.png')
|
||||
yy,xx=np.mgrid[:848,:480];body=np.empty((848,480,4),np.uint8)
|
||||
body[:,:,0]=xx%256;body[:,:,1]=yy%256;body[:,:,2]=((xx//16+yy//16)%2)*255;body[:,:,3]=255
|
||||
patch=np.zeros((22,40,4),np.uint8);patch[:,:,:3]=[211,70,39];patch[:,:,3]=np.arange(40,dtype=np.uint8)[None,:]*6
|
||||
for w,h in [(480,848),(360,800),(800,480)]:
|
||||
for opacity in [0,.5,1]:check(body,patch,211.25,112.5,opacity,w,h,f'synthetic-{w}x{h}-opacity{opacity}')
|
||||
check(body,patch,211.25,112.5,1,480,848,'synthetic-transform-crop',1)
|
||||
pipe=subprocess.Popen(['/home/ubuntu/gori-bin/ffmpeg','-v','error','-i',str(args.runtime/m['body']['path']),'-f','rawvideo','-pix_fmt','rgba','-'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||
try:
|
||||
for i,row in enumerate(m['patches']):
|
||||
raw=pipe.stdout.read(480*848*4);assert len(raw)==480*848*4
|
||||
if i not in (0,26,43,52,69,96):continue
|
||||
body=np.frombuffer(raw,np.uint8).reshape(848,480,4)
|
||||
for level in (0,1,2,3,4):
|
||||
patch=np.asarray(Image.open(args.runtime/row['levels'][level]['path']).convert('RGBA'))
|
||||
check(body,patch,row['x'],row['y'],0 if level==0 else 1,480,848,f'frame{i}-level{level}')
|
||||
assert pipe.stdout.read(1)==b'';assert pipe.wait(timeout=10)==0
|
||||
finally:
|
||||
if pipe.poll() is None:pipe.kill();pipe.wait()
|
||||
report={'status':'passed','shaderSourceSha':hashlib.sha256(source.encode()).hexdigest(),
|
||||
'harnessSha':hashlib.sha256((ROOT/'tests/avatar-pixels/gles-golden.c').read_bytes()).hexdigest(),
|
||||
'scope':'Production shader strings; body OES sampler substituted by2D, decoded ffmpeg/PIL straight bytes. Does not test Android Bitmap/OES/YUV/physicaldisplay.','cases':results}
|
||||
(args.output/'shader-golden.json').write_text(json.dumps(report,indent=2)+'\n')
|
||||
print('PASS:',len(results),'real offline EGL/GLES pixel golden cases: UV/top-bottom/Fit/nontrivial body transform/straight blend/alpha0/6fixedframes x5levels; Android device pending')
|
||||
|
||||
if __name__=='__main__':main()
|
||||
@@ -44,6 +44,7 @@ for name in ('CallScreen','EngineeringPreviewScreen'):
|
||||
assert text(avatar).count('AvatarPortrait(')==1
|
||||
no_calls(avatar,['Text','AvatarDiagnostics','ExpressionControls','Button','TextButton'])
|
||||
assert 'AvatarDiagnostics(pack,video)' in text(settings)
|
||||
assert 'PermissionSettings(' in text(settings)
|
||||
assert 'settingsOpen' not in text(fn)
|
||||
if name=='CallScreen':
|
||||
for expected in ('正在连接','重试连接','permissionMessage','onAuthorizeMic','onMute','onCamera','ExpressionControls','请求表达','onReport'):
|
||||
@@ -59,5 +60,15 @@ activity=(ROOT/'app/src/main/java/com/gorios/lanvoice/MainActivity.kt').read_tex
|
||||
offline=activity[activity.index('if (offlineAvatarPreview) {'):activity.index('audioOutput = AudioOutputGate')]
|
||||
assert 'EngineeringPreviewScreen' in offline and 'return' in offline
|
||||
for forbidden in ('VoiceSession(', 'ExpressionController(', 'permission.launch(', '.dial('): assert forbidden not in offline
|
||||
assert 'conversationEnabled=false,automaticPermissions=false' in offline
|
||||
assert 'isLaidOut' in activity and 'isAttachedToWindow' in activity
|
||||
for method,next_method in (('authorizeMicrophone','authorizeCamera'),('authorizeCamera','retryConnection')):
|
||||
body=activity[activity.index('private fun '+method):activity.index('private fun '+next_method)]
|
||||
assert 'ConnectionStatus.CONNECTED' not in body,'Manual consent must not depend on HELLO'
|
||||
assert 'granted(Manifest.permission.' in body and 'openSettings()' in body
|
||||
assert 'entry.permissionPending!=permission' in activity
|
||||
permissions=text(block('fun PermissionSettings'))
|
||||
for label in ('已授权','未授权','申请麦克风权限','申请摄像头权限','系统权限设置'):
|
||||
assert label in permissions
|
||||
assert '本版仅修复界面;嘴层沿用 runtime03,变形问题尚未修复' in source
|
||||
print('PASS: clean home has persistent avatar + one 48dp safe-inset gear; normal/offline text and controls are sheet-only; sheet state never keys renderer/session; offline construction bypasses sensors/network. Source contracts only; real-device probe pending.')
|
||||
|
||||
@@ -40,21 +40,31 @@ for name, main, real in suites:
|
||||
with tempfile.TemporaryDirectory(prefix=f'lan-voice-{name}-') as out:
|
||||
files = list((ROOT/'tests'/name).glob('*.kt')) + real
|
||||
if name == 'avatar' and args.runtime_manifest:
|
||||
definitions=[]
|
||||
def kotlin(value):
|
||||
if value is None: return 'null'
|
||||
if isinstance(value,bool): return str(value).lower()
|
||||
if isinstance(value,str): return json.dumps(value,ensure_ascii=False).replace('$','\\$')
|
||||
if isinstance(value,int): return str(value)+'L'
|
||||
if isinstance(value,float): return repr(value)
|
||||
if isinstance(value,list): return 'listOf<Any?>('+','.join(map(kotlin,value))+')'
|
||||
if isinstance(value,dict): return 'mapOf<String,Any?>('+','.join(kotlin(k)+' to '+kotlin(v) for k,v in value.items())+')'
|
||||
if isinstance(value,(list,dict)):
|
||||
result=('listOf<Any?>('+','.join(map(kotlin,value))+')' if isinstance(value,list) else
|
||||
'mapOf<String,Any?>('+','.join(kotlin(k)+' to '+kotlin(v) for k,v in value.items())+')')
|
||||
# Actual97x5 metadata exceeds a single JVM method. Preserve every
|
||||
# field while splitting literal construction into bounded helpers.
|
||||
method='metadata'+str(len(definitions))
|
||||
kind='List<Any?>' if isinstance(value,list) else 'Map<String,Any?>'
|
||||
definitions.append('private fun '+method+'(): '+kind+' = '+result+'\n')
|
||||
return method+'()'
|
||||
raise TypeError(type(value))
|
||||
import hashlib
|
||||
raw=args.runtime_manifest.read_bytes();digest=hashlib.sha256(raw).hexdigest()
|
||||
extra=Path(out)/'ActualRuntimeCheck.kt'
|
||||
extra.write_text('import com.gorios.lanvoice.avatar.*\nfun main() {\nval root='+kotlin(json.loads(raw))+'\n'+
|
||||
literal=kotlin(json.loads(raw))
|
||||
extra.write_text('import com.gorios.lanvoice.avatar.*\n'+''.join(definitions)+'fun main() {\nval root='+literal+'\n'+
|
||||
'val pack=checkNotNull(ContinuousAvatarManifest.read(root,"'+digest+'","'+digest+'",true,"runtime/"))\n'+
|
||||
'check(pack.patches.size==97 && pack.body.frameCount==97 && pack.curves.size==5)\n'+
|
||||
('check(pack.apertureMode && pack.textureImages.size==485 && pack.patches.all { it.levels.size==5 })\n' if json.loads(raw)['packId'].endswith('runtime-04') else 'check(!pack.apertureMode && pack.textureImages.size==97)\n')+
|
||||
'println("PASS: actual exported runtime manifest parsed by production Kotlin, exact hash '+digest+'; 97 body/patch frames and five authored curves/routing")\n}\n')
|
||||
files.append(extra)
|
||||
subprocess.run([JAVA,'-cp',compiler,'org.jetbrains.kotlin.cli.jvm.K2JVMCompiler','-no-stdlib',
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Pinned runtime04 aperture-level Android internal debug candidate; no final quality approval."""
|
||||
from pathlib import Path
|
||||
import argparse,hashlib,importlib.util,json,os,re,subprocess,tempfile,urllib.request,zipfile
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
spec=importlib.util.spec_from_file_location('natural_packaging',ROOT/'scripts/package-avatar-natural.py')
|
||||
natural=importlib.util.module_from_spec(spec);spec.loader.exec_module(natural)
|
||||
LOG=ROOT/'logs/avatar-mouth-062';natural.LOG=LOG
|
||||
SOURCE=ROOT/'.runtime/avatar-imports/a01-neutral-graph-v1/runtime-04'
|
||||
PACK=ROOT/'app/src/main/assets/avatar/a01-neutral-graph-v1/runtime-04'
|
||||
PIN='0a3c4918ba746019cf1df885bec66e5858a8950997dac4f64e7d37094be64dad'
|
||||
ARTIFACT=ROOT/'artifacts/lan-voice-v062-mouth-candidate-arm64-debug.apk'
|
||||
CERT='b9608336bc1ed1de3269bb4594f9fe718daaa5439511c5187aa385d2b799dcf1'
|
||||
UI_SHA='8d18f4b4f46ad1a165901cd794d9407b4b61fc017cafb249a7addf9834d5e029'
|
||||
sha=lambda data:hashlib.sha256(data).hexdigest()
|
||||
|
||||
def import_runtime():
|
||||
raw=(SOURCE/'manifest.json').read_bytes();assert sha(raw)==PIN and len(raw)<=512000,'runtime04 manifest drift'
|
||||
m=json.loads(raw);assert m['schemaVersion']==1 and m['packId']=='a01-neutral-graph-v1-runtime-04' and m['identityId']=='a01'
|
||||
assert m['runtimeReady'] is True and m['publishApproval'] is False and m['deviceTestStatus']=='pending'
|
||||
assert m['naturalQualityStatus']=='pending_coordinator' and m['safeTransitions']['reviewStatus']=='pending' and m['approvedEdges']==[]
|
||||
assert m['patchFormat']['alphaEncoding']=='straight_unassociated' and m['patchFormat']['apertureLevels']==[0,.25,.5,.75,1]
|
||||
b=m['body'];assert b['sha256']=='177dbc0ab809e3c9c684899ffbd9cf3a2c357973c7037134f5d79e4e6cdfc762'
|
||||
assert (b['frameCount'],b['width'],b['height'],b['fpsNumerator'],b['fpsDenominator'],b['durationUs'],b['hasAudio'])==(97,480,848,24,1,4041667,False)
|
||||
files={'manifest.json':raw}
|
||||
def read(row,pattern,limit):
|
||||
name=row['path'];assert re.fullmatch(pattern,name) and name not in files
|
||||
p=(SOURCE/name).resolve(strict=True);assert p.is_relative_to(SOURCE.resolve()) and p.stat().st_size<=limit
|
||||
data=p.read_bytes();assert sha(data)==row['sha256'];files[name]=data
|
||||
read(b,r'body/[A-Za-z0-9_.-]+\.mp4',16000000)
|
||||
assert len(m['patches'])==97
|
||||
size=0
|
||||
for i,p in enumerate(m['patches']):
|
||||
assert p['frameIndex']==i and abs(p['ptsUs']-i*1000000//24)<=2
|
||||
x,y,w,h=(p[k] for k in ('x','y','width','height'))
|
||||
assert all(isinstance(v,int) for v in (x,y,w,h)) and 1<=w<=128 and 1<=h<=128 and 0<=x<=480-w and 0<=y<=848-h
|
||||
assert len(p['levels'])==5
|
||||
for level,l in enumerate(p['levels']):
|
||||
assert l['levelIndex']==level and l['aperture']==level/4
|
||||
read(l,r'patches/[A-Za-z0-9_.-]+\.png',256000)
|
||||
with Image.open(SOURCE/l['path']) as image:assert image.mode=='RGBA' and image.size==(w,h)
|
||||
size+=w*h*4
|
||||
assert p['path']==p['levels'][4]['path'] and p['sha256']==p['levels'][4]['sha256']
|
||||
assert size<=8000000 and len(files)==487
|
||||
for name,data in files.items():
|
||||
dest=PACK/name;assert not dest.exists() or dest.read_bytes()==data,'Unknown existing runtime04 byte: '+name
|
||||
for name,data in files.items():
|
||||
dest=PACK/name;dest.parent.mkdir(parents=True,exist_ok=True,mode=0o700)
|
||||
if dest.exists():continue
|
||||
fd,tmp=tempfile.mkstemp(prefix='.runtime04-',dir=dest.parent)
|
||||
try:
|
||||
with os.fdopen(fd,'wb') as f:f.write(data)
|
||||
os.chmod(tmp,0o600);os.replace(tmp,dest)
|
||||
finally:
|
||||
if os.path.exists(tmp):os.unlink(tmp)
|
||||
assert sha((SOURCE/'manifest.json').read_bytes())==PIN
|
||||
(LOG/'import.json').write_text(json.dumps({'manifestSha':PIN,'admissionScope':'coordinator_authorized_debug_device_candidate_only','fileCount':len(files),'rgbaBytes':size,'productionApproval':False},indent=2)+'\n')
|
||||
return m,files
|
||||
|
||||
def decode_math(m):
|
||||
body=PACK/m['body']['path']
|
||||
probe=json.loads(natural.run(['/home/ubuntu/miniconda3/envs/gori-speech/bin/ffprobe','-v','error','-show_streams','-show_frames','-of','json',body],'body-probe.json'))
|
||||
assert len(probe['streams'])==1 and len(probe['frames'])==97
|
||||
s=probe['streams'][0];assert (s['codec_name'],s['pix_fmt'],s['width'],s['height'],s['r_frame_rate'])==('h264','yuv420p',480,848,'24/1')
|
||||
assert all(abs(float(f['best_effort_timestamp_time'])-i/24)<1e-5 for i,f in enumerate(probe['frames']))
|
||||
natural.run(['/home/ubuntu/gori-bin/ffmpeg','-v','error','-xerror','-i',body,'-f','null','-'],'body-full-decode.txt')
|
||||
pipe=subprocess.Popen(['/home/ubuntu/gori-bin/ffmpeg','-v','error','-i',str(body),'-f','rawvideo','-pix_fmt','rgb24','-'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||
metrics=[]
|
||||
try:
|
||||
for i,row in enumerate(m['patches']):
|
||||
data=pipe.stdout.read(480*848*3);assert len(data)==480*848*3
|
||||
base=np.frombuffer(data,np.uint8).reshape(848,480,3);x,y,w,h=[row[k] for k in ('x','y','width','height')]
|
||||
region=base[y:y+h,x:x+w].astype(float);previous=region
|
||||
for level,l in enumerate(row['levels']):
|
||||
rgba=np.asarray(Image.open(PACK/l['path']),float);a=rgba[:,:,3:4]/255
|
||||
out=region if level==0 else region*(1-a)+rgba[:,:,:3]*a
|
||||
if level==0:assert np.array_equal(out,region)
|
||||
delta=np.abs(out-previous)
|
||||
metrics.append({'frameIndex':i,'levelIndex':level,'opacity':0 if level==0 else 1,
|
||||
'adjacentLevelMaxRGB':float(delta.max()),'adjacentLevelMeanRGB':float(delta.mean()),
|
||||
'perceivedMotion':'unknown','zeroBypassExact':True if level==0 else None})
|
||||
previous=out
|
||||
assert pipe.stdout.read(1)==b'' and pipe.wait(timeout=10)==0
|
||||
finally:
|
||||
if pipe.poll() is None:pipe.kill();pipe.wait()
|
||||
(LOG/'level-math.json').write_text(json.dumps({'scope':'CPU selected geometry with spatial mask only; pixel deltas do not certify naturalness, visible talk or ≤1s','frames':metrics},indent=2)+'\n')
|
||||
|
||||
def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--import-only',action='store_true');parser.add_argument('--verify-existing',action='store_true')
|
||||
args=parser.parse_args();LOG.mkdir(parents=True,exist_ok=True)
|
||||
m,files=import_runtime();_,oldfiles=natural.import_runtime()
|
||||
ui=ROOT/'artifacts/lan-voice-v062-ui-candidate-arm64-debug.apk';assert sha(ui.read_bytes())==UI_SHA
|
||||
if args.import_only:
|
||||
decode_math(m);print('PASS: runtime04 pinned debug candidate manifest/body/97x5RGBA, strict dimensions/bounds/hash, CFR/full decode, alpha0 bypass and selected geometry opacity1 math. runtime03/code14 retained.');return
|
||||
natural.tests_current()
|
||||
actual=(LOG/'actual-manifest-tests.txt').read_text();assert PIN in actual and 'PASS: actual exported runtime manifest parsed' in actual
|
||||
assert 'PASS: clean home' in (ROOT/'logs/avatar-safe-061/ui-contract-tests.txt').read_text()
|
||||
assert 'BUILD SUCCESSFUL' in (LOG/'android-test-compile.txt').read_text()
|
||||
golden=json.loads((LOG/'shader-golden/shader-golden.json').read_text());assert golden['status']=='passed' and len(golden['cases'])==40
|
||||
assert golden['shaderSourceSha']==sha((ROOT/'app/src/main/java/com/gorios/lanvoice/avatar/ContinuousBodyRenderer.kt').read_bytes())
|
||||
if args.verify_existing:assert ARTIFACT.is_file();built=ARTIFACT
|
||||
else:
|
||||
assert not ARTIFACT.exists(),'Never overwrite a delivered code15 artifact'
|
||||
natural.run([ROOT/'scripts/build.sh','assembleDebug','-PavatarNatural=true','-PavatarMouthCandidate=true','-PnaturalManifestSha='+PIN],'assemble.txt')
|
||||
built=ROOT/'app/build/outputs/apk/debug/app-debug.apk'
|
||||
extra={'assets/avatar/a01-neutral-graph-v1/runtime-04/'+n:data for n,data in files.items()}
|
||||
cert=natural.verify(built,oldfiles,15,'0.6.2-mouth-dev',extra);assert cert==CERT
|
||||
signature=natural.run([natural.TOOLS/'apksigner','verify','--print-certs',ui],'signature-code14.txt');assert CERT in signature
|
||||
with zipfile.ZipFile(built) as new,zipfile.ZipFile(ui) as old:
|
||||
for n in old.namelist():
|
||||
if n.startswith('assets/avatar/') and not n.endswith('/'):assert new.read(n)==old.read(n)
|
||||
if not args.verify_existing:
|
||||
with ARTIFACT.open('xb') as f:f.write(built.read_bytes())
|
||||
digest=sha(ARTIFACT.read_bytes());checksum=f'{digest} {ARTIFACT.name}\n'.encode();side=ARTIFACT.with_suffix('.apk.sha256')
|
||||
assert not side.exists() or side.read_bytes()==checksum;side.write_bytes(checksum)
|
||||
url='http://192.168.31.124:8080/'+ARTIFACT.name;opener=urllib.request.build_opener(urllib.request.ProxyHandler({}))
|
||||
with opener.open(url,timeout=15) as response:
|
||||
data=response.read();assert response.status==200 and len(data)==ARTIFACT.stat().st_size and sha(data)==digest
|
||||
with opener.open(url+'.sha256',timeout=15) as response:assert response.status==200 and response.read()==checksum
|
||||
result={'scope':'coordinator_authorized_runtime04_debug_device_candidate_only','version':'0.6.2-mouth-dev','versionCode':15,
|
||||
'url':url,'apk':str(ARTIFACT),'sha256':digest,'bytes':ARTIFACT.stat().st_size,'sameCertificateSha256':cert,'manifestSha256':PIN,
|
||||
'httpBytesVerified':True,'permissionTiming':'foreground_host_layout_before_network','offlinePermissions':'manual_only_no_collection','mouthChanged':True,'mouthDeformationResolved':'not_certified','bodyChanged':False,
|
||||
'naturalQuality':'device_pending','visibleTalk':'device_pending','stairStepping':'device_pending','compliance1s':'not_certified',
|
||||
'productionApproval':False,'deviceInstall':'not_attempted','offlineExtra':'avatar_offline_preview'}
|
||||
(LOG/'delivery.json').write_text(json.dumps(result,indent=2)+'\n');print(json.dumps(result,indent=2))
|
||||
|
||||
if __name__=='__main__':main()
|
||||
@@ -104,7 +104,7 @@ def tests_current():
|
||||
assert sha((ROOT/'artifacts/lan-voice-v060-arm64-debug.apk').read_bytes())=='37f789820e86ac1656bda546f47ece3e4533ff8fc54614b171fd8a42accaa52e'
|
||||
assert 'APPROVED_MOTION_HASHES = emptySet<String>()' in (ROOT/'app/src/main/java/com/gorios/lanvoice/avatar/AvatarPack.kt').read_text()
|
||||
|
||||
def verify(apk,files,version_code=13,version_name='0.6.1-natural-dev'):
|
||||
def verify(apk,files,version_code=13,version_name='0.6.1-natural-dev',additional_assets=None):
|
||||
badge=run([TOOLS/'aapt','dump','badging',apk],'badging.txt')
|
||||
for value in ("name='com.gorios.lanvoice'",f"versionCode='{version_code}'",f"versionName='{version_name}'","sdkVersion:'26'","targetSdkVersion:'34'"):
|
||||
assert value in badge,value
|
||||
@@ -126,6 +126,7 @@ def verify(apk,files,version_code=13,version_name='0.6.1-natural-dev'):
|
||||
expected['assets/avatar/a01-neutral-graph-v1/'+row['path']]=data
|
||||
still='assets/avatar/a01-standing-arms-reference/frames/reference.png';data=(ROOT/'app/src/main'/still).read_bytes()
|
||||
assert sha(data)=='36a078ad9e1d2929612e9baa2af524bda90dafceddc4515dd448fc08121d7dd2';expected[still]=data
|
||||
expected.update(additional_assets or {})
|
||||
with zipfile.ZipFile(apk) as z:
|
||||
actual={n for n in z.namelist() if n.startswith('assets/avatar/') and not n.endswith('/')}
|
||||
assert actual==set(expected),f'Unexpected/missing avatar files: {actual^set(expected)}'
|
||||
|
||||
Reference in New Issue
Block a user