Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
0b141e05
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
467
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
0b141e05
编写于
1月 10, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 10, 2023
浏览文件
操作
浏览文件
下载
差异文件
!1079 Fix : 将测试用例移植过程中的修改同步回A核
Merge pull request !1079 from yinjiaming/test
上级
46cc8433
e816896d
变更
32
隐藏空白更改
内联
并排
Showing
32 changed file
with
232 addition
and
226 deletion
+232
-226
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_002.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_002.cpp
+7
-7
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_005.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_005.cpp
+3
-3
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_008.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_008.cpp
+11
-10
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_011.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_011.cpp
+10
-9
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_013.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_013.cpp
+9
-9
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_014.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_014.cpp
+7
-7
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_015.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_015.cpp
+8
-10
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_016.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_016.cpp
+7
-7
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_018.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_018.cpp
+6
-6
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_019.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_019.cpp
+6
-6
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_020.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_020.cpp
+6
-6
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_021.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_021.cpp
+3
-3
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_025.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_025.cpp
+3
-3
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_026.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_026.cpp
+3
-3
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_027.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_027.cpp
+8
-9
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_030.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_030.cpp
+4
-5
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_031.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_031.cpp
+8
-8
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_032.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_032.cpp
+6
-6
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_033.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_033.cpp
+7
-7
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_036.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_036.cpp
+7
-7
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_038.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_038.cpp
+6
-6
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_040.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_040.cpp
+7
-7
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_041.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_041.cpp
+10
-9
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_042.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_042.cpp
+9
-8
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_043.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_043.cpp
+6
-6
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_044.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_044.cpp
+8
-8
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_046.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_046.cpp
+6
-6
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_047.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_047.cpp
+8
-8
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_048.cpp
...es/unittest/libc/posix/mqueue/full/It_posix_queue_048.cpp
+8
-8
testsuites/unittest/libc/posix/mqueue/smoke/It_posix_queue_001.cpp
...s/unittest/libc/posix/mqueue/smoke/It_posix_queue_001.cpp
+5
-5
testsuites/unittest/libc/posix/mqueue/smoke/It_posix_queue_003.cpp
...s/unittest/libc/posix/mqueue/smoke/It_posix_queue_003.cpp
+10
-8
testsuites/unittest/libc/posix/mqueue/smoke/It_posix_queue_028.cpp
...s/unittest/libc/posix/mqueue/smoke/It_posix_queue_028.cpp
+20
-16
未找到文件。
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_002.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -36,7 +36,7 @@ static UINT32 Testcase(VOID)
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
CHAR
mqname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
""
;
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
mqd_t
mqueue
;
attr
.
mq_msgsize
=
MQUEUE_STANDARD_NAME_LENGTH
;
...
...
@@ -47,7 +47,7 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT2
);
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_send
(
mqueue
,
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
...
...
@@ -57,10 +57,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_STRING_EQUAL
(
msgrcd
,
MQUEUE_SEND_STRING_TEST
,
msgrcd
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
...
...
@@ -69,10 +69,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue002
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue002
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_002"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_005.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -49,10 +49,10 @@ EXIT:
mq_close
(
mqueue
);
mq_unlink
(
mqname
);
EXIT1:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue005
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue005
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_005"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_008.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -41,31 +41,32 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT2
);
roqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDONLY
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
roqueue
,
(
mqd_t
)
-
1
,
roqueue
,
EXIT
);
ICUNIT_GOTO_NOT_EQUAL
(
roqueue
,
(
mqd_t
)
-
1
,
roqueue
,
EXIT
2
);
roqueue2
=
mq_open
(
mqname
,
O_RDONLY
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
roqueue2
,
(
mqd_t
)
-
1
,
roqueue2
,
EXIT1
);
ret
=
mq_close
(
roqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
ICUNIT_GOTO_NOT_EQUAL
(
roqueue2
,
(
mqd_t
)
-
1
,
roqueue2
,
EXIT
);
ret
=
mq_close
(
roqueue2
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_close
(
roqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT3
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
mq_close
(
roqueue2
);
EXIT:
mq_close
(
roqueue
);
EXIT3:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue008
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue008
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_008"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_011.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -38,7 +38,7 @@ static UINT32 Testcase(VOID)
CHAR
msgrcd2
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
mqd_t
rdwrqueue
,
rdwrqueue2
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
ret
=
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
"/mq011_%d"
,
LosCurTaskIDGet
());
...
...
@@ -47,7 +47,7 @@ static UINT32 Testcase(VOID)
attr
.
mq_msgsize
=
MQUEUE_STANDARD_NAME_LENGTH
;
attr
.
mq_maxmsg
=
MQUEUE_STANDARD_NAME_LENGTH
;
rdwrqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
rdwrqueue
,
(
mqd_t
)
-
1
,
rdwrqueue
,
EXIT
);
ICUNIT_GOTO_NOT_EQUAL
(
rdwrqueue
,
(
mqd_t
)
-
1
,
rdwrqueue
,
EXIT
2
);
ret
=
mq_send
(
rdwrqueue
,
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
...
...
@@ -56,7 +56,7 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
ret
,
strlen
(
msgptr
),
ret
,
EXIT
);
rdwrqueue2
=
mq_open
(
mqname
,
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
rdwrqueue2
,
(
mqd_t
)
-
1
,
rdwrqueue2
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
rdwrqueue2
,
(
mqd_t
)
-
1
,
rdwrqueue2
,
EXIT
);
ret
=
mq_send
(
rdwrqueue2
,
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
...
...
@@ -65,25 +65,26 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
ret
,
strlen
(
msgptr
),
ret
,
EXIT1
);
ret
=
mq_close
(
rdwrqueue2
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ret
=
mq_close
(
rdwrqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
3
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
mq_close
(
rdwrqueue2
);
EXIT:
mq_close
(
rdwrqueue
);
EXIT3:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue011
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue011
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_011"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_013.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -42,26 +42,26 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT3
);
mqueue1
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue1
,
(
mqd_t
)
-
1
,
mqueue1
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue1
,
(
mqd_t
)
-
1
,
mqueue1
,
EXIT
3
);
ret
=
mq_send
(
mqueue1
,
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
mqueue2
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue2
,
(
mqd_t
)
-
1
,
mqueue2
,
EXIT
2
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue2
,
(
mqd_t
)
-
1
,
mqueue2
,
EXIT
1
);
ret
=
mq_send
(
mqueue2
,
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT2
);
ret
=
mq_close
(
mqueue1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT2
);
ret
=
mq_close
(
mqueue2
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
ret
=
mq_
unlink
(
mqname
);
ret
=
mq_
close
(
mqueue1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT3
);
return
MQUEUE_NO_ERROR
;
EXIT2:
mq_close
(
mqueue2
);
...
...
@@ -70,10 +70,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT3:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue013
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue013
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_013"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_014.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -35,14 +35,14 @@ static UINT32 Testcase(VOID)
INT32
ret
;
CHAR
mqname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
""
;
mqd_t
mqueue
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
ret
=
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
"/mq014_%d"
,
LosCurTaskIDGet
());
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT2
);
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_getattr
(
mqueue
,
&
attr
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
...
...
@@ -52,10 +52,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
attr
.
mq_msgsize
,
MQ_MAX_MSG_LEN
,
attr
.
mq_msgsize
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -63,10 +63,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue014
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue014
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_014"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_015.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -35,7 +35,7 @@ static UINT32 Testcase(VOID)
INT32
ret
;
CHAR
mqname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
""
;
mqd_t
mqueue
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attrget
;
ret
=
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
...
...
@@ -45,7 +45,7 @@ static UINT32 Testcase(VOID)
attr
.
mq_maxmsg
=
MQUEUE_SHORT_ARRAY_LENGTH
;
attr
.
mq_msgsize
=
5
;
// 5, queue message size.
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
|
O_NONBLOCK
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_getattr
(
mqueue
,
&
attrget
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
...
...
@@ -54,15 +54,13 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
attrget
.
mq_maxmsg
,
attr
.
mq_maxmsg
,
attrget
.
mq_maxmsg
,
EXIT1
);
ICUNIT_GOTO_EQUAL
(
attrget
.
mq_msgsize
,
attr
.
mq_msgsize
,
attrget
.
mq_msgsize
,
EXIT1
);
if
(
!
(
attrget
.
mq_flags
&
O_NONBLOCK
))
{
goto
EXIT1
;
}
ICUNIT_GOTO_NOT_EQUAL
(
attrget
.
mq_flags
&
O_NONBLOCK
,
0
,
MQUEUE_IS_ERROR
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -70,10 +68,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue015
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue015
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_015"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_016.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -41,16 +41,16 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT3
);
mqueue1
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue1
,
(
mqd_t
)
-
1
,
mqueue1
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue1
,
(
mqd_t
)
-
1
,
mqueue1
,
EXIT
3
);
mqueue2
=
mq_open
(
mqname
,
O_CREAT
|
O_EXCL
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_EQUAL
(
mqueue2
,
(
mqd_t
)
-
1
,
mqueue2
,
EXIT
2
);
ICUNIT_GOTO_EQUAL
(
mqueue2
,
(
mqd_t
)
-
1
,
mqueue2
,
EXIT
1
);
ret
=
mq_close
(
mqueue1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
3
);
return
MQUEUE_NO_ERROR
;
EXIT2:
...
...
@@ -60,10 +60,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT3:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue016
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue016
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_016"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_018.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -42,16 +42,16 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT2
);
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
|
O_NONBLOCK
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_send
(
mqueue
,
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -59,10 +59,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue018
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue018
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_018"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_019.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -37,7 +37,7 @@ static UINT32 Testcase(VOID)
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
mqd_t
mqueue1
,
mqueue2
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
ret
=
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
"/mq019_%d"
,
LosCurTaskIDGet
());
...
...
@@ -47,7 +47,7 @@ static UINT32 Testcase(VOID)
attr
.
mq_maxmsg
=
MQUEUE_STANDARD_NAME_LENGTH
;
mqueue1
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
|
O_NONBLOCK
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue1
,
(
mqd_t
)
-
1
,
mqueue1
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue1
,
(
mqd_t
)
-
1
,
mqueue1
,
EXIT
3
);
ret
=
mq_receive
(
mqueue1
,
msgrcd
,
MQUEUE_STANDARD_NAME_LENGTH
,
NULL
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT1
);
...
...
@@ -56,7 +56,7 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
mqueue2
=
mq_open
(
mqname
,
O_RDWR
|
O_NONBLOCK
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue1
,
(
mqd_t
)
-
1
,
mqueue1
,
EXIT
2
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue1
,
(
mqd_t
)
-
1
,
mqueue1
,
EXIT
1
);
ret
=
mq_receive
(
mqueue1
,
msgrcd
,
MQUEUE_STANDARD_NAME_LENGTH
,
NULL
);
ICUNIT_GOTO_EQUAL
(
ret
,
strlen
(
msgptr
),
ret
,
EXIT2
);
...
...
@@ -79,10 +79,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT3:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue019
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue019
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_019"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_020.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -43,13 +43,13 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT2
);
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -57,10 +57,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue020
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue020
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_020"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_021.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -49,10 +49,10 @@ EXIT:
mq_close
(
mqueue
);
mq_unlink
(
mqname
);
EXIT1:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue021
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue021
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_021"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_025.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -57,10 +57,10 @@ EXIT:
mq_close
(
mqueue
);
mq_unlink
(
mqname
);
EXIT1:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue025
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue025
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_025"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_026.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -49,10 +49,10 @@ EXIT:
mq_close
(
queue
);
mq_unlink
(
qname
);
EXIT1:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue026
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue026
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_026"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_027.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -32,7 +32,7 @@
static
UINT32
Testcase
(
VOID
)
{
CHAR
qname
[
50
];
CHAR
qname
[
MQUEUE_STANDARD_NAME_LENGTH
];
INT32
ret
;
mqd_t
queue
;
...
...
@@ -41,25 +41,24 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT1
);
queue
=
mq_open
(
qname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
NULL
);
if
(
queue
==
(
mqd_t
)
-
1
)
{
ICUNIT_ASSERT_NOT_EQUAL
(
queue
,
(
mqd_t
)
-
1
,
queue
);
}
ICUNIT_ASSERT_NOT_EQUAL
(
queue
,
(
mqd_t
)
-
1
,
queue
);
ret
=
mq_close
(
queue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
ret
=
mq_unlink
(
qname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
return
MQUEUE_NO_ERROR
;
EXIT:
mq_close
(
queue
);
EXIT2:
mq_unlink
(
qname
);
EXIT1:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue027
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue027
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_027"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_030.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -33,18 +33,17 @@
static
UINT32
Testcase
(
VOID
)
{
INT32
ret
;
ret
=
mq_close
((
mqd_t
)
-
1
);
ret
=
mq_close
((
mqd_t
)
-
1
);
// -1: an invalid argument
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_ASSERT_EQUAL
(
errno
,
EBADF
,
errno
);
return
MQUEUE_NO_ERROR
;
EXIT:
mq_close
((
mqd_t
)
-
1
);
return
MQUEUE_NO_ERROR
;
return
MQUEUE_IS_ERROR
;
}
VOID
ItPosixQueue030
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue030
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_030"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_031.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -32,13 +32,13 @@
static
UINT32
Testcase
(
VOID
)
{
INT32
ret
=
0
;
INT32
ret
;
CHAR
mqname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
struct
timespec
ts
;
mqd_t
mqueue
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
ret
=
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
\
"/mq031_%d"
,
LosCurTaskIDGet
());
...
...
@@ -47,7 +47,7 @@ static UINT32 Testcase(VOID)
attr
.
mq_msgsize
=
MQUEUE_STANDARD_NAME_LENGTH
;
attr
.
mq_maxmsg
=
MQUEUE_SHORT_ARRAY_LENGTH
;
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ts
.
tv_sec
=
1
;
ts
.
tv_nsec
=
0
;
...
...
@@ -61,10 +61,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -72,10 +72,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue031
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue031
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_031"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_032.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -42,13 +42,13 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT2
);
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -56,10 +56,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue032
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue032
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_032"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_033.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -37,7 +37,7 @@ static UINT32 Testcase(VOID)
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
mqd_t
mqueue
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
ret
=
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
\
"/mq033_%d"
,
LosCurTaskIDGet
());
...
...
@@ -46,7 +46,7 @@ static UINT32 Testcase(VOID)
attr
.
mq_msgsize
=
MQUEUE_STANDARD_NAME_LENGTH
;
attr
.
mq_maxmsg
=
MQUEUE_SHORT_ARRAY_LENGTH
;
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_send
(
mqueue
,
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
...
...
@@ -58,10 +58,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -69,10 +69,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue033
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue033
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_033"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_036.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -32,7 +32,7 @@
static
UINT32
Testcase
(
VOID
)
{
INT32
ret
=
0
;
INT32
ret
;
CHAR
mqname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
""
;
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
struct
timespec
ts
;
...
...
@@ -43,7 +43,7 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT2
);
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ts
.
tv_sec
=
1
;
ts
.
tv_nsec
=
0
;
...
...
@@ -52,10 +52,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
errno
,
EINVAL
,
errno
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -63,10 +63,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue036
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue036
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_036"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_038.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -42,17 +42,17 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT2
);
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_send
(
mqueue
,
msgptr
,
strlen
(
msgptr
),
MQ_PRIO_MAX
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT1
);
ICUNIT_GOTO_EQUAL
(
errno
,
EINVAL
,
errno
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -60,10 +60,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue038
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue038
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_038"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_040.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -85,7 +85,7 @@ static UINT32 Testcase(VOID)
UINT32
ret
;
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
""
;
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
pthread_attr_t
attr1
;
ret
=
snprintf_s
(
g_gqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
\
...
...
@@ -98,7 +98,7 @@ static UINT32 Testcase(VOID)
g_testCount
=
0
;
g_gqueue
=
mq_open
(
g_gqname
,
O_CREAT
|
O_RDWR
|
O_EXCL
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
g_gqueue
,
(
mqd_t
)
-
1
,
g_gqueue
,
EXIT
);
ICUNIT_GOTO_NOT_EQUAL
(
g_gqueue
,
(
mqd_t
)
-
1
,
g_gqueue
,
EXIT
3
);
ret
=
PosixPthreadInit
(
&
attr1
,
MQUEUE_PTHREAD_PRIORITY_TEST1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
...
...
@@ -121,10 +121,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
4
,
g_testCount
,
EXIT2
);
// 4, Here, assert the g_testCount.
ret
=
PosixPthreadDestroy
(
&
attr1
,
newTh2
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ret
=
PosixPthreadDestroy
(
&
attr1
,
newTh1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
return
MQUEUE_NO_ERROR
;
...
...
@@ -136,10 +136,10 @@ EXIT:
mq_close
(
g_gqueue
);
mq_unlink
(
g_gqname
);
EXIT3:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue040
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue040
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_040"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_041.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -68,10 +68,10 @@ static VOID *PthreadF02(VOID *argument)
TestExtraTaskDelay
(
2
);
// 2, Set delay time.
ret
=
mq_close
(
g_gqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
g_gqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
g_testCount
=
4
;
// 4, Init test count value.
...
...
@@ -80,6 +80,7 @@ EXIT1:
mq_close
(
g_gqueue
);
EXIT:
mq_unlink
(
g_gqname
);
EXIT2:
g_testCount
=
0
;
return
NULL
;
}
...
...
@@ -87,7 +88,7 @@ EXIT:
static
UINT32
Testcase
(
VOID
)
{
UINT32
ret
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
pthread_attr_t
attr1
;
pthread_t
newTh1
,
newTh2
;
...
...
@@ -98,7 +99,7 @@ static UINT32 Testcase(VOID)
attr
.
mq_msgsize
=
MQUEUE_STANDARD_NAME_LENGTH
;
attr
.
mq_maxmsg
=
5
;
// 5, queue max message size.
g_gqueue
=
mq_open
(
g_gqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
g_gqueue
,
(
mqd_t
)
-
1
,
g_gqueue
,
EXIT
);
ICUNIT_GOTO_NOT_EQUAL
(
g_gqueue
,
(
mqd_t
)
-
1
,
g_gqueue
,
EXIT
3
);
g_testCount
=
0
;
...
...
@@ -123,10 +124,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
g_testCount
,
4
,
g_testCount
,
EXIT2
);
// 4, Here, assert the g_testCount.
ret
=
PosixPthreadDestroy
(
&
attr1
,
newTh2
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ret
=
PosixPthreadDestroy
(
&
attr1
,
newTh1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
return
MQUEUE_NO_ERROR
;
...
...
@@ -138,10 +139,10 @@ EXIT:
mq_close
(
g_gqueue
);
mq_unlink
(
g_gqname
);
EXIT3:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue041
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue041
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_041"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_042.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -32,12 +32,13 @@
static
UINT32
Testcase
(
VOID
)
{
INT32
ret
,
i
=
0
;
INT32
ret
;
INT32
i
=
0
;
CHAR
mqname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
CHAR
msgptr
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
mqd_t
mqueue
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
ret
=
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
"/mq042_%d"
,
LosCurTaskIDGet
());
...
...
@@ -47,7 +48,7 @@ static UINT32 Testcase(VOID)
attr
.
mq_maxmsg
=
MQUEUE_SHORT_ARRAY_LENGTH
;
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
|
O_NONBLOCK
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
while
(
1
)
{
ret
=
snprintf_s
(
msgptr
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
"message %d"
,
i
);
...
...
@@ -71,10 +72,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -82,10 +83,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue042
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue042
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_042"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_043.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -37,7 +37,7 @@ static UINT32 Testcase(VOID)
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
mqd_t
mqueue
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
ret
=
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
"/mq043_%d"
,
LosCurTaskIDGet
());
...
...
@@ -59,10 +59,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -70,7 +70,7 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
/* *
...
...
@@ -94,7 +94,7 @@ EXIT2:
*-@tauto TRUE
*-@tremark
*/
VOID
ItPosixQueue043
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue043
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_043"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_044.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -32,12 +32,12 @@
static
UINT32
Testcase
(
VOID
)
{
INT32
ret
=
0
;
INT32
ret
;
CHAR
mqname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
mqd_t
mqueue
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
ret
=
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
"/mq044_%d"
,
LosCurTaskIDGet
());
...
...
@@ -46,7 +46,7 @@ static UINT32 Testcase(VOID)
attr
.
mq_msgsize
=
MQUEUE_STANDARD_NAME_LENGTH
;
attr
.
mq_maxmsg
=
MQUEUE_SHORT_ARRAY_LENGTH
;
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
|
O_NONBLOCK
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_send
((
mqd_t
)(
&
mqueue
+
1
),
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT1
);
...
...
@@ -60,10 +60,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -71,10 +71,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue044
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue044
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_044"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_046.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -35,7 +35,7 @@ static UINT32 Testcase(VOID)
CHAR
qname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
""
;
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
mqd_t
queue
;
INT32
unresolved
=
0
,
failure
=
0
,
ret
=
0
;
INT32
ret
;
ret
=
snprintf_s
(
qname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
\
"/mq046-1_%d"
,
LosCurTaskIDGet
());
...
...
@@ -49,10 +49,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
errno
,
EBADF
,
errno
,
EXIT2
);
ret
=
mq_close
(
queue
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
2
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
1
);
ret
=
mq_unlink
(
qname
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
return
MQUEUE_NO_ERROR
;
EXIT2:
...
...
@@ -60,10 +60,10 @@ EXIT2:
EXIT1:
mq_unlink
(
qname
);
EXIT:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue046
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue046
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_046"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_047.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -32,9 +32,9 @@
static
UINT32
Testcase
(
VOID
)
{
INT32
ret
=
0
;
INT32
ret
;
CHAR
mqname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
""
;
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
*
2
];
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
*
2
];
// 2: mqueue message length
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
mqd_t
mqueue
;
...
...
@@ -43,7 +43,7 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_NOT_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT2
);
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDONLY
|
O_NONBLOCK
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_send
(
mqueue
,
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT1
);
...
...
@@ -58,10 +58,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
errno
,
EAGAIN
,
errno
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -69,10 +69,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue047
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue047
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_047"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/full/It_posix_queue_048.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -32,13 +32,13 @@
static
UINT32
Testcase
(
VOID
)
{
INT32
ret
=
0
;
INT32
ret
;
CHAR
mqname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
CHAR
msgrv
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
const
CHAR
*
msgptr
=
"test message"
;
mqd_t
mqueue
;
struct
timespec
ts
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
ret
=
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
\
"/mq048_%d"
,
LosCurTaskIDGet
());
...
...
@@ -47,7 +47,7 @@ static UINT32 Testcase(VOID)
attr
.
mq_msgsize
=
MQUEUE_STANDARD_NAME_LENGTH
;
attr
.
mq_maxmsg
=
MQUEUE_STANDARD_NAME_LENGTH
;
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_send
(
mqueue
,
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
...
...
@@ -59,10 +59,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
errno
,
EINVAL
,
errno
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
...
...
@@ -70,10 +70,10 @@ EXIT1:
EXIT:
mq_unlink
(
mqname
);
EXIT2:
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue048
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue048
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_048"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL2
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/smoke/It_posix_queue_001.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -37,14 +37,14 @@ static UINT32 Testcase(VOID)
CHAR
mqname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
""
;
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
mqd_t
mqueue
;
attr
.
mq_msgsize
=
MQUEUE_STANDARD_NAME_LENGTH
;
attr
.
mq_maxmsg
=
0
;
(
void
)
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
MQUEUE_STANDARD_NAME_LENGTH
,
"/mq001_%d"
,
LosCurTaskIDGet
());
LosCurTaskIDGet
());
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT1
);
...
...
@@ -60,10 +60,10 @@ EXIT1:
mq_close
(
mqueue
);
EXIT:
mq_unlink
(
mqname
);
return
MQUEUE_
NO
_ERROR
;
return
MQUEUE_
IS
_ERROR
;
}
VOID
ItPosixQueue001
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue001
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_001"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL0
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/smoke/It_posix_queue_003.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -37,16 +37,16 @@ static UINT32 Testcase(VOID)
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
const
CHAR
*
msgptr
=
MQUEUE_SEND_STRING_TEST
;
mqd_t
mqueue
;
struct
mq_attr
attr
=
{
0
};
struct
mq_attr
attr
=
{
0
};
attr
.
mq_msgsize
=
MQUEUE_STANDARD_NAME_LENGTH
;
attr
.
mq_maxmsg
=
1
;
(
void
)
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
MQUEUE_STANDARD_NAME_LENGTH
,
"/mq003_%d"
,
LosCurTaskIDGet
());
LosCurTaskIDGet
());
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_send
(
mqueue
,
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
...
...
@@ -59,19 +59,21 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT:
mq_close
(
mqueue
);
EXIT1:
mq_unlink
(
mqname
);
return
MQUEUE_NO_ERROR
;
EXIT2:
return
MQUEUE_IS_ERROR
;
}
VOID
ItPosixQueue003
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue003
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_003"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL0
,
TEST_FUNCTION
);
}
testsuites/unittest/libc/posix/mqueue/smoke/It_posix_queue_028.cpp
浏览文件 @
0b141e05
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
1
Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-202
3
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:
...
...
@@ -30,54 +30,58 @@
*/
#include "It_posix_queue.h"
const
int
queue_msg_size
=
20
;
const
int
queue_max_msg_size
=
20
;
static
UINT32
Testcase
(
VOID
)
{
INT32
ret
;
CHAR
mqname
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
""
;
CHAR
msgrcd
[
20
]
=
{
0
};
struct
mq_attr
attr
=
{
0
};
struct
timespec
absTimeout
=
{
0
};
CHAR
msgrcd
[
queue_max_msg_size
]
=
{
0
};
struct
mq_attr
attr
=
{
0
};
struct
timespec
absTimeout
=
{
0
};
mqd_t
mqueue
;
(
void
)
snprintf_s
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
-
1
,
MQUEUE_STANDARD_NAME_LENGTH
,
"/mq028_%d"
,
LosCurTaskIDGet
());
attr
.
mq_msgsize
=
20
;
// 20, queue message size.
attr
.
mq_maxmsg
=
20
;
// 20, queue max message size.
attr
.
mq_msgsize
=
queue_msg_size
;
attr
.
mq_maxmsg
=
queue_max_msg_size
;
mqueue
=
mq_open
(
mqname
,
O_CREAT
|
O_RDWR
|
O_EXCL
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_ASSERT_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
);
ret
=
mq_timedsend
(
mqueue
,
"1234567890123456789"
,
20
,
0
,
&
absTimeout
);
// 20, mqueue message length.
ret
=
mq_timedsend
(
mqueue
,
"1234567890123456789"
,
queue_msg_size
,
0
,
&
absTimeout
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
ret
=
mq_receive
(
mqueue
,
msgrcd
,
20
,
NULL
);
// 20, mqueue message length.
ICUNIT_GOTO_EQUAL
(
ret
,
20
,
ret
,
EXIT1
);
// 20, Here, assert the ret.
ret
=
mq_receive
(
mqueue
,
msgrcd
,
queue_msg_size
,
NULL
);
ICUNIT_GOTO_EQUAL
(
ret
,
queue_msg_size
,
ret
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
mqueue
=
mq_open
(
mqname
,
O_RDWR
|
O_NONBLOCK
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
1
);
ICUNIT_GOTO_NOT_EQUAL
(
mqueue
,
(
mqd_t
)
-
1
,
mqueue
,
EXIT
2
);
ret
=
mq_receive
(
mqueue
,
msgrcd
,
20
,
NULL
);
// 20, mqueue message length.
ret
=
mq_receive
(
mqueue
,
msgrcd
,
queue_msg_size
,
NULL
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_IS_ERROR
,
ret
,
EXIT1
);
ret
=
mq_close
(
mqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
1
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ret
=
mq_unlink
(
mqname
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
2
);
return
MQUEUE_NO_ERROR
;
EXIT1:
mq_close
(
mqueue
);
EXIT:
mq_unlink
(
mqname
);
return
MQUEUE_NO_ERROR
;
EXIT2:
return
MQUEUE_IS_ERROR
;
}
VOID
ItPosixQueue028
(
VOID
)
// IT_Layer_ModuleORFeature_No
VOID
ItPosixQueue028
(
VOID
)
{
TEST_ADD_CASE
(
"IT_POSIX_QUEUE_028"
,
Testcase
,
TEST_POSIX
,
TEST_QUE
,
TEST_LEVEL0
,
TEST_FUNCTION
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录