app-mgmt-test: Add test for app termination/start race

Adds a test that (non-deterministically) triggers a race condition
between terminating an app and starting it again via a port start. This
race can also be seen occasionally in the PortStartFail. To make these
races easier to trigger, a sleep can be added to
kill_waiting_connections and has_waiting_connections in
trusty/kernel/lib/trusty/trusty_app.c.

Test: build.py qemu-generic-arm64-test-debug --test com.android.appmgmt-unittest.appmngr
Bug: 198698206
Change-Id: I369e46a10f47d8ea52808e78bdba57463bc57868
1 file changed