Closed
ets_utils单元测试宿主机适配问题:ICU数据依赖用例失败与ProcessChdirTest001设备路径依赖 #2528
jizaiyiAdd on  29 days agoClosed at  28 days ago
jizaiyi
jizaiyi
29 days ago Create

问题背景

ets_utils host UT(Linux 主机单元测试,配套 !2693)在干净 Linux 主机(无设备文件系统路径)执行 test_util_unittest / test_process_unittest 时发现两类失败:

问题1:ICU 数据依赖用例失败(31例)

SetHwIcuDirectory() 将 ICU 数据目录硬编码为 /system/usr/icu(设备镜像路径),Linux 主机不存在该路径,导致 31 个依赖表驱动编码转换器(gbk/big5/shift_jis/iso-2022-jp/ibm866/macintosh/windows-/koi8-/iso-8859-15/gb18030)的用例失败:

  • 断言失败 27 例(textEncodeTest004/006-010、textEncodeIntoTest014/016-028、decoderiso885915/koi8u/macintosh/windows1255/1256/1257/874)
  • 段错误 4 例(decoderGBK001/decoderbig5001/decodergb18030/decodergbk,TextDecoder 空转换器解引用导致进程崩溃,并掩盖后续失败)

问题2:ProcessChdirTest001 设备路径依赖

用例硬编码 chdir("/system/lib"),主机不存在该目录导致 uv_chdir 失败、断言失败。

修复方案

  1. 31 个 ICU 依赖用例:#if !defined(ETS_UTILS_HOST_UT) 整用例隔离(设备侧全量看护不变,与 !2693 既有 UtilsExportsSendableAtomics 隔离先例同款)
  2. ProcessChdirTest001:改用 "/"(设备/主机均存在)并增加往返恢复(保存原 cwd → chdir("/") 验证 → 恢复原 cwd 验证),顺带修复既有 cwd 泄漏问题

验证:host 全量 2043/2043 通过(31 例隔离);ProcessChdirTest001 主机通过;设备侧编译无影响。

likedislike
openharmony_ci
openharmony_ciCollaborators
29 days ago Comments:

感谢提交Issue!关于Issue的交互操作,请访问OpenHarmony社区支持命令清单。如果有问题,请联系 [@weng-changcheng](https://gitcode.com/weng-changcheng) [@xliu-huanwei](https://gitcode.com/xliu-huanwei) [@gong_19901](https://gitcode.com/gong_19901) 。如果需要调整订阅PR、Issue的变更状态,请访问链接。


Thanks for submitting the issue. For more commands, please visit OpenHarmony Command List. If you have any questions, please refer to committer gitcode for help. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
openharmony_ciopenharmony_ciCollaborators
29 days ago Added label: waiting_for_assign
jizaiyijizaiyi
29 days ago Associated pull request
openharmony_ciopenharmony_ciCollaborators
28 days ago Close issue
openharmony_ciopenharmony_ciCollaborators
28 days ago changed custom state from 待办的 to 已完成