Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcd3f9ab authored by Martin Stjernholm's avatar Martin Stjernholm
Browse files

Skip installd dexopt tests when ART Service is enabled.

Those code paths are not supposed to be used in that case, and there
may be consistency checks that fail.

Test: atest installd_dexopt_test
  with and without dalvik.vm.useartservice=true
Bug: 274100046
Change-Id: I552cae15db2809131b4b694e5116df62894d397d
parent 04d05a69
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -199,6 +199,10 @@ protected:
    std::string secondary_dex_de_;

    virtual void SetUp() {
        if (base::GetBoolProperty("dalvik.vm.useartservice", false)) {
            GTEST_SKIP() << "Skipping legacy dexopt tests when ART Service is enabled";
        }

        setenv("ANDROID_LOG_TAGS", "*:v", 1);
        android::base::InitLogging(nullptr);
        // Initialize the globals holding the file system main paths (/data/, /system/ etc..).
@@ -219,6 +223,10 @@ protected:
    }

    virtual void TearDown() {
        if (base::GetBoolProperty("dalvik.vm.useartservice", false)) {
            GTEST_SKIP();
        }

        if (!kDebug) {
            service_->controlDexOptBlocking(false);
            service_->destroyAppData(
@@ -942,6 +950,10 @@ TEST_F(DexoptTest, DexoptDex2oat64Enabled) {
class PrimaryDexReCompilationTest : public DexoptTest {
  public:
    virtual void SetUp() {
        if (base::GetBoolProperty("dalvik.vm.useartservice", false)) {
            GTEST_SKIP() << "Skipping legacy dexopt tests when ART Service is enabled";
        }

        DexoptTest::SetUp();
        CompilePrimaryDexOk("verify",
                            DEXOPT_BOOTCOMPLETE | DEXOPT_PUBLIC,
@@ -956,6 +968,10 @@ class PrimaryDexReCompilationTest : public DexoptTest {
    }

    virtual void TearDown() {
        if (base::GetBoolProperty("dalvik.vm.useartservice", false)) {
            GTEST_SKIP();
        }

        first_compilation_odex_fd_.reset(-1);
        first_compilation_vdex_fd_.reset(-1);
        DexoptTest::TearDown();
@@ -978,6 +994,10 @@ TEST_F(PrimaryDexReCompilationTest, DexoptPrimaryUpdateInPlaceVdex) {

class ReconcileTest : public DexoptTest {
    virtual void SetUp() {
        if (base::GetBoolProperty("dalvik.vm.useartservice", false)) {
            GTEST_SKIP() << "Skipping legacy dexopt tests when ART Service is enabled";
        }

        DexoptTest::SetUp();
        CompileSecondaryDex(secondary_dex_ce_, DEXOPT_STORAGE_CE,
            /*binder_ok*/ true, /*compile_ok*/ true);
@@ -1043,6 +1063,10 @@ class ProfileTest : public DexoptTest {
    static constexpr const char* kPrimaryProfile = "primary.prof";

    virtual void SetUp() {
        if (base::GetBoolProperty("dalvik.vm.useartservice", false)) {
            GTEST_SKIP() << "Skipping legacy dexopt tests when ART Service is enabled";
        }

        DexoptTest::SetUp();
        cur_profile_ = create_current_profile_path(
                kTestUserId, package_name_, kPrimaryProfile, /*is_secondary_dex*/ false);
@@ -1416,6 +1440,9 @@ class BootProfileTest : public ProfileTest {
    std::vector<int64_t> extra_ce_data_inodes_;

    virtual void SetUp() {
        if (base::GetBoolProperty("dalvik.vm.useartservice", false)) {
            GTEST_SKIP() << "Skipping legacy dexopt tests when ART Service is enabled";
        }

        ProfileTest::SetUp();
        intial_android_profiles_dir = android_profiles_dir;
@@ -1429,6 +1456,10 @@ class BootProfileTest : public ProfileTest {
    }

    virtual void TearDown() {
        if (base::GetBoolProperty("dalvik.vm.useartservice", false)) {
            GTEST_SKIP();
        }

        android_profiles_dir = intial_android_profiles_dir;
        deleteAppProfilesForBootMerge();
        ProfileTest::TearDown();