Ayah Kashkoul created a merge request: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1098

Project:Branches: AyahKash/rtems:ayah-psxmsgq-priority-tests to 
rtems/rtos/rtems:main
Author:   Ayah Kashkoul



Depends on: !1084 (adds mq_ispriority_np to mq_attr and selects discipline in 
mq_open). I’m proposing to keep feature work in !1084 (Xinhong’s MR) and add 
these tests so the change is covered by regression tests before merging to 
main. The test uses semaphores to deterministically control the order threads 
enter mq_receive(). I ran the test locally on erc32-sis and attached the 
psxmsgq05.scn.

#### Summary

This MR depends on 
[!1084](https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1084). It 
will fail to build until that MR is merged. This change is for adding a new 
POSIX message queue test, psxmsgq05, to cover the mq_ispriority_np attribute 
and the FIFO vs priority wake-up behavior.

#### Test Logic (2 Cases)

This MR adds a deterministic regression test suite \`psxmsgq05\` that verifies:

1. **Default FIFO discipline** (mq_ispriority_np=0): With two threads blocked 
in mq_receive(), the thread that blocked first receives the message first, 
regardless of thread priority.
2. **Opt-in Priority Wakeup discipline** (mq_ispriority_np=1): With two threads 
blocked in mq_receive(), the higher-priority thread receives the message first, 
regardless of blocking order.

#### Test Implementation

* Uses semaphores to control blocking order (low-priority thread blocks first, 
then high-priority thread).
* Uses sem_first_done so the main thread waits for the first receiver before 
sending the second message, avoiding timing-based synchronization. It is better 
to avoid usleep() for a more deterministic approach that is less reliant on 
time, especially when used outside a local environment.
* Uses pthread_mutex for the winner variable 
* Sets thread priorities with PTHREAD_EXPLICIT_SCHED and SCHED_FIFO.

#### Explanation of Changed Files

* testsuites/psxtests/psxmsgq05/init.c – test implementation is contained here 
and follows existing patterns
* testsuites/psxtests/psxmsgq05/psxmsgq05.doc – test description, following 
existing patterns
* testsuites/psxtests/psxmsgq05/psxmsgq05.scn – expected output, following 
existing patterns
* spec/build/testsuites/psxtests/psxmsgq05.yml – build spec, following existing 
patterns
* spec/build/testsuites/psxtests/grp.yml – add psxmsgq05 to build, following 
existing patterns

#### Important: Related Change

This test uses the mq_ispriority_np attribute introduced in mqueueopen.c for 
per-queue FIFO vs priority wake-up discipline in MR !1089 
[4](https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1084) (issue 
[#3791](https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/3791)) which has not 
been merged yet. This must be merged in first.

Updates [#3791](https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/3791)

## Generative AI

<!--If you have used AI please use the "AI Contribution" template otherwise 
leave this blank see our fulls statement at 
https://www.rtems.org/generative-ai/-->

<!--Default settings, if it is a dropdown it will set after submission-->

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1098
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to