summaryrefslogtreecommitdiffstats
path: root/runtime/oat_file_assistant_test.cc
diff options
context:
space:
mode:
authorRichard Uhler <ruhler@google.com>2015-05-11 09:32:47 -0700
committerRichard Uhler <ruhler@google.com>2015-05-11 09:32:47 -0700
commitf16d5727f9062379519043bc063a2c0527c59eb8 (patch)
treecc4552157e74366d39e27dc95d59df93d5689ff6 /runtime/oat_file_assistant_test.cc
parent2b689e370be9f32a88b419edf2d78eb6befade9c (diff)
downloadart-f16d5727f9062379519043bc063a2c0527c59eb8.zip
art-f16d5727f9062379519043bc063a2c0527c59eb8.tar.gz
art-f16d5727f9062379519043bc063a2c0527c59eb8.tar.bz2
Add more diagnostics info to flaky oat file assistant test.
Change-Id: Ifd0029d389ba7585a819c01fc9cc846681d0a349
Diffstat (limited to 'runtime/oat_file_assistant_test.cc')
-rw-r--r--runtime/oat_file_assistant_test.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/oat_file_assistant_test.cc b/runtime/oat_file_assistant_test.cc
index 3f6b2d2..865fcb0 100644
--- a/runtime/oat_file_assistant_test.cc
+++ b/runtime/oat_file_assistant_test.cc
@@ -29,6 +29,7 @@
#include "class_linker-inl.h"
#include "common_runtime_test.h"
#include "compiler_callbacks.h"
+#include "gc/space/image_space.h"
#include "mem_map.h"
#include "os.h"
#include "scoped_thread_state_change.h"
@@ -610,10 +611,23 @@ TEST_F(OatFileAssistantTest, OdexOatOverlap) {
// Things aren't relocated, so it should fall back to interpreted.
std::unique_ptr<OatFile> oat_file = oat_file_assistant.GetBestOatFile();
ASSERT_TRUE(oat_file.get() != nullptr);
+
EXPECT_FALSE(oat_file->IsExecutable());
std::vector<std::unique_ptr<const DexFile>> dex_files;
dex_files = oat_file_assistant.LoadDexFiles(*oat_file, dex_location.c_str());
EXPECT_EQ(1u, dex_files.size());
+
+ // Add some extra checks to help diagnose apparently flaky test failures.
+ Runtime* runtime = Runtime::Current();
+ const gc::space::ImageSpace* image_space = runtime->GetHeap()->GetImageSpace();
+ ASSERT_TRUE(image_space != nullptr);
+ const ImageHeader& image_header = image_space->GetImageHeader();
+ const OatHeader& oat_header = oat_file->GetOatHeader();
+ EXPECT_FALSE(oat_file->IsPic());
+ EXPECT_EQ(image_header.GetOatChecksum(), oat_header.GetImageFileLocationOatChecksum());
+ EXPECT_NE(reinterpret_cast<uintptr_t>(image_header.GetOatDataBegin()),
+ oat_header.GetImageFileLocationOatDataBegin());
+ EXPECT_NE(image_header.GetPatchDelta(), oat_header.GetImagePatchDelta());
}
// Case: We have a DEX file and a PIC ODEX file, but no OAT file.