A stopped VM with no files is deleted
I came across this accidentally while writing a demo app. It's very
much an edge case, but without this fix quite difficult to get out of.
(Writing the test to reproduce was most of the work here.)
Bug: 243512240
Test: atest MicrodroidTests
Change-Id: Ifd51b463302418d36c83a25c1d5dedb701179363
diff --git a/tests/testapk/Android.bp b/tests/testapk/Android.bp
index e3c9961..5f9b915 100644
--- a/tests/testapk/Android.bp
+++ b/tests/testapk/Android.bp
@@ -24,6 +24,7 @@
"MicrodroidTestNativeLib",
"MicrodroidIdleNativeLib",
"MicrodroidEmptyNativeLib",
+ "MicrodroidExitNativeLib",
"MicrodroidPrivateLinkingNativeLib",
],
jni_uses_platform_apis: true,
@@ -73,6 +74,14 @@
stl: "none",
}
+// A payload that exits immediately on start
+cc_library_shared {
+ name: "MicrodroidExitNativeLib",
+ srcs: ["src/native/exitbinary.cpp"],
+ header_libs: ["vm_payload_headers"],
+ stl: "libc++_static",
+}
+
// A payload which tries to link against libselinux, one of private libraries
cc_library_shared {
name: "MicrodroidPrivateLinkingNativeLib",