!1077 添加native daemon UT测试资源文件

Merge pull request !1077 from wenlong_12/master
This commit is contained in:
openharmony_ci 2023-08-24 08:33:52 +00:00 committed by Gitee
commit ee5c82eaf5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 11 additions and 19 deletions

View File

@ -151,6 +151,8 @@ Note:If the text contains special characters, please escape them according to th
<filteritem type="filepath" name="host/smartperf/trace_streamer/prebuilts/buildsqlite/.*.patch" desc="the third_party patch file, the file is self-developed"/>
<filteritem type="filepath" name="hiebpf/test/resources/elf32.unstripped" desc="the hiebpf test file, the file is self-developed"/>
<filteritem type="filepath" name="hiebpf/test/resources/elf64.stripped" desc="the hiebpf test file, the file is self-developed"/>
<filteritem type="filepath" name="device/plugins/native_daemon/test/unittest/resource/testdata/syms_from_readelf_64" desc="the binary file for test, the file is self-developed"/>
<filteritem type="filepath" name="device/plugins/native_daemon/test/unittest/resource/testdata/syms_from_readelf_32" desc="the binary file for test, the file is self-developed"/>
</filefilter>
</filefilterlist>
</oatconfig>

View File

@ -108,6 +108,8 @@
<option name="push" value="plugins/native_daemon/test/unittest/resource/testdata/phdrs_from_readelf_64 -> /data/test/resource/testdata/" src="res"/>
<option name="push" value="plugins/native_daemon/test/unittest/resource/testdata/syms_from_readelf_32 -> /data/test/resource/testdata/" src="res"/>
<option name="push" value="plugins/native_daemon/test/unittest/resource/testdata/syms_from_readelf_64 -> /data/test/resource/testdata/" src="res"/>
<option name="push" value="plugins/native_daemon/test/unittest/resource/testdata/symbols_file_test_elf32 -> /data/test/resource/testdata/" src="res"/>
<option name="push" value="plugins/native_daemon/test/unittest/resource/testdata/symbols_file_test_elf64 -> /data/test/resource/testdata/" src="res"/>
<option name="push" value="plugins/native_daemon/test/unittest/resource/testdata/dwarf/user_regs.dump -> /data/test/resource/testdata/dwarf/" src="res"/>
<option name="push" value="plugins/native_daemon/test/unittest/resource/testdata/dwarf/user_data.dump -> /data/test/resource/testdata/dwarf/" src="res"/>
<option name="push" value="plugins/native_daemon/test/unittest/resource/testdata/dwarf/hiperf_example_cmd -> /data/test/resource/testdata/dwarf/" src="res"/>

View File

@ -351,10 +351,7 @@ bool FlowController::ParseEventDataOnDelayMode()
for (long i = 0; i < dataBytes; i += PAGE_SIZE) {
uint8_t page[PAGE_SIZE] = {0};
fread(page, sizeof(uint8_t), PAGE_SIZE, rawDataFile_.get());
if (!ParseFtraceEvent(cpuId, page)) {
HILOG_ERROR(LOG_CORE, "ParseFtraceEvent failed!");
return false;
}
CHECK_TRUE(ParseFtraceEvent(cpuId, page), false, "ParseFtraceEvent failed!");
}
}
return true;
@ -366,10 +363,8 @@ int FlowController::StopCapture(void)
CHECK_NOTNULL(tansporter_, -1, "crate ResultTransporter FAILED!");
CHECK_NOTNULL(traceOps_, -1, "create TraceOps FAILED!");
if (requestEvents_.size() == 0 && traceApps_.size() == 0 && traceCategories_.size() == 0) {
HILOG_INFO(LOG_CORE, "StopCapture: ftrace event is not set, return false");
return -1;
}
CHECK_TRUE(requestEvents_.size() != 0 || traceApps_.size() != 0 || traceCategories_.size() != 0, -1,
"StopCapture: ftrace event is not set, return false");
// disable ftrace event switches
DisableTraceEvents();
@ -531,10 +526,8 @@ int FlowController::LoadConfig(const uint8_t configData[], uint32_t size)
traceApps_.assign(traceConfig.hitrace_apps().begin(), traceConfig.hitrace_apps().end());
traceCategories_.assign(traceConfig.hitrace_categories().begin(), traceConfig.hitrace_categories().end());
if (requestEvents_.size() == 0 && traceApps_.size() == 0 && traceCategories_.size() == 0) {
HILOG_INFO(LOG_CORE, "LoadConfig: ftrace event is not set, return false");
return -1;
}
CHECK_TRUE(requestEvents_.size() != 0 || traceApps_.size() != 0 || traceCategories_.size() != 0, -1,
"LoadConfig: ftrace event is not set, return false");
// setup trace clock
if (g_availableClocks.count(traceConfig.clock()) > 0) {

View File

@ -42,10 +42,7 @@ int SamplePlugin::Start(const uint8_t* configData, uint32_t configSize)
}
// 反序列化
if (protoConfig_.ParseFromArray(configData, configSize) <= 0) {
HILOG_ERROR(LOG_CORE, "%s:parseFromArray failed!", __func__);
return -1;
}
CHECK_TRUE(protoConfig_.ParseFromArray(configData, configSize) > 0, -1, "%s:parseFromArray failed!", __func__);
HILOG_INFO(LOG_CORE, "%s:pid = %d", __func__, protoConfig_.pid());
// 插件准备工作
@ -64,9 +61,7 @@ int SamplePlugin::Report(uint8_t* data, uint32_t dataSize)
dataProto.set_double_data(doubleData);
uint32_t length = dataProto.ByteSizeLong();
if (length > dataSize) {
return -length;
}
CHECK_TRUE(length <= dataSize, -length, "%s:Report failed!", __func__);
// 序列化
if (dataProto.SerializeToArray(data, length) > 0) {
HILOG_DEBUG(LOG_CORE, "%s:report success! length = %d", __func__, length);