diff --git a/system/libuv/CMakeLists.txt b/system/libuv/CMakeLists.txt index 12cde4fa7..5364fb959 100644 --- a/system/libuv/CMakeLists.txt +++ b/system/libuv/CMakeLists.txt @@ -171,6 +171,13 @@ if(CONFIG_LIBUV) ${LIBUV_TEST_DIR}/run-tests.c ${LIBUV_TEST_DIR}/runner.c ${LIBUV_TEST_DIR}/runner-unix.c ${LIBUV_TEST_DIR}/echo-server.c) file(GLOB TEST_CSRCS ${LIBUV_TEST_DIR}/test-*.c) + + # See system/libuv/Makefile. + + if(NOT CONFIG_ARCH_HAVE_FORK) + list(REMOVE_ITEM TEST_CSRCS ${LIBUV_TEST_DIR}/test-fork.c + ${LIBUV_TEST_DIR}/test-pipe-close-stdout-read-stdin.c) + endif() list(APPEND LIBUV_UTILS_TEST_SRCS ${TEST_CSRCS}) nuttx_add_application( NAME diff --git a/system/libuv/Makefile b/system/libuv/Makefile index dec76cc1a..483f6194f 100644 --- a/system/libuv/Makefile +++ b/system/libuv/Makefile @@ -144,7 +144,19 @@ CSRCS += runner.c CSRCS += runner-unix.c CSRCS += echo-server.c -CSRCS += $(wildcard libuv/test/test-*.c) +LIBUV_TEST_CSRCS = $(wildcard libuv/test/test-*.c) + +# test-fork.c and test-pipe-close-stdout-read-stdin.c call fork(), so they +# cannot be built where NuttX does not provide it. Nothing is lost either +# way: every test they define is already excluded from the task list on +# NuttX by 0001-libuv-port-for-nuttx.patch. + +ifeq ($(CONFIG_ARCH_HAVE_FORK),) +LIBUV_TEST_CSRCS := $(filter-out libuv/test/test-fork.c,$(LIBUV_TEST_CSRCS)) +LIBUV_TEST_CSRCS := $(filter-out libuv/test/test-pipe-close-stdout-read-stdin.c,$(LIBUV_TEST_CSRCS)) +endif + +CSRCS += $(LIBUV_TEST_CSRCS) endif ifneq ($(CONFIG_LIBUV_UTILS_BENCHMARK),) diff --git a/testing/ltp/CMakeLists.txt b/testing/ltp/CMakeLists.txt index 2e458d5e4..8d4674ecd 100644 --- a/testing/ltp/CMakeLists.txt +++ b/testing/ltp/CMakeLists.txt @@ -86,6 +86,12 @@ if(CONFIG_TESTING_LTP) list(APPEND BLACKWORDS "pthread_spin_init" "pthread_spin_destroy" "pthread_spin_trylock") endif() + + # See testing/ltp/Makefile. + + if(NOT CONFIG_ARCH_HAVE_FORK) + list(APPEND BLACKWORDS "[^v_]fork(") + endif() list( APPEND BLACKWORDS diff --git a/testing/ltp/Makefile b/testing/ltp/Makefile index 39a7d931b..cee750cd0 100644 --- a/testing/ltp/Makefile +++ b/testing/ltp/Makefile @@ -44,6 +44,13 @@ BLACKWORDS += "pthread_spin_destroy" BLACKWORDS += "pthread_spin_trylock" endif +# Where NuttX does not declare fork(), a test that calls it cannot be built. +# The pattern spares vfork() and task_fork(), which remain available. + +ifeq ($(CONFIG_ARCH_HAVE_FORK),) +BLACKWORDS += "[^v_]fork(" +endif + BLACKWORDS += "CHILD_MAX" BLACKWORDS += "setpgid(" BLACKWORDS += "PTHREAD_SCOPE_PROCESS"