From a06fff224fcc16da61e9e81c7e2cb85a8ca15471 Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Thu, 7 Aug 2014 11:54:36 +0100 Subject: [PATCH] Fix GetDexCanonicalLocation test for relative paths. If the reference file is created with a relative path the test will fail. (cherry picked from commit 61281dc0aaa22730fd4fee268cac40776b193042) Change-Id: Ie82b9d381bd884111dfc91cc235b46ad9f3225be --- runtime/dex_file_test.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/dex_file_test.cc b/runtime/dex_file_test.cc index fa1329029..330d045b4 100644 --- a/runtime/dex_file_test.cc +++ b/runtime/dex_file_test.cc @@ -355,9 +355,10 @@ TEST_F(DexFileTest, GetMultiDexClassesDexName) { TEST_F(DexFileTest, GetDexCanonicalLocation) { ScratchFile file; - std::string dex_location = file.GetFilename(); + char* dex_location_real = realpath(file.GetFilename().c_str(), nullptr); + std::string dex_location(dex_location_real); - ASSERT_EQ(file.GetFilename(), DexFile::GetDexCanonicalLocation(dex_location.c_str())); + ASSERT_EQ(dex_location, DexFile::GetDexCanonicalLocation(dex_location.c_str())); std::string multidex_location = DexFile::GetMultiDexClassesDexName(1, dex_location.c_str()); ASSERT_EQ(multidex_location, DexFile::GetDexCanonicalLocation(multidex_location.c_str())); @@ -370,6 +371,8 @@ TEST_F(DexFileTest, GetDexCanonicalLocation) { ASSERT_EQ(multidex_location, DexFile::GetDexCanonicalLocation(multidex_location_sym.c_str())); ASSERT_EQ(0, unlink(dex_location_sym.c_str())); + + free(dex_location_real); } } // namespace art -- 2.11.0