From 35de6133f12b7e5efae2f29c618b0326e14e2650 Mon Sep 17 00:00:00 2001 From: Zhou Shihui Date: Thu, 4 Sep 2025 20:52:34 +0800 Subject: [PATCH] =?UTF-8?q?el2=E4=B8=8Bcache=E7=9B=AE=E5=BD=95=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E6=97=B6project=20quota=E8=BF=94=E5=9B=9E0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Zhou Shihui --- services/bundlemgr/src/installd/installd_host_impl.cpp | 2 +- .../bms_install_daemon_host_impl_test.cpp | 1 + .../bms_install_daemon_test/bms_install_daemon_test.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/bundlemgr/src/installd/installd_host_impl.cpp b/services/bundlemgr/src/installd/installd_host_impl.cpp index d646747a68..5039de8094 100644 --- a/services/bundlemgr/src/installd/installd_host_impl.cpp +++ b/services/bundlemgr/src/installd/installd_host_impl.cpp @@ -1320,7 +1320,7 @@ int64_t InstalldHostImpl::GetEl2CacheSize(const int32_t projectId, const std::st std::string cachePath = std::string(ServiceConstants::BUNDLE_APP_DATA_BASE_DIR) + ServiceConstants::DIR_EL2 + ServiceConstants::PATH_SEPARATOR + std::to_string(userId) + ServiceConstants::BASE + bundleNameDir + ServiceConstants::PATH_SEPARATOR + Constants::CACHE_DIR; - if (InstalldOperator::IsDirEmptyFast(cachePath)) { + if (!InstalldOperator::IsExistDir(cachePath) || InstalldOperator::IsDirEmptyFast(cachePath)) { LOG_I(BMS_TAG_INSTALLD, "%{public}s el2 cache dir empty", bundleNameDir.c_str()); return 0; } diff --git a/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_host_impl_test.cpp b/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_host_impl_test.cpp index 5249220a6a..b9eba6875d 100755 --- a/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_host_impl_test.cpp +++ b/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_host_impl_test.cpp @@ -1390,6 +1390,7 @@ HWTEST_F(BmsInstallDaemonHostImplTest, InstalldHostImplTest_8000, Function | Sma auto hostImpl = GetInstalldHostImpl(); ASSERT_NE(hostImpl, nullptr); EXPECT_TRUE(InstalldOperator::DeleteDir("/data/app/el2/100/base/com.test.8000")); + EXPECT_EQ(hostImpl->GetEl2CacheSize(8000, "com.test.8000", 100, 0), 0); EXPECT_TRUE(InstalldOperator::MkRecursiveDir("/data/app/el2/100/base/com.test.8000/cache", true)); EXPECT_EQ(hostImpl->GetEl2CacheSize(8000, "com.test.8000", 100, 0), 0); diff --git a/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_test.cpp b/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_test.cpp index 18e58b4fb7..20edabf71d 100644 --- a/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_test.cpp +++ b/services/bundlemgr/test/unittest/bms_install_daemon_test/bms_install_daemon_test.cpp @@ -947,7 +947,7 @@ HWTEST_F(BmsInstallDaemonTest, GetBundleStats_0200, Function | SmallTest | Level EXPECT_NE(stats[1], 0); EXPECT_EQ(stats[2], 0); EXPECT_EQ(stats[3], 0); - EXPECT_NE(stats[4], 0); + EXPECT_EQ(stats[4], 0); } /** -- Gitee