Skip to content

Commit 69e8152

Browse files
Pancakemnashif
authored andcommitted
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 <[email protected]>
1 parent 6d38b24 commit 69e8152

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

tests/posix/spinlocks/CMakeLists.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.20.0)
4+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5+
project(posix_spinlocks)
6+
7+
target_sources(app PRIVATE src/main.c)
8+
9+
target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L)

tests/posix/spinlocks/prj.conf

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CONFIG_POSIX_API=y
2+
CONFIG_ZTEST=y
3+
4+
CONFIG_POSIX_AEP_CHOICE_BASE=y
5+
CONFIG_POSIX_SPIN_LOCKS=y

tests/posix/common/src/spinlock.c renamed to tests/posix/spinlocks/src/main.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <zephyr/ztest.h>
1010
#include <zephyr/sys/util.h>
1111

12-
ZTEST(spinlock, test_spin_init_destroy)
12+
ZTEST(posix_spinlocks, test_spin_init_destroy)
1313
{
1414
pthread_spinlock_t lock;
1515

@@ -24,7 +24,7 @@ ZTEST(spinlock, test_spin_init_destroy)
2424
zassert_ok(pthread_spin_destroy(&lock), "pthread_spin_destroy() failed");
2525
}
2626

27-
ZTEST(spinlock, test_spin_descriptor_leak)
27+
ZTEST(posix_spinlocks, test_spin_descriptor_leak)
2828
{
2929
pthread_spinlock_t lock[CONFIG_MAX_PTHREAD_SPINLOCK_COUNT];
3030

@@ -47,7 +47,7 @@ ZTEST(spinlock, test_spin_descriptor_leak)
4747
}
4848
}
4949

50-
ZTEST(spinlock, test_spin_lock_unlock)
50+
ZTEST(posix_spinlocks, test_spin_lock_unlock)
5151
{
5252
pthread_spinlock_t lock;
5353

@@ -70,4 +70,4 @@ ZTEST(spinlock, test_spin_lock_unlock)
7070
zassert_equal(pthread_spin_destroy(&lock), EINVAL, "pthread_spin_unlock() did not fail");
7171
}
7272

73-
ZTEST_SUITE(spinlock, NULL, NULL, NULL, NULL, NULL);
73+
ZTEST_SUITE(posix_spinlocks, NULL, NULL, NULL, NULL, NULL);

tests/posix/spinlocks/testcase.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
common:
2+
filter: not CONFIG_NATIVE_LIBC
3+
tags:
4+
- posix
5+
- spinlocks
6+
# 1 tier0 platform per supported architecture
7+
platform_key:
8+
- arch
9+
- simulation
10+
min_flash: 64
11+
min_ram: 32
12+
tests:
13+
portability.posix.spinlocks: {}
14+
portability.posix.spinlocks.minimal:
15+
extra_configs:
16+
- CONFIG_MINIMAL_LIBC=y
17+
portability.posix.spinlocks.newlib:
18+
filter: TOOLCHAIN_HAS_NEWLIB == 1
19+
extra_configs:
20+
- CONFIG_NEWLIB_LIBC=y
21+
portability.posix.spinlocks.picolibc:
22+
tags: picolibc
23+
filter: CONFIG_PICOLIBC_SUPPORTED
24+
extra_configs:
25+
- CONFIG_PICOLIBC=y
26+
portability.posix.spinlocks.no_spin_validate:
27+
extra_configs:
28+
- CONFIG_SPIN_VALIDATE=n

0 commit comments

Comments
 (0)