diff options
author | 2013-04-30 18:35:32 -0700 | |
---|---|---|
committer | 2013-04-30 18:37:22 -0700 | |
commit | 654d91957edb4d1f7534ed5d743cf914db763448 (patch) | |
tree | f87cb1349f2eff97cd4f5edd4b015b4b2a4ff072 | |
parent | 10c35dc16aea5b77f201f42fac4b39523e6ceed7 (diff) |
Add conscrypt to art tests
Change-Id: I26694517d398b0f84f48c7496c3159b7863fa833
-rw-r--r-- | build/Android.oat.mk | 2 | ||||
-rw-r--r-- | src/common_test.h | 7 | ||||
-rw-r--r-- | src/dex_method_iterator_test.cc | 2 | ||||
-rw-r--r-- | src/image_test.cc | 14 | ||||
-rw-r--r-- | src/oat_test.cc | 2 |
5 files changed, 20 insertions, 7 deletions
diff --git a/build/Android.oat.mk b/build/Android.oat.mk index 92a86c73e7..2daf5d0cec 100644 --- a/build/Android.oat.mk +++ b/build/Android.oat.mk @@ -39,7 +39,7 @@ PRELOADED_CLASSES := frameworks/base/preloaded-classes ######################################################################## # A smaller libcore only oat file -TARGET_CORE_JARS := core core-junit bouncycastle +TARGET_CORE_JARS := core conscrypt okhttp core-junit bouncycastle HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS)) HOST_CORE_DEX_LOCATIONS := $(foreach jar,$(HOST_CORE_JARS), $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar) diff --git a/src/common_test.h b/src/common_test.h index 6876274b7b..78d86d2f90 100644 --- a/src/common_test.h +++ b/src/common_test.h @@ -311,7 +311,9 @@ class CommonTest : public testing::Test { ASSERT_EQ(mkdir_result, 0); java_lang_dex_file_ = DexFile::Open(GetLibCoreDexFileName(), GetLibCoreDexFileName()); + conscrypt_file_ = DexFile::Open(GetConscryptFileName(), GetConscryptFileName()); boot_class_path_.push_back(java_lang_dex_file_); + boot_class_path_.push_back(conscrypt_file_); std::string min_heap_string(StringPrintf("-Xms%zdm", Heap::kDefaultInitialSize / MB)); std::string max_heap_string(StringPrintf("-Xmx%zdm", Heap::kDefaultMaximumSize / MB)); @@ -416,6 +418,10 @@ class CommonTest : public testing::Test { return GetDexFileName("core"); } + std::string GetConscryptFileName() { + return GetDexFileName("conscrypt"); + } + std::string GetDexFileName(const std::string& jar_prefix) { if (IsHost()) { const char* host_dir = getenv("ANDROID_HOST_OUT"); @@ -529,6 +535,7 @@ class CommonTest : public testing::Test { std::string android_data_; std::string art_cache_; const DexFile* java_lang_dex_file_; // owned by runtime_ + const DexFile* conscrypt_file_; // owned by runtime_ std::vector<const DexFile*> boot_class_path_; UniquePtr<Runtime> runtime_; // Owned by the runtime diff --git a/src/dex_method_iterator_test.cc b/src/dex_method_iterator_test.cc index e4a42db792..64c645e81a 100644 --- a/src/dex_method_iterator_test.cc +++ b/src/dex_method_iterator_test.cc @@ -26,6 +26,8 @@ TEST_F(DexMethodIteratorTest, Basic) { ScopedObjectAccess soa(Thread::Current()); std::vector<const DexFile*> dex_files; dex_files.push_back(DexFile::Open(GetDexFileName("core"), GetDexFileName("core"))); + dex_files.push_back(DexFile::Open(GetDexFileName("conscrypt"), GetDexFileName("conscrypt"))); + dex_files.push_back(DexFile::Open(GetDexFileName("okhttp"), GetDexFileName("okhttp"))); dex_files.push_back(DexFile::Open(GetDexFileName("core-junit"), GetDexFileName("core-junit"))); dex_files.push_back(DexFile::Open(GetDexFileName("bouncycastle"), GetDexFileName("bouncycastle"))); DexMethodIterator it(dex_files); diff --git a/src/image_test.cc b/src/image_test.cc index 192e28ac0e..8066a90957 100644 --- a/src/image_test.cc +++ b/src/image_test.cc @@ -46,16 +46,20 @@ TEST_F(ImageTest, WriteRead) { ScopedObjectAccess soa(Thread::Current()); std::vector<const DexFile*> dex_files; dex_files.push_back(java_lang_dex_file_); + dex_files.push_back(conscrypt_file_); VectorOutputStream output_stream(tmp_elf.GetFilename(), oat_contents); bool success_oat = OatWriter::Create(output_stream, dex_files, 0, 0, "", *compiler_driver_.get()); ASSERT_TRUE(success_oat); // Force all system classes into memory - for (size_t i = 0; i < java_lang_dex_file_->NumClassDefs(); ++i) { - const DexFile::ClassDef& class_def = java_lang_dex_file_->GetClassDef(i); - const char* descriptor = java_lang_dex_file_->GetClassDescriptor(class_def); - mirror::Class* klass = class_linker_->FindSystemClass(descriptor); - EXPECT_TRUE(klass != NULL) << descriptor; + for (size_t dex_file_index = 0; dex_file_index < dex_files.size(); ++dex_file_index) { + const DexFile* dex_file = dex_files[dex_file_index]; + for (size_t class_def_index = 0; class_def_index < dex_file->NumClassDefs(); ++class_def_index) { + const DexFile::ClassDef& class_def = dex_file->GetClassDef(class_def_index); + const char* descriptor = dex_file->GetClassDescriptor(class_def); + mirror::Class* klass = class_linker_->FindSystemClass(descriptor); + EXPECT_TRUE(klass != NULL) << descriptor; + } } bool success_elf = compiler_driver_->WriteElf(GetTestAndroidRoot(), !kIsTargetBuild, diff --git a/src/oat_test.cc b/src/oat_test.cc index 5d6edf2e98..a7fbaf14a3 100644 --- a/src/oat_test.cc +++ b/src/oat_test.cc @@ -106,7 +106,7 @@ TEST_F(OatTest, WriteRead) { ASSERT_TRUE(oat_file.get() != NULL); const OatHeader& oat_header = oat_file->GetOatHeader(); ASSERT_TRUE(oat_header.IsValid()); - ASSERT_EQ(1U, oat_header.GetDexFileCount()); + ASSERT_EQ(2U, oat_header.GetDexFileCount()); // core and conscrypt ASSERT_EQ(42U, oat_header.GetImageFileLocationOatChecksum()); ASSERT_EQ(4096U, oat_header.GetImageFileLocationOatDataBegin()); ASSERT_EQ("lue.art", oat_header.GetImageFileLocation()); |