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 <pancakesdeath@protonmail.com>
This commit is contained in:
parent
a995d9d76f
commit
ab601ae05c
7 changed files with 55 additions and 11 deletions
11
tests/posix/single_process/CMakeLists.txt
Normal file
11
tests/posix/single_process/CMakeLists.txt
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.20.0)
|
||||||
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||||
|
project(posix_single_process)
|
||||||
|
|
||||||
|
FILE(GLOB app_sources src/*.c)
|
||||||
|
|
||||||
|
target_sources(app PRIVATE ${app_sources})
|
||||||
|
|
||||||
|
target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L)
|
5
tests/posix/single_process/prj.conf
Normal file
5
tests/posix/single_process/prj.conf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
CONFIG_POSIX_API=y
|
||||||
|
CONFIG_ZTEST=y
|
||||||
|
|
||||||
|
CONFIG_POSIX_AEP_CHOICE_BASE=y
|
||||||
|
CONFIG_POSIX_SINGLE_PROCESS=y
|
|
@ -10,7 +10,7 @@
|
||||||
#include <zephyr/ztest.h>
|
#include <zephyr/ztest.h>
|
||||||
#include <zephyr/sys/util.h>
|
#include <zephyr/sys/util.h>
|
||||||
|
|
||||||
ZTEST(confstr, test_confstr)
|
ZTEST(posix_single_process, test_confstr)
|
||||||
{
|
{
|
||||||
char buf[1];
|
char buf[1];
|
||||||
|
|
||||||
|
@ -63,5 +63,3 @@ ZTEST(confstr, test_confstr)
|
||||||
zassert_true(confstr(_CS_PATH, buf, sizeof(buf) > 0));
|
zassert_true(confstr(_CS_PATH, buf, sizeof(buf) > 0));
|
||||||
zassert_equal(buf[0], '\0');
|
zassert_equal(buf[0], '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
ZTEST_SUITE(confstr, NULL, NULL, NULL, NULL, NULL);
|
|
10
tests/posix/single_process/src/main.c
Normal file
10
tests/posix/single_process/src/main.c
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Meta
|
||||||
|
* Copyright (c) 2024, Marvin Ouma <pancakesdeath@protonmail.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr/ztest.h>
|
||||||
|
|
||||||
|
ZTEST_SUITE(posix_single_process, NULL, NULL, NULL, NULL, NULL);
|
|
@ -8,7 +8,7 @@
|
||||||
#include <zephyr/ztest.h>
|
#include <zephyr/ztest.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
ZTEST(posix_apis, test_posix_sysconf)
|
ZTEST(posix_single_process, test_posix_sysconf)
|
||||||
{
|
{
|
||||||
long ret;
|
long ret;
|
||||||
|
|
||||||
|
@ -23,10 +23,7 @@ ZTEST(posix_apis, test_posix_sysconf)
|
||||||
/* SC that value depends on target's configuration */
|
/* SC that value depends on target's configuration */
|
||||||
ret = sysconf(_SC_SEMAPHORES);
|
ret = sysconf(_SC_SEMAPHORES);
|
||||||
if (IS_ENABLED(CONFIG_POSIX_THREADS)) {
|
if (IS_ENABLED(CONFIG_POSIX_THREADS)) {
|
||||||
zassert_equal(ret,
|
zassert_equal(ret, _POSIX_VERSION, "sysconf returned unexpected value %d", ret);
|
||||||
_POSIX_VERSION,
|
|
||||||
"sysconf returned unexpected value %d",
|
|
||||||
ret);
|
|
||||||
} else {
|
} else {
|
||||||
zassert_equal(ret, -1L, "sysconf returned unexpected value %d", ret);
|
zassert_equal(ret, -1L, "sysconf returned unexpected value %d", ret);
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <zephyr/ztest.h>
|
#include <zephyr/ztest.h>
|
||||||
|
|
||||||
ZTEST(uname, test_uname)
|
ZTEST(posix_single_process, test_uname)
|
||||||
{
|
{
|
||||||
struct utsname info;
|
struct utsname info;
|
||||||
|
|
||||||
|
@ -17,5 +17,3 @@ ZTEST(uname, test_uname)
|
||||||
zassert_ok(strncmp(info.sysname, "Zephyr", sizeof(info.sysname)));
|
zassert_ok(strncmp(info.sysname, "Zephyr", sizeof(info.sysname)));
|
||||||
zassert_ok(strncmp(info.machine, CONFIG_ARCH, sizeof(info.machine)));
|
zassert_ok(strncmp(info.machine, CONFIG_ARCH, sizeof(info.machine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ZTEST_SUITE(uname, NULL, NULL, NULL, NULL, NULL);
|
|
25
tests/posix/single_process/testcase.yaml
Normal file
25
tests/posix/single_process/testcase.yaml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
common:
|
||||||
|
filter: not CONFIG_NATIVE_LIBC
|
||||||
|
tags:
|
||||||
|
- posix
|
||||||
|
- single_process
|
||||||
|
# 1 tier0 platform per supported architecture
|
||||||
|
platform_key:
|
||||||
|
- arch
|
||||||
|
- simulation
|
||||||
|
tests:
|
||||||
|
portability.single_process.rwlocks:
|
||||||
|
min_flash: 64
|
||||||
|
min_ram: 32
|
||||||
|
portability.posix.single_process.minimal:
|
||||||
|
extra_configs:
|
||||||
|
- CONFIG_MINIMAL_LIBC=y
|
||||||
|
portability.posix.single_process.newlib:
|
||||||
|
filter: TOOLCHAIN_HAS_NEWLIB == 1
|
||||||
|
extra_configs:
|
||||||
|
- CONFIG_NEWLIB_LIBC=y
|
||||||
|
portability.posix.single_process.picolibc:
|
||||||
|
tags: picolibc
|
||||||
|
filter: CONFIG_PICOLIBC_SUPPORTED
|
||||||
|
extra_configs:
|
||||||
|
- CONFIG_PICOLIBC=y
|
Loading…
Add table
Add a link
Reference in a new issue