Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: posix: common: separate posix c_lib_ext to standalone test #81441

Conversation

Pancakem
Copy link
Contributor

@Pancakem Pancakem commented Nov 15, 2024

Fixes #81488
posix.common contains testsuites that can be separated into smaller groups of tests. This change moves fnmatch into a singular testsuite at tests/posix/c_lib_ext app directory.

@zephyrbot zephyrbot added the area: POSIX POSIX API Library label Nov 15, 2024
@zephyrbot zephyrbot requested review from cfriedt and ycsin November 15, 2024 11:58
@Pancakem Pancakem force-pushed the separate_posix_c_lib_ext_into_standalone_test branch from b2e9176 to c0122d7 Compare November 15, 2024 12:17
Copy link
Member

@cfriedt cfriedt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also move the getentropy and getopt tests to the new directory in this PR as well.

Note: getentropy() was added as part of the 2024 revision but was not part of the 2008 revision.

https://pubs.opengroup.org/onlinepubs/9799919799/xrat/V4_subprofiles.html

@Pancakem Pancakem force-pushed the separate_posix_c_lib_ext_into_standalone_test branch 2 times, most recently from 232585b to dd22cbc Compare November 15, 2024 14:41
@Pancakem Pancakem force-pushed the separate_posix_c_lib_ext_into_standalone_test branch from dd22cbc to 1083082 Compare November 19, 2024 14:42
@cfriedt
Copy link
Member

cfriedt commented Nov 19, 2024

@Pancakem - this would do it for me. For the POSIX_C_LIB_EXT option group, there should be no requirement to even set CONFIG_POSIX_API. Since CONFIG_POSIX_API will probably go the way of the dinosaur, this should be fine.

diff --git a/tests/posix/c_lib_ext/CMakeLists.txt b/tests/posix/c_lib_ext/CMakeLists.txt
index e607b5283b5..24c7cfd2194 100644
--- a/tests/posix/c_lib_ext/CMakeLists.txt
+++ b/tests/posix/c_lib_ext/CMakeLists.txt
@@ -8,4 +8,5 @@ FILE(GLOB app_sources src/*.c)
 
 target_sources(app PRIVATE ${app_sources})
 
+target_include_directories(app PRIVATE ${ZEPHYR_BASE}/lib/posix/options/getopt)
 target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L)
diff --git a/tests/posix/c_lib_ext/prj.conf b/tests/posix/c_lib_ext/prj.conf
index 55affe2f7f8..7e8b0675c52 100644
--- a/tests/posix/c_lib_ext/prj.conf
+++ b/tests/posix/c_lib_ext/prj.conf
@@ -1,4 +1,3 @@
-CONFIG_POSIX_API=y
 CONFIG_ZTEST=y
 
 CONFIG_POSIX_C_LIB_EXT=y
diff --git a/tests/posix/c_lib_ext/src/fnmatch.c b/tests/posix/c_lib_ext/src/fnmatch.c
index 0faf8492829..66b6aadf86d 100644
--- a/tests/posix/c_lib_ext/src/fnmatch.c
+++ b/tests/posix/c_lib_ext/src/fnmatch.c
@@ -4,8 +4,7 @@
  * SPDX-License-Identifier: Apache-2.0
  */
 
-#include <fnmatch.h>
-
+#include <zephyr/posix/fnmatch.h>
 #include <zephyr/ztest.h>
 
 /*
diff --git a/tests/posix/c_lib_ext/src/getentropy.c b/tests/posix/c_lib_ext/src/getentropy.c
index b41527a9c50..f04e54becb0 100644
--- a/tests/posix/c_lib_ext/src/getentropy.c
+++ b/tests/posix/c_lib_ext/src/getentropy.c
@@ -4,9 +4,8 @@
  * SPDX-License-Identifier: Apache-2.0
  */
 
-#include <zephyr/ztest.h>
-
 #include <zephyr/posix/unistd.h>
+#include <zephyr/ztest.h>
 
 ZTEST(posix_c_lib_ext, test_getentropy_too_large)
 {
diff --git a/tests/posix/c_lib_ext/src/getopt.c b/tests/posix/c_lib_ext/src/getopt.c
index 826d8d9be8a..febe55c3468 100644
--- a/tests/posix/c_lib_ext/src/getopt.c
+++ b/tests/posix/c_lib_ext/src/getopt.c
@@ -9,11 +9,12 @@
  *
  */
 
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
+#include <getopt.h>
 #include <string.h>
+
+#include <zephyr/kernel.h>
 #include <zephyr/posix/unistd.h>
-#include <getopt.h>
+#include <zephyr/ztest.h>
 
 ZTEST(posix_c_lib_ext, test_getopt_basic)
 {

@Pancakem Pancakem force-pushed the separate_posix_c_lib_ext_into_standalone_test branch from 1083082 to 608e48e Compare November 19, 2024 15:38
@cfriedt
Copy link
Member

cfriedt commented Nov 20, 2024

I think there is likely an unrelated test failing in main, so this will just need a rebase at some point

@cfriedt
Copy link
Member

cfriedt commented Nov 23, 2024

@Pancakem - this should basically be ready to go after a rebase

@Pancakem Pancakem force-pushed the separate_posix_c_lib_ext_into_standalone_test branch from 608e48e to a81b463 Compare November 25, 2024 15:38
@Pancakem Pancakem force-pushed the separate_posix_c_lib_ext_into_standalone_test branch 2 times, most recently from 504a02a to 3839829 Compare November 26, 2024 07:37
posix.common contains testsuites that can be separated into smaller
groups of tests. This change moves fnmatch, getopt and getentropy
into a singular testsuite at tests/posix/c_lib_ext app directory.

Signed-off-by: Marvin Ouma <[email protected]>
@Pancakem Pancakem force-pushed the separate_posix_c_lib_ext_into_standalone_test branch from 3839829 to 35cfa54 Compare November 26, 2024 07:55
@kartben kartben merged commit 3977703 into zephyrproject-rtos:main Nov 27, 2024
24 checks passed
@Pancakem Pancakem deleted the separate_posix_c_lib_ext_into_standalone_test branch December 2, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: POSIX POSIX API Library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tests: posix: common: split c_lib_ext tests into standalone test
5 participants