Remove support for command-line args
We no longer support passing string arguments to a VM. Any
customization needed can be done by having the host communicate with
the VM after it starts.
Also start adding a header to provide the entry-point prototype for
better safety.
Bug: 249064104
Bug: 243513572
Test: atest MicrodroidTests MicrodroidHostTestCases
Change-Id: I0a1775f3b6a0b11c71c4831f6c380d96bb637c00
diff --git a/tests/testapk/src/native/crashbinary.cpp b/tests/testapk/src/native/crashbinary.cpp
index 9f80fd0..a0edc40 100644
--- a/tests/testapk/src/native/crashbinary.cpp
+++ b/tests/testapk/src/native/crashbinary.cpp
@@ -17,8 +17,10 @@
#include <stdio.h>
#include <stdlib.h>
+#include "vm_main.h"
+
// A VM payload that crashes as soon as it starts, to allow us to exercise that error path.
-extern "C" int android_native_main(int /* argc */, char* /* argv */[]) {
+extern "C" int AVmPayload_main() {
printf("test crash!!!!\n");
abort();
}
diff --git a/tests/testapk/src/native/testbinary.cpp b/tests/testapk/src/native/testbinary.cpp
index 003aca8..d810e3c 100644
--- a/tests/testapk/src/native/testbinary.cpp
+++ b/tests/testapk/src/native/testbinary.cpp
@@ -27,6 +27,7 @@
#include <sys/ioctl.h>
#include <sys/system_properties.h>
#include <unistd.h>
+#include <vm_main.h>
#include <vm_payload.h>
#include <binder_rpc_unstable.hpp>
@@ -146,20 +147,13 @@
} // Anonymous namespace
-extern "C" int android_native_main(int argc, char* argv[]) {
+extern "C" int AVmPayload_main() {
// disable buffering to communicate seamlessly
setvbuf(stdin, nullptr, _IONBF, 0);
setvbuf(stdout, nullptr, _IONBF, 0);
setvbuf(stderr, nullptr, _IONBF, 0);
- printf("Hello Microdroid ");
- for (int i = 0; i < argc; i++) {
- printf("%s", argv[i]);
- bool last = i == (argc - 1);
- if (!last) {
- printf(" ");
- }
- }
+ printf("Hello Microdroid");
testlib_sub();
printf("\n");