Add isolated Liam persona test APK profile
This commit is contained in:
@@ -21,7 +21,9 @@ private fun DialogueClient.listener(epoch: Long)=javaClass.getDeclaredMethod("li
|
||||
fun main() {
|
||||
val wires=mutableListOf<String>()
|
||||
val pin="208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93"
|
||||
for(persona in listOf("default","lvbu")) for(pending in listOf(false,true)) {
|
||||
val personas=System.getProperty("character.personas","default,lvbu,liam").split(",")
|
||||
check(personas.isNotEmpty() && personas.all { it in setOf("default","lvbu","liam") })
|
||||
for(persona in personas) for(pending in listOf(false,true)) {
|
||||
var readyPin: String?=if(pending) null else pin
|
||||
val statuses=mutableListOf<ConnectionStatus>()
|
||||
val client=DialogueClient("localhost",5011,statuses::add,persona=persona,
|
||||
@@ -51,5 +53,5 @@ fun main() {
|
||||
client.release();Handler.drain()
|
||||
}
|
||||
java.io.File(checkNotNull(System.getProperty("character.helloFile"))).writeText(wires.joinToString("\n")+"\n")
|
||||
println("PASS: four actual DialogueClient AUTH→production HELLO persona/media offers, pending readiness, duplicate AUTH and retired socket fences; transport/main/JSON adapters, device not_run")
|
||||
println("PASS: "+wires.size+" actual DialogueClient AUTH→production HELLO persona/media offers, pending readiness, duplicate AUTH and retired socket fences; transport/main/JSON adapters, device not_run")
|
||||
}
|
||||
|
||||
@@ -22,12 +22,13 @@ class CharacterProfilesTests(unittest.TestCase):
|
||||
return select.selection(ASSETS, profile, **flags)
|
||||
|
||||
def test_identities_are_distinct_media_is_identical(self):
|
||||
main, lvbu = self.full(), self.full('lvbu-test')
|
||||
self.assertEqual(main['files'], lvbu['files'])
|
||||
self.assertEqual(lvbu['file_count'], 4051)
|
||||
self.assertEqual((main['persona'], lvbu['persona']), ('default', 'lvbu'))
|
||||
self.assertNotEqual(main['application_id'], lvbu['application_id'])
|
||||
self.assertEqual((main['media_identity'], lvbu['media_identity']), ('a01', 'a01'))
|
||||
results=[self.full(p) for p in ('main','lvbu-test','liam-test')]
|
||||
for row in results:
|
||||
self.assertEqual(results[0]['files'],row['files'])
|
||||
self.assertEqual((row['file_count'],row['media_identity']),(4051,'a01'))
|
||||
self.assertEqual([r['persona'] for r in results],['default','lvbu','liam'])
|
||||
self.assertEqual(len({r['application_id'] for r in results}),3)
|
||||
self.assertEqual(results[2]['application_id'],'com.gorios.lanvoice.liamtest')
|
||||
self.assertNotIn('voice_id', json.dumps(select.catalog()))
|
||||
|
||||
def test_complete_inventory_is_exact_code33(self):
|
||||
@@ -55,9 +56,9 @@ class CharacterProfilesTests(unittest.TestCase):
|
||||
self.assertEqual(select.selection(copied)['files'], select.selection(ASSETS)['files'])
|
||||
|
||||
def test_wrong_persona_flags_or_pin_are_rejected(self):
|
||||
for profile, changes in [('unknown', {}), ('lvbu-test', {'startup': False}),
|
||||
('lvbu-test', {'mouth': False}), ('lvbu-test', {'user_assets': False}),
|
||||
('main', {'emotion_sha': '0'*64})]:
|
||||
cases=[('unknown',{}),('main',{'emotion_sha':'0'*64})]
|
||||
cases += [(p,{flag:False}) for p in ('lvbu-test','liam-test') for flag in ('startup','mouth','user_assets')]
|
||||
for profile, changes in cases:
|
||||
with self.subTest(profile=profile, changes=changes), self.assertRaises(ValueError):
|
||||
self.full(profile, **changes)
|
||||
|
||||
@@ -83,17 +84,20 @@ class CharacterProfilesTests(unittest.TestCase):
|
||||
select.relative(name)
|
||||
|
||||
def test_staging_cannot_overwrite_other_profile_or_build_root(self):
|
||||
result = self.full('lvbu-test')
|
||||
for dest in (ROOT/'app/build', ROOT/'app/build/generated/packagedAssets', ASSETS):
|
||||
with self.subTest(dest=dest), self.assertRaises(ValueError):
|
||||
select.stage(ASSETS, dest, result)
|
||||
for profile,other in [('lvbu-test','liam-test'),('liam-test','lvbu-test')]:
|
||||
result=self.full(profile)
|
||||
for dest in (ROOT/'app/build',ROOT/'app/build/generated/packagedAssets',ASSETS,
|
||||
ROOT/'app/build/characters'/other/'generated/packagedAssets'):
|
||||
with self.subTest(profile=profile,dest=dest),self.assertRaises(ValueError):
|
||||
select.stage(ASSETS,dest,result)
|
||||
|
||||
def test_backup_lifecycle_component_contracts(self):
|
||||
profiles = select.catalog()['profiles']
|
||||
self.assertTrue(profiles['main']['allowBackup'])
|
||||
self.assertTrue(profiles['main']['permissionConnectionRetention'])
|
||||
self.assertFalse(profiles['lvbu-test']['allowBackup'])
|
||||
self.assertFalse(profiles['lvbu-test']['permissionConnectionRetention'])
|
||||
for profile in ('lvbu-test','liam-test'):
|
||||
self.assertFalse(profiles[profile]['allowBackup'])
|
||||
self.assertFalse(profiles[profile]['permissionConnectionRetention'])
|
||||
text = (ROOT/'app/src/main/AndroidManifest.xml').read_text()
|
||||
self.assertIn('android:allowBackup="${characterAllowBackup}"', text)
|
||||
self.assertIn('android:name="com.gorios.lanvoice.MainActivity"', text)
|
||||
@@ -106,3 +110,13 @@ class CharacterProfilesTests(unittest.TestCase):
|
||||
pause=activity[activity.index("override fun onPause()"):activity.index("override fun onStop()")]
|
||||
self.assertLess(pause.index("if(releaseSessionFirst"),pause.index("closeCamera()"))
|
||||
self.assertIn("if(!releaseSessionFirst",pause)
|
||||
|
||||
def test_artifact_names_and_build_directories_are_isolated(self):
|
||||
spec=importlib.util.spec_from_file_location('character_pack',ROOT/'scripts/package-character-test.py')
|
||||
pack=importlib.util.module_from_spec(spec);spec.loader.exec_module(pack)
|
||||
self.assertEqual(pack.artifact_name('lvbu-test',34),'lan-voice-v0714-lvbu-test-code34-arm64-debug.apk')
|
||||
self.assertEqual(pack.artifact_name('liam-test',35),'lan-voice-v0714-liam-test-code35-arm64-debug.apk')
|
||||
self.assertNotEqual(pack.build_dir('liam-test'),pack.build_dir('lvbu-test'))
|
||||
self.assertIn('-PcharacterProfile=liam-test',pack.flags('liam-test',35))
|
||||
self.assertEqual(select.catalog()['profiles']['liam-test']['minimumVersionCode'],35)
|
||||
with self.assertRaises(ValueError):pack.artifact_name('main',35)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import com.gorios.lanvoice.net.DialogueProtocol
|
||||
|
||||
fun main() {
|
||||
for(persona in listOf("default","lvbu")) {
|
||||
for(persona in listOf("default","lvbu","liam")) {
|
||||
for((ready,pending) in listOf(null to null,"a".repeat(64) to null,null to "a".repeat(64))) {
|
||||
val hello=DialogueProtocol.hello(ready,pending,persona)
|
||||
check("\"persona\":\"$persona\"" in hello)
|
||||
@@ -10,7 +10,7 @@ fun main() {
|
||||
}
|
||||
check("\"persona\":\"default\"" in DialogueProtocol.hello())
|
||||
check(runCatching { DialogueProtocol.hello(persona="unknown") }.isFailure)
|
||||
println("PASS: production HELLO default/lvbu for no, ready and pending media; no client voice/CID; unknown persona rejected")
|
||||
println("PASS: production HELLO default/lvbu/liam for no, ready and pending media; no client voice/CID; unknown persona rejected")
|
||||
check("\"presence_greeting_version\":1" in DialogueProtocol.hello())
|
||||
for(kind in com.gorios.lanvoice.expression.PresenceKind.entries) {
|
||||
val wire=DialogueProtocol.presence(7,25,kind,100)
|
||||
|
||||
@@ -62,8 +62,9 @@ fun checkCallControls() {
|
||||
session.release(); AudioPlayback.activityFence = null
|
||||
// Actual session/client background path: the independent profile never retains
|
||||
// mic/playback/socket, including when a permission Activity pauses this Activity.
|
||||
for(persona in listOf("lvbu","liam")) {
|
||||
val independentStates=mutableListOf<VoiceUiState>()
|
||||
val independent=VoiceSession("localhost",5011,independentStates::add,persona="lvbu",keepPermissionConnection=false)
|
||||
val independent=VoiceSession("localhost",5011,independentStates::add,persona=persona,keepPermissionConnection=false)
|
||||
val connection=independent.javaClass.getDeclaredField("dialogue").apply { isAccessible=true }.get(independent) as DialogueClient
|
||||
val oldSocket=FakeSocket();connection.setField("socket",oldSocket);connection.setField("ready",true)
|
||||
independent.javaClass.getDeclaredField("foreground").apply { isAccessible=true }.set(independent,true)
|
||||
@@ -80,6 +81,7 @@ fun checkCallControls() {
|
||||
connection.callbacks(0).onMessage(oldSocket,"hello");Handler.drain()
|
||||
check(independentStates.last().connection==ConnectionStatus.DISCONNECTED)
|
||||
independent.release()
|
||||
println("PASS: lvbu background/permission pause disconnects actual session/client; late capture/playback/HELLO cannot revive it; default retention covered separately")
|
||||
}
|
||||
println("PASS: lvbu/liam background/permission pause disconnects actual session/client; late capture/playback/HELLO cannot revive it; default retention covered separately")
|
||||
println("PASS: real VoiceSession explicit start/duplicate dial, mute discards queued capture/keeps seq/no restart while answering, audio turn/generation/abort/hangup/late-frame fences")
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ class StartingFixture(val healthCode: Int = 200, val healthError: java.io.IOExce
|
||||
fun close() { client.release(); barrier.countDown(); Handler.drain() }
|
||||
}
|
||||
fun runChecks() {
|
||||
Fixture("lvbu").apply {
|
||||
event("auth");check(socket.sent==listOf("hello persona=lvbu"))
|
||||
for(persona in listOf("lvbu","liam")) Fixture(persona).apply {
|
||||
event("auth");check(socket.sent==listOf("hello persona=$persona"))
|
||||
event("auth");check(socket.sent.size==1)
|
||||
event("hello");check(statuses==listOf(ConnectionStatus.CONNECTED))
|
||||
client.disconnect()
|
||||
|
||||
Reference in New Issue
Block a user