diff --git a/libc-test/src/functional/atexit_dlclose.c b/libc-test/src/functional/atexit_dlclose.c index 726cdbe42a4c90746d951e5460fedb8ca90b7045..cece33c3001e989627932f75c161282c64de5a62 100644 --- a/libc-test/src/functional/atexit_dlclose.c +++ b/libc-test/src/functional/atexit_dlclose.c @@ -24,9 +24,10 @@ typedef void (* ATEXIT_CB)(); -#define TEST_DSO "libatexit_dlclose_dso.so" +#define TEST_DSO "/data/tests/libc-test/src/libatexit_dlclose_dso.so" #define ATEXIT_CB_NAME "atexit_cb" #define ATEXIT_WATCHPOINT_NAME "g_watchpoint" +#define LIBATEXIT_DLCLOSE_DSO_ABSOLUTE_PATH "/data/tests/libc-test/src/libatexit_dlclose_dso.so" int fork_main(char *exe) { @@ -43,7 +44,7 @@ int fork_main(char *exe) return 1; } - handler = dlopen(buf, RTLD_LAZY|RTLD_LOCAL); + handler = dlopen(LIBATEXIT_DLCLOSE_DSO_ABSOLUTE_PATH, RTLD_LAZY|RTLD_LOCAL); if(!handler) { t_error("dlopen %s failed: %s\n", buf, dlerror()); return 2; diff --git a/libc-test/src/functionalext/common/sigchain_util.h b/libc-test/src/functionalext/common/sigchain_util.h index 5fedc0ff222fccf99f092fd700711611942a0ed8..68dc83435f0b69a6fdf97c08098947bd99169923 100644 --- a/libc-test/src/functionalext/common/sigchain_util.h +++ b/libc-test/src/functionalext/common/sigchain_util.h @@ -45,4 +45,19 @@ #define SIGCHAIN_SIGNAL_56 56 #define SIGCHAIN_SIGNAL_64 64 -extern bool get_sigchain_mask_enable(); \ No newline at end of file +bool get_sigchain_mask_enable() +{ +#ifdef OHOS_ENABLE_PARAMETER + static CachedHandle sigchain_procmask_handle = NULL; + if (sigchain_procmask_handle == NULL) { + sigchain_procmask_handle = CachedParameterCreate(param_name, "false"); + } + char *param_value = CachedParameterGet(sigchain_procmask_handle); + if (param_value != NULL) { + if (strcmp(param_value, "true") == 0) { + return true; + } + } +#endif + return false; +} \ No newline at end of file diff --git a/libc-test/src/functionalext/sigchain/BUILD.gn b/libc-test/src/functionalext/sigchain/BUILD.gn index bc9ff895cb7d229cb2957c64ab6e83a75398e283..9037ec9fb813aec17b55baa87b1282c84178a970 100644 --- a/libc-test/src/functionalext/sigchain/BUILD.gn +++ b/libc-test/src/functionalext/sigchain/BUILD.gn @@ -16,6 +16,7 @@ import("test_src_functionalext_sigchain.gni") foreach(s, functionalext_sigchain_list) { test_unittest(s) { target_dir = "functionalext/sigchain" + musl_unit_test_flag = true } } diff --git a/libc-test/src/functionalext/supplement/stat/mknod.c b/libc-test/src/functionalext/supplement/stat/mknod.c index 0dff1c6e75b4a385ba90cf1f130718d84ac0aed7..a4895cca36a07d2c72769c5c37d43a146c08d5a5 100755 --- a/libc-test/src/functionalext/supplement/stat/mknod.c +++ b/libc-test/src/functionalext/supplement/stat/mknod.c @@ -13,6 +13,7 @@ * limitations under the License. */ +#include #include #include "functionalext.h" #include "filepath_util.h" @@ -26,8 +27,7 @@ */ void mknod_0100(void) { - char pathname[PATH_MAX] = {0}; - FILE_ABSOLUTE_PATH("mknod", pathname); + char pathname[PATH_MAX] = "/dev/zero"; int ret = mknod(pathname, TEST_MODE, 0); EXPECT_EQ("mknod_0100", ret, ERREXPECT); } diff --git a/libc-test/src/functionalext/supplement/time/timer_create.c b/libc-test/src/functionalext/supplement/time/timer_create.c index 1aca66bf0eaf330a45eee9c03d3cc21de958dd38..d859a7cf0c750f9a775c0e863d26eaf1628b9154 100644 --- a/libc-test/src/functionalext/supplement/time/timer_create.c +++ b/libc-test/src/functionalext/supplement/time/timer_create.c @@ -19,7 +19,7 @@ #include #include "test.h" - +#define SIGNUM 40 static int count = 0; void handler(int sig) @@ -40,10 +40,10 @@ void timer_create_0100(void) timer_t timerid; sev.sigev_notify = SIGEV_SIGNAL; - sev.sigev_signo = SIGRTMIN; + sev.sigev_signo = SIGNUM; sev.sigev_value.sival_ptr = &timerid; - signal(SIGRTMIN, handler); + signal(SIGNUM, handler); int result = timer_create(CLOCK_REALTIME, &sev, &timerid); if (result != 0) { diff --git a/libc-test/src/functionalext/supplement/time/timer_getoverrun.c b/libc-test/src/functionalext/supplement/time/timer_getoverrun.c index c2e79cfca834e250282152f76a340667764543e0..722948a74fc6c9e20af4e92e8e7c66c181f5a425 100644 --- a/libc-test/src/functionalext/supplement/time/timer_getoverrun.c +++ b/libc-test/src/functionalext/supplement/time/timer_getoverrun.c @@ -20,7 +20,7 @@ #include #include "test.h" - +#define SIGNUM 40 static int count = 0; static timer_t timerid; @@ -45,10 +45,10 @@ void timer_getoverrun_0100(void) struct sigevent sev; sev.sigev_notify = SIGEV_SIGNAL; - sev.sigev_signo = SIGRTMIN; + sev.sigev_signo = SIGNUM; sev.sigev_value.sival_ptr = &timerid; - signal(SIGRTMIN, handler); + signal(SIGNUM, handler); int result = timer_create(CLOCK_REALTIME, &sev, &timerid); if (result != 0) { diff --git a/libc-test/src/functionalext/supplement/time/timer_settime.c b/libc-test/src/functionalext/supplement/time/timer_settime.c index e79caece52e134f4553f861379745058ba8e5b1e..95a516de6b83d39e7d2345fcebb0d8e4dfca1362 100644 --- a/libc-test/src/functionalext/supplement/time/timer_settime.c +++ b/libc-test/src/functionalext/supplement/time/timer_settime.c @@ -20,7 +20,7 @@ #include #include "test.h" - +#define SIGNUM 40 static int count = 0; extern int __timer_settime64(timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict); @@ -48,10 +48,10 @@ void timer_settime_0100(void) timer_t timerid; sev.sigev_notify = SIGEV_SIGNAL; - sev.sigev_signo = SIGRTMIN; + sev.sigev_signo = SIGNUM; sev.sigev_value.sival_ptr = &timerid; - signal(SIGRTMIN, handler); + signal(SIGNUM, handler); int result = timer_create(CLOCK_REALTIME, &sev, &timerid); if (result != 0) { @@ -102,10 +102,10 @@ void timer_settime64_0100(void) timer_t timerid; sev.sigev_notify = SIGEV_SIGNAL; - sev.sigev_signo = SIGRTMIN; + sev.sigev_signo = SIGNUM; sev.sigev_value.sival_ptr = &timerid; - signal(SIGRTMIN, handler); + signal(SIGNUM, handler); int result = timer_create(CLOCK_REALTIME, &sev, &timerid); if (result != 0) { diff --git a/libc-test/src/functionalext/trace/trace_marker.c b/libc-test/src/functionalext/trace/trace_marker.c index 7934efd3068e4f5f72dc17b3bd6f9193e1e20dbb..9336c78bdf3e7b63c6be22038b498ef76232ab88 100644 --- a/libc-test/src/functionalext/trace/trace_marker.c +++ b/libc-test/src/functionalext/trace/trace_marker.c @@ -1283,6 +1283,7 @@ TEST_FUN G_Fun_Array[] = { int main(void) { + trace_marker_reset(); int num = sizeof(G_Fun_Array) / sizeof(TEST_FUN); for (int pos = 0; pos < num; ++pos) { G_Fun_Array[pos](); diff --git a/libc-test/src/regression/raise-race.c b/libc-test/src/regression/raise-race.c index 6b4c4ef1c7c54b96a5c767fc91d22a7690385415..e0f4d2b6c9da6e0db959b0a5e2bc36a90967e89e 100644 --- a/libc-test/src/regression/raise-race.c +++ b/libc-test/src/regression/raise-race.c @@ -8,7 +8,7 @@ #include #include #include "test.h" - +#define SIGNUM 40 static volatile int c0; static volatile int c1; static volatile int child; @@ -32,7 +32,7 @@ static void *start(void *arg) int i,r,s; for (i = 0; i < 1000; i++) { - r = raise(SIGRTMIN); + r = raise(SIGNUM); if (r) t_error("raise failed: %s\n", strerror(errno)); } @@ -59,16 +59,16 @@ int main(void) void *p; int r, i, s; - if (signal(SIGRTMIN, handler0) == SIG_ERR) + if (signal(SIGNUM, handler0) == SIG_ERR) t_error("registering signal handler failed: %s\n", strerror(errno)); - if (signal(SIGRTMIN+1, handler1) == SIG_ERR) + if (signal(SIGNUM+1, handler1) == SIG_ERR) t_error("registering signal handler failed: %s\n", strerror(errno)); r = pthread_create(&t, 0, start, 0); if (r) t_error("pthread_create failed: %s\n", strerror(r)); for (i = 0; i < 100; i++) { - r = pthread_kill(t, SIGRTMIN+1); + r = pthread_kill(t, SIGNUM+1); if (r) t_error("phread_kill failed: %s\n", strerror(r)); } diff --git a/libc-test/test_template.gni b/libc-test/test_template.gni index 2b3b0aec062e4281ec178251b83fe2fe944c2bce..18b8c1aac3418fd84e92787b4ee36e7f20ea60ec 100644 --- a/libc-test/test_template.gni +++ b/libc-test/test_template.gni @@ -28,7 +28,9 @@ template("test_unittest") { target_name = invoker.target_name target_dir = invoker.target_dir - + if (defined(invoker.musl_unit_test_flag)) { + musl_unit_test_flag = invoker.musl_unit_test_flag + } target("ohos_executable", "${target_name}") { subsystem_name = "musl" part_name = "libc-test"