examples/ostest: Cannot be configured or build if CONFIG_DISABLE_SIGNALS=y
This commit is contained in:
parent
b169bd4641
commit
497130f372
@ -6,6 +6,7 @@
|
||||
config EXAMPLES_OSTEST
|
||||
bool "OS test example"
|
||||
default n
|
||||
depends on !DISABLE_SIGNALS
|
||||
---help---
|
||||
Enable the OS test example
|
||||
|
||||
@ -78,7 +79,7 @@ config EXAMPLES_OSTEST_RR_RUNS
|
||||
length of this test - it should last at least a few tens of seconds. Allowed
|
||||
values [1; 32767], default 10
|
||||
|
||||
if ARCH_FPU && SCHED_WAITPID && !DISABLE_SIGNALS
|
||||
if ARCH_FPU && SCHED_WAITPID
|
||||
|
||||
config EXAMPLES_OSTEST_FPUTESTDISABLE
|
||||
bool "Disable FPU test"
|
||||
|
@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# apps/examples/ostest/Makefile
|
||||
#
|
||||
# Copyright (C) 2007-2012, 2014 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2007-2012, 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -44,7 +44,7 @@ STACKSIZE = 2048
|
||||
# NuttX OS Test
|
||||
|
||||
ASRCS =
|
||||
CSRCS = dev_null.c restart.c
|
||||
CSRCS = dev_null.c restart.c sigprocmask.c sighand.c signest.c
|
||||
MAINSRC = ostest_main.c
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
@ -66,7 +66,7 @@ CSRCS += waitpid.c
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DISABLE_PTHREAD),y)
|
||||
CSRCS += cancel.c cond.c mutex.c sem.c semtimed.c barrier.c
|
||||
CSRCS += cancel.c cond.c mutex.c sem.c semtimed.c barrier.c timedwait.c
|
||||
|
||||
ifeq ($(CONFIG_FS_NAMED_SEMAPHORES),y)
|
||||
CSRCS += nsem.c
|
||||
@ -85,13 +85,6 @@ CSRCS += sporadic.c
|
||||
endif
|
||||
endif # CONFIG_DISABLE_PTHREAD
|
||||
|
||||
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||
CSRCS += sigprocmask.c sighand.c signest.c
|
||||
ifneq ($(CONFIG_DISABLE_PTHREAD),y)
|
||||
CSRCS += timedwait.c
|
||||
endif # CONFIG_DISABLE_PTHREAD
|
||||
endif # CONFIG_DISABLE_SIGNALS
|
||||
|
||||
ifneq ($(CONFIG_DISABLE_MQUEUE),y)
|
||||
ifneq ($(CONFIG_DISABLE_PTHREAD),y)
|
||||
CSRCS += mqueue.c timedmqueue.c
|
||||
@ -111,13 +104,11 @@ CSRCS += vfork.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||
ifneq ($(CONFIG_DISABLE_PTHREAD),y)
|
||||
ifeq ($(CONFIG_PRIORITY_INHERITANCE),y)
|
||||
CSRCS += prioinherit.c
|
||||
endif # CONFIG_PRIORITY_INHERITANCE
|
||||
endif # CONFIG_DISABLE_PTHREAD
|
||||
endif # CONFIG_DISABLE_SIGNALS
|
||||
|
||||
CONFIG_XYZ_PROGNAME ?= ostest$(EXEEXT)
|
||||
PROGNAME = $(CONFIG_XYZ_PROGNAME)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* examples/ostest/barrier.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -69,9 +69,7 @@ static void *barrier_func(void *parameter)
|
||||
int status;
|
||||
|
||||
printf("barrier_func: Thread %d started\n", id);
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
usleep(HALF_SECOND);
|
||||
#endif
|
||||
|
||||
/* Wait at the barrier until all threads are synchronized. */
|
||||
|
||||
@ -98,9 +96,7 @@ static void *barrier_func(void *parameter)
|
||||
}
|
||||
FFLUSH();
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
usleep(HALF_SECOND);
|
||||
#endif
|
||||
printf("barrier_func: Thread %d done\n", id);
|
||||
FFLUSH();
|
||||
return NULL;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* examples/ostest/cancel.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -33,6 +33,10 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -42,9 +46,17 @@
|
||||
|
||||
#include "ostest.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static pthread_mutex_t mutex;
|
||||
static pthread_cond_t cond;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PTHREAD_CLEANUP
|
||||
static void thread_cleaner(FAR void *arg)
|
||||
{
|
||||
@ -274,6 +286,10 @@ static void restart_thread(FAR void *(*entry)(FAR void *), pthread_t *waiter, in
|
||||
start_thread(entry, waiter, cancelable);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void cancel_test(void)
|
||||
{
|
||||
pthread_t waiter;
|
||||
@ -437,7 +453,6 @@ void cancel_test(void)
|
||||
* could be re-designed so that it does not depend on signals.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
printf("cancel_test: Test 5: Non-cancelable threads\n");
|
||||
printf("cancel_test: Re-starting thread (non-cancelable)\n");
|
||||
restart_thread(thread_waiter, &waiter, 0);
|
||||
@ -508,5 +523,4 @@ void cancel_test(void)
|
||||
printf("cancel_test: PASS thread terminated with PTHREAD_CANCELED\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/ostest/fpu.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -57,7 +57,6 @@
|
||||
#ifdef CONFIG_ARCH_FPU
|
||||
# if defined(CONFIG_EXAMPLES_OSTEST_FPUSIZE) && \
|
||||
defined(CONFIG_SCHED_WAITPID) && \
|
||||
!defined(CONFIG_DISABLE_SIGNALS) && \
|
||||
defined(CONFIG_BUILD_FLAT)
|
||||
# define HAVE_FPU 1
|
||||
# else
|
||||
@ -67,9 +66,6 @@
|
||||
# ifndef CONFIG_SCHED_WAITPID
|
||||
# warning "FPU test not built; CONFIG_SCHED_WAITPID not defined"
|
||||
# endif
|
||||
# ifdef CONFIG_DISABLE_SIGNALS
|
||||
# warning "FPU test not built; CONFIG_DISABLE_SIGNALS defined"
|
||||
# endif
|
||||
# ifndef CONFIG_BUILD_FLAT
|
||||
# warning "FPU test not built; Only available in the flat build (CONFIG_BUILD_FLAT)"
|
||||
# endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/ostest/mqueue.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -59,34 +59,18 @@
|
||||
#if defined(SDCC) || defined(__ZILOG__)
|
||||
/* Cannot use strlen in array size */
|
||||
|
||||
# define TEST_MSGLEN (31)
|
||||
# define TEST_MSGLEN (31)
|
||||
#else
|
||||
/* Message lenght is the size of the message plus the null terminator */
|
||||
|
||||
# define TEST_MSGLEN (strlen(TEST_MESSAGE)+1)
|
||||
# define TEST_MSGLEN (strlen(TEST_MESSAGE)+1)
|
||||
#endif
|
||||
|
||||
#define TEST_SEND_NMSGS (10)
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
# define TEST_RECEIVE_NMSGS (11)
|
||||
#else
|
||||
# define TEST_RECEIVE_NMSGS (10)
|
||||
#endif
|
||||
#define TEST_RECEIVE_NMSGS (11)
|
||||
|
||||
#define HALF_SECOND_USEC_USEC 500000L
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
@ -94,10 +78,6 @@
|
||||
static mqd_t g_send_mqfd;
|
||||
static mqd_t g_recv_mqfd;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -376,7 +356,6 @@ void mqueue_test(void)
|
||||
(int)((intptr_t)result));
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
/* Wake up the receiver thread with a signal */
|
||||
|
||||
printf("mqueue_test: Killing receiver\n");
|
||||
@ -385,7 +364,6 @@ void mqueue_test(void)
|
||||
/* Wait a bit to see if the thread exits on its own */
|
||||
|
||||
usleep(HALF_SECOND_USEC_USEC);
|
||||
#endif
|
||||
|
||||
/* Then cancel the thread and see if it did */
|
||||
|
||||
|
@ -36,6 +36,14 @@
|
||||
#ifndef __APPS_EXAMPLES_OSTEST_OSTEST_H
|
||||
#define __APPS_EXAMPLES_OSTEST_OSTEST_H
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DISABLE_SIGNALS
|
||||
# error Signals are disabled (CONFIG_DISABLE_SIGNALS)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
@ -206,8 +214,7 @@ void priority_inheritance(void);
|
||||
|
||||
/* vfork.c ******************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_HAVE_VFORK) && defined(CONFIG_SCHED_WAITPID) && \
|
||||
!defined(CONFIG_DISABLE_SIGNALS)
|
||||
#if defined(CONFIG_ARCH_HAVE_VFORK) && defined(CONFIG_SCHED_WAITPID)
|
||||
int vfork_test(void);
|
||||
#endif
|
||||
|
||||
|
@ -90,11 +90,9 @@ static const char *g_argv[NARGS+1];
|
||||
static const char *g_argv[NARGS+1] = { arg1, arg2, arg3, arg4, NULL };
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
static struct mallinfo g_mmbefore;
|
||||
static struct mallinfo g_mmprevious;
|
||||
static struct mallinfo g_mmafter;
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
const char g_var1_name[] = "Variable1";
|
||||
@ -119,7 +117,6 @@ const char g_putenv_value[] = "Variable1=BadValue3";
|
||||
* Name: show_memory_usage
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
static void show_memory_usage(struct mallinfo *mmbefore,
|
||||
struct mallinfo *mmafter)
|
||||
{
|
||||
@ -131,15 +128,11 @@ static void show_memory_usage(struct mallinfo *mmbefore,
|
||||
printf("uordblks %8x %8x\n", mmbefore->uordblks, mmafter->uordblks);
|
||||
printf("fordblks %8x %8x\n", mmbefore->fordblks, mmafter->fordblks);
|
||||
}
|
||||
#else
|
||||
# define show_memory_usage(mm1, mm2)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: check_test_memory_usage
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
static void check_test_memory_usage(void)
|
||||
{
|
||||
/* Wait a little bit to let any threads terminate */
|
||||
@ -171,9 +164,6 @@ static void check_test_memory_usage(void)
|
||||
|
||||
dump_nfreeholders("user_main:");
|
||||
}
|
||||
#else
|
||||
# define check_test_memory_usage()
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: show_variable
|
||||
@ -238,7 +228,6 @@ static int user_main(int argc, char *argv[])
|
||||
|
||||
/* Sample the memory usage now */
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
usleep(HALF_SECOND_USEC);
|
||||
|
||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
||||
@ -247,7 +236,6 @@ static int user_main(int argc, char *argv[])
|
||||
#else
|
||||
(void)mallinfo(&g_mmbefore);
|
||||
memcpy(&g_mmprevious, &g_mmbefore, sizeof(struct mallinfo));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
printf("\nuser_main: Begin argument test\n");
|
||||
@ -424,7 +412,7 @@ static int user_main(int argc, char *argv[])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD)
|
||||
#ifndef CONFIG_DISABLE_PTHREAD
|
||||
/* Verify pthreads and condition variable timed waits */
|
||||
|
||||
printf("\nuser_main: timed wait test\n");
|
||||
@ -448,7 +436,6 @@ static int user_main(int argc, char *argv[])
|
||||
check_test_memory_usage();
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
/* Verify that we can modify the signal mask */
|
||||
|
||||
printf("\nuser_main: sigprocmask test\n");
|
||||
@ -464,9 +451,8 @@ static int user_main(int argc, char *argv[])
|
||||
printf("\nuser_main: nested signal handler test\n");
|
||||
signest_test();
|
||||
check_test_memory_usage();
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_POSIX_TIMERS) && !defined(CONFIG_DISABLE_SIGNALS)
|
||||
#ifndef CONFIG_DISABLE_POSIX_TIMERS
|
||||
/* Verify posix timers (with SIGEV_SIGNAL) */
|
||||
|
||||
printf("\nuser_main: POSIX timer test\n");
|
||||
@ -506,16 +492,15 @@ static int user_main(int argc, char *argv[])
|
||||
check_test_memory_usage();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD)
|
||||
#if defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_DISABLE_PTHREAD)
|
||||
/* Verify priority inheritance */
|
||||
|
||||
printf("\nuser_main: priority inheritance test\n");
|
||||
priority_inheritance();
|
||||
check_test_memory_usage();
|
||||
#endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_SIGNALS && !CONFIG_DISABLE_PTHREAD */
|
||||
#endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_PTHREAD */
|
||||
|
||||
#if defined(CONFIG_ARCH_HAVE_VFORK) && defined(CONFIG_SCHED_WAITPID) && \
|
||||
!defined(CONFIG_DISABLE_SIGNALS)
|
||||
#if defined(CONFIG_ARCH_HAVE_VFORK) && defined(CONFIG_SCHED_WAITPID)
|
||||
printf("\nuser_main: vfork() test\n");
|
||||
vfork_test();
|
||||
#endif
|
||||
@ -526,7 +511,6 @@ static int user_main(int argc, char *argv[])
|
||||
* leaks.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
usleep(HALF_SECOND_USEC);
|
||||
|
||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
||||
@ -537,7 +521,6 @@ static int user_main(int argc, char *argv[])
|
||||
|
||||
printf("\nFinal memory usage:\n");
|
||||
show_memory_usage(&g_mmbefore, &g_mmafter);
|
||||
#endif
|
||||
}
|
||||
|
||||
printf("user_main: Exitting\n");
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* examples/ostest/prioinherit.c
|
||||
*
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009, 2011, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -49,7 +49,7 @@
|
||||
|
||||
#include "ostest.h"
|
||||
|
||||
#if defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD)
|
||||
#if defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_DISABLE_PTHREAD)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@ -392,7 +392,7 @@ static void *lowpri_thread(void *parameter)
|
||||
g_lowstate[threadno-1] = DONE;
|
||||
return retval;
|
||||
}
|
||||
#endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_SIGNALS && !CONFIG_DISABLE_PTHREAD */
|
||||
#endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_PTHREAD */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -404,7 +404,7 @@ static void *lowpri_thread(void *parameter)
|
||||
|
||||
void priority_inheritance(void)
|
||||
{
|
||||
#if defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD)
|
||||
#if defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_DISABLE_PTHREAD)
|
||||
pthread_t lowpri[NLOWPRI_THREADS];
|
||||
pthread_t medpri;
|
||||
pthread_t highpri[NHIGHPRI_THREADS];
|
||||
@ -573,5 +573,5 @@ void priority_inheritance(void)
|
||||
sem_destroy(&g_sem);
|
||||
dump_nfreeholders("priority_inheritance:");
|
||||
FFLUSH();
|
||||
#endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_SIGNALS && !CONFIG_DISABLE_PTHREAD */
|
||||
#endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_PTHREAD */
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* examples/ostest/vfork.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -47,12 +47,7 @@
|
||||
|
||||
#include "ostest.h"
|
||||
|
||||
#if defined(CONFIG_ARCH_HAVE_VFORK) && defined(CONFIG_SCHED_WAITPID) && \
|
||||
!defined(CONFIG_DISABLE_SIGNALS)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
#if defined(CONFIG_ARCH_HAVE_VFORK) && defined(CONFIG_SCHED_WAITPID)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -101,4 +96,4 @@ int vfork_test(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_HAVE_VFORK && CONFIG_SCHED_WAITPID && !CONFIG_DISABLE_SIGNALS */
|
||||
#endif /* CONFIG_ARCH_HAVE_VFORK && CONFIG_SCHED_WAITPID */
|
||||
|
Loading…
Reference in New Issue
Block a user