This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new f50d2cdbe fix ostest sigprocmask testcase
f50d2cdbe is described below
commit f50d2cdbe35184a7849f3c02c154d9cc80be6f11
Author: guanyi <[email protected]>
AuthorDate: Mon Jul 3 20:07:07 2023 +0800
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 <[email protected]>
---
testing/ostest/sigprocmask.c | 40 ++++++++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/testing/ostest/sigprocmask.c b/testing/ostest/sigprocmask.c
index f4c8b8fd1..9e12c9077 100644
--- a/testing/ostest/sigprocmask.c
+++ b/testing/ostest/sigprocmask.c
@@ -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);
@@ -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)