提交 a693cd41 编写于 作者: T teamol 提交者: 悟空又丢了

fix: fix ppoll

1.modifications:
modified:   syscall/fs_syscall.c
2.modify 2 testcases:
IO/full/IO_test_ppoll_001.cpp
IO/full/IO_test_ppoll_002.cpp
3.influence:
none
Signed-off-by: 悟空又丢了's avatarpef <cyd1997@126.com>
Change-Id: I85fc091098a6dfef1a4694a3bbc489640ee6dda2
上级 ca8909b8
......@@ -226,7 +226,7 @@ int OsSigprocMask(int how, const sigset_t_l *setl, sigset_t_l *oldset)
unsigned int intSave;
sigset_t set;
int retVal;
if (setl != NULL) {
retVal = LOS_ArchCopyFromUser(&set, &(setl->sig[0]), sizeof(sigset_t));
if (retVal != 0) {
......
......@@ -2467,31 +2467,35 @@ int SysPpoll(struct pollfd *fds, nfds_t nfds, const struct timespec *tmo_p, cons
sigset_t_l origMask;
sigset_t_l setl;
if (sigMask == NULL) {
ret = -EINVAL;
return ret;
}
CHECK_ASPACE(tmo_p, sizeof(struct timespec));
CHECK_ASPACE(sigMask, sizeof(sigset_t));
CPY_FROM_USER(tmo_p);
CPY_FROM_USER(sigMask);
timeout = (tmo_p == NULL) ? -1 : (tmo_p->tv_sec * OS_SYS_US_PER_MS + tmo_p->tv_nsec / OS_SYS_NS_PER_MS);
if (timeout & 0x80000000) {
ret = -EINVAL;
return ret;
DUP_FROM_USER(tmo_p, sizeof(struct timespec));
DUP_FROM_USER(sigMask, sizeof(sigset_t), FREE_DUP(tmo_p));
if (tmo_p != NULL) {
timeout = tmo_p->tv_sec * OS_SYS_US_PER_MS + tmo_p->tv_nsec / OS_SYS_NS_PER_MS;
if (timeout & 0x80000000) {
ret = -EINVAL;
printf("ret[1] = %d\n", ret);
return ret;
}
} else {
timeout = -1;
}
if (sigMask != NULL) {
memcpy(&setl.sig[0], sigMask, sizeof(sigset_t));
}
setl.sig[0] = *sigMask;
OsSigprocMask(SIG_SETMASK, &setl, &origMask);
OsSigprocMask(SIG_SETMASK, sigMask?(&setl):NULL, &origMask);
ret = SysPoll(fds, nfds, timeout);
if (ret < 0) {
ret = -get_errno();
}
OsSigprocMask(SIG_SETMASK, &origMask, NULL);
PointerFree(tmo_pbak);
PointerFree(sigMaskbak);
FREE_DUP(tmo_p);
FREE_DUP(sigMask);
return (ret == -1) ? -get_errno() : ret;
}
#endif
......@@ -85,6 +85,7 @@ sources_full = [
"full/IO_test_strncasecmp_l_002.cpp",
"full/IO_test_ppoll_001.cpp",
"full/IO_test_ppoll_002.cpp",
"full/IO_test_ppoll_003.cpp",
]
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
......
......@@ -127,12 +127,11 @@ extern VOID IO_TEST_DCNGETTEXT_002(VOID);
extern VOID IO_TEST_DCGETTEXT_001(VOID);
extern VOID IO_TEST_DCGETTEXT_002(VOID);
extern VOID IO_TEST_GETTEXT_001(VOID);
extern VOID IO_TEST_PPOLL_001(void);
extern VOID IO_TEST_PPOLL_002(void);
extern VOID IO_TEST_PSELECT_001(void);
extern VOID IO_TEST_STRFMON_L_001(VOID);
extern VOID IO_TEST_STRFMON_L_002(VOID);
extern VOID IO_TEST_PPOLL_001(VOID);
extern VOID IO_TEST_PPOLL_002(VOID);
extern VOID IO_TEST_PPOLL_003(VOID);
#endif
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "It_test_IO.h"
#include <poll.h>
#include "signal.h"
#include "pthread.h"
#define LISTEN_FD_NUM 10
#define POLL_EVENTS 1
#define BUF_SIZE 128
#define DELAY_TIME 200
int pipeFdPpoll[LISTEN_FD_NUM][2];
static pthread_t g_tid = -1;
extern int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *tmo_p, const sigset_t *sigmask);
STATIC INT32 pipeFdPpoll[2];
STATIC INT32 g_step = 1;
STATIC CHAR strBuf[] = "hello world.";
STATIC struct pollfd pfd;
static void *pthread_01(void)
STATIC VOID *pthread_01(VOID *arg)
{
static int count = 0;
int total_num = 0;
int times = 3;
int i, ret;
struct pollfd fds[LISTEN_FD_NUM] = { 0 };
char buffer[20];
struct timespec t = { 3,0 };
sigset_t sigset;
/* TEST_PRINT("[INFO]%s:%d,%s,Create thread %d\n", __FILE__, __LINE__, __func__, count); */
count++;
sigemptyset(&sigset);
sigaddset(&sigset, SIGALRM); /* 把SIGALRM 信号添加到sigset 信号集中 */
sigaddset(&sigset, SIGUSR1);
for (i = 0; i < LISTEN_FD_NUM; i++) {
fds[i].fd = pipeFdPpoll[i][0];
fds[i].events = POLL_EVENTS;
INT32 retVal;
CHAR buf[BUF_SIZE];
const struct timespec timeout = {1000, 0};
/* 执行ppoll监视文件描述符*/
while(g_step < 3) {
usleep(DELAY_TIME);
}
while (times--) {
ret = ppoll(fds, LISTEN_FD_NUM, &t, &sigset);
total_num += ((ret > 0) ? ret : 0);
if (ret <= 0) {
continue;
}
for (i = 0; i < LISTEN_FD_NUM; i++) {
if (fds[i].revents & POLL_EVENTS) {
ret = read(fds[i].fd, buffer, 12);
ICUNIT_GOTO_EQUAL(ret, 12, ret, EXIT);
ret = strcmp(buffer, "hello world");
TEST_PRINT("[EVENT]%s:%d,%s,buffer=%s\n", __FILE__, __LINE__, __func__, buffer);
}
}
if (total_num == LISTEN_FD_NUM) {
break;
}
g_step++;
retVal = ppoll(&pfd, 1, NULL, NULL);
ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal);
while(g_step < 5) {
usleep(DELAY_TIME);
}
/* ICUNIT_GOTO_EQUAL(total_num, 10, -1, EXIT); */
/* TEST_PRINT("[INFO]%s:%d,%s,total_num=%d\n", __FILE__, __LINE__, __func__, total_num); */
EXIT:
return nullptr;
}
static UINT32 testcase1(VOID)
{
int i;
int ret;
int count = 0;
for (i = 0; i < LISTEN_FD_NUM; i++) {
ret = pipe(pipeFdPpoll[i]);
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
TEST_PRINT("[INFO]%s:%d,%s,ret=%d,pipeFdPpoll[%d][0]=%d\n", __FILE__, __LINE__, __func__, ret, i, pipeFdPpoll[i][0]);
TEST_PRINT("[INFO]%s:%d,%s,ret=%d,pipeFdPpoll[%d][0]=%d\n", __FILE__, __LINE__, __func__, ret, i, pipeFdPpoll[i][1]);
g_step++;
/* 判断revents*/
if (pfd.revents & POLLIN) {
memset(buf, 0, sizeof(buf));
retVal = read(pfd.fd, buf, BUF_SIZE);
ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal);
retVal = strcmp(strBuf, buf);
ICUNIT_ASSERT_EQUAL_NULL(retVal, 0, retVal);
}
errno = 0;
ret = pthread_create(&g_tid, nullptr, (void *(*)(void *))pthread_01, nullptr);
TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
errno = 0;
for (i = 0; i < LISTEN_FD_NUM; i++) {
if ((pipeFdPpoll[i][1] != 9) && (pipeFdPpoll[i][1] != 10) && (pipeFdPpoll[i][1] != 11)) {
ret = write(pipeFdPpoll[i][1], "hello world!", 12); /* 12, "hello world" length and '\0' */
}
ICUNIT_GOTO_EQUAL(ret, 12, ret, EXIT);
TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno));
while(g_step < 6) {
usleep(DELAY_TIME);
}
pthread_exit(NULL);
}
#if 1 /* write looply */
while(1) {
if (count++ > 3) {
break;
}
sleep(1);
for (i = 0; i < LISTEN_FD_NUM; i++) {
errno = 0;
ret = pthread_create(&g_tid, nullptr, (void *(*)(void *))pthread_01, nullptr);
TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
if ((pipeFdPpoll[i][1] == 13) || (pipeFdPpoll[i][1] == 14) || (pipeFdPpoll[i][1] == 15)) {
errno = 0;
ret = write(pipeFdPpoll[i][1], "World HELLO!", 12); /* 12, "hello world" length and '\0' */
TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno));
TEST_PRINT("[INFO]%s:%d,%s,ret=%d,pipeFdPpoll[%d][1]=%d,count=%d\n", __FILE__, __LINE__, __func__, ret,i, pipeFdPpoll[i][1], count);
}
/* ICUNIT_GOTO_EQUAL(ret, 12, ret, EXIT); */
}
STATIC UINT32 testcase(VOID)
{
INT32 retVal;
pthread_t tid;
/* 建立管道*/
while(g_step < 1) {
usleep(DELAY_TIME);
}
#endif
pthread_join(g_tid, nullptr);
for (i = 0; i < LISTEN_FD_NUM; i++) {
close(pipeFdPpoll[i][0]);
close(pipeFdPpoll[i][1]);
retVal = pipe(pipeFdPpoll);
ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal);
g_step++;
/* 设置pfd*/
pfd.fd = pipeFdPpoll[0];
pfd.events = POLLIN;
/* 开辟线程执行 ppoll*/
while(g_step < 2) {
usleep(DELAY_TIME);
}
return LOS_OK;
EXIT:
for (i = 0; i < LISTEN_FD_NUM; i++) {
close(pipeFdPpoll[i][0]);
close(pipeFdPpoll[i][1]);
retVal = pthread_create(&tid, NULL, pthread_01, NULL);
ICUNIT_ASSERT_EQUAL(retVal, 0, retVal);
g_step++;
/* 向管道写入数据*/
while(g_step < 4) {
usleep(DELAY_TIME);
}
return LOS_NOK;
}
static UINT32 testcase(VOID)
{
testcase1();
sleep(1);
retVal = write(pipeFdPpoll[1], "hello world.", sizeof(strBuf));
ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal);
g_step++;
pthread_join(tid, NULL);
return LOS_OK;
}
VOID IO_TEST_PPOLL_001(VOID)
{
TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION);
}
}
\ No newline at end of file
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "It_test_IO.h"
#include "time.h"
#include "signal.h"
#include <poll.h>
#include <fcntl.h>
#include <unistd.h>
#include <strings.h>
#define BUF_LEN 20
#define MAX_SCAN_FDSET 10 /* define poll's listened FD set's size */
#define POLL_WAIT_TIMEOUT 10*1000 /* ms */
extern int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, const sigset_t *sigmask);
void work_ppoll(int fd)
{
int ret = 0;
int i = 0;
char recv_buf[BUF_LEN];
sigset_t sigset;
struct timespec t;
struct pollfd scan_fdset[MAX_SCAN_FDSET];
int scan_fdset_num = 10;
int count = 5;
#include "pthread.h"
bzero(recv_buf, BUF_LEN);
sigemptyset(&sigset);
sigaddset(&sigset, SIGALRM); /* add SIGALRM to sigset */
sigaddset(&sigset, SIGUSR1); /* add SIGUSR1 to sigset */
bzero(&t, sizeof(struct timespec));
t.tv_sec = 10;
t.tv_nsec = 0;
bzero(scan_fdset, sizeof(struct pollfd) * MAX_SCAN_FDSET);
scan_fdset[0].fd = fd;
#define BUF_SIZE 128
#define DELAY_TIME 200
/* attention:in the book《UNIX网络编程第一卷》P162 metions:POLLERR,POLLHUP,POLLNVAL\
those error signals can not be set in events. */
/* they will return in revents,while the proper condition happens. */
scan_fdset[0].events = POLLOUT; /* set the signal needed to be listened:POLLOUT/POLLIN */
static int pipeFdPpoll[2];
static int g_step = 1;
static char strBuf[] = "hello world.";
static struct pollfd pfd;
/* set other elements in the array as invalid. */
for (i = 1; i < MAX_SCAN_FDSET; i++) {
/* scan_fdset[i].fd = -1; */
scan_fdset[i].fd = fd;
scan_fdset[i].events = POLLOUT; /* set the signal needed to be listened. */
static void *pthread_01(void *arg)
{
int retVal;
char buf[BUF_SIZE];
const struct timespec timeout = {10000, 0};
/* 执行ppoll监视文件描述符 */
while(g_step < 4) {
usleep(DELAY_TIME);
}
/* scan_fdset_num = 1; */ /* 表示当前的scan_fdset[] 数组中只使用前面1 个元素存放需要监听的扫描符 */
while (count--) {
ret = ppoll(scan_fdset, scan_fdset_num, &t, &sigset);
for (i = 0; i < MAX_SCAN_FDSET; i++) {
if (scan_fdset[i].revents & POLLOUT) {
TEST_PRINT("[INFO]%s:%d,%s,fd have signal!\n", __FILE__, __LINE__, __func__);
ret = read(fd, recv_buf, BUF_LEN);
if (-1 == ret) {
TEST_PRINT("[INFO]%s:%d,%s,read error!\n", __FILE__, __LINE__, __func__);
continue;
}
TEST_PRINT("[INFO]%s:%d,%s,recv_buf=%s\n", __FILE__, __LINE__, __func__, recv_buf);
}
TEST_PRINT("[INFO]%s:%d,%s,scan_fdset[i].revents=%d\n", __FILE__, __LINE__, __func__, scan_fdset[i].revents);
}
g_step++;
retVal = ppoll(&pfd, 1, &timeout, NULL);
ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal);
/* 判断revents */
if (pfd.revents & POLLIN) {
memset(buf, 0, sizeof(buf));
retVal = read(pfd.fd, buf, BUF_SIZE);
ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal);
retVal = strcmp(strBuf, buf);
ICUNIT_ASSERT_EQUAL_NULL(retVal, 0, retVal);
}
while(g_step < 5) {
usleep(DELAY_TIME);
}
pthread_exit(NULL);
}
static UINT32 testcase(VOID)
{
int fd;
char *filename = FILEPATH_775;
int retVal;
pthread_t tid;
/* 建立管道 */
while(g_step < 1) {
usleep(DELAY_TIME);
}
retVal = pipe(pipeFdPpoll);
ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal);
g_step++;
/* 设置pfd */
pfd.fd = pipeFdPpoll[0];
pfd.events = POLLIN;
/* 向管道写入数据 */
while(g_step < 2) {
usleep(DELAY_TIME);
}
sleep(1);
retVal = write(pipeFdPpoll[1], "hello world.", sizeof(strBuf));
ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal);
g_step++;
fd = open(filename, O_RDWR);
TEST_PRINT("[INFO]%s:%d,%s,fd=%d\n", __FILE__, __LINE__, __func__, fd);
work_ppoll(fd);
/* 开辟线程执行 ppoll */
while(g_step < 3) {
usleep(DELAY_TIME);
}
retVal = pthread_create(&tid, NULL, pthread_01, NULL);
ICUNIT_ASSERT_EQUAL(retVal, 0, retVal);
g_step++;
return LOS_OK;
pthread_join(tid, NULL);
return LOS_OK;
}
VOID IO_TEST_PPOLL_002(VOID)
{
TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION);
}
}
\ No newline at end of file
#include "It_test_IO.h"
#include "pthread.h"
#include "signal.h"
#define BUF_SIZE 128
#define DELAY_TIME 200
STATIC INT32 pipeFdPpoll[2];
STATIC INT32 g_step = 1;
STATIC CHAR strBuf[] = "hello world.";
STATIC struct pollfd pfd;
sigset_t sigMask;
STATIC UINT32 count = 0;
STATIC VOID signalHandle(INT32 sigNum)
{
//printf("Capture %d\n", sigNum);
g_step++;
return;
}
STATIC VOID *pthread_01(VOID *arg)
{
INT32 retVal;
CHAR buf[BUF_SIZE];
signal(SIGUSR1, signalHandle);
while (1) {
/*执行ppoll监视文件描述符*/
while (g_step < 2) {
usleep(DELAY_TIME);
}
g_step++;
retVal = ppoll(&pfd, 1, NULL, &sigMask);
ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal);
/*判断revents*/
if (pfd.revents & POLLIN) {
memset(buf, 0, sizeof(buf));
retVal = read(pfd.fd, buf, BUF_SIZE);
ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal);
retVal = strcmp(strBuf, buf);
ICUNIT_ASSERT_EQUAL_NULL(retVal, 0, retVal);
count++;
} else {
ICUNIT_ASSERT_NOT_EQUAL_NULL(pfd.revents & POLLIN, 0, pfd.revents & POLLIN);
}
g_step++;
if (g_step >= 7) {
ICUNIT_ASSERT_EQUAL_NULL(count, 2, count);
pthread_exit(NULL);
}
}
return LOS_OK;
}
STATIC UINT32 testcase(VOID)
{
INT32 retVal;
pthread_t tid;
/*建立管道*/
while (g_step < 1) {
usleep(DELAY_TIME);
}
retVal = pipe(pipeFdPpoll);
ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal);
/*设置pfd sigmask*/
pfd.fd = pipeFdPpoll[0];
pfd.events = POLLIN;
pfd.revents = 0x0;
sigemptyset(&sigMask);
sigaddset(&sigMask, SIGUSR1);
/*开辟线程执行 ppoll*/
retVal = pthread_create(&tid, NULL, pthread_01, NULL);
ICUNIT_ASSERT_EQUAL(retVal, 0, retVal);
g_step++;
/*向管道写入数据*/
while (g_step < 3) {
usleep(DELAY_TIME);
}
sleep(1); /*保证先挂起再写入数据*/
retVal = write(pipeFdPpoll[1], "hello world.", sizeof(strBuf));
ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal);
/*向线程发送信号*/
while (g_step < 5) {
usleep(DELAY_TIME);
}
sleep(1); /*保证先挂起再发送信号*/
retVal = pthread_kill(tid, SIGUSR1);
ICUNIT_ASSERT_EQUAL(retVal, 0, retVal);
/*继续向管道写入数据*/
ICUNIT_ASSERT_EQUAL(g_step, 5, g_step); /*判断挂起解除之前信号没有被处理*/
retVal = write(pipeFdPpoll[1], "hello world.", sizeof(strBuf));
ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal);
while (g_step < 7) {
usleep(DELAY_TIME);
}
ICUNIT_ASSERT_EQUAL(count, 2, count);
/*等待退出*/
pthread_join(tid, NULL);
return LOS_OK;
}
VOID IO_TEST_PPOLL_003(VOID)
{
TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION);
}
\ No newline at end of file
......@@ -115,6 +115,17 @@ HWTEST_F(IoTest, IO_TEST_PPOLL_002, TestSize.Level0)
IO_TEST_PPOLL_002();
}
/* *
* @tc.name: IO_TEST_PPOLL_003
* @tc.desc: function for IoTest
* @tc.type: FUNC
* @tc.require: AR000EEMQ9
*/
HWTEST_F(IoTest, IO_TEST_PPOLL_003, TestSize.Level0)
{
IO_TEST_PPOLL_003();
}
/* *
* @tc.name: IT_STDLIB_POLL_002
* @tc.desc: function for IoTest
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册