mirror of
https://gitee.com/openharmony/developtools_profiler
synced 2024-12-04 05:06:45 +00:00
modify testcase err
Signed-off-by: ganchuantao <ganchuantao1@huawei.com> Change-Id: I86598cc8263e3286f88676f7db90d9fe38e1a2e2
This commit is contained in:
parent
5702eacd96
commit
49148f85dd
@ -66,6 +66,7 @@ ohos_unittest("hiprofiler_cmd_ut") {
|
||||
"grpc:grpc",
|
||||
"grpc:grpcxx",
|
||||
"hilog:libhilog_base",
|
||||
"init:libbegetutil",
|
||||
"openssl:libcrypto_shared",
|
||||
"protobuf:protobuf_lite",
|
||||
]
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "logging.h"
|
||||
#include "openssl/sha.h"
|
||||
#include "parameters.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -48,7 +49,7 @@ 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 +57,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<FILE, decltype(&pclose)> pipe(popen(stopCmd.c_str(), "r"), pclose);
|
||||
sleep(SLEEP_TIME); // wait process exit
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
bool RunCommand(const std::string& cmd, std::string& content)
|
||||
@ -463,33 +457,6 @@ public:
|
||||
}
|
||||
return static_cast<unsigned long>(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<FILE, decltype(&pclose)> 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<unsigned char>(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 +466,10 @@ private:
|
||||
*/
|
||||
HWTEST_F(HiprofilerCmdTest, DFX_DFR_Hiprofiler_0110, Function | MediumTest | Level1)
|
||||
{
|
||||
KillProcess(DEFAULT_HIPROFILERD_NAME);
|
||||
KillProcess(DEFAULT_HIPROFILER_PLUGINS_NAME);
|
||||
StopProcessStub(DEFAULT_HIPROFILERD_NAME);
|
||||
sleep(1);
|
||||
StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_NAME);
|
||||
sleep(1);
|
||||
|
||||
std::string cmd = DEFAULT_HIPROFILER_CMD_PATH + " -h";
|
||||
std::string content = "";
|
||||
@ -520,7 +489,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_NAME);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -530,8 +500,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_NAME);
|
||||
sleep(1);
|
||||
StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_NAME);
|
||||
sleep(1);
|
||||
|
||||
// 测试不存在的config文件
|
||||
std::string configTestFile = DEFAULT_PATH + "1234.txt";
|
||||
@ -566,8 +538,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 +570,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 +583,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_NAME);
|
||||
sleep(1);
|
||||
StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_NAME);
|
||||
sleep(1);
|
||||
|
||||
std::string cmd = DEFAULT_HIPROFILER_CMD_PATH + " -s -l -k";
|
||||
std::string content = "";
|
||||
@ -624,8 +602,8 @@ 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_NAME);
|
||||
StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_NAME);
|
||||
|
||||
std::string cmd = DEFAULT_HIPROFILER_CMD_PATH + " -l -k";
|
||||
std::string content = "";
|
||||
@ -639,8 +617,8 @@ 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_NAME);
|
||||
StopProcessStub(DEFAULT_HIPROFILER_PLUGINS_NAME);
|
||||
|
||||
std::string cmd = DEFAULT_HIPROFILER_CMD_PATH + " -k";
|
||||
std::string content = "";
|
||||
@ -673,8 +651,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 +729,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,7 @@ ohos_unittest("hiprofiler_plugins_ut") {
|
||||
"grpc:grpc",
|
||||
"grpc:grpcxx",
|
||||
"hilog:libhilog_base",
|
||||
"init:libbegetutil",
|
||||
"openssl:libcrypto_shared",
|
||||
"protobuf:protobuf_lite",
|
||||
]
|
||||
|
@ -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<FILE, decltype(&pclose)> pipe(popen(stopCmd.c_str(), "r"), pclose);
|
||||
OHOS::system::SetParameter("hiviewdfx.hiprofiler.profilerd.start", "0");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -14,24 +14,21 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#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<FILE, decltype(&pclose)> pipe(popen(stopCmd.c_str(), "r"), pclose);
|
||||
OHOS::system::SetParameter("hiviewdfx.hiprofiler.profilerd.start", "0");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -82,27 +82,17 @@ HWTEST_F(NetworkProfilerTest, NetworkProfilerTest001, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(NetworkProfilerTest, NetworkProfilerTest002, TestSize.Level1)
|
||||
{
|
||||
auto networkProfilerMgr = std::make_shared<NetworkProfilerManager>();
|
||||
auto networkProfilerService = std::make_unique<NetworkProfilerSocketService>(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<int8_t*>(&config), sizeof(config));
|
||||
ASSERT_TRUE(ret);
|
||||
SystemSetParameter("hiviewdfx.hiprofiler.plugins.start", "0");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,6 +63,7 @@ ohos_unittest("profiler_service_ut") {
|
||||
"grpc:grpc",
|
||||
"grpc:grpcxx",
|
||||
"hilog:libhilog_base",
|
||||
"init:libbegetutil",
|
||||
"openssl:libcrypto_shared",
|
||||
"protobuf:protobuf_lite",
|
||||
]
|
||||
|
@ -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<FILE, decltype(&pclose)> 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<FILE, decltype(&pclose)> 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<IProfilerService::Stub> 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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user