Skip to content

Conversation

Spago123
Copy link

@Spago123 Spago123 commented Oct 11, 2025

Fixed failling tests in fnmatch.c test file.
Removed duplicated code and added simplicfications.
Added new test cases.

Stepts to test run: west build -p -b qemu_cortex_a53 -t run tests/posix/c_lib_ext/
in the shell and you shall get the next result:
- PASS - [posix_c_lib_ext.test_fnmatch] duration = 0.001 seconds

Fixes #55186

Copy link

Hello @Spago123, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

@zephyrbot zephyrbot added area: POSIX POSIX API Library area: Tests Issues related to a particular existing or missing test labels Oct 11, 2025
@zephyrbot zephyrbot requested review from cfriedt, nashif and ycsin October 11, 2025 18:52
@cfriedt
Copy link
Member

cfriedt commented Oct 11, 2025

@Spago123 - really nice, thanks!

Just a couple of housekeeping requests.

I like that you've broken this up into separate commits, but can the commits be redone in this order:

  1. Code commit that adds the new functionality ("alpha", etc matching)
  2. Add just the tests for "alpha", etc
  3. Optimizations to reduce duplicate code, etc
  4. Doxygen

Please make sure the commit messages are really clear about what is being done and why in each commit.

@Spago123 Spago123 force-pushed the bugfix/harunspago/55186_fnmatch_known_bug branch from fb271dc to dd6ce78 Compare October 11, 2025 19:50
@Spago123
Copy link
Author

@Spago123 - really nice, thanks!

Just a couple of housekeeping requests.

I like that you've broken this up into separate commits, but can the commits be redone in this order:

1. Code commit that adds the new functionality ("alpha", etc matching)

2. Add just the tests for "alpha", etc

3. Optimizations to reduce duplicate code, etc

4. Doxygen

Please make sure the commit messages are really clear about what is being done and why in each commit.

Yup I reorderd and split the needed commit as you suggested

@Spago123 Spago123 force-pushed the bugfix/harunspago/55186_fnmatch_known_bug branch from 0883837 to 9cd4353 Compare October 11, 2025 20:10
@cfriedt
Copy link
Member

cfriedt commented Oct 13, 2025

@Spago123 - some CI errors related to islower() and ispunct(), which are often defined as macros.

@Spago123
Copy link
Author

@Spago123 - some CI errors related to islower() and ispunct(), which are often defined as macros.

Yup it seems there is an issue with those fucntions on some platforms, I added custom implementations that satistify the library definitions

@Spago123 Spago123 force-pushed the bugfix/harunspago/55186_fnmatch_known_bug branch 2 times, most recently from 6625e76 to 285079e Compare October 16, 2025 20:21
Implemented match_posix_class function that was needed
to match the possible posix classes like alnum, alpha etc...

Signed-off-by: Harun Spago <[email protected]>
Added tests for isprint, ispunct, islower and other posix classes

Signed-off-by: Harun Spago <[email protected]>
Some Ifs had the same condition so insted of duplicating that work
simple helper functions have been created

Signed-off-by: Harun Spago <[email protected]>
Added Doxygen on new functions and on fnmatch function

Signed-off-by: Harun Spago <[email protected]>
Resolved all sonar qube issues

Signed-off-by: Harun Spago <[email protected]>
Added custom implementations for islower and ispunch
since there is some issue with compilenace on some platforms

Signed-off-by: Harun Spago <[email protected]>
Formated fnmatch c and h files and test files using clang-format

Signed-off-by: Harun Spago <[email protected]>
@Spago123 Spago123 force-pushed the bugfix/harunspago/55186_fnmatch_known_bug branch from 285079e to 6c3a529 Compare October 16, 2025 20:27
Copy link

Please retry analysis of this Pull-Request directly on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: POSIX POSIX API Library area: Tests Issues related to a particular existing or missing test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

posix: fnmatch: fix known bugs

3 participants