Repository navigation
Conversation
In tx_event_flags_get, calling the function with requested_flags set to 0 and wait_option != TX_NO_WAIT enters the early return branch setting status = TX_NO_EVENTS, preventing suspension on zero events. Tests previously only covered this with TX_NO_WAIT. Added regression cases in both standard and SMP suites to verify immediate return when suspension is requested on zero event flags. In common_smp/src/tx_thread_smp_utilities.c, the simple priority change helper handles cases where the new priority is lower (numerically greater) than the thread's inherited priority by maintaining the thread's active priority and preempt threshold at the inherited priority. Added a test case in threadx_thread_priority_change.c to exercise this branch and properly restore thread priority state afterwards. Signed-off-by: Dev10-sys <kalpanagola9897@gmail.com>
…and FreeRTOS wrapper Add unit and regression tests to close remaining execution and coverage gaps across the ThreadX core scheduler, SMP time-slicing, module manager host suite, low-power and execution profile utilities, and the FreeRTOS compatibility layer: - test/tx/regression/threadx_thread_basic_execution_test.c: Exercise deferred _tx_thread_system_resume preemption handoff when _tx_thread_preempt_disable > 0 and higher- then lower-priority threads are resumed. - test/smp/regression/threadx_smp_time_slice_test.c: Exercise the SMP time-slice ready-list scan wraparound path when all ready equal-priority threads are currently executing on cores. - test/freertos/regression/: Add runtime tests covering queues, queue sets, semaphores, mutexes, task lifecycle, notifications, event groups, and software timers. - test/tx/low_power/ and test/tx/execution_profile/: Add standalone host tests for low-power enter/exit/next-timer helpers and execution profile tick/ISR/thread/idle counters. - test/tx/module_manager/: Add host tests covering module callback notification trampolines and queue deduplication, full module manager lifecycle and cleanup paths, and dispatcher parameter, range, and ownership validation. Signed-off-by: Dev10-sys <kalpanagola9897@gmail.com>
Contributor
|
Hi @Dev10-sys, thanks for adding these coverage tests. Could you cherry-pick Once the follow-up is open, I can revert that commit on #847 so this PR stays focused on the zero-event wait and SMP priority-inheritance tests. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR checklist
Description
While checking the regression test suites with code coverage enabled, I noticed a couple of real branches in the kernel that were never hit by existing tests. I added targeted test cases to cover both paths and protect against regression.
The first gap was in
tx_event_flags_get. The kernel includes a safeguard where requesting zero event flags (requested_flags == 0) with suspension (wait_option != TX_NO_WAIT) immediately returnsTX_NO_EVENTSinstead of suspending the thread. Without this safeguard, a thread asking for zero events would suspend and deadlock waiting on nothing. The existing test suite only checked zero flags withTX_NO_WAIT, leaving the suspension branch unverified. I added test cases in both the standard (test/tx) and SMP (test/smp) regression tests to make sure requesting zero flags with a timeout returnsTX_NO_EVENTSimmediately and prevents accidental deadlocks.The second gap was in SMP priority inheritance inside
_tx_thread_smp_simple_priority_change(common_smp/src/tx_thread_smp_utilities.c). When a thread inherits a higher priority from a mutex and its base priority is changed to a lower priority (new_priority >= inherit_priority), the kernel must keep the running priority and preempt threshold at the inherited priority to prevent priority inversion. This branch had zero test coverage. I added a test case inthreadx_thread_priority_change.cto verify that the inherited priority is properly preserved when the new priority is lower, and that thread priority lists are cleanly restored.Local Testing
threadx_event_flag_basic_test(standard and SMP) andthreadx_thread_priority_change(SMP) locally with coverage enabled.tx_event_flags_get.cand lines 1074–1075 oftx_thread_smp_utilities.care now covered, bringingtx_thread_smp_utilities.cto 100% line coverage.