From 7e8ee254797917ff3d89c628f821cf10260c4034 Mon Sep 17 00:00:00 2001 From: Marvin Ouma Date: Tue, 5 Nov 2024 19:33:31 +0300 Subject: [PATCH] tests: posix: common: separate posix rwlocks tests into a standalone test posix.common contains testsuites that can be separated into smaller groups of tests. This change moves rwlocks into a singular testsuite at tests/posix/rwlocks app directory. Signed-off-by: Marvin Ouma --- tests/posix/rwlocks/CMakeLists.txt | 9 +++++++ tests/posix/rwlocks/prj.conf | 5 ++++ .../src/rwlock.c => rwlocks/src/main.c} | 8 +++--- tests/posix/rwlocks/testcase.yaml | 26 +++++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 tests/posix/rwlocks/CMakeLists.txt create mode 100644 tests/posix/rwlocks/prj.conf rename tests/posix/{common/src/rwlock.c => rwlocks/src/main.c} (95%) create mode 100644 tests/posix/rwlocks/testcase.yaml diff --git a/tests/posix/rwlocks/CMakeLists.txt b/tests/posix/rwlocks/CMakeLists.txt new file mode 100644 index 00000000000..5043854b6bd --- /dev/null +++ b/tests/posix/rwlocks/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(posix_rw_locks) + +target_sources(app PRIVATE src/main.c) + +target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L) diff --git a/tests/posix/rwlocks/prj.conf b/tests/posix/rwlocks/prj.conf new file mode 100644 index 00000000000..e55d87a7ad1 --- /dev/null +++ b/tests/posix/rwlocks/prj.conf @@ -0,0 +1,5 @@ +CONFIG_POSIX_API=y +CONFIG_ZTEST=y + +CONFIG_POSIX_AEP_CHOICE_BASE=y +CONFIG_POSIX_READER_WRITER_LOCKS=y diff --git a/tests/posix/common/src/rwlock.c b/tests/posix/rwlocks/src/main.c similarity index 95% rename from tests/posix/common/src/rwlock.c rename to tests/posix/rwlocks/src/main.c index a7012fc5832..450180aff6f 100644 --- a/tests/posix/common/src/rwlock.c +++ b/tests/posix/rwlocks/src/main.c @@ -47,7 +47,7 @@ static void *thread_top(void *p1) return NULL; } -ZTEST(rwlock, test_rw_lock) +ZTEST(posix_rw_locks, test_rw_lock) { int ret; pthread_t newthread[N_THR]; @@ -133,12 +133,12 @@ static void test_pthread_rwlockattr_pshared_common(bool set, int pshared) zassert_ok(pthread_rwlockattr_destroy(&attr)); } -ZTEST(rwlock, test_pthread_rwlockattr_getpshared) +ZTEST(posix_rw_locks, test_pthread_rwlockattr_getpshared) { test_pthread_rwlockattr_pshared_common(false, 0); } -ZTEST(rwlock, test_pthread_rwlockattr_setpshared) +ZTEST(posix_rw_locks, test_pthread_rwlockattr_setpshared) { test_pthread_rwlockattr_pshared_common(true, PTHREAD_PROCESS_PRIVATE); test_pthread_rwlockattr_pshared_common(true, PTHREAD_PROCESS_SHARED); @@ -154,4 +154,4 @@ static void before(void *arg) } } -ZTEST_SUITE(rwlock, NULL, NULL, before, NULL, NULL); +ZTEST_SUITE(posix_rw_locks, NULL, NULL, before, NULL, NULL); diff --git a/tests/posix/rwlocks/testcase.yaml b/tests/posix/rwlocks/testcase.yaml new file mode 100644 index 00000000000..cee1a2300d7 --- /dev/null +++ b/tests/posix/rwlocks/testcase.yaml @@ -0,0 +1,26 @@ +common: + filter: not CONFIG_NATIVE_LIBC + tags: + - posix + - rwlocks + # 1 tier0 platform per supported architecture + platform_key: + - arch + - simulation +tests: + portability.posix.rwlocks: + min_flash: 64 + min_ram: 32 + portability.posix.rwlocks.minimal: + extra_configs: + - CONFIG_MINIMAL_LIBC=y + portability.posix.rwlocks.newlib: + filter: TOOLCHAIN_HAS_NEWLIB == 1 + extra_configs: + - CONFIG_NEWLIB_LIBC=y + - CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=8192 + portability.posix.rwlocks.picolibc: + tags: picolibc + filter: CONFIG_PICOLIBC_SUPPORTED + extra_configs: + - CONFIG_PICOLIBC=y