您的位置:首页 > 科技 > IT业 > 移植案例与原理 - XTS子系统之应用兼容性测试套件(1)

移植案例与原理 - XTS子系统之应用兼容性测试套件(1)

2024/10/5 13:58:57 来源:https://blog.csdn.net/maniuT/article/details/139804104  浏览:    关键词:移植案例与原理 - XTS子系统之应用兼容性测试套件(1)

本文主要通过实例分析下ACTS应用兼容性测试套件移植案例,以及移植过程中特定的操作的原理。主要讲述的是轻量系统兼容性测试。轻量系统因系统能力限制,兼容性测试在系统初始化阶段进行;并且各设备烧录工具存在差异,导致自动化工具(xDevice工具)无法实现真正的自动适配,因此认证执行方式不对合作伙伴进行限制。流程如下:

  • 步骤1 编译适配:XTS子系统加入到编译组件中,随版本一起编译;

  • 步骤2 本地执行:完成兼容性测试;

1、编译适配XTS子系统

1.1 产品解决方案适配

需要在产品解决方案配置文件中增加增加xts_acts与xts_tools组件定义。下面看几个示例,文件vendor\bestechnic\xts_demo\config.json中的配置片段:

    {"subsystem": "xts","components": [{ "component": "xts_acts", "features":["config_ohos_xts_acts_utils_lite_kv_store_data_path = \"/data\"","enable_ohos_test_xts_acts_use_thirdparty_lwip = true"]},{ "component": "xts_tools", "features":[] }]}

文件vendor\goodix\gr5515_sk_xts_demo\config.json中的配置片段:

      {"subsystem": "xts","components": [{ "component": "xts_acts", "features":["config_ohos_xts_acts_utils_lite_kv_store_data_path = \"/data\""]},{ "component": "xts_tools", "features":[] }]},

1.2 编译链接

需要通过链接选项指定需要链接的ACTS的部件编译库文件,会使用到 --whole-archive 和 --no-whole-archive这2个ld链接选项。–whole-archive 可以把 在其后面出现的静态库包含的函数和变量输出到动态库,–no-whole-archive 则关掉这个特性。在文件vendor\goodix\gr5515_sk_xts_demo\BUILD.gn中,对ACTS的编译文件进行链接。其中⑴到⑵处的链接选项为编译出的属于ACTS的组件测试库文件。

    executable("${fw_img_name}.elf") {deps = ["tests:drivers","tests:fs_test","tests:ohosdemo","tests:shell_test","//build/lite:ohos",]ldflags = ["-Wl,--whole-archive",# "-lfs_test",# "-ldrivers_test",# "-lapp_hello","-lshell_test",
⑴      "-lhctest","-lmodule_ActsBootstrapTest","-lmodule_ActsWifiIotTest","-lmodule_ActsUtilsFileTest","-lmodule_ActsKvStoreTest","-lmodule_ActsParameterTest","-lmodule_ActsSamgrTest","-lhuks_test_common","-lmodule_ActsHuksHalFunctionTest","-lmodule_ActsDfxFuncTest","-lmodule_ActsUpdaterFuncTest",
⑵      "-lmodule_ActsHieventLiteTest","-Wl,--no-whole-archive",]}

在文件vendor\bestechnic\xts_demo\config.json中,需要链接的ACTS部件测试库文件写在了bin_list里的force_link_libs里。

  "bin_list": [{"elf_name": "wifiiot","bsp_target_name": "best2600w_liteos","signature": "false","burn_name": "rtos_main","enable": "true","force_link_libs": ["bootstrap","abilityms","bundlems","broadcast","hctest",
⑴      "module_ActsParameterTest","module_ActsBootstrapTest","module_ActsDfxFuncTest","module_ActsHieventLiteTest","module_ActsSamgrTest",
⑵      "module_ActsKvStoreTest"]},.......],

然后在文件device\soc\bestechnic\bes2600\BUILD.gn里组装编译链接选项,相关代码片段如下:

  # config bin from vendor/bestechnic/<product_name>/config.jsonforeach(bin_file, bin_list) {......if (build_enable == "true") {......# force link invisible function ,which ar to libldflags += [ "-Wl,--whole-archive" ]foreach(force_link_lib, bin_file.force_link_libs) {ldflags += [ "-l${force_link_lib}" ]}ldflags += [ "-lbsp${bsp_target_name}" ]ldflags += [ "-Wl,--no-whole-archive" ]......}}

在文件vendor_asrmicro\xts_demo\config.json中,存在这样的配置片段。

    "xts_list": [{"enable": "true","xts_modules": ["ActsKvStoreTest","ActsDfxFuncTest","ActsHieventLiteTest","ActsSamgrTest","ActsParameterTest","ActsWifiServiceTest","ActsWifiIotTest","ActsBootstrapTest"]}]

然后,在文件device_soc_asrmicro\asr582x\liteos_m\sdk\BUILD.gn文件中组装编译链接选项。

  foreach(xts_item, xts_list) {xts_enable = xts_item.enableif(xts_enable == "true"){defines = [ "CFG_HARMONY_SUPPORT" ]ldflags += ["-Llibs","-Wl,--whole-archive","-lhctest","-lbootstrap","-lbroadcast",]foreach(xts_module, xts_item.xts_modules) {ldflags += [ "-lmodule_${xts_module}" ]}ldflags += [ "-Wl,--no-whole-archive" ]}}

在产品解决方案配置文件中增加的bin_list、xts_list这些配置选项都不是config.json中的默认的标准选项。各个方案实现的风格差异比较大,建议使用第一种,写在文件vendor\goodix\gr5515_sk_xts_demo\BUILD.gn中会比较好。另外,需要使用hb命令触发debug版本(非debug版本不会触发测试编译)。

如果大家想更加深入的学习 OpenHarmony 开发的内容,不妨可以参考以下相关学习文档进行学习,助你快速提升自己:

OpenHarmony 开发环境搭建:https://qr18.cn/CgxrRy

《OpenHarmony源码解析》:https://qr18.cn/CgxrRy

  • 搭建开发环境
  • Windows 开发环境的搭建
  • Ubuntu 开发环境搭建
  • Linux 与 Windows 之间的文件共享
  • ……

系统架构分析:https://qr18.cn/CgxrRy

  • 构建子系统
  • 启动流程
  • 子系统
  • 分布式任务调度子系统
  • 分布式通信子系统
  • 驱动子系统
  • ……

OpenHarmony 设备开发学习手册:https://qr18.cn/CgxrRy

在这里插入图片描述

OpenHarmony面试题(内含参考答案):https://qr18.cn/CgxrRy

写在最后

  • 如果你觉得这篇内容对你还蛮有帮助,我想邀请你帮我三个小忙:
  • 点赞,转发,有你们的 『点赞和评论』,才是我创造的动力。
  • 关注小编,同时可以期待后续文章ing🚀,不定期分享原创知识。
  • 想要获取更多完整鸿蒙最新学习资源,请移步前往小编:https://qr21.cn/FV7h05

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com