tests: posix: common: separate posix spinlock tests into standalone test

posix.common contains testsuites that can be separated into smaller
groups of tests. This change moves spinlock into a singular
testsuite at tests/posix/spinlocks app directory.

Signed-off-by: Marvin Ouma <pancakesdeath@protonmail.com>
This commit is contained in:
Marvin Ouma 2024-11-05 21:35:14 +03:00 committed by Anas Nashif
commit 69e8152fc1
4 changed files with 46 additions and 4 deletions

View file

@ -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_spinlocks)
target_sources(app PRIVATE src/main.c)
target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L)

View file

@ -0,0 +1,5 @@
CONFIG_POSIX_API=y
CONFIG_ZTEST=y
CONFIG_POSIX_AEP_CHOICE_BASE=y
CONFIG_POSIX_SPIN_LOCKS=y

View file

@ -9,7 +9,7 @@
#include <zephyr/ztest.h>
#include <zephyr/sys/util.h>
ZTEST(spinlock, test_spin_init_destroy)
ZTEST(posix_spinlocks, test_spin_init_destroy)
{
pthread_spinlock_t lock;
@ -24,7 +24,7 @@ ZTEST(spinlock, test_spin_init_destroy)
zassert_ok(pthread_spin_destroy(&lock), "pthread_spin_destroy() failed");
}
ZTEST(spinlock, test_spin_descriptor_leak)
ZTEST(posix_spinlocks, test_spin_descriptor_leak)
{
pthread_spinlock_t lock[CONFIG_MAX_PTHREAD_SPINLOCK_COUNT];
@ -47,7 +47,7 @@ ZTEST(spinlock, test_spin_descriptor_leak)
}
}
ZTEST(spinlock, test_spin_lock_unlock)
ZTEST(posix_spinlocks, test_spin_lock_unlock)
{
pthread_spinlock_t lock;
@ -70,4 +70,4 @@ ZTEST(spinlock, test_spin_lock_unlock)
zassert_equal(pthread_spin_destroy(&lock), EINVAL, "pthread_spin_unlock() did not fail");
}
ZTEST_SUITE(spinlock, NULL, NULL, NULL, NULL, NULL);
ZTEST_SUITE(posix_spinlocks, NULL, NULL, NULL, NULL, NULL);

View file

@ -0,0 +1,28 @@
common:
filter: not CONFIG_NATIVE_LIBC
tags:
- posix
- spinlocks
# 1 tier0 platform per supported architecture
platform_key:
- arch
- simulation
min_flash: 64
min_ram: 32
tests:
portability.posix.spinlocks: {}
portability.posix.spinlocks.minimal:
extra_configs:
- CONFIG_MINIMAL_LIBC=y
portability.posix.spinlocks.newlib:
filter: TOOLCHAIN_HAS_NEWLIB == 1
extra_configs:
- CONFIG_NEWLIB_LIBC=y
portability.posix.spinlocks.picolibc:
tags: picolibc
filter: CONFIG_PICOLIBC_SUPPORTED
extra_configs:
- CONFIG_PICOLIBC=y
portability.posix.spinlocks.no_spin_validate:
extra_configs:
- CONFIG_SPIN_VALIDATE=n