Fix bogus image test assert
Previously we were comparing the size of the non moving space to
size of the image file.
Now we properly compare the size of the image space against the size
of the image file.
Bug: 19264997
Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a
diff --git a/compiler/image_test.cc b/compiler/image_test.cc
index dbdd350..772cc80 100644
--- a/compiler/image_test.cc
+++ b/compiler/image_test.cc
@@ -105,6 +105,7 @@
<< oat_file.GetFilename();
}
+ uint64_t image_file_size;
{
std::unique_ptr<File> file(OS::OpenFileForReading(image_file.GetFilename().c_str()));
ASSERT_TRUE(file.get() != nullptr);
@@ -121,7 +122,8 @@
ASSERT_FALSE(space->IsImageSpace());
ASSERT_TRUE(space != nullptr);
ASSERT_TRUE(space->IsMallocSpace());
- ASSERT_LE(space->Size(), static_cast<size_t>(file->GetLength()));
+
+ image_file_size = file->GetLength();
}
ASSERT_TRUE(compiler_driver_->GetImageClasses() != nullptr);
@@ -167,6 +169,9 @@
ASSERT_TRUE(heap->GetNonMovingSpace()->IsMallocSpace());
gc::space::ImageSpace* image_space = heap->GetImageSpace();
+ ASSERT_TRUE(image_space != nullptr);
+ ASSERT_LE(image_space->Size(), image_file_size);
+
image_space->VerifyImageAllocations();
uint8_t* image_begin = image_space->Begin();
uint8_t* image_end = image_space->End();