fix ostest sigprocmask testcase

problem: ostest may fail at procmask test, because signals:sigkill/sigstop should not be added in signal mask
solution: skip checking whether sigkill/sigstop are in signal mask

Signed-off-by: guanyi <guanyi@xiaomi.com>
This commit is contained in:
guanyi 2023-07-03 20:07:07 +08:00 committed by Masayuki Ishikawa
parent 4a4c550ced
commit f50d2cdbe3

View File

@ -100,14 +100,20 @@ void sigprocmask_test(void)
{ {
int signo = g_some_signals[i]; int signo = g_some_signals[i];
/* SIGKILL and SIGSTOP should not be added to signal mask */
if (signo != SIGKILL && signo != SIGSTOP)
{
ret = sigaddset(&newmask, signo); ret = sigaddset(&newmask, signo);
if (ret != OK) if (ret != OK)
{ {
int errcode = errno; int errcode = errno;
printf("sigprocmask_test: ERROR sigaddset failed: %d\n", errcode); printf("sigprocmask_test: ERROR sigaddset failed: %d\n",
errcode);
ASSERT(false); ASSERT(false);
goto errout_with_mask; goto errout_with_mask;
} }
}
ret = sighold(signo); ret = sighold(signo);
if (ret != OK) if (ret != OK)
@ -195,6 +201,28 @@ void sigprocmask_test(void)
goto errout_with_mask; goto errout_with_mask;
} }
/* SIGKILL and SIGSTOP should never be added to signal mask,
* so delete them from newmask before comparing.
*/
ret = sigdelset(&newmask, SIGKILL);
if (ret != OK)
{
int errcode = errno;
printf("sigprocmask_test: ERROR sigprocmask failed: %d\n", errcode);
ASSERT(false);
goto errout_with_mask;
}
ret = sigdelset(&newmask, SIGSTOP);
if (ret != OK)
{
int errcode = errno;
printf("sigprocmask_test: ERROR sigprocmask failed: %d\n", errcode);
ASSERT(false);
goto errout_with_mask;
}
/* It should be the same as newmask */ /* It should be the same as newmask */
if (memcmp(&currmask, &newmask, sizeof(sigset_t)) != 0) if (memcmp(&currmask, &newmask, sizeof(sigset_t)) != 0)