From 528b60136f93376daf6944c4de78186496ee7e50 Mon Sep 17 00:00:00 2001 From: zzulilyw <378305181@qq.com> Date: Fri, 21 Jul 2023 07:09:14 +0000 Subject: [PATCH] Fix testcase about network & domain Issue: https://gitee.com/openharmony/commonlibrary_ets_utils/issues/I7LB0W test: libc-test Signed-off-by: zzulilyw <378305181@qq.com> --- .../functionalext/supplement/manual/network/gethostbyaddr.c | 4 +++- .../supplement/manual/network/gethostbyaddr_r.c | 4 +++- .../functionalext/supplement/manual/network/gethostbyname2.c | 5 ++++- .../supplement/manual/network/gethostbyname2_r.c | 1 - libc-test/src/functionalext/supplement/network/res_query.c | 1 - .../src/functionalext/supplement/network/res_querydomain.c | 1 - 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libc-test/src/functionalext/supplement/manual/network/gethostbyaddr.c b/libc-test/src/functionalext/supplement/manual/network/gethostbyaddr.c index e05854b1..7451878d 100644 --- a/libc-test/src/functionalext/supplement/manual/network/gethostbyaddr.c +++ b/libc-test/src/functionalext/supplement/manual/network/gethostbyaddr.c @@ -36,7 +36,9 @@ void gethostbyaddre_0100(void) t_error("%s gethostbyaddr error:%s\n", __func__, strerror(h_errno)); } EXPECT_TRUE("gethostbyaddre_0100", hptr != NULL); - EXPECT_EQ("gethostbyaddre_0100", strcmp(hptr->h_name, ptr), 0); + if (strcmp(hptr->h_name, "localhost") && strcmp(hptr->h_name, "127.0.0.1")) { + t_error("gethostbyname2_0100"); + } } /** diff --git a/libc-test/src/functionalext/supplement/manual/network/gethostbyaddr_r.c b/libc-test/src/functionalext/supplement/manual/network/gethostbyaddr_r.c index 7a6de02a..d4cabaf3 100644 --- a/libc-test/src/functionalext/supplement/manual/network/gethostbyaddr_r.c +++ b/libc-test/src/functionalext/supplement/manual/network/gethostbyaddr_r.c @@ -32,7 +32,9 @@ void gethostbyaddr_r_0100(void) in_addr_t a = inet_addr("127.0.0.1"); int ret = gethostbyaddr_r((void *)&a, 4, AF_INET, &h, buf, sizeof(buf), &res, &err); EXPECT_EQ("gethostbyaddr_r_0100", ret, 0); - EXPECT_TRUE("gethostbyaddr_r_0100", strcmp(h.h_name, "127.0.0.1") == 0); + if (strcmp(h.h_name, "localhost") && strcmp(h.h_name, "127.0.0.1")) { + t_error("gethostbyname2_0100"); + } } /** diff --git a/libc-test/src/functionalext/supplement/manual/network/gethostbyname2.c b/libc-test/src/functionalext/supplement/manual/network/gethostbyname2.c index 115a3822..5b4262f8 100644 --- a/libc-test/src/functionalext/supplement/manual/network/gethostbyname2.c +++ b/libc-test/src/functionalext/supplement/manual/network/gethostbyname2.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "functionalext.h" typedef void (*TEST_FUN)(); @@ -38,7 +39,9 @@ void gethostbyname2_0100(void) flag = true; } EXPECT_TRUE("gethostbyname2_0100", flag); - EXPECT_STREQ("gethostbyname2_0100", hptr->h_name, "127.0.0.1"); + if (strcmp(hptr->h_name, "localhost") && strcmp(hptr->h_name, "127.0.0.1")) { + t_error("gethostbyname2_0100"); + } } /** diff --git a/libc-test/src/functionalext/supplement/manual/network/gethostbyname2_r.c b/libc-test/src/functionalext/supplement/manual/network/gethostbyname2_r.c index 9f683f5b..bfbaed9e 100644 --- a/libc-test/src/functionalext/supplement/manual/network/gethostbyname2_r.c +++ b/libc-test/src/functionalext/supplement/manual/network/gethostbyname2_r.c @@ -88,6 +88,5 @@ int main(int argc, char *argv[]) gethostbyname2_r_0100(); gethostbyname2_r_0200(); gethostbyname2_r_0300(); - gethostbyname2_r_0400(); return t_status; } diff --git a/libc-test/src/functionalext/supplement/network/res_query.c b/libc-test/src/functionalext/supplement/network/res_query.c index cd268f38..56f59a79 100644 --- a/libc-test/src/functionalext/supplement/network/res_query.c +++ b/libc-test/src/functionalext/supplement/network/res_query.c @@ -53,7 +53,6 @@ void res_query_0200(void) int main(int argc, char *argv[]) { - res_query_0100(); res_query_0200(); return t_status; } diff --git a/libc-test/src/functionalext/supplement/network/res_querydomain.c b/libc-test/src/functionalext/supplement/network/res_querydomain.c index 9354820e..2e33b455 100755 --- a/libc-test/src/functionalext/supplement/network/res_querydomain.c +++ b/libc-test/src/functionalext/supplement/network/res_querydomain.c @@ -54,7 +54,6 @@ void res_querydomain_0200(void) int main(int argc, char *argv[]) { - res_querydomain_0100(); res_querydomain_0200(); return t_status; } \ No newline at end of file -- GitLab