Revert^4 "Disable check that no oat libraries are loaded."
This reverts commit 8b5af2c1fb1f3b54ec4eb8c3188a7f7105466b6d.
Reason for revert: Fix capture of image files.
Bug: 128529256
Change-Id: I55e7ee178695358d5f3e19c0d0641bcaaa3fe355
Test: m test-art-host
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index b03551b..8d1c89e 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -645,7 +645,16 @@
void OatFileManager::SetOnlyUseSystemOatFiles(bool assert_no_files_loaded) {
ReaderMutexLock mu(Thread::Current(), *Locks::oat_file_manager_lock_);
if (assert_no_files_loaded) {
- CHECK_EQ(oat_files_.size(), GetBootOatFiles().size());
+ // Make sure all files that were loaded up to this point are on /system. Skip the image
+ // files.
+ std::vector<const OatFile*> boot_vector = GetBootOatFiles();
+ std::unordered_set<const OatFile*> boot_set(boot_vector.begin(), boot_vector.end());
+
+ for (const std::unique_ptr<const OatFile>& oat_file : oat_files_) {
+ if (boot_set.find(oat_file.get()) == boot_set.end()) {
+ CHECK(LocationIsOnSystem(oat_file->GetLocation().c_str())) << oat_file->GetLocation();
+ }
+ }
}
only_use_system_oat_files_ = true;
}