Musl and glibc syscall wrappers handles the null mq name in different ways and report different errors. Glibc reports EINVAL error if the mq_name is not preceded by "/" character but musl library does not treat this as an error and invokes the kernel mq_open syscall which finally fails with ENOENT error.
Introduce an alternative return error ENOENT so that this test passes with musl library.
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com --- changes in v3: *) Retain the mq_open library call and add new error code for musl failure as suggested by Beata.
testcases/kernel/syscalls/mq_open/mq_open01.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/mq_open/mq_open01.c b/testcases/kernel/syscalls/mq_open/mq_open01.c index cd2a229d8..8a229d298 100644 --- a/testcases/kernel/syscalls/mq_open/mq_open01.c +++ b/testcases/kernel/syscalls/mq_open/mq_open01.c @@ -34,6 +34,7 @@ struct test_case { struct mq_attr *rq; int ret; int err; + int alt_err; void (*setup)(void); void (*cleanup)(void); }; @@ -96,6 +97,7 @@ static struct test_case tcase[] = { .oflag = O_CREAT, .ret = -1, .err = EINVAL, + .alt_err = ENOENT, /* Musl library reports this error for empty mqueue name */ }, { .desc = "NORMAL", @@ -260,9 +262,11 @@ static void do_test(unsigned int i) }
if (TST_ERR != tc->err) { - tst_res(TFAIL | TTERRNO, "%s expected errno: %d", - tc->desc, TST_ERR); - goto CLEANUP; + if (TST_ERR != tc->alt_err) { + tst_res(TFAIL | TTERRNO, "%s expected errno: %d", + tc->desc, TST_ERR); + goto CLEANUP; + } }
if (TST_RET != tc->ret) {