Add tombstone upon crash test
Bug: 236588647
Test: atest MicrodroidHostTestCases both on Pixel and CF
Change-Id: I5e0a5db243e9688580c8ca44614f4a0c944dd997
diff --git a/tests/testapk/assets/vm_config_crash.json b/tests/testapk/assets/vm_config_crash.json
new file mode 100644
index 0000000..282f25c
--- /dev/null
+++ b/tests/testapk/assets/vm_config_crash.json
@@ -0,0 +1,13 @@
+{
+ "os": {
+ "name": "microdroid"
+ },
+ "task": {
+ "type": "microdroid_launcher",
+ "command": "MicrodroidTestNativeLib.so",
+ "args": [
+ "crash"
+ ]
+ },
+ "export_tombstones": true
+ }
diff --git a/tests/testapk/assets/vm_config_crash_no_tombstone.json b/tests/testapk/assets/vm_config_crash_no_tombstone.json
new file mode 100644
index 0000000..be0983d
--- /dev/null
+++ b/tests/testapk/assets/vm_config_crash_no_tombstone.json
@@ -0,0 +1,13 @@
+{
+ "os": {
+ "name": "microdroid"
+ },
+ "task": {
+ "type": "microdroid_launcher",
+ "command": "MicrodroidTestNativeLib.so",
+ "args": [
+ "crash"
+ ]
+ },
+ "export_tombstones": false
+ }
diff --git a/tests/testapk/src/native/testbinary.cpp b/tests/testapk/src/native/testbinary.cpp
index 422afca..b4fee86 100644
--- a/tests/testapk/src/native/testbinary.cpp
+++ b/tests/testapk/src/native/testbinary.cpp
@@ -181,6 +181,11 @@
setvbuf(stdout, nullptr, _IONBF, 0);
setvbuf(stderr, nullptr, _IONBF, 0);
+ if (strcmp(argv[1], "crash") == 0) {
+ printf("test crash!!!!\n");
+ abort();
+ }
+
printf("Hello Microdroid ");
for (int i = 0; i < argc; i++) {
printf("%s", argv[i]);