Skip to content

Commit ab601ae

Browse files
Pancakemnashif
authored andcommitted
tests: posix: common: separate posix single process into a standalone test
posix.common contains testsuites that can be separated into smaller groups of tests. This change moves confstr, sysconf and uname into a singular testsuite at tests/posix/single_process app directory. Signed-off-by: Marvin Ouma <[email protected]>
1 parent a995d9d commit ab601ae

File tree

7 files changed

+55
-11
lines changed

7 files changed

+55
-11
lines changed
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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_single_process)
6+
7+
FILE(GLOB app_sources src/*.c)
8+
9+
target_sources(app PRIVATE ${app_sources})
10+
11+
target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L)

tests/posix/single_process/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_SINGLE_PROCESS=y

tests/posix/common/src/confstr.c renamed to tests/posix/single_process/src/confstr.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <zephyr/ztest.h>
1111
#include <zephyr/sys/util.h>
1212

13-
ZTEST(confstr, test_confstr)
13+
ZTEST(posix_single_process, test_confstr)
1414
{
1515
char buf[1];
1616

@@ -63,5 +63,3 @@ ZTEST(confstr, test_confstr)
6363
zassert_true(confstr(_CS_PATH, buf, sizeof(buf) > 0));
6464
zassert_equal(buf[0], '\0');
6565
}
66-
67-
ZTEST_SUITE(confstr, NULL, NULL, NULL, NULL, NULL);

tests/posix/single_process/src/main.c

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright (c) 2023, Meta
3+
* Copyright (c) 2024, Marvin Ouma <[email protected]>
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
#include <zephyr/ztest.h>
9+
10+
ZTEST_SUITE(posix_single_process, NULL, NULL, NULL, NULL, NULL);

tests/posix/common/src/sysconf.c renamed to tests/posix/single_process/src/sysconf.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <zephyr/ztest.h>
99
#include <unistd.h>
1010

11-
ZTEST(posix_apis, test_posix_sysconf)
11+
ZTEST(posix_single_process, test_posix_sysconf)
1212
{
1313
long ret;
1414

@@ -23,10 +23,7 @@ ZTEST(posix_apis, test_posix_sysconf)
2323
/* SC that value depends on target's configuration */
2424
ret = sysconf(_SC_SEMAPHORES);
2525
if (IS_ENABLED(CONFIG_POSIX_THREADS)) {
26-
zassert_equal(ret,
27-
_POSIX_VERSION,
28-
"sysconf returned unexpected value %d",
29-
ret);
26+
zassert_equal(ret, _POSIX_VERSION, "sysconf returned unexpected value %d", ret);
3027
} else {
3128
zassert_equal(ret, -1L, "sysconf returned unexpected value %d", ret);
3229
}

tests/posix/common/src/uname.c renamed to tests/posix/single_process/src/uname.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99

1010
#include <zephyr/ztest.h>
1111

12-
ZTEST(uname, test_uname)
12+
ZTEST(posix_single_process, test_uname)
1313
{
1414
struct utsname info;
1515

1616
zassert_ok(uname(&info));
1717
zassert_ok(strncmp(info.sysname, "Zephyr", sizeof(info.sysname)));
1818
zassert_ok(strncmp(info.machine, CONFIG_ARCH, sizeof(info.machine)));
1919
}
20-
21-
ZTEST_SUITE(uname, NULL, NULL, NULL, NULL, NULL);
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
common:
2+
filter: not CONFIG_NATIVE_LIBC
3+
tags:
4+
- posix
5+
- single_process
6+
# 1 tier0 platform per supported architecture
7+
platform_key:
8+
- arch
9+
- simulation
10+
tests:
11+
portability.single_process.rwlocks:
12+
min_flash: 64
13+
min_ram: 32
14+
portability.posix.single_process.minimal:
15+
extra_configs:
16+
- CONFIG_MINIMAL_LIBC=y
17+
portability.posix.single_process.newlib:
18+
filter: TOOLCHAIN_HAS_NEWLIB == 1
19+
extra_configs:
20+
- CONFIG_NEWLIB_LIBC=y
21+
portability.posix.single_process.picolibc:
22+
tags: picolibc
23+
filter: CONFIG_PICOLIBC_SUPPORTED
24+
extra_configs:
25+
- CONFIG_PICOLIBC=y

0 commit comments

Comments
 (0)