summaryrefslogtreecommitdiff
path: root/runtime/common_runtime_test.cc
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2018-10-26 15:01:18 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-10-26 15:01:18 +0000
commitc2099b0b0c052dd61137b9cf5f9f8b30bab1a7a8 (patch)
treecd56ff9ec27abd929d855d2e3dff4af56f6fabec /runtime/common_runtime_test.cc
parentda1cc3b9eea9954754e11441cd52f1f9b2fc33e7 (diff)
parentc857f4a087e16539871f724647e1bed4c67645c0 (diff)
Merge "ART: Dump proc/maps on mem_map_test failure"
Diffstat (limited to 'runtime/common_runtime_test.cc')
-rw-r--r--runtime/common_runtime_test.cc37
1 files changed, 23 insertions, 14 deletions
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index be39631e44..cfc0d283d1 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -59,20 +59,6 @@
#include "thread.h"
#include "well_known_classes.h"
-int main(int argc, char **argv) {
- // Gtests can be very noisy. For example, an executable with multiple tests will trigger native
- // bridge warnings. The following line reduces the minimum log severity to ERROR and suppresses
- // everything else. In case you want to see all messages, comment out the line.
- setenv("ANDROID_LOG_TAGS", "*:e", 1);
-
- art::Locks::Init();
- art::InitLogging(argv, art::Runtime::Abort);
- art::MemMap::Init();
- LOG(INFO) << "Running main() from common_runtime_test.cc...";
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
namespace art {
using android::base::StringPrintf;
@@ -420,3 +406,26 @@ void CheckJniAbortCatcher::Hook(void* data, const std::string& reason) {
}
} // namespace art
+
+// Allow other test code to run global initialization/configuration before
+// gtest infra takes over.
+extern "C"
+__attribute__((visibility("default"))) __attribute__((weak))
+void ArtTestGlobalInit() {
+ LOG(ERROR) << "ArtTestGlobalInit in common_runtime_test";
+}
+
+int main(int argc, char **argv) {
+ // Gtests can be very noisy. For example, an executable with multiple tests will trigger native
+ // bridge warnings. The following line reduces the minimum log severity to ERROR and suppresses
+ // everything else. In case you want to see all messages, comment out the line.
+ setenv("ANDROID_LOG_TAGS", "*:e", 1);
+
+ art::Locks::Init();
+ art::InitLogging(argv, art::Runtime::Abort);
+ art::MemMap::Init();
+ LOG(INFO) << "Running main() from common_runtime_test.cc...";
+ testing::InitGoogleTest(&argc, argv);
+ ArtTestGlobalInit();
+ return RUN_ALL_TESTS();
+}