Fix for gtest missing core classes.
common_runtime_test loads both core-libart and
core-oj
Change-Id: I5b814e4dcf9f6162c47b4eb5e7890a32e59c2cef
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index c299210..5172fbe 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -197,8 +197,11 @@
MemMap::Init(); // For LoadExpectSingleDexFile
std::string error_msg;
- java_lang_dex_file_ = LoadExpectSingleDexFile(GetLibCoreDexFileName().c_str());
- boot_class_path_.push_back(java_lang_dex_file_);
+
+ for (const std::string &core_dex_file_name : GetLibCoreDexFileNames()) {
+ java_lang_dex_file_ = LoadExpectSingleDexFile(core_dex_file_name.c_str());
+ boot_class_path_.push_back(java_lang_dex_file_);
+ }
std::string min_heap_string(StringPrintf("-Xms%zdm", gc::Heap::kDefaultInitialSize / MB));
std::string max_heap_string(StringPrintf("-Xmx%zdm", gc::Heap::kDefaultMaximumSize / MB));
@@ -283,8 +286,8 @@
Runtime::Current()->GetHeap()->VerifyHeap(); // Check for heap corruption after the test
}
-std::string CommonRuntimeTest::GetLibCoreDexFileName() {
- return GetDexFileName("core-libart");
+std::vector<std::string> CommonRuntimeTest::GetLibCoreDexFileNames() {
+ return std::vector<std::string>({GetDexFileName("core-oj"), GetDexFileName("core-libart")});
}
std::string CommonRuntimeTest::GetDexFileName(const std::string& jar_prefix) {
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h
index c19b30f..2af8208 100644
--- a/runtime/common_runtime_test.h
+++ b/runtime/common_runtime_test.h
@@ -92,8 +92,8 @@
virtual void TearDown();
- // Gets the path of the libcore dex file.
- std::string GetLibCoreDexFileName();
+ // Gets the paths of the libcore dex files.
+ std::vector<std::string> GetLibCoreDexFileNames();
// Gets the path of the specified dex file for host or target.
std::string GetDexFileName(const std::string& jar_prefix);