Skip to content

Commit

Permalink
ltp: sigprocmask fix
Browse files Browse the repository at this point in the history
VELAPLATFO-8233

fix ostest sigprocmask testcase

dependson: 3105316

Change-Id: I67c64263f420db7961e5a5b7f92ac2456492d629
Signed-off-by: guanyi <[email protected]>
  • Loading branch information
guanyi committed Jul 28, 2023
1 parent 7b066ed commit ec0e292
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions testing/ostest/sigprocmask.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,19 @@ void sigprocmask_test(void)
{
int signo = g_some_signals[i];

ret = sigaddset(&newmask, signo);
if (ret != OK)
/* SIGKILL and SIGSTOP should not be added to signal mask */

if (signo != SIGKILL && signo != SIGSTOP)
{
int errcode = errno;
printf("sigprocmask_test: ERROR sigaddset failed: %d\n", errcode);
ASSERT(false);
goto errout_with_mask;
ret = sigaddset(&newmask, signo);
if (ret != OK)
{
int errcode = errno;
printf("sigprocmask_test: ERROR sigaddset failed: %d\n",
errcode);
ASSERT(false);
goto errout_with_mask;
}
}

ret = sighold(signo);
Expand Down Expand Up @@ -195,6 +201,28 @@ void sigprocmask_test(void)
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 */

if (memcmp(&currmask, &newmask, sizeof(sigset_t)) != 0)
Expand Down

0 comments on commit ec0e292

Please sign in to comment.