From f7b2ee4cc9ad25cfeeb6073d2adcaaaaa25ff3f6 Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 7 Feb 2019 20:58:33 +0800 Subject: [PATCH] CI: Cover kernel utility --- trunk/src/kernel/srs_kernel_utility.cpp | 2 +- trunk/src/utest/srs_utest_kernel.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/trunk/src/kernel/srs_kernel_utility.cpp b/trunk/src/kernel/srs_kernel_utility.cpp index 408c3e4d8..c0dc2bd07 100644 --- a/trunk/src/kernel/srs_kernel_utility.cpp +++ b/trunk/src/kernel/srs_kernel_utility.cpp @@ -1013,7 +1013,7 @@ uint8_t srs_from_hex_char(uint8_t c) return -1; } -char *srs_data_to_hex(char *des,const u_int8_t *src,int len) +char* srs_data_to_hex(char* des, const u_int8_t* src, int len) { if(src == NULL || len == 0 || des == NULL){ return NULL; diff --git a/trunk/src/utest/srs_utest_kernel.cpp b/trunk/src/utest/srs_utest_kernel.cpp index 19c3582b2..7c98936fd 100644 --- a/trunk/src/utest/srs_utest_kernel.cpp +++ b/trunk/src/utest/srs_utest_kernel.cpp @@ -3229,6 +3229,22 @@ VOID TEST(KernelUtilityTest, CoverTimeUtilityAll) if (true) { EXPECT_EQ('H', av_toupper('h')); } + + if (true) { + int family = 0; + string ip = srs_dns_resolve("localhost", family); + EXPECT_TRUE(ip == "127.0.0.1" || ip == "::1"); + } + + if (true) { + EXPECT_TRUE(srs_path_exists(".")); + EXPECT_TRUE(srs_success == srs_create_dir_recursively(".")); + } + + if (true) { + char buf[16] = {0}; + EXPECT_STREQ("FE", srs_data_to_hex(buf, (const uint8_t*)"\xfe", 1)); + } } VOID TEST(KernelTSTest, CoverContextUtility)