Changes to apps needed by nutts PR 8885

ostest contains some logic that depends on internal implementation of signal sets and ostest must be updated to match those changes.

There is no particular impact from this PR.  This PR is the result of impact from nuttx 8885.

Tested with nuttx 8885
This commit is contained in:
Gregory Nutt 2023-03-24 12:02:04 -06:00 committed by Petro Karashchenko
parent 75b4720a6e
commit a1bca5070c
5 changed files with 73 additions and 16 deletions

View File

@ -30,6 +30,7 @@ MODULE = $(CONFIG_TESTING_OSTEST)
# NuttX OS Test
CSRCS = getopt.c dev_null.c restart.c sigprocmask.c sighand.c signest.c
CSRCS += sighelper.c
MAINSRC = ostest_main.c
ifeq ($(CONFIG_SIG_SIGSTOP_ACTION),y)

View File

@ -26,6 +26,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <inttypes.h>
#include <signal.h>
/****************************************************************************
* Pre-processor Definitions
@ -80,14 +83,6 @@
# define FFLUSH()
#endif
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@ -190,6 +185,10 @@ void timedwait_test(void);
void sigprocmask_test(void);
/* sighelper.c **************************************************************/
bool sigset_isequal(FAR const sigset_t *left, FAR const sigset_t *right);
/* sighand.c ****************************************************************/
void sighand_test(void);

View File

@ -30,6 +30,8 @@
#include <stdio.h>
#include <unistd.h>
#include <nuttx/signal.h>
#include "ostest.h"
/****************************************************************************
@ -115,10 +117,11 @@ static void timer_expiration(int signo, siginfo_t *info, void *ucontext)
ASSERT(false);
}
if (oldset != allsigs)
if (!sigset_isequal(&oldset, &allsigs))
{
printf("timer_expiration: ERROR sigprocmask=%jx expected=%jx\n",
(uintmax_t)oldset, (uintmax_t)allsigs);
printf("timer_expiration: ERROR sigprocmask=" SIGSET_FMT
" expected=" SIGSET_FMT "\n",
SIGSET_ELEM(&oldset), SIGSET_ELEM(&allsigs));
ASSERT(false);
}
}
@ -170,8 +173,9 @@ void timer_test(void)
}
#ifndef SDCC
printf("timer_test: oact.sigaction=%p oact.sa_flags=%x oact.sa_mask=%jx\n",
oact.sa_sigaction, oact.sa_flags, (uintmax_t)oact.sa_mask);
printf("timer_test: oact.sigaction=%p oact.sa_flags=%x "
"oact.sa_mask=" SIGSET_FMT "\n",
oact.sa_sigaction, oact.sa_flags, SIGSET_ELEM(&oact.sa_mask));
#endif
/* Create the POSIX timer */

View File

@ -35,6 +35,8 @@
#include <sys/types.h>
#include <unistd.h>
#include <nuttx/signal.h>
#include "ostest.h"
/****************************************************************************
@ -120,7 +122,7 @@ static void wakeup_action(int signo, siginfo_t *info, void *ucontext)
ASSERT(false);
}
if (oldset != allsigs)
if (!sigset_isequal(&oldset, &allsigs))
{
ASSERT(false);
}
@ -162,8 +164,8 @@ static int waiter_main(int argc, char *argv[])
#ifndef SDCC
printf("waiter_main: oact.sigaction=%p oact.sa_flags=%x "
"oact.sa_mask=%jx\n",
oact.sa_sigaction, oact.sa_flags, (uintmax_t)oact.sa_mask);
"oact.sa_mask=" SIGSET_FMT "\n",
oact.sa_sigaction, oact.sa_flags, SIGSET_ELEM(&oact.sa_mask));
#endif
/* Take the semaphore */

View File

@ -0,0 +1,51 @@
/****************************************************************************
* apps/testing/ostest/sighelper.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <signal.h>
#include "ostest.h"
/****************************************************************************
* Public Functions
****************************************************************************/
bool sigset_isequal(FAR const sigset_t *left, FAR const sigset_t *right)
{
int ndx;
/* Check if all elements of the set are the same */
for (ndx = 0; ndx < _SIGSET_NELEM; ndx++)
{
if (right->_elem[ndx] != left->_elem[ndx])
{
return false;
}
}
return true;
}