未验证 提交 109684bc 编写于 作者: O openharmony_ci 提交者: Gitee

!912 Fix test cases' bugs in xts suite (2/2)

Merge pull request !912 from zzulilyw/master
......@@ -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;
......
......@@ -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
......@@ -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
}
}
......
......@@ -13,6 +13,7 @@
* limitations under the License.
*/
#include <errno.h>
#include <sys/stat.h>
#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);
}
......
......@@ -19,7 +19,7 @@
#include <unistd.h>
#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) {
......
......@@ -20,7 +20,7 @@
#include <unistd.h>
#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) {
......
......@@ -20,7 +20,7 @@
#include <unistd.h>
#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) {
......
......@@ -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]();
......
......@@ -8,7 +8,7 @@
#include <sys/wait.h>
#include <unistd.h>
#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));
}
......
......@@ -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"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册