更多信息请访问:华为官方共建的鸿蒙技术社区https://harmonyos.51cto。comXTS(XTestSuite)子系统是OpenHarmony生态认证测试套件的集合,目前包括:行为(applicationcompatibilitytestsuite)应用兼容性测试套件、carenorthboundHAP兼容性、OpenHarmony开发API兼容性。hats(HardwareAbstractionTestSuite)硬件抽象测试套件,守护HDI层接口。dcts(DistributedCompatibilityTestSuite)分布式兼容性测试套件,守护分布式兼容性(待推出)本文主要通过实例分析ACTS应用兼容性测试套件的移植案例,以及移植过程中具体操作的原理。主要是关于轻量级系统兼容性测试。由于系统能力的限制,轻量级系统的兼容性测试在系统初始化阶段进行;且各设备的烧录工具存在差异,使得自动化工具(xDevice工具)无法实现真正??的自动适配,因此认证实施方式不限制合作伙伴。流程如下:Step1编译适配:将XTS子系统添加到编译组件中,与版本一起编译;Step2本地执行:完成兼容性测试;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_jts.config中的片段配置:{“子系统”:“xts”,“组件”:[{“组件”:“xts_acts”,“功能”:[“config_ohos_xts_acts_utils_lite_kv_store_data_path=\”/data\“”]},{“组件”:“xts_tools”,"features":[]}]},1.2编译链接需要通过link选项指定要链接的ACTS组件编译库文件,会用到两个ld链接--whole-archive和--no-whole-archive选项。--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”,“广播”,“hctest”,(1)“module_ActsParameterTest”,“module_ActsBootstrapTest”,“module_ActsDfxFuncTest”,“module_ActsHieventLiteTest”,“module_ActsSamgrTest”,(2)“module_ActsKvStoreTest”]},.......],然后在文件device\soc\bestechnic\bes2600\BUILD.gn中编译链接选项,相关代码片段如下:#configbinfromvendor/bestechnic/
