From ff276e422f0e23c747aa55e59791b29424748094 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 17 Jul 2023 06:50:45 +0800 Subject: [PATCH] ostest: Skip test_dev_null when CONFIG_DEV_NULL isn't enabled Signed-off-by: Xiang Xiao --- testing/ostest/CMakeLists.txt | 5 ++++- testing/ostest/Makefile | 6 +++++- testing/ostest/dev_null.c | 2 +- testing/ostest/ostest.h | 4 +++- testing/ostest/ostest_main.c | 4 +++- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/testing/ostest/CMakeLists.txt b/testing/ostest/CMakeLists.txt index c0b1691b4..b690b2e43 100644 --- a/testing/ostest/CMakeLists.txt +++ b/testing/ostest/CMakeLists.txt @@ -22,13 +22,16 @@ if(CONFIG_TESTING_OSTEST) set(SRCS getopt.c - dev_null.c restart.c sigprocmask.c sighand.c signest.c sighelper.c) + if(CONFIG_DEV_NULL) + list(APPEND SRCS dev_null.c) + endif() + if(CONFIG_SIG_SIGSTOP_ACTION) if(CONFIG_SIG_SIGKILL_ACTION) list(APPEND SRCS suspend.c) diff --git a/testing/ostest/Makefile b/testing/ostest/Makefile index 3235521c9..3bb70baff 100644 --- a/testing/ostest/Makefile +++ b/testing/ostest/Makefile @@ -29,10 +29,14 @@ MODULE = $(CONFIG_TESTING_OSTEST) # NuttX OS Test -CSRCS = getopt.c dev_null.c restart.c sigprocmask.c sighand.c signest.c +CSRCS = getopt.c restart.c sigprocmask.c sighand.c signest.c CSRCS += sighelper.c MAINSRC = ostest_main.c +ifeq ($(CONFIG_DEV_NULL),y) +CSRCS += dev_null.c +endif + ifeq ($(CONFIG_SIG_SIGSTOP_ACTION),y) ifeq ($(CONFIG_SIG_SIGKILL_ACTION),y) CSRCS += suspend.c diff --git a/testing/ostest/dev_null.c b/testing/ostest/dev_null.c index 9352d1daa..4720a0499 100644 --- a/testing/ostest/dev_null.c +++ b/testing/ostest/dev_null.c @@ -41,7 +41,7 @@ static FAR char buffer[1024]; * Public Functions ****************************************************************************/ -int dev_null(void) +int dev_null_test(void) { int nbytes; int fd; diff --git a/testing/ostest/ostest.h b/testing/ostest/ostest.h index e29457c7d..a9bd857bd 100644 --- a/testing/ostest/ostest.h +++ b/testing/ostest/ostest.h @@ -99,7 +99,9 @@ int setvbuf_test(void); /* dev_null.c ***************************************************************/ -int dev_null(void); +#ifdef CONFIG_DEV_NULL +int dev_null_test(void); +#endif /* fpu.c ********************************************************************/ diff --git a/testing/ostest/ostest_main.c b/testing/ostest/ostest_main.c index e0631271a..3f33c6c7c 100644 --- a/testing/ostest/ostest_main.c +++ b/testing/ostest/ostest_main.c @@ -325,9 +325,11 @@ static int user_main(int argc, char *argv[]) /* Checkout /dev/null */ +#ifdef CONFIG_DEV_NULL printf("\nuser_main: /dev/null test\n"); - dev_null(); + dev_null_test(); check_test_memory_usage(); +#endif #ifdef CONFIG_TESTING_OSTEST_AIO /* Check asynchronous I/O */