9
0
Fork 0

examples/ostest can be executed in a loop

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@763 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2008-06-01 17:50:07 +00:00
parent 471a765be4
commit e9da735fe1
10 changed files with 100 additions and 67 deletions

View File

@ -366,3 +366,4 @@
verified).
* Host simulator no longer uses Linux system calls directly; Now works with Cygwin.
* Fix an error that occurs when a POSIX timer is deleted by the timer signal handler.
* Add logic to allow the examples/ostest to be run repetitively as an endurance test.

View File

@ -1016,6 +1016,7 @@ nuttx-0.3.11 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
verified).
* Host simulator no longer uses Linux system calls directly; Now works with Cygwin.
* Fix an error that occurs when a POSIX timer is deleted by the timer signal handler.
* Add logic to allow the examples/ostest to be run repetitively as an endurance test.
pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>

View File

@ -114,6 +114,7 @@ nuttx$(EXEEXT): nuttx.rel $(HOSTOBJS)
@$(NM) $(TOPDIR)/$@ | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > $(TOPDIR)/System.map
@rm -f nuttx.rel
.depend: Makefile $(SRCS)
@$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep

View File

@ -311,7 +311,8 @@ CONFIG_NET_RESOLV_ENTRIES=4
#
# Settings for examples/ostest
CONFIG_OSTEST_STACKSIZE=256
CONFIG_EXAMPLES_OSTEST_LOOPS=1
CONFIG_EXAMPLES_OSTEST_STACKSIZE=256
#
# Settings for examples/nsh

View File

@ -281,6 +281,11 @@ CONFIG_EXAMPLE_NETTEST_DRIPADDR=(192<<24|168<<16|0<<8|1)
CONFIG_EXAMPLE_NETTEST_NETMASK=(255<<24|255<<16|255<<8|0)
CONFIG_EXAMPLE_NETTEST_CLIENTIP=(192<<24|168<<16|0<<8|106)
#
# Settings for examples/ostest
CONFIG_EXAMPLES_OSTEST_LOOPS=100
CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
#
# Settings for examples/nsh
CONFIG_EXAMPLES_NSH_TELNET=n

View File

@ -312,7 +312,8 @@ CONFIG_NET_RESOLV_ENTRIES=4
#
# Settings for examples/ostest
CONFIG_OSTEST_STACKSIZE=256
CONFIG_EXAMPLES_OSTEST_LOOPS=1
CONFIG_EXAMPLES_OSTEST_STACKSIZE=256
#
# Settings for examples/nsh

View File

@ -312,7 +312,8 @@ CONFIG_NET_RESOLV_ENTRIES=4
#
# Settings for examples/ostest
CONFIG_OSTEST_STACKSIZE=256
CONFIG_EXAMPLES_OSTEST_LOOPS=1
CONFIG_EXAMPLES_OSTEST_STACKSIZE=256
#
# Settings for examples/nsh

View File

@ -20,7 +20,11 @@ examples/ostest
The behavior of the ostest can be modified with the following
settings in the configs/<board-name>/defconfig file:
* CONFIG_OSTEST_STACKSIZE
* CONFIG_EXAMPLES_OSTEST_LOOPS
Used to control the number of executions of the test. If
undefined, the test executes one time. If defined to be
zero, the test runs forever.
* CONFIG_EXAMPLES_OSTEST_STACKSIZE
Used to create the ostest task. Default is 8192.
examples/nsh

View File

@ -53,7 +53,7 @@ static void *barrier_func(void *parameter)
usleep(500*1000);
#endif
/* Take the semaphore */
/* Wait at the barrier until all threads are synchronized. */
printf("barrier_func: Thread %d calling pthread_barrier_wait()\n", id);
status = pthread_barrier_wait(&barrier);
@ -99,6 +99,7 @@ void barrier_test(void)
{
printf("barrier_test: pthread_barrierattr_init failed, status=%d\n", status);
}
/* Create the barrier */
status = pthread_barrierattr_init(&barrierattr);

View File

@ -58,12 +58,21 @@
#define NARGS 4
/* The task_create task size can be specified in the defconfig file */
#ifdef CONFIG_OSTEST_STACKSIZE
# define STACKSIZE CONFIG_OSTEST_STACKSIZE
#ifdef CONFIG_EXAMPLES_OSTEST_STACKSIZE
# define STACKSIZE CONFIG_EXAMPLES_OSTEST_STACKSIZE
#else
# define STACKSIZE 8192
#endif
/* The number of times to execute the test can be specified in the defconfig
* file.
*/
#ifndef CONFIG_EXAMPLES_OSTEST_LOOPS
# define CONFIG_EXAMPLES_OSTEST_LOOPS 1
#endif
/****************************************************************************
* Private Data
****************************************************************************/
@ -280,121 +289,129 @@ static int user_main(int argc, char *argv[])
check_test_memory_usage();
#endif
/* Top of test loop */
#if CONFIG_EXAMPLES_OSTEST_LOOPS > 1
for (i = 0; i < CONFIG_EXAMPLES_OSTEST_LOOPS; i++)
#elif CONFIG_EXAMPLES_OSTEST_LOOPS == 0
for (;;)
#endif
{
#if CONFIG_NFILE_DESCRIPTORS > 0
/* Checkout /dev/null */
/* Checkout /dev/null */
printf("\nuser_main: /dev/null test\n");
dev_null();
check_test_memory_usage();
printf("\nuser_main: /dev/null test\n");
dev_null();
check_test_memory_usage();
#endif
#ifndef CONFIG_DISABLE_PTHREAD
/* Verify pthreads and pthread mutex */
/* Verify pthreads and pthread mutex */
printf("\nuser_main: mutex test\n");
mutex_test();
check_test_memory_usage();
printf("\nuser_main: mutex test\n");
mutex_test();
check_test_memory_usage();
#endif
#ifndef CONFIG_DISABLE_PTHREAD
/* Verify pthread cancellation */
/* Verify pthread cancellation */
printf("\nuser_main: cancel test\n");
cancel_test();
check_test_memory_usage();
printf("\nuser_main: cancel test\n");
cancel_test();
check_test_memory_usage();
#endif
#ifndef CONFIG_DISABLE_PTHREAD
/* Verify pthreads and semaphores */
/* Verify pthreads and semaphores */
printf("\nuser_main: semaphore test\n");
sem_test();
check_test_memory_usage();
printf("\nuser_main: semaphore test\n");
sem_test();
check_test_memory_usage();
#endif
#ifndef CONFIG_DISABLE_PTHREAD
/* Verify pthreads and condition variables */
/* Verify pthreads and condition variables */
printf("\nuser_main: condition variable test\n");
cond_test();
check_test_memory_usage();
printf("\nuser_main: condition variable test\n");
cond_test();
check_test_memory_usage();
#endif
#if !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD) && !defined(CONFIG_DISABLE_CLOCK)
/* Verify pthreads and condition variable timed waits */
/* Verify pthreads and condition variable timed waits */
printf("\nuser_main: timed wait test\n");
timedwait_test();
check_test_memory_usage();
printf("\nuser_main: timed wait test\n");
timedwait_test();
check_test_memory_usage();
#endif
#if !defined(CONFIG_DISABLE_MQUEUE) && !defined(CONFIG_DISABLE_PTHREAD)
/* Verify pthreads and message queues */
/* Verify pthreads and message queues */
printf("\nuser_main: message queue test\n");
mqueue_test();
check_test_memory_usage();
printf("\nuser_main: message queue test\n");
mqueue_test();
check_test_memory_usage();
#endif
#if !defined(CONFIG_DISABLE_MQUEUE) && !defined(CONFIG_DISABLE_PTHREAD) && !defined(CONFIG_DISABLE_CLOCK)
/* Verify pthreads and message queues */
/* Verify pthreads and message queues */
printf("\nuser_main: timed message queue test\n");
timedmqueue_test();
check_test_memory_usage();
printf("\nuser_main: timed message queue test\n");
timedmqueue_test();
check_test_memory_usage();
#endif
#ifndef CONFIG_DISABLE_SIGNALS
/* Verify signal handlers */
/* Verify signal handlers */
printf("\nuser_main: signal handler test\n");
sighand_test();
check_test_memory_usage();
printf("\nuser_main: signal handler test\n");
sighand_test();
check_test_memory_usage();
#endif
#if !defined(CONFIG_DISABLE_POSIX_TIMERS) && !defined(CONFIG_DISABLE_SIGNALS)
/* Verify posix timers */
/* Verify posix timers */
printf("\nuser_main: POSIX timer test\n");
timer_test();
check_test_memory_usage();
printf("\nuser_main: POSIX timer test\n");
timer_test();
check_test_memory_usage();
#endif
#if !defined(CONFIG_DISABLE_PTHREAD) && CONFIG_RR_INTERVAL > 0
/* Verify round robin scheduling */
/* Verify round robin scheduling */
printf("\nuser_main: round-robin scheduler test\n");
rr_test();
check_test_memory_usage();
printf("\nuser_main: round-robin scheduler test\n");
rr_test();
check_test_memory_usage();
#endif
#ifndef CONFIG_DISABLE_PTHREAD
/* Verify pthread barriers */
/* Verify pthread barriers */
printf("\nuser_main: barrier test\n");
barrier_test();
check_test_memory_usage();
printf("\nuser_main: barrier test\n");
barrier_test();
check_test_memory_usage();
#endif
/* Compare memory usage at time user_start started until
* user_main exits. These should not be identical, but should
* be similar enough that we can detect any serious OS memory
* leaks.
*/
/* Compare memory usage at time user_start started until
* user_main exits. These should not be identical, but should
* be similar enough that we can detect any serious OS memory
* leaks.
*/
#ifndef CONFIG_DISABLE_SIGNALS
usleep(500*1000);
usleep(500*1000);
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmafter = mallinfo();
g_mmafter = mallinfo();
#else
(void)mallinfo(&g_mmafter);
(void)mallinfo(&g_mmafter);
#endif
printf("\nFinal memory usage:\n");
show_memory_usage(&g_mmbefore, &g_mmafter);
printf("\nFinal memory usage:\n");
show_memory_usage(&g_mmbefore, &g_mmafter);
#endif
}
printf("user_main: Exitting\n");
return 0;
}
@ -446,7 +463,7 @@ int user_start(int argc, char *argv[])
stdio_test();
#ifdef SDCC
/* I am not yet certain why SDCC does not like the initilizer.
/* I am not yet certain why SDCC does not like the following initilizers.
* It involves some issues with 2- vs 3-byte pointer types.
*/