diff --git a/README.md b/README.md index f96f906104c23fa23ac53e7388203177c7180d96..57779007982bbe70d41128a9e2bd95bb12a8c4e8 100755 --- a/README.md +++ b/README.md @@ -44,13 +44,13 @@ OpenHarmony supports the following system types: ``` /test/xts -├── acts # Test code +├── acts # Test code │ └── subsystem # Source code of subsystem test cases for the standard system │ └── subsystem_lite # Source code of subsystems test cases for mini and small systems │ └── BUILD.gn # Build configuration of test cases for the standard system │ └── build_lite │ └── BUILD.gn # Build configuration of test cases for mini and small systems -└── tools # Test tool code +└── tools # Test tool code ``` ## Constraints diff --git a/README_zh.md b/README_zh.md index ddd67cd2dd2107ae82ebe2768f2e385d584103c2..82392f15a6ee88dd724950e638e43acbea6591ee 100755 --- a/README_zh.md +++ b/README_zh.md @@ -45,13 +45,13 @@ OpenHarmony支持如下几种系统类型: ``` /test/xts -├── acts # 测试代码存放目录 +├── acts # 测试代码存放目录 │ └── subsystem # 标准系统子系统测试用例源码存放目录 │ └── subsystem_lite # 轻量系统、小型系统子系统测试用例源码存放目录 │ └── BUILD.gn # 标准系统测试用例编译配置 │ └── build_lite # 轻量系统、小型系统测试用例编译配置存放目录 │ └── BUILD.gn # 轻量系统、小型系统测试用例编译配置 -└── tools # 测试工具代码存放目录 +└── tools # 测试工具代码存放目录 ``` ## 约束 diff --git a/build_lite/BUILD.gn b/build_lite/BUILD.gn index 999f30c2ec80198b55873edf78a7ae690fd2a0a2..880a1bc9bd519c8b0af7daa978682671a13d117d 100644 --- a/build_lite/BUILD.gn +++ b/build_lite/BUILD.gn @@ -53,7 +53,7 @@ lite_component("acts_component") { "//test/xts/acts/utils_lite/kv_store_posix:ActsKvStoreTest", "//test/xts/acts/startup_lite/syspara_posix:ActsParameterTest", "//test/xts/acts/startup_lite/bootstrap_posix:ActsBootstrapTest", - "//test/xts/acts/multimedia_lite/camera_lite_posix/camera_native:ActsMediaCameraTest", + #"//test/xts/acts/multimedia_lite/camera_lite_posix/camera_native:ActsMediaCameraTest", "//test/xts/acts/open_posix_testsuite/conformance/interfaces:ActsOpenPosixTest", #"//test/xts/acts/multimedia_lite/media_lite_posix/player_native:ActsMediaPlayerTest", "//test/xts/acts/distributed_schedule_lite/system_ability_manager_posix:ActsSamgrTest", @@ -61,7 +61,8 @@ lite_component("acts_component") { #"//test/xts/acts/distributedschedule_lite/distributed_schedule_posix:ActsDMSTest", "//test/xts/acts/security_lite/permission_posix/pms:ActsPMSTest", "//test/xts/acts/hiviewdfx_lite/hilog_posix:ActsHilogTest", - #"//test/xts/acts/multimedia_lite/media_lite_posix/recorder_native:ActsMediaRecorderTest", + + "//test/xts/acts/multimedia_lite/media_lite_posix/recorder_native:ActsMediaRecorderTest", "//test/xts/acts/graphic_lite/graphic_utils:uikit_test1", "//test/xts/acts/graphic_lite/surface:uikit_test2", @@ -81,9 +82,9 @@ lite_component("acts_component") { "//test/xts/acts/utils_lite/kv_store_posix:ActsKvStoreTest", "//test/xts/acts/startup_lite/syspara_posix:ActsParameterTest", "//test/xts/acts/security_lite/huks_posix:ActsSecurityDataTest", - "//test/xts/acts/multimedia_lite/camera_lite_posix/camera_native:ActsMediaCameraTest", + #"//test/xts/acts/multimedia_lite/camera_lite_posix/camera_native:ActsMediaCameraTest", #"//test/xts/acts/multimedia_lite/media_lite_posix/player_native:ActsMediaPlayerTest", - #"//test/xts/acts/multimedia_lite/media_lite_posix/recorder_native:ActsMediaRecorderTest", + "//test/xts/acts/multimedia_lite/media_lite_posix/recorder_native:ActsMediaRecorderTest", "//test/xts/acts/distributed_schedule_lite/system_ability_manager_posix:ActsSamgrTest", "//test/xts/acts/appexecfwk_lite/bundle_mgr_posix:ActsBundleMgrTest", "//test/xts/acts/aafwk_lite/ability_posix:ActsAbilityMgrTest", diff --git a/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/LibhilogCPPtest.cpp b/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/LibhilogCPPtest.cpp index 74ba370fbb4d41a267ebb3d1f64ac7318f1786d2..9d6b824716f35e1b380021b1e6c0a42ab749d28b 100755 --- a/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/LibhilogCPPtest.cpp +++ b/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/LibhilogCPPtest.cpp @@ -75,12 +75,13 @@ HWTEST_F(LibhilogCPPtest, HILOG_INFO_CPP, Function|MediumTest|Level2) int i = 1; HiLog::Info(a, "123456789_1234567890_publicandprivatelogHWTEST_Fis:%{public}d," "%{private}lf,%{public}.2f,%s,%{private}c", i, 1.00001, 2.333333, "sse", 'a'); - std::string expected{"I 123456789_1234567890_publicandprivatelogHWTEST_Fis:1,,2.33,,"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $5, $7}'", cmdRunResult); + std::string expected{"I 03200/HWTEST_Ftag0HWTEST_Ftag0HWTEST: \ +123456789_1234567890_publicandprivatelogHWTEST_Fis:1,,2.33,,"}; + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); std::cout<<"cmdRunResult = " + cmdRunResult<,2.33,,"}; - CmdRun("hilog -L D -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $5, $7}'", cmdRunResult); + std::string expected{"D 03200/HWTEST_Ftag0HWTEST_Ftag0HWTEST: \ +123456789_1234567890_publicandprivatelogHWTEST_Fis:1,,2.33,,"}; + CmdRun("hilog -L D -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); std::cout<<"cmdRunResult = " + cmdRunResult<,2.33,,"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $5, $7}'", cmdRunResult); + std::string expected{"W 03200/HWTEST_Ftag0HWTEST_Ftag0HWTEST: \ +123456789_1234567890_publicandprivatelogHWTEST_Fis:1,,2.33,,"}; + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); std::cout<<"cmdRunResult = " + cmdRunResult<,2.33,,"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $5, $7}'", cmdRunResult); + std::string expected{"E 03200/HWTEST_Ftag0HWTEST_Ftag0HWTEST: \ +123456789_1234567890_publicandprivatelogHWTEST_Fis:1,,2.33,,"}; + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); std::cout<<"cmdRunResult = " + cmdRunResult<,2.33,,"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $5, $7}'", cmdRunResult); + std::string expected{"F 03200/HWTEST_Ftag0HWTEST_Ftag0HWTEST: \ +123456789_1234567890_publicandprivatelogHWTEST_Fis:1,,2.33,,"}; + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); std::cout<<"cmdRunResult = " + cmdRunResult<,1,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -220,8 +225,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_LONG_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "INTEGER_long:%{private}ld,%{public}ld,%ld;", 2147483647L, 2147483647L, 2147483647L); std::string expected{"INTEGER_long:,2147483647,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -241,8 +246,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_4_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "INTEGER_4:%{private}4d,%{public}4d,%4d;", 2000, 2000, 2000); std::string expected{"INTEGER_4:,2000,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -262,8 +267,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_SHORT_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "INTEGER_short:%{private}hd,%{public}hd,%hd;", (short)1024, (short)1024, (short)1024); std::string expected{"INTEGER_short:,1024,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -283,8 +288,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_UN_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "INTEGER_un:%{private}u,%{public}u,%u;", 2147483647u, 2147483647u, 2147483647u); std::string expected{"INTEGER_un:,2147483647,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -304,8 +309,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_LONG_UN_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "INTEGER_long_un:%{private}lu,%{public}lu,%lu;", 7483647ul, 2147483647ul, 2147483647ul); std::string expected{"INTEGER_long_un:,2147483647,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -325,8 +330,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_4_UN_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "INTEGER_4_un:%{private}4u,%{public}4u,%4u;", 4000, 4000, 4000); std::string expected{"INTEGER_4_un:,4000,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -347,8 +352,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_SHORT_UN_CPP, Function|MediumTest|Level3 HiLog::Fatal(a, "INTEGER_short_un:%{private}hu,%{public}hu,%hu;", (unsigned short)65535, (unsigned short)65535, (unsigned short)65535); std::string expected{"INTEGER_short_un:,65535,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -368,8 +373,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_FLOAT_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "FLOAT:%{private}f,%{public}f,%f;", 1.01, 1.01, 1.01); std::string expected{"FLOAT:,1.010000,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -389,8 +394,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_FLOAT_LONG_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "FLOAT_long:%{private}lf,%{public}lf,%lf;", 2.147483647, 2.147483647, 2.147483647); std::string expected{"FLOAT_long:,2.147484,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -412,8 +417,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_FLOAT_POINT2_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "FLOAT_.2:%{private}.2f,%{public}.2f,%.2f;", 2.147483647, 2.147483647, 2.147483647); std::string expected{"FLOAT_.2:,2.15,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -435,8 +440,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_FLOAT_3POINT2_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "FLOAT_3.2:%{private}3.2f,%{public}4.1f,%2.6f;", 32.147483647, 321.147483647, 23.147483647); std::string expected{"FLOAT_3.2:,321.1,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -456,8 +461,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_CHAR_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "CHAR:%{private}c,%{public}c,%c;", 'a', 'b', 'c'); std::string expected{"CHAR:,b,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -477,8 +482,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_OCTAL_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "OCTAL:%{private}o,%{public}o,%o;", 15, 16, 17); std::string expected{"OCTAL:,20,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -498,8 +503,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_OCTAL_LONG_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "OCTAL_long:%{private}lo,%{public}lo,%lo;", 18ul, 19ul, 20ul); std::string expected{"OCTAL_long:,23,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -519,8 +524,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_HEX_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "HEX:%{private}x,%{public}x,%x;", 15, 16, 17); std::string expected{"HEX:,10,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -540,8 +545,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_HEX_UPPER_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "HEX_#:%{private}#x,%{public}#x,%#x;", 18, 19, 20); std::string expected{"HEX_#:,0x13,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -563,8 +568,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_HEX_LONG_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "HEX_long:%{private}lx,%{public}lx,%lx;", 21l, 22l, 23l); std::string expected{"HEX_long:,16,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -586,8 +591,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_HEX_X_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "HEX_X:%{private}X,%{public}X,%X;", 24u, 25u, 26u); std::string expected{"HEX_X:,19,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -609,8 +614,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_HEX_UPPER_X_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "HEX_#X:%{private}#X,%{public}#X,%#X;", 27, 28, 28); std::string expected{"HEX_#X:,0X1C,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -632,8 +637,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_HEX_LONG_UPPER_X_CPP, Function|MediumTest|Level3 a.tag = tag; HiLog::Fatal(a, "HEX_long_X:%{private}lX,%{public}lX,%lX;", 30ul, 31ul, 32ul); std::string expected{"HEX_long_X:,1F,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -653,8 +658,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_STR_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "STRING:%{private}s,%{public}s,%s;", "STRING1", "STRING2", "STRING3"); std::string expected{"STRING:,STRING2,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -674,8 +679,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_STR_EMPTY_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "STRING_empty:%{private}s,%{public}s,%s;", "", "", ""); std::string expected{"STRING_empty:,,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -695,8 +700,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_STR_CHINESE_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "STRING_Chinese:%{private}s,%{public}s,%s;", "中文", "中文", "中文"); std::string expected{"STRING_Chinese:,中文,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -716,8 +721,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_E_DOUBLE_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "DOUBLE_e:%{private}e,%{public}e,%e;", 1e-30, 2.231e10, 3.999e-13); std::string expected{"DOUBLE_e:,2.231000e+10,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -739,8 +744,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_E_UPPER_DOUBLE_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "DOUBLE_E:%{private}E,%{public}E,%E;", 4.88E2, 5.676767e-2, 6.17E13); std::string expected{"DOUBLE_E:,5.676767E-02,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -762,8 +767,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_E_AUTO_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "AUTO:%{private}g,%{public}g,%g;", 1e-30, 2.231e10, 3.999e-13); std::string expected{"AUTO:,2.231e+10,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -785,8 +790,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_E_UPPER_AUTO_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "AUTO_E:%{private}G,%{public}G,%G;", 4.88E2, 5.676767e-2, 6.17E13); std::string expected{"AUTO_E:,0.0567677,;"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -807,8 +812,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_PRIVATE_CPP, Function|MediumTest|Level3) HiLog::Fatal(a, "private:%{private}d,%{private}lf,%{private}.2f,%{private}s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"private:,,,,"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -829,8 +834,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_PUBLIC_CPP, Function|MediumTest|Level3) HiLog::Fatal(a, "public:%{public}d,%{public}lf,%{public}.2f,%{public}s,%{public}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"public:1,1.000010,2.33,sse,a"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -850,8 +855,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_NO_SIGN_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "no_sign:%d,%lf,%.2f,%s,%c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"no_sign:,,,,"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -873,8 +878,8 @@ HWTEST_F(LibhilogCPPtest, HILOG_MIX_CPP, Function|MediumTest|Level3) a.tag = tag; HiLog::Fatal(a, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"MIX:1,,2.33,,"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -894,8 +899,8 @@ HWTEST_F(LibhilogCPPtest, TAG_CHECK_CPP, Function|MediumTest|Level2) a.tag = tagNormal; HiLog::Fatal(a, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"03200/HWTEST_Ftag0HWTEST_Ftag0HWTEST:"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $6}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -916,8 +921,8 @@ HWTEST_F(LibhilogCPPtest, TAG_OVER_CHECK_CPP, Function|MediumTest|Level2) a.tag = tagToolong; HiLog::Fatal(a, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"03200/HWTEST_Ftag0HWTEST_Ftag0HWTEST_:"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST_/ | awk '{print $6}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST_/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -937,8 +942,8 @@ HWTEST_F(LibhilogCPPtest, DOMAIN_CHECK_CPP, Function|MediumTest|Level1) a.tag = tagNormal; HiLog::Fatal(a, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"01111/HWTEST_Ftag0HWTEST_Ftag0HWTEST:"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $6}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -958,6 +963,6 @@ HWTEST_F(LibhilogCPPtest, TYPE_APP_CHECK_CPP, Function|MediumTest|Level2) a.tag = tagNormal; HiLog::Fatal(a, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"03200/HWTEST_Ftag0HWTEST_Ftag0HWTEST:"}; - CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $6}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } diff --git a/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/libhilogCtest.cpp b/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/libhilogCtest.cpp index e8ea4561339f39450e129b91ece6739abea9e671..438e9cfc2835ec3081b7408be44ca3779563e005 100755 --- a/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/libhilogCtest.cpp +++ b/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/libhilogCtest.cpp @@ -72,9 +72,12 @@ HWTEST_F(LibhilogCtest, HILOG_INFO, Function|MediumTest|Level2) int i = 1; HILOG_INFO(type, "123456789_1234567890_publicandprivatelogtestis:%{public}d," "%{private}lf,%{public}.2f,%s,%{private}c", i, 1.00001, 2.333333, "sse", 'a'); - std::string expected{"I 123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $5, $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + std::string expected{"I 03e00/testtag0testtag0testtag0testta: \ +123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"}; + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + std::cout<<"cmdRunResult = " + cmdRunResult<,2.33,,"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $5, $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + std::string expected{"D 03e00/testtag0testtag0testtag0testta: \ +123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"}; + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -106,9 +110,10 @@ HWTEST_F(LibhilogCtest, HILOG_WARNING, Function|MediumTest|Level2) int i = 1; HILOG_WARN(type, "123456789_1234567890_publicandprivatelogtestis:%{public}d," "%{private}lf,%{public}.2f,%s,%{private}c", i, 1.00001, 2.333333, "sse", 'a'); - std::string expected{"W 123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $5, $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + std::string expected{"W 03e00/testtag0testtag0testtag0testta: \ +123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"}; + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -123,9 +128,10 @@ HWTEST_F(LibhilogCtest, HILOG_ERROR, Function|MediumTest|Level2) int i = 1; HILOG_ERROR(type, "123456789_1234567890_publicandprivatelogtestis:%{public}d,%{private}lf," "%{public}.2f,%s,%{private}c", i, 1.00001, 2.333333, "sse", 'a'); - std::string expected{"E 123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $5, $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + std::string expected{"E 03e00/testtag0testtag0testtag0testta: \ +123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"}; + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -140,9 +146,10 @@ HWTEST_F(LibhilogCtest, HILOG_FATAL, Function|MediumTest|Level2) int i = 1; HILOG_FATAL(type, "123456789_1234567890_publicandprivatelogtestis:%{public}d,%{private}lf," "%{public}.2f,%s,%{private}c", i, 1.00001, 2.333333, "sse", 'a'); - std::string expected{"F 123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $5, $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + std::string expected{"F 03e00/testtag0testtag0testtag0testta: \ +123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"}; + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -156,8 +163,8 @@ HWTEST_F(LibhilogCtest, HILOG_INTEGER, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "INTEGER:%{private}d,%{public}d,%d;", 1, 1, 1); std::string expected{"INTEGER:,1,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -171,8 +178,8 @@ HWTEST_F(LibhilogCtest, HILOG_INTEGER_LONG, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "INTEGER_long:%{private}ld,%{public}ld,%ld;", 2147483647L, 2147483647L, 2147483647L); std::string expected{"INTEGER_long:,2147483647,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -186,8 +193,8 @@ HWTEST_F(LibhilogCtest, HILOG_INTEGER_4, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "INTEGER_4:%{private}4d,%{public}4d,%4d;", 2000, 2000, 2000); std::string expected{"INTEGER_4:,2000,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -201,8 +208,8 @@ HWTEST_F(LibhilogCtest, HILOG_INTEGER_SHORT, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "INTEGER_short:%{private}hd,%{public}hd,%hd;", (short)1024, (short)1024, (short)1024); std::string expected{"INTEGER_short:,1024,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -216,8 +223,8 @@ HWTEST_F(LibhilogCtest, HILOG_INTEGER_UN, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "INTEGER_un:%{private}u,%{public}u,%u;", 2147483647u, 2147483647u, 2147483647u); std::string expected{"INTEGER_un:,2147483647,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -231,8 +238,8 @@ HWTEST_F(LibhilogCtest, HILOG_INTEGER_LONG_UN, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "INTEGER_long_un:%{private}lu,%{public}lu,%lu;", 7483647lu, 2147483647lu, 2147483647lu); std::string expected{"INTEGER_long_un:,2147483647,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -246,8 +253,8 @@ HWTEST_F(LibhilogCtest, HILOG_INTEGER_4_UN, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "INTEGER_4_un:%{private}4u,%{public}4u,%4u;", 4000u, 4000u, 4000u); std::string expected{"INTEGER_4_un:,4000,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -262,8 +269,8 @@ HWTEST_F(LibhilogCtest, HILOG_INTEGER_SHORT_UN, Function|MediumTest|Level3) HILOG_FATAL(type, "INTEGER_short_un:%{private}hu,%{public}hu,%hu;", (unsigned short)65535, (unsigned short)65535, (unsigned short)65535); std::string expected{"INTEGER_short_un:,65535,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -277,8 +284,8 @@ HWTEST_F(LibhilogCtest, HILOG_FLOAT, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "FLOAT:%{private}f,%{public}f,%f;", 1.01, 1.01, 1.01); std::string expected{"FLOAT:,1.010000,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -292,8 +299,8 @@ HWTEST_F(LibhilogCtest, HILOG_FLOAT_LONG, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "FLOAT_long:%{private}lf,%{public}lf,%lf;", 2.147483647, 2.147483647, 2.147483647); std::string expected{"FLOAT_long:,2.147484,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -309,8 +316,8 @@ HWTEST_F(LibhilogCtest, HILOG_FLOAT_POINT2, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "FLOAT_.2:%{private}.2f,%{public}.2f,%.2f;", 2.147483647, 2.147483647, 2.147483647); std::string expected{"FLOAT_.2:,2.15,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -326,8 +333,8 @@ HWTEST_F(LibhilogCtest, HILOG_FLOAT_3POINT2, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "FLOAT_3.2:%{private}3.2f,%{public}4.1f,%2.6f;", 32.147483647, 321.147483647, 23.147483647); std::string expected{"FLOAT_3.2:,321.1,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -341,8 +348,8 @@ HWTEST_F(LibhilogCtest, HILOG_CHAR, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "CHAR:%{private}c,%{public}c,%c;", 'a', 'b', 'c'); std::string expected{"CHAR:,b,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -356,8 +363,8 @@ HWTEST_F(LibhilogCtest, HILOG_OCTAL, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "OCTAL:%{private}o,%{public}o,%o;", 15, 16, 17); std::string expected{"OCTAL:,20,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -371,8 +378,8 @@ HWTEST_F(LibhilogCtest, HILOG_OCTAL_LONG, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "OCTAL_long:%{private}lo,%{public}lo,%lo;", 022l, 023l, 024l); std::string expected{"OCTAL_long:,23,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -386,8 +393,8 @@ HWTEST_F(LibhilogCtest, HILOG_HEX, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "HEX:%{private}x,%{public}x,%x;", 0x0F, 0x10, 0x11); std::string expected{"HEX:,10,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -401,8 +408,8 @@ HWTEST_F(LibhilogCtest, HILOG_HEX_UPPER, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "HEX_#:%{private}#x,%{public}#x,%#x;", 0x12, 0x13, 0x14); std::string expected{"HEX_#:,0x13,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -418,8 +425,8 @@ HWTEST_F(LibhilogCtest, HILOG_HEX_LONG, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "HEX_long:%{private}lx,%{public}lx,%lx;", 0x15l, 0x16l, 0x17l); std::string expected{"HEX_long:,16,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -435,8 +442,8 @@ HWTEST_F(LibhilogCtest, HILOG_HEX_X, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "HEX_X:%{private}X,%{public}X,%X;", 0x18, 0x19, 0x1A); std::string expected{"HEX_X:,19,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -452,8 +459,8 @@ HWTEST_F(LibhilogCtest, HILOG_HEX_UPPER_X, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "HEX_#X:%{private}#X,%{public}#X,%#X;", 0x1B, 0x1C, 0x1C); std::string expected{"HEX_#X:,0X1C,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -469,8 +476,8 @@ HWTEST_F(LibhilogCtest, HILOG_HEX_LONG_UPPER_X, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "HEX_long_X:%{private}lX,%{public}lX,%lX;", 0x1El, 0x1Fl, 0x20l); std::string expected{"HEX_long_X:,1F,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -484,8 +491,8 @@ HWTEST_F(LibhilogCtest, HILOG_STR, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "STRING:%{private}s,%{public}s,%s;", "STRING1", "STRING2", "STRING3"); std::string expected{"STRING:,STRING2,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -499,8 +506,8 @@ HWTEST_F(LibhilogCtest, HILOG_STR_EMPTY, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "STRING_empty:%{private}s,%{public}s,%s;", "", "", ""); std::string expected{"STRING_empty:,,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -515,8 +522,8 @@ HWTEST_F(LibhilogCtest, HILOG_STR_CHINESE, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "STRING_Chinese:%{private}s,%{public}s,%s;", "中文", "中文", "中文"); std::string expected{"STRING_Chinese:,中文,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -530,8 +537,8 @@ HWTEST_F(LibhilogCtest, HILOG_E_DOUBLE, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "DOUBLE_e:%{private}e,%{public}e,%e;", 1e-30, 2.231e10, 3.999e-13); std::string expected{"DOUBLE_e:,2.231000e+10,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -547,8 +554,8 @@ HWTEST_F(LibhilogCtest, HILOG_E_UPPER_DOUBLE, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "DOUBLE_E:%{private}E,%{public}E,%E;", 4.88E2, 5.676767e-2, 6.17E13); std::string expected{"DOUBLE_E:,5.676767E-02,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -564,8 +571,8 @@ HWTEST_F(LibhilogCtest, HILOG_E_AUTO, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "AUTO:%{private}g,%{public}g,%g;", 1e-30, 2.231e10, 3.999e-13); std::string expected{"AUTO:,2.231e+10,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -581,8 +588,8 @@ HWTEST_F(LibhilogCtest, HILOG_E_UPPER_AUTO, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "AUTO_E:%{private}G,%{public}G,%G;", 4.88E2, 5.676767e-2, 6.17E13); std::string expected{"AUTO_E:,0.0567677,;"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -597,8 +604,8 @@ HWTEST_F(LibhilogCtest, HILOG_PRIVATE, Function|MediumTest|Level3) HILOG_FATAL(type, "private:%{private}d,%{private}lf,%{private}.2f," "%{private}s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"private:,,,,"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -613,8 +620,8 @@ HWTEST_F(LibhilogCtest, HILOG_PUBLIC, Function|MediumTest|Level3) HILOG_FATAL(type, "public:%{public}d,%{public}lf,%{public}.2f,%{public}s,%{public}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"public:1,1.000010,2.33,sse,a"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -628,8 +635,8 @@ HWTEST_F(LibhilogCtest, HILOG_NO_SIGN, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "no_sign:%d,%lf,%.2f,%s,%c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"no_sign:,,,,"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -645,8 +652,8 @@ HWTEST_F(LibhilogCtest, HILOG_MIX, Function|MediumTest|Level3) LogType type = LOG_CORE; HILOG_FATAL(type, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"MIX:1,,2.33,,"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -660,8 +667,8 @@ HWTEST_F(LibhilogCtest, TAG_CHECK, Function|MediumTest|Level2) LogType type = LOG_CORE; HILOG_FATAL(type, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"03e00/testtag0testtag0testtag0testta:"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $6}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -675,8 +682,8 @@ HWTEST_F(LibhilogCtest, TYPE_APP_CHECK, Function|MediumTest|Level2) LogType type = LOG_APP; HILOG_FATAL(type, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"03e00/testtag0testtag0testtag0testta:"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $6}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -692,8 +699,8 @@ HWTEST_F(LibhilogCtest, TAG_OVER_CHECK, Function|MediumTest|Level2) #define LOG_TAG "testtag0testtag0testtag0testtag0testtag0testtag0testtag0testtag0testtag0testtag0testtag0testtag0" HILOG_FATAL(type, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"03e00/testtag0testtag0testtag0testtag:"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testtag/ | awk '{print $6}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testtag/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } /** @@ -709,6 +716,6 @@ HWTEST_F(LibhilogCtest, DOMAIN_CHECK, Function|MediumTest|Level1) #define LOG_DOMAIN 0xD001111 HILOG_FATAL(type, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a'); std::string expected{"01111/testtag0testtag0testtag0testtag:"}; - CmdRun("hilog -x -M ///testtag0testtag0testtag0testtag/ | awk '{print $6}'", cmdRunResult); - EXPECT_EQ(cmdRunResult, expected); + CmdRun("hilog -x -M ///testtag0testtag0testtag0testtag/", cmdRunResult); + ASSERT_TRUE(cmdRunResult.find(expected) != std::string::npos); } \ No newline at end of file