testsuites fixed

Change-Id: I7f4add72f2fd1cc3770bcf103d1909add4829822
This commit is contained in:
lnlan
2021-04-29 18:56:24 +08:00
parent 8592e04c78
commit 6fe4a3f946
84 changed files with 1897 additions and 1690 deletions

View File

@@ -46,30 +46,35 @@ unittest("liteos_a_net_netdb_unittest") {
]
sources = [
"../../common/osTest.cpp",
"full/net_netdb_test_001.cpp",
"full/net_netdb_test_002.cpp",
"full/net_netdb_test_003.cpp",
"full/net_netdb_test_004.cpp",
"full/net_netdb_test_005.cpp",
"full/net_netdb_test_006.cpp",
"full/net_netdb_test_007.cpp",
"full/net_netdb_test_008.cpp",
"full/net_netdb_test_009.cpp",
"full/net_netdb_test_010.cpp",
"full/net_netdb_test_011.cpp",
"full/net_netdb_test_012.cpp",
"full/net_netdb_test_013.cpp",
"full/net_netdb_test_014.cpp",
"full/net_netdb_test_015.cpp",
"full/net_netdb_test_016.cpp",
"full/net_netdb_test_017.cpp",
"full/net_netdb_test_018.cpp",
"full/net_netdb_test_019.cpp",
"full/net_netdb_test_020.cpp",
"full/net_netdb_test_021.cpp",
"full/net_netdb_test_022.cpp",
"net_netdb_test.cpp",
]
if (LOSCFG_USER_TEST_FULL == true) {
sources_full = [
"full/net_netdb_test_001.cpp",
"full/net_netdb_test_002.cpp",
"full/net_netdb_test_003.cpp",
"full/net_netdb_test_004.cpp",
"full/net_netdb_test_005.cpp",
"full/net_netdb_test_006.cpp",
"full/net_netdb_test_007.cpp",
"full/net_netdb_test_008.cpp",
"full/net_netdb_test_009.cpp",
"full/net_netdb_test_010.cpp",
"full/net_netdb_test_011.cpp",
"full/net_netdb_test_012.cpp",
"full/net_netdb_test_013.cpp",
"full/net_netdb_test_014.cpp",
"full/net_netdb_test_015.cpp",
"full/net_netdb_test_016.cpp",
"full/net_netdb_test_017.cpp",
"full/net_netdb_test_018.cpp",
"full/net_netdb_test_019.cpp",
"full/net_netdb_test_020.cpp",
"full/net_netdb_test_021.cpp",
"full/net_netdb_test_022.cpp",
]
sources += sources_full
}
configs = [
"../..:public_config",
":net_local_config",

View File

@@ -46,16 +46,21 @@ unittest("liteos_a_net_resolv_unittest") {
]
sources = [
"../../common/osTest.cpp",
"full/net_resolv_test_001.cpp",
"full/net_resolv_test_002.cpp",
"full/net_resolv_test_003.cpp",
"full/net_resolv_test_004.cpp",
"full/net_resolv_test_005.cpp",
"full/net_resolv_test_006.cpp",
"full/net_resolv_test_007.cpp",
"full/net_resolv_test_008.cpp",
"net_resolv_test.cpp",
]
if (LOSCFG_USER_TEST_FULL == true) {
sources_full = [
"full/net_resolv_test_001.cpp",
"full/net_resolv_test_002.cpp",
"full/net_resolv_test_003.cpp",
"full/net_resolv_test_004.cpp",
"full/net_resolv_test_005.cpp",
"full/net_resolv_test_006.cpp",
"full/net_resolv_test_007.cpp",
"full/net_resolv_test_008.cpp",
]
sources += sources_full
}
configs = [
"../..:public_config",
":net_local_config",

View File

@@ -47,20 +47,25 @@ unittest("liteos_a_net_socket_unittest") {
sources = [
"../../common/osTest.cpp",
"net_socket_test.cpp",
"smoke/net_socket_test_001.cpp",
"smoke/net_socket_test_002.cpp",
"smoke/net_socket_test_003.cpp",
"smoke/net_socket_test_004.cpp",
"smoke/net_socket_test_005.cpp",
"smoke/net_socket_test_006.cpp",
"smoke/net_socket_test_007.cpp",
"smoke/net_socket_test_008.cpp",
"smoke/net_socket_test_009.cpp",
"smoke/net_socket_test_010.cpp",
"smoke/net_socket_test_011.cpp",
"smoke/net_socket_test_012.cpp",
"smoke/net_socket_test_013.cpp",
]
if (LOSCFG_USER_TEST_SMOKE == true) {
sources_smoke = [
"smoke/net_socket_test_001.cpp",
"smoke/net_socket_test_002.cpp",
"smoke/net_socket_test_003.cpp",
"smoke/net_socket_test_004.cpp",
"smoke/net_socket_test_005.cpp",
"smoke/net_socket_test_006.cpp",
"smoke/net_socket_test_007.cpp",
"smoke/net_socket_test_008.cpp",
"smoke/net_socket_test_009.cpp",
"smoke/net_socket_test_010.cpp",
"smoke/net_socket_test_011.cpp",
"smoke/net_socket_test_012.cpp",
"smoke/net_socket_test_013.cpp",
]
sources += sources_smoke
}
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [
"../../:public_config",

View File

@@ -38,7 +38,7 @@
#define SERVER_PORT 6666
#define INVALID_SOCKET -1
#define CLIENT_NUM 50
#define CLIENT_NUM 25
#define BACKLOG CLIENT_NUM
static int gFds[FD_SETSIZE];

View File

@@ -38,7 +38,7 @@
#define SERVER_PORT 8888
#define INVALID_SOCKET -1
#define CLIENT_NUM 50
#define CLIENT_NUM 25
#define BACKLOG CLIENT_NUM
static int gFds[FD_SETSIZE];

View File

@@ -38,7 +38,7 @@
#define SERVER_PORT 7777
#define INVALID_SOCKET -1
#define CLIENT_NUM 50
#define CLIENT_NUM 25
static int gFds[FD_SETSIZE];
static int gBye;
@@ -97,7 +97,7 @@ static int CloseAllFd(void)
static int HandleRecv(int fd)
{
char buf[256];
char buf[128];
int ret = recv(fd, buf, sizeof(buf)-1, 0);
if (ret < 0) {
LogPrintln("[%d]Error: %s", fd, strerror(errno));
@@ -151,11 +151,11 @@ static void *ClientsThread(void *param)
LogPrintln("[%d]<%d>connected to udp://%s:%d successful", fd, thrNo, inet_ntoa(sa.sin_addr), SERVER_PORT);
const char *msg[] = {
"hello, ",
"ohos, ",
"hello, ",
"my name is net_socket_test_011, ",
"see u next time, ",
"Bye!"
"Bye!",
};
for (int i = 0; i < sizeof(msg) / sizeof(msg[0]); ++i) {
@@ -172,15 +172,20 @@ static void *ClientsThread(void *param)
static int StartClients(pthread_t *cli, int cliNum)
{
int ret;
pthread_attr_t attr;
pthread_attr_t attr = {0};
struct sched_param param = { 0 };
int policy;
ret = pthread_getschedparam(pthread_self(), &policy, &param);
ICUNIT_ASSERT_EQUAL(ret, 0, -ret);
for (int i = 0; i < cliNum; ++i) {
ret = pthread_attr_init(&attr);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
param.sched_priority = param.sched_priority + 1;
pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
pthread_attr_setschedparam(&attr, &param);
ret = pthread_create(&cli[i], &attr, ClientsThread, (void *)(intptr_t)i);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = pthread_attr_destroy(&attr);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
}