提交 36c724e1 编写于 作者: D dhy308

fix review problems

Signed-off-by: Ndhy308 <tony.gan@huawei.com>
上级 75710600
......@@ -26,7 +26,7 @@ int main(int argc, char **argv)
char set_thread_name[] = "THREADFOO";
char default_name[] = "pthread_getname";
rc = pthread_getname_np(pthread_self(), thread_name, 0);
rc = pthread_getname_np(pthread_self(), thread_name, NAMELEN-1);
if (rc != ERANGE) errExitEN(rc, "pthread_getname_np(invalid args[len]) failed");
rc = pthread_getname_np(pthread_self(), thread_name, NAMELEN);
......
......@@ -75,7 +75,7 @@ static void poll_0020(void)
/**
* @tc.name : poll_0030
* @tc.desc : test poll with two fds and param count is 1
* @tc.desc : test poll with buf's size greater than fd_count, return fd_count
* @tc.level : Level 1
*/
static void poll_0030(void)
......@@ -143,7 +143,7 @@ static void ppoll_0020(void)
/**
* @tc.name : ppoll_0030
* @tc.desc : test ppoll with two fds and param count is 1
* @tc.desc : test poll with buf's size greater than fd_count, return fd_count
* @tc.level : Level 1
*/
static void ppoll_0030(void)
......
......@@ -232,7 +232,6 @@ static void fatal_message_0060(void)
const char* msg = NULL;
fatal_msg_t *fatal_message = NULL;
int pidParent = 0;
int pidChild = 0;
pid_t fpid;
......
......@@ -24,7 +24,7 @@ typedef void (*TEST_FUN)(void);
/**
* @tc.name : sched_setparam
* @tc.desc : Test the function of sched_setparam.
* @tc.desc : When param is NULL, call sched_setparam.
* @tc.level : Level 2
*/
static void sched_setparam_0010(void)
......
......@@ -51,7 +51,7 @@ void clone_0200(void)
int cpid = -1;
cpid = clone((int (*)(void *))test, (char *)stack + STACK_SIZE, 0, NULL);
sleep(1);
EXPECT_NE("clone_0100", cpid, -1);
EXPECT_NE("clone_0200", cpid, -1);
}
int main(int argc, char *argv[])
......
......@@ -37,6 +37,12 @@ void getspnam_r_0100(void)
if (result != 0) {
t_error("%s getgrnam_r failed\n", __func__);
}
if (!spwd) {
t_error("%s failed, spwd is NULL\n", __func__);
}
if (strcmp(spwd_name, spwd->sp_namp)) {
t_error("%s spwd->sp_namp is %s\n", __func__, spwd->sp_namp);
}
}
int main(int argc, char *argv[])
......
......@@ -146,38 +146,11 @@ ohos_executable("unittest_hilog_vsnprint") {
libs = [ "${musl_lib_dir}/libc.a" ]
}
ohos_executable("unittest_hook_preinit") {
subsystem_name = "musl"
part_name = "libc-test"
sources = [ "unit_test_hook_preinit.c" ]
include_dirs = [
"${musl_src_base}/src/hook",
"//${test_dir}/src/common",
"//${test_dir}/src/functionalext/common",
"${musl_src_base}/src/include",
"${musl_src_base}/include",
"${musl_src_base}/src/internal",
]
configs = [ "//third_party/musl/libc-test/src/common:config_unittest" ]
deps = [ "//third_party/musl:create_porting_src" ]
if (musl_unit_test_flag) {
defines = [ "UNIT_TEST_STATIC" ]
}
libs = [ "${musl_lib_dir}/libc.a" ]
}
group("functionalext_unittest_test") {
testonly = true
deps = [
":unittest_hilog_adapter",
":unittest_hilog_vsnprint",
":unittest_hook_preinit",
":unittest_ldso_dynlink",
":unittest_ldso_ld_log",
":unittest_ldso_namesapce",
......
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "test.h"
#include "functionalext.h"
typedef void (*TEST_FUN)(void);
#ifdef UNIT_TEST_STATIC
enum EnumHookMode;
int parse_hook_variable(enum EnumHookMode* mode, char* path, int size);
/**
* @tc.name : preinit_test_0010
* @tc.desc : test
* @tc.level : Level 2
*/
static void preinit_test_0010(void)
{
int ret = parse_hook_variable(NULL, NULL, 0);
EXPECT_EQ(preinit_test_0010, ret, -1);
}
bool get_proc_name(pid_t pid, char *buf, unsigned int buf_len);
/**
* @tc.name : preinit_test_0020
* @tc.desc : test
* @tc.level : Level 2
*/
static void preinit_test_0020(void)
{
int ret = get_proc_name(0, NULL, 0);
EXPECT_EQ(preinit_test_0020, ret, false);
}
void clear_function_table();
/**
* @tc.name : preinit_test_0030
* @tc.desc : test
* @tc.level : Level 2
*/
static void preinit_test_0030(void)
{
clear_function_table();
EXPECT_TRUE(preinit_test_0030, true);
}
void get_memleak_hook_param();
/**
* @tc.name : preinit_test_0040
* @tc.desc : test
* @tc.level : Level 2
*/
static void preinit_test_0040(void)
{
get_memleak_hook_param();
EXPECT_TRUE(preinit_test_0040, true);
}
void __restore_hook_function_table();
/**
* @tc.name : preinit_test_0050
* @tc.desc : test
* @tc.level : Level 2
*/
static void preinit_test_0050(void)
{
__restore_hook_function_table();
EXPECT_TRUE(preinit_test_0050, true);
}
void __install_malloc_hook();
/**
* @tc.name : preinit_test_0060
* @tc.desc : test
* @tc.level : Level 2
*/
static void preinit_test_0060(void)
{
__install_malloc_hook();
EXPECT_TRUE(preinit_test_0060, true);
}
#endif
TEST_FUN G_Fun_Array[] = {
#ifdef UNIT_TEST_STATIC
preinit_test_0010,
preinit_test_0020,
preinit_test_0030,
preinit_test_0040,
preinit_test_0050,
preinit_test_0060,
#endif
};
int main(void)
{
int num = sizeof(G_Fun_Array) / sizeof(TEST_FUN);
for (int pos = 0; pos < num; ++pos) {
G_Fun_Array[pos]();
}
return t_status;
}
\ No newline at end of file
......@@ -22,7 +22,7 @@ typedef void (*TEST_FUN)(void);
/**
* @tc.name : dynlink_test_0010
* @tc.desc : dlns_set_namespace_lib_path test
* @tc.desc : Test dlns_set_namespace_lib_path with invalid input
* @tc.level : Level 2
*/
static void dynlink_test_0010(void)
......@@ -33,7 +33,7 @@ static void dynlink_test_0010(void)
/**
* @tc.name : dynlink_test_0020
* @tc.desc : dlns_set_namespace_lib_path test
* @tc.desc : Test dlns_set_namespace_lib_path with invalid input
* @tc.level : Level 2
*/
static void dynlink_test_0020(void)
......@@ -44,7 +44,7 @@ static void dynlink_test_0020(void)
/**
* @tc.name : dynlink_test_0030
* @tc.desc : dlns_set_namespace_lib_path test
* @tc.desc : Set path for default lib use dlns_set_namespace_lib_path
* @tc.level : Level 1
*/
static void dynlink_test_0030(void)
......@@ -55,7 +55,7 @@ static void dynlink_test_0030(void)
/**
* @tc.name : dynlink_test_0040
* @tc.desc : dlns_set_namespace_separated test
* @tc.desc : Test dlns_set_namespace_separated with invalid input
* @tc.level : Level 2
*/
static void dynlink_test_0040(void)
......@@ -66,7 +66,7 @@ static void dynlink_test_0040(void)
/**
* @tc.name : dynlink_test_0050
* @tc.desc : dlns_set_namespace_separated test
* @tc.desc : Test dlns_set_namespace_separated with invalid input
* @tc.level : Level 2
*/
static void dynlink_test_0050(void)
......@@ -77,7 +77,7 @@ static void dynlink_test_0050(void)
/**
* @tc.name : dynlink_test_0060
* @tc.desc : dlns_set_namespace_separated test
* @tc.desc : Set separated for default lib use dlns_set_namespace_separated
* @tc.level : Level 0
*/
static void dynlink_test_0060(void)
......@@ -88,7 +88,7 @@ static void dynlink_test_0060(void)
/**
* @tc.name : dynlink_test_0070
* @tc.desc : dlns_set_namespace_permitted_paths test
* @tc.desc : Test dlns_set_namespace_permitted_paths with invalid input
* @tc.level : Level 2
*/
static void dynlink_test_0070(void)
......@@ -99,7 +99,7 @@ static void dynlink_test_0070(void)
/**
* @tc.name : dynlink_test_0080
* @tc.desc : dlns_set_namespace_permitted_paths test
* @tc.desc : Test dlns_set_namespace_permitted_paths with invalid input
* @tc.level : Level 2
*/
static void dynlink_test_0080(void)
......@@ -110,7 +110,7 @@ static void dynlink_test_0080(void)
/**
* @tc.name : dynlink_test_0090
* @tc.desc : dlns_set_namespace_permitted_paths test
* @tc.desc : Set path for default lib use dlns_set_namespace_permitted_paths
* @tc.level : Level 0
*/
static void dynlink_test_0090(void)
......@@ -121,7 +121,7 @@ static void dynlink_test_0090(void)
/**
* @tc.name : dynlink_test_0100
* @tc.desc : dlns_set_namespace_allowed_libs test
* @tc.desc : Test dlns_set_namespace_allowed_libs with invalid input
* @tc.level : Level 2
*/
static void dynlink_test_0100(void)
......@@ -132,7 +132,7 @@ static void dynlink_test_0100(void)
/**
* @tc.name : dynlink_test_0110
* @tc.desc : dlns_set_namespace_allowed_libs test
* @tc.desc : Test dlns_set_namespace_allowed_libs with invalid input
* @tc.level : Level 2
*/
static void dynlink_test_0110(void)
......@@ -143,7 +143,7 @@ static void dynlink_test_0110(void)
/**
* @tc.name : dynlink_test_0120
* @tc.desc : dlns_set_namespace_allowed_libs test
* @tc.desc : Set allowed libs for default lib use dlns_set_namespace_allowed_libs
* @tc.level : Level 0
*/
static void dynlink_test_0120(void)
......
......@@ -19,8 +19,8 @@
typedef void (*TEST_FUN)(void);
/**
* @tc.name : strops_test_0010
* @tc.desc : strlwc test args null
* @tc.name : ld_log_test_0010
* @tc.desc : test ld_log_reset normal condition.
* @tc.level : Level 0
*/
static void ld_log_test_0010(void)
......
......@@ -35,7 +35,7 @@ static void namespace_test_0010(void)
/**
* @tc.name : namespace_test_0020
* @tc.desc : ns_free test
* @tc.desc : ns_free test normal condition
* @tc.level : Level 0
*/
static void namespace_test_0020(void)
......@@ -64,7 +64,7 @@ static void namespace_test_0020(void)
/**
* @tc.name : namespace_test_0030
* @tc.desc : ns_free test
* @tc.desc : ns_free test arg ns's memebers are NULL
* @tc.level : Level 2
*/
static void namespace_test_0030(void)
......@@ -86,7 +86,7 @@ static void namespace_test_0030(void)
/**
* @tc.name : namespace_test_0040
* @tc.desc : ns_add_dso test
* @tc.desc : ns_add_dso test args are NULL
* @tc.level : Level 2
*/
static void namespace_test_0040(void)
......@@ -97,7 +97,7 @@ static void namespace_test_0040(void)
/**
* @tc.name : namespace_test_0050
* @tc.desc : ns_add_dso test
* @tc.desc : ns_add_dso test arg dso is NULL
* @tc.level : Level 2
*/
static void namespace_test_0050(void)
......@@ -109,7 +109,7 @@ static void namespace_test_0050(void)
/**
* @tc.name : namespace_test_0060
* @tc.desc : ns_add_dso test
* @tc.desc : ns_add_dso test arg ns is NULL
* @tc.level : Level 2
*/
static void namespace_test_0060(void)
......@@ -121,7 +121,7 @@ static void namespace_test_0060(void)
/**
* @tc.name : namespace_test_0070
* @tc.desc : ns_add_dso test
* @tc.desc : ns_add_dso test normal condition
* @tc.level : Level 1
*/
static void namespace_test_0070(void)
......@@ -138,7 +138,7 @@ static void namespace_test_0070(void)
/**
* @tc.name : namespace_test_0080
* @tc.desc : nslist_add_ns test
* @tc.desc : nslist_add_ns test many times
* @tc.level : Level 1
*/
static void namespace_test_0080(void)
......@@ -166,7 +166,7 @@ static void namespace_test_0080(void)
/**
* @tc.name : namespace_test_0090
* @tc.desc : nslist_add_ns test
* @tc.desc : nslist_add_ns test arg is NULL
* @tc.level : Level 2
*/
static void namespace_test_0090(void)
......@@ -177,7 +177,7 @@ static void namespace_test_0090(void)
/**
* @tc.name : namespace_test_0100
* @tc.desc : ns_set_name test
* @tc.desc : ns_set_name test args are NULL
* @tc.level : Level 2
*/
static void namespace_test_0100(void)
......@@ -188,7 +188,7 @@ static void namespace_test_0100(void)
/**
* @tc.name : namespace_test_0110
* @tc.desc : ns_set_name test
* @tc.desc : ns_set_name test arg name is NULL
* @tc.level : Level 2
*/
static void namespace_test_0110(void)
......@@ -200,7 +200,7 @@ static void namespace_test_0110(void)
/**
* @tc.name : namespace_test_0120
* @tc.desc : ns_set_name test
* @tc.desc : ns_set_name test arg ns is NULL
* @tc.level : Level 2
*/
static void namespace_test_0120(void)
......@@ -211,7 +211,7 @@ static void namespace_test_0120(void)
/**
* @tc.name : namespace_test_0130
* @tc.desc : ns_set_env_paths test
* @tc.desc : ns_set_env_paths test arg ns is NULL
* @tc.level : Level 2
*/
static void namespace_test_0130(void)
......@@ -222,7 +222,7 @@ static void namespace_test_0130(void)
/**
* @tc.name : namespace_test_0140
* @tc.desc : ns_set_env_paths test
* @tc.desc : ns_set_env_paths test arg ns.env_paths is NULL
* @tc.level : Level 1
*/
static void namespace_test_0140(void)
......@@ -235,7 +235,7 @@ static void namespace_test_0140(void)
/**
* @tc.name : namespace_test_0150
* @tc.desc : ns_set_env_paths test
* @tc.desc : ns_set_env_paths test arg ns.env_paths is equal to arg name
* @tc.level : Level 1
*/
static void namespace_test_0150(void)
......@@ -248,7 +248,7 @@ static void namespace_test_0150(void)
/**
* @tc.name : namespace_test_0160
* @tc.desc : ns_set_env_paths test
* @tc.desc : ns_set_env_paths test arg name is NULL and ns.env_paths is NULL
* @tc.level : Level 2
*/
static void namespace_test_0160(void)
......@@ -261,7 +261,7 @@ static void namespace_test_0160(void)
/**
* @tc.name : namespace_test_0170
* @tc.desc : ns_set_env_paths test
* @tc.desc : ns_set_env_paths test arg name is NULL and ns.env_paths is not NULL
* @tc.level : Level 2
*/
static void namespace_test_0170(void)
......@@ -274,7 +274,7 @@ static void namespace_test_0170(void)
/**
* @tc.name : namespace_test_0180
* @tc.desc : ns_set_asan_lib_paths test
* @tc.desc : ns_set_asan_lib_paths test arg ns is NULL
* @tc.level : Level 2
*/
static void namespace_test_0180(void)
......@@ -285,7 +285,7 @@ static void namespace_test_0180(void)
/**
* @tc.name : namespace_test_0190
* @tc.desc : ns_set_asan_lib_paths test
* @tc.desc : ns_set_asan_lib_paths test arg ns.asan_lib_paths is NULL
* @tc.level : Level 1
*/
static void namespace_test_0190(void)
......@@ -298,7 +298,7 @@ static void namespace_test_0190(void)
/**
* @tc.name : namespace_test_0200
* @tc.desc : ns_set_asan_lib_paths test
* @tc.desc : ns_set_asan_lib_paths test arg ns.asan_lib_paths is equal to arg name
* @tc.level : Level 1
*/
static void namespace_test_0200(void)
......@@ -311,7 +311,7 @@ static void namespace_test_0200(void)
/**
* @tc.name : namespace_test_0210
* @tc.desc : ns_set_asan_lib_paths test
* @tc.desc : ns_set_asan_lib_paths test arg name is NULL and ns.asan_lib_paths is NULL
* @tc.level : Level 2
*/
static void namespace_test_0210(void)
......@@ -324,7 +324,7 @@ static void namespace_test_0210(void)
/**
* @tc.name : namespace_test_0220
* @tc.desc : ns_set_asan_lib_paths test
* @tc.desc : ns_set_asan_lib_paths test arg name is NULL and ns.asan_lib_paths is not NULL
* @tc.level : Level 1
*/
static void namespace_test_0220(void)
......@@ -337,7 +337,7 @@ static void namespace_test_0220(void)
/**
* @tc.name : namespace_test_0230
* @tc.desc : ns_set_permitted_paths test
* @tc.desc : ns_set_permitted_paths test arg permitted_paths is NULL and ns.permitted_paths is not NULL
* @tc.level : Level 1
*/
static void namespace_test_0230(void)
......@@ -351,7 +351,7 @@ static void namespace_test_0230(void)
/**
* @tc.name : namespace_test_0240
* @tc.desc : ns_set_permitted_paths test
* @tc.desc : ns_set_permitted_paths test args are NULL
* @tc.level : Level 2
*/
static void namespace_test_0240(void)
......@@ -362,7 +362,7 @@ static void namespace_test_0240(void)
/**
* @tc.name : namespace_test_0250
* @tc.desc : ns_set_permitted_paths test
* @tc.desc : ns_set_permitted_paths test arg permitted_paths is NULL and ns.permitted_paths is NULL
* @tc.level : Level 2
*/
static void namespace_test_0250(void)
......@@ -375,7 +375,7 @@ static void namespace_test_0250(void)
/**
* @tc.name : namespace_test_0260
* @tc.desc : ns_set_asan_permitted_paths test
* @tc.desc : ns_set_asan_permitted_paths test arg asan_permitted_paths is NULL and ns.asan_permitted_paths is not NULL
* @tc.level : Level 1
*/
static void namespace_test_0260(void)
......@@ -389,7 +389,7 @@ static void namespace_test_0260(void)
/**
* @tc.name : namespace_test_0270
* @tc.desc : ns_set_asan_permitted_paths test
* @tc.desc : ns_set_asan_permitted_paths test args are NULL
* @tc.level : Level 2
*/
static void namespace_test_0270(void)
......@@ -400,7 +400,7 @@ static void namespace_test_0270(void)
/**
* @tc.name : namespace_test_0280
* @tc.desc : ns_set_asan_permitted_paths test
* @tc.desc : ns_set_asan_permitted_paths test arg asan_permitted_paths is NULL and ns.asan_permitted_paths is NULL
* @tc.level : Level 1
*/
static void namespace_test_0280(void)
......@@ -413,7 +413,7 @@ static void namespace_test_0280(void)
/**
* @tc.name : namespace_test_0290
* @tc.desc : ns_set_separated test
* @tc.desc : ns_set_separated test arg ns is NULL and separated is false
* @tc.level : Level 2
*/
static void namespace_test_0290(void)
......@@ -424,7 +424,7 @@ static void namespace_test_0290(void)
/**
* @tc.name : namespace_test_0300
* @tc.desc : ns_set_allowed_libs test
* @tc.desc : ns_set_allowed_libs test arg ns is NULL
* @tc.level : Level 2
*/
static void namespace_test_0300(void)
......@@ -435,7 +435,7 @@ static void namespace_test_0300(void)
/**
* @tc.name : namespace_test_0310
* @tc.desc : ns_set_allowed_libs test
* @tc.desc : ns_set_allowed_libs test arg ns is ns.allowed_libs NULL
* @tc.level : Level 1
*/
static void namespace_test_0310(void)
......@@ -448,7 +448,7 @@ static void namespace_test_0310(void)
/**
* @tc.name : namespace_test_0320
* @tc.desc : ns_set_allowed_libs test
* @tc.desc : ns_set_allowed_libs test normal condition
* @tc.level : Level 0
*/
static void namespace_test_0320(void)
......@@ -462,7 +462,7 @@ static void namespace_test_0320(void)
/**
* @tc.name : namespace_test_0330
* @tc.desc : ns_set_allowed_libs test
* @tc.desc : ns_set_allowed_libs test allowed_libs is NULL and ns.allowed_libs is NULL
* @tc.level : Level 1
*/
static void namespace_test_0330(void)
......@@ -475,7 +475,7 @@ static void namespace_test_0330(void)
/**
* @tc.name : namespace_test_0400
* @tc.desc : ns_set_allowed_libs test
* @tc.desc : ns_set_allowed_libs test allowed_libs is NULL and ns.allowed_libs is not NULL
* @tc.level : Level 1
*/
static void namespace_test_0400(void)
......@@ -489,7 +489,7 @@ static void namespace_test_0400(void)
/**
* @tc.name : namespace_test_0340
* @tc.desc : ns_add_inherit test
* @tc.desc : ns_add_inherit test arg ns_inherited and shared_libs are NULL
* @tc.level : Level 2
*/
static void namespace_test_0340(void)
......@@ -501,7 +501,7 @@ static void namespace_test_0340(void)
/**
* @tc.name : namespace_test_0350
* @tc.desc : ns_add_inherit test
* @tc.desc : ns_add_inherit test args are NULL
* @tc.level : Level 2
*/
static void namespace_test_0350(void)
......@@ -513,7 +513,7 @@ static void namespace_test_0350(void)
/**
* @tc.name : namespace_test_0360
* @tc.desc : ns_add_inherit test
* @tc.desc : ns_add_inherit test arg ns and shared_libs are NULL
* @tc.level : Level 2
*/
static void namespace_test_0360(void)
......@@ -525,7 +525,7 @@ static void namespace_test_0360(void)
/**
* @tc.name : namespace_test_0370
* @tc.desc : is_accessible test
* @tc.desc : is_accessible test arg lib_pathname is NULL
* @tc.level : Level 1
*/
static void namespace_test_0370(void)
......@@ -538,7 +538,7 @@ static void namespace_test_0370(void)
/**
* @tc.name : namespace_test_0380
* @tc.desc : is_accessible test
* @tc.desc : is_accessible test args is (&ns, NULL, true, false) and ns.separated is false
* @tc.level : Level 1
*/
static void namespace_test_0380(void)
......@@ -551,7 +551,7 @@ static void namespace_test_0380(void)
/**
* @tc.name : namespace_test_0390
* @tc.desc : is_accessible test
* @tc.desc : is_accessible test args is (&ns, "/data/test.so", true, false) and ns.separated is false
* @tc.level : Level 1
*/
static void namespace_test_0390(void)
......@@ -575,7 +575,7 @@ static void namespace_test_0390(void)
/**
* @tc.name : namespace_test_0410
* @tc.desc : is_sharable test
* @tc.desc : is_sharable test args are NULL
* @tc.level : Level 0
*/
static void namespace_test_0410(void)
......
......@@ -20,7 +20,7 @@ typedef void (*TEST_FUN)(void);
/**
* @tc.name : ns_config_0010
* @tc.desc : test error config
* @tc.desc : Set default error callback for configor
* @tc.level : Level 1
*/
static void ns_config_test_0010(void)
......@@ -40,7 +40,7 @@ int errorback(const char* format, ...)
/**
* @tc.name : ns_config_0030
* @tc.desc : test error config
* @tc.desc : Set custom error callback for configor
* @tc.level : Level 0
*/
static void ns_config_test_0020(void)
......@@ -55,7 +55,7 @@ static void ns_config_test_0020(void)
/**
* @tc.name : ns_config_0030
* @tc.desc : test parse config
* @tc.desc : Test parse with invalid input
* @tc.level : Level 2
*/
static void ns_config_test_0030(void)
......@@ -70,7 +70,7 @@ static void ns_config_test_0030(void)
/**
* @tc.name : ns_config_0040
* @tc.desc : test get_namespaces
* @tc.desc : Test get_namespaces with invalid input
* @tc.level : Level 2
*/
static void ns_config_test_0040(void)
......@@ -84,7 +84,7 @@ static void ns_config_test_0040(void)
/**
* @tc.name : ns_config_0050
* @tc.desc : test get_namespaces
* @tc.desc : Test get_namespaces with invalid input
* @tc.level : Level 2
*/
static void ns_config_test_0050(void)
......@@ -105,7 +105,7 @@ static void ns_config_test_0050(void)
/**
* @tc.name : ns_config_0060
* @tc.desc : test get_namespaces
* @tc.desc : Test get_namespaces with invalid input
* @tc.level : Level 2
*/
static void ns_config_test_0060(void)
......@@ -126,7 +126,7 @@ static void ns_config_test_0060(void)
/**
* @tc.name : ns_config_0070
* @tc.desc : test get_lib_paths
* @tc.desc : Test get_lib_paths with invalid input
* @tc.level : Level 2
*/
static void ns_config_test_0070(void)
......@@ -140,7 +140,7 @@ static void ns_config_test_0070(void)
/**
* @tc.name : ns_config_0080
* @tc.desc : test get_lib_paths
* @tc.desc : Test get_lib_paths with invalid input
* @tc.level : Level 2
*/
static void ns_config_test_0080(void)
......@@ -154,7 +154,7 @@ static void ns_config_test_0080(void)
/**
* @tc.name : ns_config_0090
* @tc.desc : test get_asan_lib_paths
* @tc.desc : Test get_asan_lib_paths with invalid input
* @tc.level : Level 2
*/
static void ns_config_test_0090(void)
......@@ -168,7 +168,7 @@ static void ns_config_test_0090(void)
/**
* @tc.name : ns_config_0100
* @tc.desc : test get_asan_lib_paths
* @tc.desc : Test get_asan_lib_paths with invalid input
* @tc.level : Level 2
*/
static void ns_config_test_0100(void)
......
......@@ -69,8 +69,3 @@ declare_args() {
product_path = ""
}
}
declare_args() {
# for unit test
musl_unit_test_flag = false
}
......@@ -715,10 +715,6 @@ template("musl_libs") {
deps += [ "//base/startup/init/services/param/base:parameterbase" ]
}
if (musl_unit_test_flag) {
defines += [ "UNIT_TEST_STATIC" ]
}
configs -= musl_inherited_configs
configs += [
......
......@@ -36,12 +36,6 @@ which need be escaped.
#include <malloc.h>
#include "musl_log.h"
#ifdef UNIT_TEST_STATIC
#define UT_STATIC
#else
#define UT_STATIC static
#endif
void* ohos_malloc_hook_init_function(size_t bytes);
static struct MallocDispatchType __ohos_malloc_hook_init_dispatch = {
......@@ -85,7 +79,7 @@ static void get_native_hook_param(char *buf, unsigned int buf_len)
#endif
}
UT_STATIC void get_memleak_hook_param()
static void get_memleak_hook_param()
{
#ifdef OHOS_ENABLE_PARAMETER
const char *key = kMemTrackPropertyEnable;
......@@ -100,7 +94,7 @@ UT_STATIC void get_memleak_hook_param()
#endif
}
UT_STATIC int parse_hook_variable(enum EnumHookMode* mode, char* path, int size)
static int parse_hook_variable(enum EnumHookMode* mode, char* path, int size)
{
if (!mode || !path || size <= 0) {
return -1;
......@@ -151,7 +145,7 @@ UT_STATIC int parse_hook_variable(enum EnumHookMode* mode, char* path, int size)
return 0;
}
UT_STATIC bool get_proc_name(pid_t pid, char *buf, unsigned int buf_len)
static bool get_proc_name(pid_t pid, char *buf, unsigned int buf_len)
{
if (pid <= 0) {
return false;
......@@ -288,7 +282,7 @@ static bool init_hook_functions(void* shared_library_handler, struct MallocDispa
return true;
}
UT_STATIC void clear_function_table()
static void clear_function_table()
{
for (size_t i = 0; i < LAST_FUNCTION; i++) {
function_of_shared_lib[i] = NULL;
......@@ -475,7 +469,7 @@ static void __set_default_malloc()
atomic_store_explicit(&__musl_libc_globals.current_dispatch_table, (volatile const long long)NULL, memory_order_seq_cst);
}
UT_STATIC void __restore_hook_function_table()
static void __restore_hook_function_table()
{
for (size_t i = 0; i < LAST_FUNCTION; i++) {
if (__get_memleak_hook_flag()) {
......@@ -486,7 +480,7 @@ UT_STATIC void __restore_hook_function_table()
}
}
UT_STATIC void __install_malloc_hook()
static void __install_malloc_hook()
{
if (__get_memleak_hook_flag()) {
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册