diff --git a/device/cmds/test/BUILD.gn b/device/cmds/test/BUILD.gn index f4a5ce03f0f0ca240678c0093ad1085d1f609ddc..a75aca2b51a5e222d4eb56bb2971b969bae884d5 100644 --- a/device/cmds/test/BUILD.gn +++ b/device/cmds/test/BUILD.gn @@ -66,6 +66,7 @@ ohos_unittest("hiprofiler_cmd_ut") { "grpc:grpc", "grpc:grpcxx", "hilog:libhilog_base", + "init:libbegetutil", "openssl:libcrypto_shared", "protobuf:protobuf_lite", ] diff --git a/device/cmds/test/unittest/hiprofiler_cmd_test.cpp b/device/cmds/test/unittest/hiprofiler_cmd_test.cpp index d147a76f23a72187ed183945ea53cdda9865e16d..8a794eba8a8377ed01ffc34615021a097792ecef 100644 --- a/device/cmds/test/unittest/hiprofiler_cmd_test.cpp +++ b/device/cmds/test/unittest/hiprofiler_cmd_test.cpp @@ -23,6 +23,7 @@ #include "logging.h" #include "openssl/sha.h" +#include "parameters.h" using namespace testing::ext; @@ -38,7 +39,6 @@ const std::string DEFAULT_SO_PATH("/system/lib/"); const std::string DEFAULT_HIPROFILERD_PATH("/system/bin/hiprofilerd"); const std::string DEFAULT_HIPROFILER_PLUGINS_PATH("/system/bin/hiprofiler_plugins"); const std::string DEFAULT_HIPROFILERD_NAME("hiprofilerd"); -const std::string DEFAULT_HIPROFILER_PLUGINS_NAME("hiprofiler_plugins"); const std::string DEFAULT_HIPROFILER_CMD_PATH("/system/bin/hiprofiler_cmd"); const std::string FTRACE_PLUGIN_PATH("/data/local/tmp/libftrace_plugin.z.so"); @@ -48,7 +48,6 @@ constexpr uint32_t READ_BUFFER_SIZE = 1024; constexpr int SLEEP_TIME = 3; constexpr int FILE_READ_CHUNK_SIZE = 4096; constexpr char HEX_CHARS[] = "0123456789abcdef"; -constexpr int LINE_SIZE = 1000; class HiprofilerCmdTest : public ::testing::Test { @@ -56,33 +55,26 @@ public: static void SetUpTestCase() {} static void TearDownTestCase() {} - void StartServerStub(std::string name) + void StartServerStub(const std::string name) { - if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) { - return; - } - int processNum = fork(); - if (processNum == 0) { - if (DEFAULT_HIPROFILERD_PATH == name) { - // start running hiprofilerd - execl(name.c_str(), nullptr, nullptr); - } else if (DEFAULT_HIPROFILER_PLUGINS_PATH == name) { - // start running hiprofiler_plugins - execl(name.c_str(), DEFAULT_PATH.c_str(), nullptr); - } - _exit(1); - } else if (DEFAULT_HIPROFILERD_PATH == name) { - hiprofilerdPid_ = processNum; + if (DEFAULT_HIPROFILERD_PATH == name) { + // start running hiprofilerd + OHOS::system::SetParameter("hiviewdfx.hiprofiler.profilerd.start", "1"); } else if (DEFAULT_HIPROFILER_PLUGINS_PATH == name) { - hiprofilerPluginsPid_ = processNum; + // start running hiprofiler_plugins + OHOS::system::SetParameter("hiviewdfx.hiprofiler.plugins.start", "1"); } } - void StopProcessStub(int processNum) + void StopProcessStub(const std::string name) { - std::string stopCmd = "kill " + std::to_string(processNum); - std::unique_ptr pipe(popen(stopCmd.c_str(), "r"), pclose); - sleep(SLEEP_TIME); // wait process exit + if (DEFAULT_HIPROFILERD_PATH == name) { + // start running hiprofilerd + OHOS::system::SetParameter("hiviewdfx.hiprofiler.profilerd.start", "0"); + } else if (DEFAULT_HIPROFILER_PLUGINS_PATH == name) { + // start running hiprofiler_plugins + OHOS::system::SetParameter("hiviewdfx.hiprofiler.plugins.start", "0"); + } } bool RunCommand(const std::string& cmd, std::string& content) @@ -463,33 +455,6 @@ public: } return static_cast(buf.st_size); } - - void KillProcess(const std::string processName) - { - int pid = -1; - std::string findpid = "pidof " + processName; - PROFILER_LOG_INFO(LOG_CORE, "find pid command : %s", findpid.c_str()); - std::unique_ptr pipe(popen(findpid.c_str(), "r"), pclose); - - char line[LINE_SIZE]; - do { - if (fgets(line, sizeof(line), pipe.get()) == nullptr) { - PROFILER_LOG_INFO(LOG_CORE, "not find processName : %s", processName.c_str()); - return; - } else if (strlen(line) > 0 && isdigit(static_cast(line[0]))) { - pid = atoi(line); - PROFILER_LOG_INFO(LOG_CORE, "find processName : %s, pid: %d", processName.c_str(), pid); - break; - } - } while (1); - - if (pid != -1) { - StopProcessStub(pid); - } - } -private: - int hiprofilerdPid_ = -1; - int hiprofilerPluginsPid_ = -1; }; /** @@ -499,8 +464,10 @@ private: */ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0110, Function | MediumTest | Level1) { - KillProcess(DEFAULT_HIPROFILERD_NAME); - KillProcess(DEFAULT_HIPROFILER_PLUGINS_NAME); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + sleep(1); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + sleep(1); std::string cmd = DEFAULT_HIPROFILER_CMD_PATH + " -h"; std::string content = ""; @@ -520,7 +487,8 @@ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0110, Function | MediumTest | Lev EXPECT_TRUE(RunCommand(cmd, content)); destStr = "OK"; EXPECT_EQ(strncmp(content.c_str(), destStr.c_str(), strlen(destStr.c_str())), 0); - StopProcessStub(hiprofilerdPid_); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + sleep(1); } /** @@ -530,8 +498,10 @@ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0110, Function | MediumTest | Lev */ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0120, Function | MediumTest | Level1) { - KillProcess(DEFAULT_HIPROFILERD_NAME); - KillProcess(DEFAULT_HIPROFILER_PLUGINS_NAME); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + sleep(1); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + sleep(1); // 测试不存在的config文件 std::string configTestFile = DEFAULT_PATH + "1234.txt"; @@ -566,8 +536,10 @@ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0120, Function | MediumTest | Lev // 删除资源文件和生成的trace文件 cmd = "rm " + configFile + " " + outFile; system(cmd.c_str()); - StopProcessStub(hiprofilerPluginsPid_); - StopProcessStub(hiprofilerdPid_); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + sleep(1); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + sleep(1); } /** @@ -596,8 +568,10 @@ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0130, Function | MediumTest | Lev // 删除资源文件和生成的trace文件 cmd = "rm " + FTRACE_PLUGIN_PATH + " " + outFile; system(cmd.c_str()); - StopProcessStub(hiprofilerPluginsPid_); - StopProcessStub(hiprofilerdPid_); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + sleep(1); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + sleep(1); } /** @@ -607,8 +581,10 @@ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0130, Function | MediumTest | Lev */ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0140, Function | MediumTest | Level1) { - KillProcess(DEFAULT_HIPROFILERD_NAME); - KillProcess(DEFAULT_HIPROFILER_PLUGINS_NAME); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + sleep(1); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + sleep(1); std::string cmd = DEFAULT_HIPROFILER_CMD_PATH + " -s -l -k"; std::string content = ""; @@ -624,8 +600,10 @@ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0140, Function | MediumTest | Lev */ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0150, Function | MediumTest | Level1) { - KillProcess(DEFAULT_HIPROFILERD_NAME); - KillProcess(DEFAULT_HIPROFILER_PLUGINS_NAME); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + sleep(1); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + sleep(1); std::string cmd = DEFAULT_HIPROFILER_CMD_PATH + " -l -k"; std::string content = ""; @@ -639,8 +617,10 @@ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0150, Function | MediumTest | Lev */ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0160, Function | MediumTest | Level1) { - KillProcess(DEFAULT_HIPROFILERD_NAME); - KillProcess(DEFAULT_HIPROFILER_PLUGINS_NAME); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + sleep(1); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + sleep(1); std::string cmd = DEFAULT_HIPROFILER_CMD_PATH + " -k"; std::string content = ""; @@ -673,8 +653,10 @@ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0170, Function | MediumTest | Lev // 删除资源文件和生成的trace文件 cmd = "rm " + FTRACE_PLUGIN_PATH + " " + outFile; system(cmd.c_str()); - StopProcessStub(hiprofilerPluginsPid_); - StopProcessStub(hiprofilerdPid_); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + sleep(1); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + sleep(1); } /** @@ -749,8 +731,10 @@ HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0190, Function | MediumTest | Lev // 删除资源文件和生成的trace文件 cmd = "rm " + HIPERF_PLUGIN_PATH + " " + outFile; system(cmd.c_str()); - StopProcessStub(hiprofilerPluginsPid_); - StopProcessStub(hiprofilerdPid_); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + sleep(1); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + sleep(1); } } diff --git a/device/plugins/api/test/BUILD.gn b/device/plugins/api/test/BUILD.gn index fa24c1f5aae4e59f2232d84fa3e19b5588a6a9a3..8b369b5a3fd78863942f44e534971279727e3d20 100644 --- a/device/plugins/api/test/BUILD.gn +++ b/device/plugins/api/test/BUILD.gn @@ -55,6 +55,7 @@ ohos_unittest("hiprofiler_plugins_ut") { "grpc:grpc", "grpc:grpcxx", "hilog:libhilog_base", + "init:libbegetutil", "openssl:libcrypto_shared", "protobuf:protobuf_lite", ] diff --git a/device/plugins/api/test/unittest/plugin_manager_test.cpp b/device/plugins/api/test/unittest/plugin_manager_test.cpp index 8e39b02c24079a5ead2e936b3b663b66879068a8..024d589595084b170e974814cd3adbf6ec99b27e 100644 --- a/device/plugins/api/test/unittest/plugin_manager_test.cpp +++ b/device/plugins/api/test/unittest/plugin_manager_test.cpp @@ -21,6 +21,7 @@ #include "command_poller.h" #include "grpc/impl/codegen/log.h" #include "logging.h" +#include "parameters.h" #include "plugin_manager.h" #include "plugin_service.h" #include "plugin_service.ipc.h" @@ -39,26 +40,13 @@ std::string g_testPluginDir("/system/lib64/"); #else std::string g_testPluginDir("/system/lib/"); #endif -int g_hiprofilerProcessNum = -1; -const std::string DEFAULT_HIPROFILERD_PATH("/system/bin/hiprofilerd"); class PluginManagerTest : public ::testing::Test { protected: static constexpr auto TEMP_DELAY = std::chrono::milliseconds(20); static void SetUpTestCase() { - if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) { - return; - } - int processNum = fork(); - if (processNum == 0) { - // start running hiprofilerd - execl(DEFAULT_HIPROFILERD_PATH.c_str(), nullptr, nullptr); - _exit(1); - } else { - g_hiprofilerProcessNum = processNum; - } - + OHOS::system::SetParameter("hiviewdfx.hiprofiler.profilerd.start", "1"); #ifdef COVERAGE_TEST const int coverageSleepTime = DEFAULT_SLEEP_TIME * 5; // sleep 5s std::this_thread::sleep_for(std::chrono::milliseconds(coverageSleepTime)); @@ -69,8 +57,7 @@ protected: static void TearDownTestCase() { - std::string stopCmd = "kill " + std::to_string(g_hiprofilerProcessNum); - std::unique_ptr pipe(popen(stopCmd.c_str(), "r"), pclose); + OHOS::system::SetParameter("hiviewdfx.hiprofiler.profilerd.start", "0"); } }; diff --git a/device/plugins/native_daemon/test/unittest/common/native/hook_manager_test.cpp b/device/plugins/native_daemon/test/unittest/common/native/hook_manager_test.cpp index 49dbbbac669b33bac8eb0ed36f388076e4ce18d2..299860eeced1df752f07d11685996d1face03721 100644 --- a/device/plugins/native_daemon/test/unittest/common/native/hook_manager_test.cpp +++ b/device/plugins/native_daemon/test/unittest/common/native/hook_manager_test.cpp @@ -14,24 +14,21 @@ */ #include +#include "command_poller.h" #include "hook_manager.h" #include "hook_service.h" #include "hook_socket_client.h" +#include "parameters.h" #include "socket_context.h" -#include "command_poller.h" using namespace testing::ext; using namespace OHOS::Developtools::NativeDaemon; - namespace { -const std::string DEFAULT_HIPROFILERD_PATH("/system/bin/hiprofilerd"); -int g_hiprofilerdProcessNum = -1; - class HookManagerTest : public ::testing::Test { public: static void SetUpTestCase() { - StartServerStub(DEFAULT_HIPROFILERD_PATH); + OHOS::system::SetParameter("hiviewdfx.hiprofiler.profilerd.start", "1"); #ifdef COVERAGE_TEST const int coverageSleepTime = 5; // sleep 5s sleep(coverageSleepTime); @@ -41,32 +38,7 @@ public: } static void TearDownTestCase() { - StopServerStub(g_hiprofilerdProcessNum); - } - - static void StartServerStub(std::string name) - { - if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) { - return; - } - int processNum = fork(); - PROFILER_LOG_INFO(LOG_CORE, "processNum : %d", processNum); - if (processNum == 0) { - if (DEFAULT_HIPROFILERD_PATH == name) { - // start running hiprofilerd - execl(name.c_str(), nullptr, nullptr); - } - _exit(1); - } else if (DEFAULT_HIPROFILERD_PATH == name) { - g_hiprofilerdProcessNum = processNum; - } - } - - static void StopServerStub(int processNum) - { - std::string stopCmd = "kill " + std::to_string(processNum); - PROFILER_LOG_INFO(LOG_CORE, "stop command : %s", stopCmd.c_str()); - std::unique_ptr pipe(popen(stopCmd.c_str(), "r"), pclose); + OHOS::system::SetParameter("hiviewdfx.hiprofiler.profilerd.start", "0"); } }; diff --git a/device/plugins/network_profiler/test/unittest/network_profiler_test.cpp b/device/plugins/network_profiler/test/unittest/network_profiler_test.cpp index 48a797b8fd58c15bb1433715d95756fab9086aaf..12de9fd79d3b7811e24b56ebfdb8ff2364947187 100644 --- a/device/plugins/network_profiler/test/unittest/network_profiler_test.cpp +++ b/device/plugins/network_profiler/test/unittest/network_profiler_test.cpp @@ -82,27 +82,17 @@ HWTEST_F(NetworkProfilerTest, NetworkProfilerTest001, TestSize.Level1) */ HWTEST_F(NetworkProfilerTest, NetworkProfilerTest002, TestSize.Level1) { - auto networkProfilerMgr = std::make_shared(); - auto networkProfilerService = std::make_unique(networkProfilerMgr); - ASSERT_TRUE(networkProfilerService != nullptr); - networkProfilerMgr->Init(); - SystemSetParameter(PARAM_KAY.c_str(), std::to_string(getpid()).c_str()); + SystemSetParameter("hiviewdfx.hiprofiler.plugins.start", "1"); auto networkProfiler = NetworkProfiler::GetInstance(); - auto ret = networkProfiler->IsProfilerEnable(); - ASSERT_TRUE(ret); - networkProfiler->SetWaitingFlag(true); - networkProfiler->SetEnableFlag(true); - const char* data = "test"; - networkProfiler->NetworkProfiling(1, data, sizeof(data)); - NetworkProfilerSocketClient client(1, networkProfiler, CallBackFunc); sleep(2); - ret = client.SendNetworkProfilerData(nullptr, 0, nullptr, 0); + auto ret = client.SendNetworkProfilerData(nullptr, 0, nullptr, 0); ASSERT_FALSE(ret); NetworkConfig config; SocketContext ctx; ret = client.ProtocolProc(ctx, 0, reinterpret_cast(&config), sizeof(config)); ASSERT_TRUE(ret); + SystemSetParameter("hiviewdfx.hiprofiler.plugins.start", "0"); } /** diff --git a/device/services/profiler_service/test/BUILD.gn b/device/services/profiler_service/test/BUILD.gn index b265f8749d3fed363a7eb4b41981f22b310533cf..3043361b302ba739228f749a35df72ba304e27e8 100644 --- a/device/services/profiler_service/test/BUILD.gn +++ b/device/services/profiler_service/test/BUILD.gn @@ -63,6 +63,7 @@ ohos_unittest("profiler_service_ut") { "grpc:grpc", "grpc:grpcxx", "hilog:libhilog_base", + "init:libbegetutil", "openssl:libcrypto_shared", "protobuf:protobuf_lite", ] diff --git a/device/services/profiler_service/test/unittest/profiler_service_performance_test.cpp b/device/services/profiler_service/test/unittest/profiler_service_performance_test.cpp index 661caa13389a02124d0146820dbf083bacfbc8ce..b4d8e437fa434c32ac0849a38bb3983e15982acf 100644 --- a/device/services/profiler_service/test/unittest/profiler_service_performance_test.cpp +++ b/device/services/profiler_service/test/unittest/profiler_service_performance_test.cpp @@ -35,6 +35,7 @@ #include "memory_plugin_result.pb.h" #include "network_plugin_config.pb.h" #include "network_plugin_result.pb.h" +#include "parameters.h" #include "plugin_module_api.h" #include "plugin_service_types.pb.h" #include "process_plugin_config.pb.h" @@ -106,25 +107,14 @@ protected: profilerStub_ = GetProfilerServiceStub(); } - void StartServerStub(std::string name) + void StartServerStub(const std::string name) { - if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) { - return; - } - int processNum = fork(); - if (processNum == 0) { - if (DEFAULT_HIPROFILERD_PATH == name) { - // start running hiprofilerd - execl(name.c_str(), nullptr, nullptr); - } else if (DEFAULT_HIPROFILER_PLUGINS_PATH == name) { - // start running hiprofiler_plugins - execl(name.c_str(), "/data/local/tmp/", nullptr); - } - _exit(1); - } else if (DEFAULT_HIPROFILERD_PATH == name) { - hiprofilerdPid_ = processNum; + if (DEFAULT_HIPROFILERD_PATH == name) { + // start running hiprofilerd + OHOS::system::SetParameter("hiviewdfx.hiprofiler.profilerd.start", "1"); } else if (DEFAULT_HIPROFILER_PLUGINS_PATH == name) { - hiprofilerPluginsPid_ = processNum; + // start running hiprofiler_plugins + OHOS::system::SetParameter("hiviewdfx.hiprofiler.plugins.start", "1"); } } void StartDependServerStub() @@ -143,7 +133,18 @@ protected: #endif } - void StopProcessStub(int processNum) + void StopProcessStub(const std::string name) + { + if (DEFAULT_HIPROFILERD_PATH == name) { + // stop running hiprofilerd + OHOS::system::SetParameter("hiviewdfx.hiprofiler.profilerd.start", "0"); + } else if (DEFAULT_HIPROFILER_PLUGINS_PATH == name) { + // stop running hiprofiler_plugins + OHOS::system::SetParameter("hiviewdfx.hiprofiler.plugins.start", "0"); + } + } + + void StopProcessStubpid(int processNum) { std::string stopCmd = "kill " + std::to_string(processNum); std::unique_ptr pipe(popen(stopCmd.c_str(), "r"), pclose); @@ -151,8 +152,10 @@ protected: void StopDependServerStub() { - std::string stopCmd = "killall " + DEFAULT_HIPROFILER_PLUGINS_PATH + " " + DEFAULT_HIPROFILERD_PATH; - std::unique_ptr pipe(popen(stopCmd.c_str(), "r"), pclose); + OHOS::system::SetParameter("hiviewdfx.hiprofiler.profilerd.start", "0"); + sleep(1); + OHOS::system::SetParameter("hiviewdfx.hiprofiler.plugins.start", "0"); + sleep(1); } std::unique_ptr GetProfilerServiceStub() @@ -772,10 +775,10 @@ HWTEST_F(ProfilerServicePerformanceTest, DFX_DFR_Hiprofiler_0010, Function | Med sendHeart2 = false; keepSessionThread2.join(); - StopProcessStub(hiprofilerPluginsPid_); - StopProcessStub(hiprofilerdPid_); - StopProcessStub(idlePid_); - StopProcessStub(requestMemoryPid); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + StopProcessStubpid(idlePid_); + StopProcessStubpid(requestMemoryPid); pluginVec_.clear(); } @@ -1011,10 +1014,10 @@ HWTEST_F(ProfilerServicePerformanceTest, DFX_DFR_Hiprofiler_0020, Function | Med } } - StopProcessStub(hiprofilerPluginsPid_); - StopProcessStub(hiprofilerdPid_); - StopProcessStub(cpuActivePid); - StopProcessStub(idlePid_); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + StopProcessStubpid(cpuActivePid); + StopProcessStubpid(idlePid_); pluginVec_.clear(); } @@ -1157,9 +1160,9 @@ HWTEST_F(ProfilerServicePerformanceTest, DFX_DFR_Hiprofiler_0030, Function | Med EXPECT_GT(diskioDataVec2[i].rd_sectors_kb(), 0); } - StopProcessStub(hiprofilerPluginsPid_); - StopProcessStub(hiprofilerdPid_); - StopProcessStub(diskioPid); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); + StopProcessStubpid(diskioPid); pluginVec_.clear(); } @@ -1271,8 +1274,8 @@ HWTEST_F(ProfilerServicePerformanceTest, DFX_DFR_Hiprofiler_0040, Function | Med timeCost = timer.ElapsedUs(); printf("FetchData cost %ldus.\n", timeCost); EXPECT_LE(timeCost, FETCHDATA_TIMEOUT_US); - EXPECT_EQ(hiprofilerdPidCount, ROUND_COUNT); - EXPECT_EQ(hiprofilerPluginsPidCount, ROUND_COUNT); + EXPECT_EQ(hiprofilerdPidCount, 0); + EXPECT_EQ(hiprofilerPluginsPidCount, 0); // StopSession timer.Reset(); @@ -1291,8 +1294,8 @@ HWTEST_F(ProfilerServicePerformanceTest, DFX_DFR_Hiprofiler_0040, Function | Med sendHeart = false; keepSessionThread.join(); - StopProcessStub(hiprofilerPluginsPid_); - StopProcessStub(hiprofilerdPid_); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); pluginVec_.clear(); } @@ -1434,8 +1437,8 @@ HWTEST_F(ProfilerServicePerformanceTest, DFX_DFR_Hiprofiler_0050, Function | Med sendHeart2 = false; keepSessionThread2.join(); - StopProcessStub(hiprofilerPluginsPid_); - StopProcessStub(hiprofilerdPid_); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); pluginVec_.clear(); } @@ -1540,8 +1543,8 @@ HWTEST_F(ProfilerServicePerformanceTest, DFX_DFR_Hiprofiler_0060, Function | Med sendHeart = false; keepSessionThread.join(); - StopProcessStub(hiprofilerPluginsPid_); - StopProcessStub(hiprofilerdPid_); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); pluginVec_.clear(); } @@ -1693,8 +1696,8 @@ HWTEST_F(ProfilerServicePerformanceTest, DFX_DFR_Hiprofiler_0070, Function | Med sendHeart = false; keepSessionThread1.join(); - StopProcessStub(hiprofilerPluginsPid_); - StopProcessStub(hiprofilerdPid_); + StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_PATH); + StopProcessStub(DEFAULT_HIPROFILERD_PATH); pluginVec_.clear(); }