From ba6e4cafb7db1bb0b9921b5fa64028b2d0c1a98c Mon Sep 17 00:00:00 2001 From: chenjunwu Date: Tue, 5 Mar 2024 11:28:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=AE=8F=E9=9A=94?= =?UTF-8?q?=E7=A6=BB=E4=BF=AE=E5=A4=8Dbattery=5Fhdi=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chenjunwu --- build.gni | 1 + bundle.json | 3 ++- powermgr/battery/hdi_battery/BUILD.gn | 6 ++++++ powermgr/battery/hdi_battery/common/hdi_battery_test.cpp | 5 ++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/build.gni b/build.gni index 4c8d29bc..41037541 100644 --- a/build.gni +++ b/build.gni @@ -15,4 +15,5 @@ declare_args() { hats_rich = false hats_nnrt = false hats_drivers_peripheral_power_wakeup_cause_path = false + hats_drivers_peripheral_battery_pc_macro_isolation = false } diff --git a/bundle.json b/bundle.json index d277a744..f397f13c 100644 --- a/bundle.json +++ b/bundle.json @@ -16,7 +16,8 @@ "features": [ "hats_rich", "hats_nnrt", - "hats_drivers_peripheral_power_wakeup_cause_path" + "hats_drivers_peripheral_power_wakeup_cause_path", + "hats_drivers_peripheral_battery_pc_macro_isolation" ], "adapted_system_type": [ "mini", diff --git a/powermgr/battery/hdi_battery/BUILD.gn b/powermgr/battery/hdi_battery/BUILD.gn index 84f2dde9..627497e4 100755 --- a/powermgr/battery/hdi_battery/BUILD.gn +++ b/powermgr/battery/hdi_battery/BUILD.gn @@ -13,6 +13,7 @@ import("//build/ohos_var.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//test/xts/hats/build.gni") import("//test/xts/tools/build/suite.gni") ohos_moduletest_suite("HatsPowermgrBatteryTest") { @@ -29,6 +30,11 @@ ohos_moduletest_suite("HatsPowermgrBatteryTest") { "hilog:libhilog", "ipc:ipc_single", ] + + if (hats_drivers_peripheral_battery_pc_macro_isolation) { + defines = [ "HATS_DRIVERS_PERIPHERAL_BATTERY_PC_MACRO_ISOLATION" ] + } + subsystem_name = "xts" part_name = "hats" } diff --git a/powermgr/battery/hdi_battery/common/hdi_battery_test.cpp b/powermgr/battery/hdi_battery/common/hdi_battery_test.cpp index 1421039a..738a8a8b 100644 --- a/powermgr/battery/hdi_battery/common/hdi_battery_test.cpp +++ b/powermgr/battery/hdi_battery/common/hdi_battery_test.cpp @@ -272,8 +272,11 @@ HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest014, TestSize.Level1) printf("HdfBatteryHdiTest014: start."); int curAverage = -1; int32_t ret = g_batteryInterface->GetCurrentAverage(curAverage); +#ifdef HATS_DRIVERS_PERIPHERAL_BATTERY_PC_MACRO_ISOLATION + EXPECT_NE(0, curAverage); +#else EXPECT_EQ(0, ret); - +#endif printf("HdfBatteryHdiTest014: return."); }