Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
1be8f2fa
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
接近 2 年 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
1be8f2fa
编写于
12月 13, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 13, 2022
浏览文件
操作
浏览文件
下载
差异文件
!744 Fix malloc_usable_size and fatal_message tests
Merge pull request !744 from sosnin-vladimir/cherry-pick-1670913841
上级
b3d7ccfa
565d3612
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
17 deletion
+33
-17
libc-test/src/functionalext/common/functionalext.h
libc-test/src/functionalext/common/functionalext.h
+10
-3
libc-test/src/functionalext/info/fatal_message.c
libc-test/src/functionalext/info/fatal_message.c
+21
-12
libc-test/src/functionalext/supplement/malloc/malloc_usable_size.c
.../src/functionalext/supplement/malloc/malloc_usable_size.c
+2
-2
未找到文件。
libc-test/src/functionalext/common/functionalext.h
浏览文件 @
1be8f2fa
...
...
@@ -122,10 +122,17 @@
t_error("[%s] failed %lld != %lld \n", fun, a, b); \
} while (0)
#define EXPECT_GT(fun, a, b) \
#define EXPECT_GT(fun, a, b) \
do { \
if ((a) <= (b)) { \
t_error("[%s] failed %d <= %d \n", fun, a, b); \
} \
} while (0)
#define EXPECT_GTE(fun, a, b) \
do { \
if ((a) <
= (b)) {
\
t_error("[%s] failed %d
>
%d \n", fun, a, b); \
if ((a) <
(b)) {
\
t_error("[%s] failed %d
<
%d \n", fun, a, b); \
} \
} while (0)
...
...
libc-test/src/functionalext/info/fatal_message.c
浏览文件 @
1be8f2fa
...
...
@@ -22,6 +22,7 @@
#include <test.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/wait.h>
#define EXPECT_TRUE(c) \
do \
...
...
@@ -29,13 +30,6 @@
if (!(c)) \
t_error("[%s] failed\n"); \
} while (0)
// val1 == val2
#define EXPECT_EQ(a, b) \
do \
{ \
if ((a) != (b)) \
t_error("failed %d != %d \n", a, b); \
} while (0)
typedef
void
(
*
TEST_FUN
)(
void
);
static
const
int
WAIT_TIME
=
1
;
...
...
@@ -61,6 +55,7 @@ static void fatal_message_0020(void)
const
char
msg
[
1024
]
=
{
"abcdefghijklmnopqrstuvwxyz1234567890"
};
fatal_msg_t
*
fatal_message
=
NULL
;
int
childRet
=
0
;
int
pidParent
=
0
;
int
pidChild
=
0
;
...
...
@@ -73,8 +68,10 @@ static void fatal_message_0020(void)
set_fatal_message
(
msg
);
fatal_message
=
get_fatal_message
();
EXPECT_TRUE
(
strcmp
(
fatal_message
->
msg
,
msg
)
==
0
);
exit
(
pidChild
);
exit
(
0
);
}
waitpid
(
fpid
,
&
childRet
,
0
);
EXPECT_TRUE
(
childRet
==
0
);
}
/**
...
...
@@ -89,6 +86,7 @@ static void fatal_message_0030(void)
const
char
msgChild
[
1024
]
=
{
"msgChild"
};
const
char
msgParent
[
1024
]
=
{
"msgParent"
};
int
childRet
=
0
;
int
pidChild
=
0
;
int
pidParent
=
0
;
int
pidCParent
=
0
;
...
...
@@ -115,13 +113,14 @@ static void fatal_message_0030(void)
set_fatal_message
(
msgParent
);
fatal_message
=
get_fatal_message
();
EXPECT_TRUE
(
strcmp
(
fatal_message
->
msg
,
msgParent
)
==
0
);
exit
(
pidCChild
);
exit
(
0
);
}
else
{
pidCParent
=
getpid
();
set_fatal_message
(
msgChild
);
fatal_message
=
get_fatal_message
();
EXPECT_TRUE
(
strcmp
(
fatal_message
->
msg
,
msgChild
)
==
0
);
exit
(
pidCParent
);
waitpid
(
fpidChild
,
&
childRet
,
0
);
EXPECT_TRUE
(
childRet
==
0
);
}
}
}
...
...
@@ -139,6 +138,7 @@ static void fatal_message_0040(void)
const
char
msgChild
[
1024
]
=
{
"msgChild004"
};
const
char
msgParent
[
1024
]
=
{
"msgParent004"
};
int
childRet
=
0
;
int
pidChild
=
0
;
int
pidParent
=
0
;
int
pidCParent
=
0
;
...
...
@@ -170,7 +170,8 @@ static void fatal_message_0040(void)
set_fatal_message
(
msgParent
);
fatal_message
=
get_fatal_message
();
EXPECT_TRUE
(
strcmp
(
fatal_message
->
msg
,
msgParent
)
==
0
);
exit
(
pidCParent
);
waitpid
(
fpidChild
,
&
childRet
,
0
);
EXPECT_TRUE
(
childRet
!=
0
);
}
}
}
...
...
@@ -231,9 +232,17 @@ TEST_FUN G_Fun_Array[] = {
int
main
(
void
)
{
int
childPid
,
childRet
;
int
num
=
sizeof
(
G_Fun_Array
)
/
sizeof
(
TEST_FUN
);
for
(
int
pos
=
0
;
pos
<
num
;
++
pos
)
{
G_Fun_Array
[
pos
]();
// Run each function in a new process to
// keep the initial state of fatal_message.
if
((
childPid
=
fork
())
==
0
)
{
G_Fun_Array
[
pos
]();
exit
(
0
);
}
waitpid
(
childPid
,
&
childRet
,
0
);
EXPECT_TRUE
(
childRet
==
0
);
}
return
t_status
;
...
...
libc-test/src/functionalext/supplement/malloc/malloc_usable_size.c
浏览文件 @
1be8f2fa
...
...
@@ -33,9 +33,9 @@ void malloc_usable_size_0100(void)
}
size_t
ret
=
malloc_usable_size
(
p
);
#ifdef _ARM64_
EXPECT_
EQ
(
"malloc_usable_size_0100"
,
ret
,
TEST_MALLOC_SIZE
+
TEST_MALLOC_PLACEHOLDER64_SIZE
);
EXPECT_
GTE
(
"malloc_usable_size_0100"
,
ret
,
TEST_MALLOC_SIZE
+
TEST_MALLOC_PLACEHOLDER64_SIZE
);
#else
EXPECT_
EQ
(
"malloc_usable_size_0100"
,
ret
,
TEST_MALLOC_SIZE
+
TEST_MALLOC_PLACEHOLDER_SIZE
);
EXPECT_
GTE
(
"malloc_usable_size_0100"
,
ret
,
TEST_MALLOC_SIZE
+
TEST_MALLOC_PLACEHOLDER_SIZE
);
#endif
free
(
p
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录