summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-06-01 17:50:07 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-06-01 17:50:07 +0000
commit6c8f17cbd53ae8c0bdc447da59619d6734ebae14 (patch)
tree1216f52f4180495d3699e39deee969be65685345
parent60baf60892705bec8c3180025cd797c5d64a1e1e (diff)
downloadnuttx-6c8f17cbd53ae8c0bdc447da59619d6734ebae14.tar.gz
nuttx-6c8f17cbd53ae8c0bdc447da59619d6734ebae14.tar.bz2
nuttx-6c8f17cbd53ae8c0bdc447da59619d6734ebae14.zip
examples/ostest can be executed in a loop
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@763 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/ChangeLog1
-rw-r--r--nuttx/Documentation/NuttX.html1
-rw-r--r--nuttx/arch/sim/src/Makefile1
-rw-r--r--nuttx/configs/ez80f910200kitg/ostest/defconfig3
-rw-r--r--nuttx/configs/sim/ostest/defconfig5
-rw-r--r--nuttx/configs/z8encore000zco/ostest/defconfig3
-rw-r--r--nuttx/configs/z8f64200100kit/ostest/defconfig3
-rw-r--r--nuttx/examples/README.txt6
-rw-r--r--nuttx/examples/ostest/barrier.c3
-rw-r--r--nuttx/examples/ostest/main.c141
10 files changed, 100 insertions, 67 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index f3742881d..33668b6ed 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -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.
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index c6b94fa59..6d8a69ba1 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -1016,6 +1016,7 @@ nuttx-0.3.11 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
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 &lt;spudmonkey@racsa.co.cr&gt;
diff --git a/nuttx/arch/sim/src/Makefile b/nuttx/arch/sim/src/Makefile
index f7f323754..040a9841d 100644
--- a/nuttx/arch/sim/src/Makefile
+++ b/nuttx/arch/sim/src/Makefile
@@ -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
diff --git a/nuttx/configs/ez80f910200kitg/ostest/defconfig b/nuttx/configs/ez80f910200kitg/ostest/defconfig
index 635ddf5f2..ea8032272 100644
--- a/nuttx/configs/ez80f910200kitg/ostest/defconfig
+++ b/nuttx/configs/ez80f910200kitg/ostest/defconfig
@@ -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
diff --git a/nuttx/configs/sim/ostest/defconfig b/nuttx/configs/sim/ostest/defconfig
index a7d93ec76..f5e7bc8f8 100644
--- a/nuttx/configs/sim/ostest/defconfig
+++ b/nuttx/configs/sim/ostest/defconfig
@@ -282,6 +282,11 @@ 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
CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE=512
diff --git a/nuttx/configs/z8encore000zco/ostest/defconfig b/nuttx/configs/z8encore000zco/ostest/defconfig
index 8a8083b30..9c5e5cd05 100644
--- a/nuttx/configs/z8encore000zco/ostest/defconfig
+++ b/nuttx/configs/z8encore000zco/ostest/defconfig
@@ -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
diff --git a/nuttx/configs/z8f64200100kit/ostest/defconfig b/nuttx/configs/z8f64200100kit/ostest/defconfig
index c7ed5aa40..1c9607175 100644
--- a/nuttx/configs/z8f64200100kit/ostest/defconfig
+++ b/nuttx/configs/z8f64200100kit/ostest/defconfig
@@ -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
diff --git a/nuttx/examples/README.txt b/nuttx/examples/README.txt
index b31785a10..47ec67f6f 100644
--- a/nuttx/examples/README.txt
+++ b/nuttx/examples/README.txt
@@ -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
diff --git a/nuttx/examples/ostest/barrier.c b/nuttx/examples/ostest/barrier.c
index 731eaa817..2b6755c9d 100644
--- a/nuttx/examples/ostest/barrier.c
+++ b/nuttx/examples/ostest/barrier.c
@@ -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);
diff --git a/nuttx/examples/ostest/main.c b/nuttx/examples/ostest/main.c
index c61e94cff..0f34eea23 100644
--- a/nuttx/examples/ostest/main.c
+++ b/nuttx/examples/ostest/main.c
@@ -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.
*/