Run the e2e tests from a directory cf controls.
This allows gtest to create temporary files for logging.
Test: Run locally, check logcat for tombstones.
Bug: 129357295
Change-Id: I5fc6bff98a73314d280364a6aca2b6484c24f216
diff --git a/guest/vsoc/lib/guest_region_e2e_test.cpp b/guest/vsoc/lib/guest_region_e2e_test.cpp
index b7f5f9f..5fd644a 100644
--- a/guest/vsoc/lib/guest_region_e2e_test.cpp
+++ b/guest/vsoc/lib/guest_region_e2e_test.cpp
@@ -135,6 +135,13 @@
}
int main(int argc, char** argv) {
+ if (argc == 2) {
+ // gtest tries to leave temporary files in the current directory, so make the
+ // current directory something that we control.
+ if (chdir(argv[1]) != 0) {
+ abort();
+ }
+ }
android::base::InitLogging(argv);
testing::InitGoogleTest(&argc, argv);
int rval = RUN_ALL_TESTS();
diff --git a/guest/vsoc/lib/managed_region_e2e_test.cpp b/guest/vsoc/lib/managed_region_e2e_test.cpp
index af10bb8..390a6b7 100644
--- a/guest/vsoc/lib/managed_region_e2e_test.cpp
+++ b/guest/vsoc/lib/managed_region_e2e_test.cpp
@@ -110,6 +110,13 @@
}
int main(int argc, char** argv) {
+ if (argc == 2) {
+ // gtest tries to leave temporary files in the current directory, so make the
+ // current directory something that we control.
+ if (chdir(argv[1]) != 0) {
+ abort();
+ }
+ }
android::base::InitLogging(argv);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();