diff options
author | 2021-07-08 10:20:26 +0800 | |
---|---|---|
committer | 2021-07-14 23:37:32 +0000 | |
commit | d61b021fffc641906d1c531a233b62a8f66c184a (patch) | |
tree | 2e81f49ce6986fbc069286d28b48f41b19dce0c6 /libartbase/base/file_utils_test.cc | |
parent | 9e050ab1a061d9660eb0c1daa01a823ad75b0f05 (diff) |
Trigger on-device AOT compilation for system_server on mainline update.
Before this change, AOT compilation for system_server are triggered only
on ART mainline update, and only the system_server components in /system are compiled.
After this change, AOT compilation for system_server are triggered on
any mainline update that touches $BOOTCLASSPATH or
$SYSTEMSERVERCLASSPATH, and the system_server components in mainline
modules are also compiled.
Test: manual - 1. Modify a mainline module (such as com.android.wifi).
2. Install the modified module on a device and reboot the device.
3. See if system_server components are recompiled (while boot
classpath components are not).
Test: atest odsign_e2e_tests
Test: art/tools/run-gtests.sh -j8 apex/com.android.art/bin/art/x86_64/art_libartbase_tests
Test: atest art_odrefresh_tests
Bug: 189467174
Change-Id: Icaba5471e9f62fd035f0a24d662ecfaf2e064cab
Diffstat (limited to 'libartbase/base/file_utils_test.cc')
-rw-r--r-- | libartbase/base/file_utils_test.cc | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/libartbase/base/file_utils_test.cc b/libartbase/base/file_utils_test.cc index 4dce3dc88a..e9093b249c 100644 --- a/libartbase/base/file_utils_test.cc +++ b/libartbase/base/file_utils_test.cc @@ -20,12 +20,15 @@ #include <stdlib.h> #include <optional> +#include <vector> #include "base/stl_util.h" #include "common_art_test.h" namespace art { +static constexpr const char kAndroidWifiApexDefaultPath[] = "/apex/com.android.wifi"; + class FileUtilsTest : public CommonArtTest {}; TEST_F(FileUtilsTest, GetDalvikCacheFilename) { @@ -169,11 +172,11 @@ TEST_F(FileUtilsTest, GetApexDataOatFilename) { GetApexDataOatFilename("/product/javalib/beep.jar", InstructionSet::kArm)); const std::string art_apex_jar = std::string {kAndroidArtApexDefaultPath} + "/javalib/some.jar"; - EXPECT_EQ(std::string{}, GetApexDataOatFilename(art_apex_jar.c_str(), InstructionSet::kArm)); + EXPECT_EQ(std::string {}, GetApexDataOatFilename(art_apex_jar.c_str(), InstructionSet::kArm)); const std::string i18n_jar = std::string {kAndroidI18nApexDefaultPath} + "/javalib/core-icu4j.jar"; - EXPECT_EQ(std::string{}, GetApexDataOatFilename(i18n_jar, InstructionSet::kArm)); + EXPECT_EQ(std::string {}, GetApexDataOatFilename(i18n_jar, InstructionSet::kArm)); const std::string system_jar_apexdata_oat = GetArtApexData() + "/dalvik-cache/x86/boot-lace.oat"; EXPECT_EQ(system_jar_apexdata_oat, @@ -188,11 +191,15 @@ TEST_F(FileUtilsTest, GetApexDataOdexFilename) { GetApexDataOdexFilename("/data/some/code.dex", InstructionSet::kArm)); const std::string art_apex_jar = std::string {kAndroidArtApexDefaultPath} + "/javalib/some.jar"; - EXPECT_EQ(std::string{}, GetApexDataOdexFilename(art_apex_jar.c_str(), InstructionSet::kArm)); + EXPECT_EQ( + GetArtApexData() + "/dalvik-cache/arm/apex@com.android.art@javalib@some.jar@classes.odex", + GetApexDataOdexFilename(art_apex_jar.c_str(), InstructionSet::kArm)); const std::string i18n_jar = std::string {kAndroidI18nApexDefaultPath} + "/javalib/core-icu4j.jar"; - EXPECT_EQ(std::string{}, GetApexDataOdexFilename(i18n_jar.c_str(), InstructionSet::kArm)); + EXPECT_EQ(GetArtApexData() + + "/dalvik-cache/arm/apex@com.android.i18n@javalib@core-icu4j.jar@classes.odex", + GetApexDataOdexFilename(i18n_jar.c_str(), InstructionSet::kArm)); const std::string system_jar_apexdata_odex = GetArtApexData() + "/dalvik-cache/x86/system@framework@cookie.jar@classes.odex"; @@ -204,7 +211,7 @@ TEST_F(FileUtilsTest, GetApexDataBootImage) { ScopedUnsetEnvironmentVariable android_root("ANDROID_ROOT"); ScopedUnsetEnvironmentVariable art_apex_data("ART_APEX_DATA"); - EXPECT_EQ(std::string{}, + EXPECT_EQ(std::string {}, GetApexDataBootImage(std::string {kAndroidI18nApexDefaultPath} + "/javalib/bar.jar")); // Check image location has the prefix "boot-" in front of the basename of dex location and @@ -224,8 +231,9 @@ TEST_F(FileUtilsTest, GetApexDataImage) { ScopedUnsetEnvironmentVariable android_root("ANDROID_ROOT"); ScopedUnsetEnvironmentVariable art_apex_data("ART_APEX_DATA"); - EXPECT_EQ(std::string{}, - GetApexDataImage(std::string {kAndroidI18nApexDefaultPath} + "/lib/javalib/bar.jar")); + EXPECT_EQ( + GetArtApexData() + "/dalvik-cache/apex@com.android.wifi@lib@javalib@bar.jar@classes.art", + GetApexDataImage(std::string {kAndroidWifiApexDefaultPath} + "/lib/javalib/bar.jar")); // Check image has basename of dex location with the .art suffix. const char* jar = "/system/framework/mcguffin/test.jar"; @@ -241,9 +249,9 @@ TEST_F(FileUtilsTest, GetApexDataImage) { } TEST_F(FileUtilsTest, GetApexDataDalvikCacheFilename) { - // Check /apex inputs return empty string - const std::string apex_jar = std::string {kAndroidI18nApexDefaultPath} + "/lib/javalib/bar.jar"; - EXPECT_EQ(std::string{}, + const std::string apex_jar = std::string {kAndroidWifiApexDefaultPath} + "/lib/javalib/bar.jar"; + EXPECT_EQ(GetArtApexData() + + "/dalvik-cache/x86_64/apex@com.android.wifi@lib@javalib@bar.jar@classes.art", GetApexDataDalvikCacheFilename(apex_jar, InstructionSet::kX86_64, "art")); // Check dalvik-cache filename follows convention. |