Skip to content

tests: posix: headers: ensure defined constants are tested #65642

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

Conversation

cfriedt
Copy link
Member

@cfriedt cfriedt commented Nov 23, 2023

A few commits

  • move pthread_equal() closer to pthread_self()
  • tests: posix: headers: check pthread_spin_lock() et al exist
  • tests: posix: headers: ensure pthread_condattr_getclock() exist
  • posix: define PTHREAD_CANCELED globally
  • tests: posix: headers: add verification tests for more constants
  • posix: do not define _PTHREAD_CANCEL_POS

* "identity" functions grouped more closely
* posix_thread_pool_init() should be adjacent to the SYS_INIT()

Signed-off-by: Christopher Friedt <[email protected]>
The simple header test was not updated to verify that the
following functions were implemented even though they were
implemented some time ago.

* pthread_spin_destroy()
* pthread_spin_init()
* pthread_spin_lock()
* pthread_spin_trylock()
* pthread_spin_unlock()

Signed-off-by: Christopher Friedt <[email protected]>
These calls were added some time ago, so ensure they are checked
for existence.

* pthread_condattr_getclock()
* pthread_condattr_setclock()

Signed-off-by: Christopher Friedt <[email protected]>
Move the definition of PTHREAD_CANCELED from pthread.c to
pthread.h.

Signed-off-by: Christopher Friedt <[email protected]>
@cfriedt cfriedt marked this pull request as ready for review November 23, 2023 03:50
@zephyrbot zephyrbot added the area: POSIX POSIX API Library label Nov 23, 2023
@cfriedt cfriedt force-pushed the tests-posix-headers-update-existence-test branch 2 times, most recently from af67eef to f3815fe Compare November 23, 2023 04:31
@cfriedt cfriedt added the area: Tests Issues related to a particular existing or missing test label Nov 23, 2023
@cfriedt cfriedt requested review from ycsin and nashif November 23, 2023 04:52
ycsin
ycsin previously approved these changes Nov 23, 2023
@cfriedt cfriedt requested a review from kartben November 23, 2023 05:50
Ensure that the "headers" test checks that the following constants
are defined:

* PTHREAD_PROCESS_SHARED
* PTHREAD_PROCESS_PRIVATE
* PTHREAD_COND_INITIALIZER
* PTHREAD_MUTEX_INITIALIZER
* PTHREAD_CANCELED

They were already defined by previous commits, but the test had not
been updated.

Signed-off-by: Christopher Friedt <[email protected]>
_PTHREAD_CANCEL_POS is an implementation detail and should not
be defined in the global scope. Furthermore, _PTHREAD_CANCEL_POS
uses a reserved identifier (underscore followed by capital
letter).

Adjust definitions so that the implementation detail is only
used in the implementation and not in the interface.

Additionally, modify naming so that the non-standard macro does
not use a reserved identifier.

Signed-off-by: Christopher Friedt <[email protected]>
@cfriedt cfriedt force-pushed the tests-posix-headers-update-existence-test branch from f3815fe to 9b233d5 Compare November 23, 2023 05:52
@cfriedt cfriedt requested a review from ycsin November 23, 2023 05:52
@cfriedt cfriedt merged commit 87635dd into zephyrproject-rtos:main Nov 25, 2023
@cfriedt cfriedt deleted the tests-posix-headers-update-existence-test branch November 25, 2023 11:29
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.

4 participants