fix: 添加宏隔离修复battery_hdi失败用例

Signed-off-by: chenjunwu <chenjunwu4@huawei.com>
This commit is contained in:
chenjunwu 2024-03-05 11:28:52 +08:00
parent e6674c4bd2
commit ba6e4cafb7
4 changed files with 13 additions and 2 deletions

View File

@ -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
}

View File

@ -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",

View File

@ -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"
}

View File

@ -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.");
}