提交 fb12e188 编写于 作者: O openharmony_ci 提交者: Gitee

!790 [hiviewdfx子系统]适配测试用例

Merge pull request !790 from zhuqingxi/master
...@@ -89,14 +89,16 @@ HWTEST_F(faultloggertest, Faultlogger_Faultdetect, Function|MediumTest|Level1) ...@@ -89,14 +89,16 @@ HWTEST_F(faultloggertest, Faultlogger_Faultdetect, Function|MediumTest|Level1)
printf("pid is %d\r\n", pid); printf("pid is %d\r\n", pid);
printf("sub process end with status %d\r\n", faultloggertest::status); printf("sub process end with status %d\r\n", faultloggertest::status);
ASSERT_FALSE(status == 0); ASSERT_FALSE(status == 0);
sleep(1);
std::vector<std::string> faultfilelist; std::vector<std::string> faultfilelist;
faultfilelist = getfileinpath("/data/log/faultlog/temp/"); faultfilelist = getfileinpath("/data/log/faultlog/temp/");
printf("sizeof faultfilelist is %d\r\n", faultfilelist.size()); printf("sizeof faultfilelist is %d\r\n", faultfilelist.size());
bool result = false; bool result = false;
for (std::string filename : faultfilelist) { for (std::string filename : faultfilelist) {
printf("file list is %s\r\n", filename.c_str()); printf("file list is %s\r\n", filename.c_str());
if (filename.find("cppcrash-" + to_string(pid))) { if (filename.find("cppcrash-" + to_string(pid)) != string::npos) {
result = true; result = true;
break;
} }
} }
ASSERT_TRUE(true == result); ASSERT_TRUE(true == result);
...@@ -112,6 +114,7 @@ HWTEST_F(faultloggertest, Faultlogger_Faultdetect1, Function|MediumTest|Level1) ...@@ -112,6 +114,7 @@ HWTEST_F(faultloggertest, Faultlogger_Faultdetect1, Function|MediumTest|Level1)
pid_t pid = DoTestProcess(3); pid_t pid = DoTestProcess(3);
printf("pid is %d\r\n", pid); printf("pid is %d\r\n", pid);
printf("sub process end with status %d\r\n", faultloggertest::status); printf("sub process end with status %d\r\n", faultloggertest::status);
sleep(1);
std::vector<std::string> faultfilelist; std::vector<std::string> faultfilelist;
faultfilelist = getfileinpath("/data/log/faultlog/temp/"); faultfilelist = getfileinpath("/data/log/faultlog/temp/");
printf("sizeof faultfilelist is %d\r\n", faultfilelist.size()); printf("sizeof faultfilelist is %d\r\n", faultfilelist.size());
...@@ -127,7 +130,7 @@ HWTEST_F(faultloggertest, Faultlogger_Faultdetect1, Function|MediumTest|Level1) ...@@ -127,7 +130,7 @@ HWTEST_F(faultloggertest, Faultlogger_Faultdetect1, Function|MediumTest|Level1)
string fileinfo; string fileinfo;
fileinfo = ReadFile("/data/log/faultlog/temp/" + faultloggerfile); fileinfo = ReadFile("/data/log/faultlog/temp/" + faultloggerfile);
std::vector<std::string> para = {"Pid:" + to_string(pid), "Uid:0", std::vector<std::string> para = {"Pid:" + to_string(pid), "Uid:0",
"Process name:./faultloggertest", "Process name:./data/local/tmp/faultloggertest",
"Reason:Signal:SIGILL", "Fault thread Info:", "Reason:Signal:SIGILL", "Fault thread Info:",
"Tid:" + to_string(pid), "Name:faultloggertest"}; "Tid:" + to_string(pid), "Name:faultloggertest"};
if (!fileinfo.empty()) { if (!fileinfo.empty()) {
......
...@@ -97,7 +97,7 @@ void hilogtest::TearDownTestCase() ...@@ -97,7 +97,7 @@ void hilogtest::TearDownTestCase()
HWTEST_F(hilogtest, Hilogtool_exit, Function|MediumTest|Level3) HWTEST_F(hilogtest, Hilogtool_exit, Function|MediumTest|Level3)
{ {
CleanCmd(); CleanCmd();
std::string saveFile= "test_data_31.txt"; std::string saveFile= "/data/local/tmp/test_data_31.txt";
std::string cmd1 = gHilogtoolExecutable + " -r"; std::string cmd1 = gHilogtoolExecutable + " -r";
std::string cmdResult; std::string cmdResult;
CmdRun(cmd1, cmdResult); CmdRun(cmd1, cmdResult);
...@@ -128,7 +128,7 @@ HWTEST_F(hilogtest, Hilogtool_exit, Function|MediumTest|Level3) ...@@ -128,7 +128,7 @@ HWTEST_F(hilogtest, Hilogtool_exit, Function|MediumTest|Level3)
HWTEST_F(hilogtest, Hilogtool_type_app, Function|MediumTest|Level3) HWTEST_F(hilogtest, Hilogtool_type_app, Function|MediumTest|Level3)
{ {
CleanCmd(); CleanCmd();
std::string saveFile= "test_data_33_1.txt"; std::string saveFile= "/data/local/tmp/test_data_33_1.txt";
LogType type = LOG_APP; LogType type = LOG_APP;
int i = 0; int i = 0;
while (i++ <= 5) { while (i++ <= 5) {
...@@ -157,7 +157,7 @@ HWTEST_F(hilogtest, Hilogtool_type_app, Function|MediumTest|Level3) ...@@ -157,7 +157,7 @@ HWTEST_F(hilogtest, Hilogtool_type_app, Function|MediumTest|Level3)
HWTEST_F(hilogtest, Hilogtool_type_core, Function|MediumTest|Level3) HWTEST_F(hilogtest, Hilogtool_type_core, Function|MediumTest|Level3)
{ {
CleanCmd(); CleanCmd();
std::string saveFile= "test_data_33_2.txt"; std::string saveFile= "/data/local/tmp/test_data_33_2.txt";
LogType type = LOG_CORE; LogType type = LOG_CORE;
int i = 0; int i = 0;
while (i++ <= 5) { while (i++ <= 5) {
...@@ -185,7 +185,7 @@ HWTEST_F(hilogtest, Hilogtool_type_core, Function|MediumTest|Level3) ...@@ -185,7 +185,7 @@ HWTEST_F(hilogtest, Hilogtool_type_core, Function|MediumTest|Level3)
HWTEST_F(hilogtest, Hilogtool_type_init, Function|MediumTest|Level3) HWTEST_F(hilogtest, Hilogtool_type_init, Function|MediumTest|Level3)
{ {
CleanCmd(); CleanCmd();
std::string saveFile= "test_data_33_3.txt"; std::string saveFile= "/data/local/tmp/test_data_33_3.txt";
LogType type = LOG_INIT; LogType type = LOG_INIT;
int i = 0; int i = 0;
while (i++ <= 5) { while (i++ <= 5) {
...@@ -213,7 +213,7 @@ HWTEST_F(hilogtest, Hilogtool_type_init, Function|MediumTest|Level3) ...@@ -213,7 +213,7 @@ HWTEST_F(hilogtest, Hilogtool_type_init, Function|MediumTest|Level3)
HWTEST_F(hilogtest, Hilogtool_type_multiple, Function|MediumTest|Level2) HWTEST_F(hilogtest, Hilogtool_type_multiple, Function|MediumTest|Level2)
{ {
CleanCmd(); CleanCmd();
std::string saveFile= "test_data_33_4.txt"; std::string saveFile= "/data/local/tmp/test_data_33_4.txt";
LogType type = LOG_INIT; LogType type = LOG_INIT;
int i = 0; int i = 0;
while (i++ <= 3) { while (i++ <= 3) {
...@@ -245,7 +245,7 @@ HWTEST_F(hilogtest, Hilogtool_type_multiple, Function|MediumTest|Level2) ...@@ -245,7 +245,7 @@ HWTEST_F(hilogtest, Hilogtool_type_multiple, Function|MediumTest|Level2)
HWTEST_F(hilogtest, Hilogtool_time, Function|MediumTest|Level3) HWTEST_F(hilogtest, Hilogtool_time, Function|MediumTest|Level3)
{ {
std::string cmd = gHilogtoolExecutable + " -a 1 -v time "; std::string cmd = gHilogtoolExecutable + " -a 1 -v time ";
std::string saveFile= "test_data_35_1.txt"; std::string saveFile= "/data/local/tmp/test_data_35_1.txt";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
bool result = false; bool result = false;
...@@ -272,7 +272,7 @@ HWTEST_F(hilogtest, Hilogtool_time, Function|MediumTest|Level3) ...@@ -272,7 +272,7 @@ HWTEST_F(hilogtest, Hilogtool_time, Function|MediumTest|Level3)
HWTEST_F(hilogtest, Hilogtool_epoch, Function|MediumTest|Level4) HWTEST_F(hilogtest, Hilogtool_epoch, Function|MediumTest|Level4)
{ {
std::string cmd = gHilogtoolExecutable + " -a 1 -v epoch "; std::string cmd = gHilogtoolExecutable + " -a 1 -v epoch ";
std::string saveFile= "test_data_35_2.txt"; std::string saveFile= "/data/local/tmp/test_data_35_2.txt";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
bool result = false; bool result = false;
...@@ -298,7 +298,7 @@ HWTEST_F(hilogtest, Hilogtool_epoch, Function|MediumTest|Level4) ...@@ -298,7 +298,7 @@ HWTEST_F(hilogtest, Hilogtool_epoch, Function|MediumTest|Level4)
HWTEST_F(hilogtest, Hilogtool_monotonic, Function|MediumTest|Level3) HWTEST_F(hilogtest, Hilogtool_monotonic, Function|MediumTest|Level3)
{ {
std::string cmd = gHilogtoolExecutable + " -a 1 -v monotonic"; std::string cmd = gHilogtoolExecutable + " -a 1 -v monotonic";
std::string saveFile= "test_data_35_3.txt"; std::string saveFile= "/data/local/tmp/test_data_35_3.txt";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
bool result = false; bool result = false;
...@@ -324,7 +324,7 @@ HWTEST_F(hilogtest, Hilogtool_monotonic, Function|MediumTest|Level3) ...@@ -324,7 +324,7 @@ HWTEST_F(hilogtest, Hilogtool_monotonic, Function|MediumTest|Level3)
HWTEST_F(hilogtest, Hilogtool_usec, Function|MediumTest|Level4) HWTEST_F(hilogtest, Hilogtool_usec, Function|MediumTest|Level4)
{ {
std::string cmd = gHilogtoolExecutable + " -a 1 -v usec"; std::string cmd = gHilogtoolExecutable + " -a 1 -v usec";
std::string saveFile= "test_data_35_4.txt"; std::string saveFile= "/data/local/tmp/test_data_35_4.txt";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
bool result = false; bool result = false;
...@@ -351,7 +351,7 @@ HWTEST_F(hilogtest, Hilogtool_usec, Function|MediumTest|Level4) ...@@ -351,7 +351,7 @@ HWTEST_F(hilogtest, Hilogtool_usec, Function|MediumTest|Level4)
HWTEST_F(hilogtest, Hilogtool_nsec, Function|MediumTest|Level4) HWTEST_F(hilogtest, Hilogtool_nsec, Function|MediumTest|Level4)
{ {
std::string cmd = gHilogtoolExecutable + " -a 1 -v nsec"; std::string cmd = gHilogtoolExecutable + " -a 1 -v nsec";
std::string saveFile= "test_data_35_5.txt"; std::string saveFile= "/data/local/tmp/test_data_35_5.txt";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
bool result = false; bool result = false;
...@@ -379,7 +379,7 @@ HWTEST_F(hilogtest, Hilogtool_nsec, Function|MediumTest|Level4) ...@@ -379,7 +379,7 @@ HWTEST_F(hilogtest, Hilogtool_nsec, Function|MediumTest|Level4)
HWTEST_F(hilogtest, Hilogtool_year, Function|MediumTest|Level4) HWTEST_F(hilogtest, Hilogtool_year, Function|MediumTest|Level4)
{ {
std::string cmd = gHilogtoolExecutable + " -a 1 -v year"; std::string cmd = gHilogtoolExecutable + " -a 1 -v year";
char saveFile356[] = "test_data_35_6.txt"; char saveFile356[] = "/data/local/tmp/test_data_35_6.txt";
SaveCmdOutput(cmd, saveFile356); SaveCmdOutput(cmd, saveFile356);
string hilogInfo = ReadFile(saveFile356); string hilogInfo = ReadFile(saveFile356);
bool result = false; bool result = false;
...@@ -406,7 +406,7 @@ HWTEST_F(hilogtest, Hilogtool_year, Function|MediumTest|Level4) ...@@ -406,7 +406,7 @@ HWTEST_F(hilogtest, Hilogtool_year, Function|MediumTest|Level4)
HWTEST_F(hilogtest, Hilogtool_zone, Function|MediumTest|Level4) HWTEST_F(hilogtest, Hilogtool_zone, Function|MediumTest|Level4)
{ {
std::string cmd = gHilogtoolExecutable + " -a 1 -v zone"; std::string cmd = gHilogtoolExecutable + " -a 1 -v zone";
std::string saveFile= "test_data_35_6.txt"; std::string saveFile= "/data/local/tmp/test_data_35_7.txt";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
bool result = false; bool result = false;
...@@ -435,7 +435,7 @@ HWTEST_F(hilogtest, Hilogtool_regex_null, Function|MediumTest|Level3) ...@@ -435,7 +435,7 @@ HWTEST_F(hilogtest, Hilogtool_regex_null, Function|MediumTest|Level3)
CleanCmd(); CleanCmd();
std::string cmd = gHilogtoolExecutable + " -x -e \"\""; std::string cmd = gHilogtoolExecutable + " -x -e \"\"";
// " -type app core init -x " // " -type app core init -x "
std::string saveFile= "test_data_46_1.txt"; std::string saveFile= "/data/local/tmp/test_data_46_1.txt";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
bool result = false; bool result = false;
...@@ -458,7 +458,7 @@ HWTEST_F(hilogtest, Hilogtool_regex, Function|MediumTest|Level3) ...@@ -458,7 +458,7 @@ HWTEST_F(hilogtest, Hilogtool_regex, Function|MediumTest|Level3)
CleanCmd(); CleanCmd();
std::string cmd1 = gHilogtoolExecutable + " -x -e \"^(123)\""; std::string cmd1 = gHilogtoolExecutable + " -x -e \"^(123)\"";
char saveFile462[] = "test_data_46_2.txt"; char saveFile462[] = "/data/local/tmp/test_data_46_2.txt";
SaveCmdOutput(cmd1, saveFile462); SaveCmdOutput(cmd1, saveFile462);
string hilogInfo = ReadFile(saveFile462); string hilogInfo = ReadFile(saveFile462);
bool result = false; bool result = false;
...@@ -499,7 +499,7 @@ HWTEST_F(hilogtest, Hilogtool_head_1, Function|MediumTest|Level3) ...@@ -499,7 +499,7 @@ HWTEST_F(hilogtest, Hilogtool_head_1, Function|MediumTest|Level3)
HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a'); HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a');
} }
std::string cmd = gHilogtoolExecutable + " -a 1 -x "; std::string cmd = gHilogtoolExecutable + " -a 1 -x ";
std::string saveFile = "test_data_47_1.txt"; std::string saveFile = "/data/local/tmp/test_data_47_1.txt";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
bool result = false; bool result = false;
...@@ -527,7 +527,7 @@ HWTEST_F(hilogtest, Hilogtool_head_20, Function|MediumTest|Level4) ...@@ -527,7 +527,7 @@ HWTEST_F(hilogtest, Hilogtool_head_20, Function|MediumTest|Level4)
usleep(1); usleep(1);
HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a'); HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a');
} }
std::string saveFile= "test_data_47_2.txt"; std::string saveFile= "/data/local/tmp/test_data_47_2.txt";
std::string cmd = gHilogtoolExecutable + " -a 20 -x "; std::string cmd = gHilogtoolExecutable + " -a 20 -x ";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
int n = GetTxtLine(saveFile); int n = GetTxtLine(saveFile);
...@@ -549,7 +549,7 @@ HWTEST_F(hilogtest, Hilogtool_tail_1, Function|MediumTest|Level4) ...@@ -549,7 +549,7 @@ HWTEST_F(hilogtest, Hilogtool_tail_1, Function|MediumTest|Level4)
usleep(1); usleep(1);
HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a'); HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a');
} }
std::string saveFile= "test_data_47_3.txt"; std::string saveFile= "/data/local/tmp/test_data_47_3.txt";
std::string cmd = gHilogtoolExecutable + "-t init -z 1"; std::string cmd = gHilogtoolExecutable + "-t init -z 1";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
sleep(2); sleep(2);
...@@ -579,7 +579,7 @@ HWTEST_F(hilogtest, Hilogtool_tail_20, Function|MediumTest|Level4) ...@@ -579,7 +579,7 @@ HWTEST_F(hilogtest, Hilogtool_tail_20, Function|MediumTest|Level4)
usleep(1); usleep(1);
HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a'); HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a');
} }
std::string saveFile= "test_data_47_4.txt"; std::string saveFile= "/data/local/tmp/test_data_47_4.txt";
std::string cmd = gHilogtoolExecutable + "-t init -z 20"; std::string cmd = gHilogtoolExecutable + "-t init -z 20";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
int n = GetTxtLine(saveFile); int n = GetTxtLine(saveFile);
...@@ -602,7 +602,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_null, Function|MediumTest|Level4) ...@@ -602,7 +602,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_null, Function|MediumTest|Level4)
usleep(1000); usleep(1000);
HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a'); HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a');
} }
std::string saveFile= "test_data_48_1.txt"; std::string saveFile= "/data/local/tmp/test_data_48_1.txt";
std::string cmd = gHilogtoolExecutable + " -t init -x"; std::string cmd = gHilogtoolExecutable + " -t init -x";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
...@@ -632,7 +632,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_level, Function|MediumTest|Level4) ...@@ -632,7 +632,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_level, Function|MediumTest|Level4)
usleep(1); usleep(1);
HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a'); HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a');
} }
std::string saveFile= "test_data_48_4.txt"; std::string saveFile= "/data/local/tmp/test_data_48_4.txt";
std::string cmd = gHilogtoolExecutable + " -t init -L D -x"; std::string cmd = gHilogtoolExecutable + " -t init -L D -x";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
...@@ -663,7 +663,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_domain, Function|MediumTest|Level3) ...@@ -663,7 +663,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_domain, Function|MediumTest|Level3)
usleep(1); usleep(1);
HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a'); HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a');
} }
std::string saveFile= "test_data_48_3.txt"; std::string saveFile= "/data/local/tmp/test_data_48_3.txt";
std::string cmd = gHilogtoolExecutable + " -t init -D 0xd003200 -x"; std::string cmd = gHilogtoolExecutable + " -t init -D 0xd003200 -x";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
...@@ -692,7 +692,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_tag, Function|MediumTest|Level4) ...@@ -692,7 +692,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_tag, Function|MediumTest|Level4)
usleep(1); usleep(1);
HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a'); HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a');
} }
std::string saveFile= "test_data_48_5.txt"; std::string saveFile= "/data/local/tmp/test_data_48_5.txt";
std::string cmd = gHilogtoolExecutable + " -T HILOGTOOLTEST -x"; std::string cmd = gHilogtoolExecutable + " -T HILOGTOOLTEST -x";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
string hilogInfo = ReadFile(saveFile); string hilogInfo = ReadFile(saveFile);
...@@ -722,7 +722,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_multiple, Function|MediumTest|Level2) ...@@ -722,7 +722,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_multiple, Function|MediumTest|Level2)
usleep(1); usleep(1);
HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a'); HILOG_DEBUG(type, g_logContent.c_str(), i, 1.00001, 2.333333, "sse", 'a');
} }
std::string saveFile= "test_data_48_6.txt"; std::string saveFile= "/data/local/tmp/test_data_48_6.txt";
std::string cmd = gHilogtoolExecutable + \ std::string cmd = gHilogtoolExecutable + \
" -T HILOGTOOLTEST -L D -x"; " -T HILOGTOOLTEST -L D -x";
SaveCmdOutput(cmd, saveFile); SaveCmdOutput(cmd, saveFile);
...@@ -744,7 +744,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_multiple, Function|MediumTest|Level2) ...@@ -744,7 +744,7 @@ HWTEST_F(hilogtest, Hilogtool_filter_multiple, Function|MediumTest|Level2)
HWTEST_F(hilogtest, Hilogtool_count, Function|MediumTest|Level2) HWTEST_F(hilogtest, Hilogtool_count, Function|MediumTest|Level2)
{ {
CleanCmd(); CleanCmd();
std::string saveFile= "test_data_30.txt"; std::string saveFile= "/data/local/tmp/test_data_30.txt";
std::string cmd1 = gHilogtoolExecutable + " -r"; std::string cmd1 = gHilogtoolExecutable + " -r";
std::string cmdResult; std::string cmdResult;
CmdRun(cmd1, cmdResult); CmdRun(cmd1, cmdResult);
......
...@@ -33,6 +33,7 @@ public: ...@@ -33,6 +33,7 @@ public:
static void TearDownTestCase(); static void TearDownTestCase();
void SetUp(); void SetUp();
void TearDown(); void TearDown();
void RedHiSysEventLog(std::string &hilogredirect, std::string &timeout);
private: private:
}; };
void HiSysEventCPPTest::SetUp() void HiSysEventCPPTest::SetUp()
...@@ -62,6 +63,23 @@ void HiSysEventCPPTest::TearDownTestCase() ...@@ -62,6 +63,23 @@ void HiSysEventCPPTest::TearDownTestCase()
{ {
std::cout << "TearDownTestCase" << std::endl; std::cout << "TearDownTestCase" << std::endl;
} }
void HiSysEventCPPTest::RedHiSysEventLog(std::string &hilogredirect, std::string &timeout)
{
unsigned long i;
std::vector<std::string> cmdret;
unsigned long cmdretlen;
std::string cmd = "rm " + hilogredirect;
cmdretlen = ExecCmdWithRet(cmd, cmdret);
for (i = 0; i < cmdretlen; i++) {
std::cout<<cmdret[i].c_str()<<std::endl;
}
cmd = "timeout " + timeout + " hilog | grep HISYSEVENT >" + hilogredirect;
std::cout<<cmd<<std::endl;
cmdretlen = ExecCmdWithRet(cmd, cmdret);
for (i = 0; i < cmdretlen; i++) {
std::cout<<cmdret[i].c_str()<<std::endl;
}
}
/** /**
* @tc.name HiSysEvent Native Write Interface Test, Reported When the KeyValue Is of the * @tc.name HiSysEvent Native Write Interface Test, Reported When the KeyValue Is of the
* boolean Type and the bool Value Is False * boolean Type and the bool Value Is False
...@@ -76,10 +94,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0100, Function|M ...@@ -76,10 +94,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0100, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo; string fileinfo;
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"AAFWK", "eventNameDemo", "\"event_type_\":1", "\"key\":0"}; std::vector<std::string> para = {"AAFWK", "eventNameDemo", "\"type_\":1", "\"key\":0"};
if (!fileinfo.empty()) { if (!fileinfo.empty()) {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -102,10 +120,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0200, Function|M ...@@ -102,10 +120,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0200, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::APPEXECFWK; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::APPEXECFWK;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"APPEXECFWK", "eventNameDemo", "\"event_type_\":1", "\"key\":1"}; std::vector<std::string> para = {"APPEXECFWK", "eventNameDemo", "\"type_\":1", "\"key\":1"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -129,10 +147,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0300, Function|M ...@@ -129,10 +147,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0300, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::ACCOUNT; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::ACCOUNT;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"ACCOUNT", "eventNameDemo", "\"event_type_\":1", "\"key\":[0]"}; std::vector<std::string> para = {"ACCOUNT", "eventNameDemo", "\"type_\":1", "\"key\":[0]"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -154,10 +172,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0400, Function|M ...@@ -154,10 +172,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0400, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::OTHERS; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::OTHERS;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"OTHERS", "eventNameDemo", "\"event_type_\":1", "\"key\":97"}; std::vector<std::string> para = {"OTHERS", "eventNameDemo", "\"type_\":1", "\"key\":97"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -181,10 +199,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0500, Function|M ...@@ -181,10 +199,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0500, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::WEARABLE; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::WEARABLE;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"WEARABLE", "eventNameDemo", "\"event_type_\":1", "\"key\":[97]"}; std::vector<std::string> para = {"WEARABLE", "eventNameDemo", "\"type_\":1", "\"key\":[97]"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -206,10 +224,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0600, Function|M ...@@ -206,10 +224,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0600, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::WEARABLE_HARDWARE; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::WEARABLE_HARDWARE;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"WEARABLEHW", "eventNameDemo", "\"event_type_\":1", "\"key\":30949.4"}; std::vector<std::string> para = {"WEARABLEHW", "eventNameDemo", "\"type_\":1", "\"key\":30949.4"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -233,10 +251,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0700, Function|M ...@@ -233,10 +251,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0700, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::USB; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::USB;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"USB", "eventNameDemo", "\"event_type_\":1", "\"key\":[30949.4]"}; std::vector<std::string> para = {"USB", "eventNameDemo", "\"type_\":1", "\"key\":[30949.4]"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -258,10 +276,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0800, Function|M ...@@ -258,10 +276,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0800, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::UPDATE; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::UPDATE;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"UPDATE", "eventNameDemo", "\"event_type_\":1", "\"key\":230.47"}; std::vector<std::string> para = {"UPDATE", "eventNameDemo", "\"type_\":1", "\"key\":230.47"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -285,10 +303,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0900, Function|M ...@@ -285,10 +303,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0900, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::TELEPHONY; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::TELEPHONY;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"TELEPHONY", "eventNameDemo", "\"event_type_\":1", "\"key\":[230.47]"}; std::vector<std::string> para = {"TELEPHONY", "eventNameDemo", "\"type_\":1", "\"key\":[230.47]"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -310,10 +328,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1000, Function|M ...@@ -310,10 +328,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1000, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::STARTUP; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::STARTUP;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"STARTUP", "eventNameDemo", "\"event_type_\":1", "\"key\":100"}; std::vector<std::string> para = {"STARTUP", "eventNameDemo", "\"type_\":1", "\"key\":100"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -337,10 +355,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1100, Function|M ...@@ -337,10 +355,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1100, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::SOURCE_CODE_TRANSFORMER; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::SOURCE_CODE_TRANSFORMER;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"SRCTRANSFORMER", "eventNameDemo", "\"event_type_\":1", "\"key\":[100]"}; std::vector<std::string> para = {"SRCTRANSFORMER", "eventNameDemo", "\"type_\":1", "\"key\":[100]"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -362,10 +380,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1200, Function|M ...@@ -362,10 +380,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1200, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::SENSORS; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::SENSORS;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"SENSORS", "eventNameDemo", "\"event_type_\":1", "\"key\":1000000"}; std::vector<std::string> para = {"SENSORS", "eventNameDemo", "\"type_\":1", "\"key\":1000000"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -389,10 +407,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1300, Function|M ...@@ -389,10 +407,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1300, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::SECURITY; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::SECURITY;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"SECURITY", "eventNameDemo", "\"event_type_\":1", "\"key\":[1000000]"}; std::vector<std::string> para = {"SECURITY", "eventNameDemo", "\"type_\":1", "\"key\":[1000000]"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -414,10 +432,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1400, Function|M ...@@ -414,10 +432,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1400, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::ROUTER; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::ROUTER;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"ROUTER", "eventNameDemo", "\"event_type_\":1", "\"key\":10"}; std::vector<std::string> para = {"ROUTER", "eventNameDemo", "\"type_\":1", "\"key\":10"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -441,10 +459,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1500, Function|M ...@@ -441,10 +459,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1500, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::POWERMGR; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::POWERMGR;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"POWERMGR", "eventNameDemo", "\"event_type_\":2", "\"key\":[10]"}; std::vector<std::string> para = {"POWERMGR", "eventNameDemo", "\"type_\":2", "\"key\":[10]"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -466,10 +484,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1600, Function|M ...@@ -466,10 +484,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1600, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::NOTIFICATION; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::NOTIFICATION;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"NOTIFICATION", "eventNameDemo", "\"event_type_\":2", "\"key\":\"abc\""}; std::vector<std::string> para = {"NOTIFICATION", "eventNameDemo", "\"type_\":2", "\"key\":\"abc\""};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -493,10 +511,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1700, Function|M ...@@ -493,10 +511,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1700, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MODAL_INPUT;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::SECURITY; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::SECURITY;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"MULTIMODALINPUT", "eventNameDemo", "\"event_type_\":3", "\"key\":[\"abc\"]"}; std::vector<std::string> para = {"MULTIMODALINPUT", "eventNameDemo", "\"type_\":3", "\"key\":[\"abc\"]"};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -528,10 +546,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1800, Function|M ...@@ -528,10 +546,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1800, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MEDIA; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::MULTI_MEDIA;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::SECURITY; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::SECURITY;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"MULTIMEDIA", "eventNameDemo", "\"event_type_\":3", str}; std::vector<std::string> para = {"MULTIMEDIA", "eventNameDemo", "\"type_\":3", str};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -564,10 +582,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_2000, Function|M ...@@ -564,10 +582,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_2000, Function|M
g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param,
g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param, g_key, param,
g_key, param, g_key, param); g_key, param, g_key, param);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"MSDP", "eventNameDemo", "\"event_type_\":4", str}; std::vector<std::string> para = {"MSDP", "eventNameDemo", "\"type_\":4", str};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
...@@ -592,10 +610,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_2200, Function|M ...@@ -592,10 +610,10 @@ HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_2200, Function|M
string domain = OHOS::HiviewDFX::HiSysEvent::Domain::LOCATION; string domain = OHOS::HiviewDFX::HiSysEvent::Domain::LOCATION;
OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR; OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR;
OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param); OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout); RedHiSysEventLog(g_hiLogRedirect, g_reDiRectTimeout);
string fileinfo = ""; string fileinfo = "";
fileinfo = ReadFile(g_hiLogRedirect); fileinfo = ReadFile(g_hiLogRedirect);
std::vector<std::string> para = {"LOCATION", "eventNameDemo", "\"event_type_\":4", g_key, param}; std::vector<std::string> para = {"LOCATION", "eventNameDemo", "\"type_\":4", g_key, param};
if (fileinfo != "") { if (fileinfo != "") {
result = CheckInfo(para, fileinfo); result = CheckInfo(para, fileinfo);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册