From b71f6d07acd4189f02a8afe854bc0e0b84fda62d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 23 Jan 2019 14:21:13 -0600 Subject: [PATCH] apps/testing/smp: Move apps/examples/smp to apps/testing/smp --- examples/README.txt | 6 ------ {examples => testing}/smp/.gitignore | 0 {examples => testing}/smp/Kconfig | 12 ++++++------ {examples => testing}/smp/Make.defs | 6 +++--- {examples => testing}/smp/Makefile | 16 ++++++++-------- {examples => testing}/smp/smp_main.c | 20 ++++++++++---------- 6 files changed, 27 insertions(+), 33 deletions(-) rename {examples => testing}/smp/.gitignore (100%) rename {examples => testing}/smp/Kconfig (84%) rename {examples => testing}/smp/Make.defs (95%) rename {examples => testing}/smp/Makefile (85%) rename {examples => testing}/smp/smp_main.c (93%) diff --git a/examples/README.txt b/examples/README.txt index e544f8523..8dcfb3cbe 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -1684,12 +1684,6 @@ examples/smart_test * CONFIG_NSH_BUILTIN_APPS=y: This test can be built only as an NSH command -examples/smp -^^^^^^^^^^^^ - - This is a simple test for SMP functionality. It is basically just the - pthread barrier test with some custom instrumentation. - examples/smps ^^^^^^^^^^^^^ diff --git a/examples/smp/.gitignore b/testing/smp/.gitignore similarity index 100% rename from examples/smp/.gitignore rename to testing/smp/.gitignore diff --git a/examples/smp/Kconfig b/testing/smp/Kconfig similarity index 84% rename from examples/smp/Kconfig rename to testing/smp/Kconfig index 2145dabc8..c2b1fedd2 100644 --- a/examples/smp/Kconfig +++ b/testing/smp/Kconfig @@ -3,7 +3,7 @@ # see the file kconfig-language.txt in the NuttX tools repository. # -config EXAMPLES_SMP +config TESTING_SMP tristate "SMP example" default n depends on SMP @@ -12,9 +12,9 @@ config EXAMPLES_SMP barrier test from apps/testing/ostest and adds some instrumentation useful for debugging SMP implementations. -if EXAMPLES_SMP +if TESTING_SMP -config EXAMPLES_SMP_NBARRIER_THREADS +config TESTING_SMP_NBARRIER_THREADS int "Number of barrier threads" default 8 ---help--- @@ -22,7 +22,7 @@ config EXAMPLES_SMP_NBARRIER_THREADS is 8 but a smaller number may be needed on systems without sufficient memory to start so many threads. -config EXAMPLES_SMP_PROGNAME +config TESTING_SMP_PROGNAME string "Program name" default "smp" depends on BUILD_LOADABLE @@ -30,11 +30,11 @@ config EXAMPLES_SMP_PROGNAME This is the name of the program that will be use when the NSH ELF program is installed. -config EXAMPLES_SMP_PRIORITY +config TESTING_SMP_PRIORITY int "SMP task priority" default 100 -config EXAMPLES_SMP_STACKSIZE +config TESTING_SMP_STACKSIZE int "SMP stack size" default 2048 diff --git a/examples/smp/Make.defs b/testing/smp/Make.defs similarity index 95% rename from examples/smp/Make.defs rename to testing/smp/Make.defs index 3ad522e77..13955cebc 100644 --- a/examples/smp/Make.defs +++ b/testing/smp/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# apps/examples/smp/Make.defs +# apps/testing/smp/Make.defs # Adds selected applications to apps/ build # # Copyright (C) 2016 Gregory Nutt. All rights reserved. @@ -34,6 +34,6 @@ # ############################################################################ -ifneq ($(CONFIG_EXAMPLES_SMP),) -CONFIGURED_APPS += examples/smp +ifneq ($(CONFIG_TESTING_SMP),) +CONFIGURED_APPS += testing/smp endif diff --git a/examples/smp/Makefile b/testing/smp/Makefile similarity index 85% rename from examples/smp/Makefile rename to testing/smp/Makefile index cddd844fe..15223cf9f 100644 --- a/examples/smp/Makefile +++ b/testing/smp/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# apps/examples/smp/Makefile +# apps/testing/smp/Makefile # # Copyright (C) 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -37,12 +37,12 @@ # SMP built-in application info -CONFIG_EXAMPLES_SMP_PRIORITY ?= SCHED_PRIORITY_DEFAULT -CONFIG_EXAMPLES_SMP_STACKSIZE ?= 2048 +CONFIG_TESTING_SMP_PRIORITY ?= SCHED_PRIORITY_DEFAULT +CONFIG_TESTING_SMP_STACKSIZE ?= 2048 APPNAME = smp -PRIORITY = $(CONFIG_EXAMPLES_SMP_PRIORITY) -STACKSIZE = $(CONFIG_EXAMPLES_SMP_STACKSIZE) +PRIORITY = $(CONFIG_TESTING_SMP_PRIORITY) +STACKSIZE = $(CONFIG_TESTING_SMP_STACKSIZE) # SMP Example @@ -50,9 +50,9 @@ ASRCS = CSRCS = MAINSRC = smp_main.c -CONFIG_EXAMPLES_SMP_PROGNAME ?= smp$(EXEEXT) -PROGNAME = $(CONFIG_EXAMPLES_SMP_PROGNAME) +CONFIG_TESTING_SMP_PROGNAME ?= smp$(EXEEXT) +PROGNAME = $(CONFIG_TESTING_SMP_PROGNAME) -MODULE = CONFIG_EXAMPLES_SMP +MODULE = CONFIG_TESTING_SMP include $(APPDIR)/Application.mk diff --git a/examples/smp/smp_main.c b/testing/smp/smp_main.c similarity index 93% rename from examples/smp/smp_main.c rename to testing/smp/smp_main.c index 66c1b3dbb..35327db43 100644 --- a/examples/smp/smp_main.c +++ b/testing/smp/smp_main.c @@ -1,5 +1,5 @@ /**************************************************************************** - * examples/smp/smp_main.c + * apps/testing/smp/smp_main.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -58,7 +58,7 @@ static pthread_barrier_t g_smp_barrier; #if defined(CONFIG_SMP) && defined(CONFIG_BUILD_FLAT) -static volatile int g_thread_cpu[CONFIG_EXAMPLES_SMP_NBARRIER_THREADS+1]; +static volatile int g_thread_cpu[CONFIG_TESTING_SMP_NBARRIER_THREADS+1]; #endif /**************************************************************************** @@ -223,7 +223,7 @@ int main(int argc, FAR char *argv[]) int smp_main(int argc, char *argv[]) #endif { - pthread_t threadid[CONFIG_EXAMPLES_SMP_NBARRIER_THREADS]; + pthread_t threadid[CONFIG_TESTING_SMP_NBARRIER_THREADS]; pthread_addr_t result; pthread_attr_t attr; pthread_barrierattr_t barrierattr; @@ -233,13 +233,13 @@ int smp_main(int argc, char *argv[]) /* Initialize data */ - memset(threadid, 0, sizeof(pthread_t) * CONFIG_EXAMPLES_SMP_NBARRIER_THREADS); - for (i = 0; i <= CONFIG_EXAMPLES_SMP_NBARRIER_THREADS; i++) + memset(threadid, 0, sizeof(pthread_t) * CONFIG_TESTING_SMP_NBARRIER_THREADS); + for (i = 0; i <= CONFIG_TESTING_SMP_NBARRIER_THREADS; i++) { #if defined(CONFIG_SMP) && defined(CONFIG_BUILD_FLAT) g_thread_cpu[i] = IMPOSSIBLE_CPU; #endif - if (i < CONFIG_EXAMPLES_SMP_NBARRIER_THREADS) + if (i < CONFIG_TESTING_SMP_NBARRIER_THREADS) { threadid[i] = 0; } @@ -258,7 +258,7 @@ int smp_main(int argc, char *argv[]) } ret = pthread_barrier_init(&g_smp_barrier, &barrierattr, - CONFIG_EXAMPLES_SMP_NBARRIER_THREADS); + CONFIG_TESTING_SMP_NBARRIER_THREADS); if (ret != OK) { printf(" Main[0]: pthread_barrierattr_init failed, ret=%d\n", ret); @@ -271,7 +271,7 @@ int smp_main(int argc, char *argv[]) (void)pthread_barrierattr_init(&barrierattr); - /* Start CONFIG_EXAMPLES_SMP_NBARRIER_THREADS thread instances */ + /* Start CONFIG_TESTING_SMP_NBARRIER_THREADS thread instances */ ret = pthread_attr_init(&attr); if (ret != OK) @@ -282,7 +282,7 @@ int smp_main(int argc, char *argv[]) goto errout_with_barrier; } - for (i = 0; i < CONFIG_EXAMPLES_SMP_NBARRIER_THREADS; i++) + for (i = 0; i < CONFIG_TESTING_SMP_NBARRIER_THREADS; i++) { ret = pthread_create(&threadid[i], &attr, barrier_thread, (pthread_addr_t)((uintptr_t)i+1)); @@ -307,7 +307,7 @@ int smp_main(int argc, char *argv[]) /* Wait for all thread instances to complete */ - for (i = 0; i < CONFIG_EXAMPLES_SMP_NBARRIER_THREADS; i++) + for (i = 0; i < CONFIG_TESTING_SMP_NBARRIER_THREADS; i++) { if (threadid[i] != 0) {