summaryrefslogtreecommitdiff
path: root/test/smp/regression/testcontrol.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/smp/regression/testcontrol.c')
-rw-r--r--test/smp/regression/testcontrol.c136
1 files changed, 73 insertions, 63 deletions
diff --git a/test/smp/regression/testcontrol.c b/test/smp/regression/testcontrol.c
index 6b45750d..1c3b2ccf 100644
--- a/test/smp/regression/testcontrol.c
+++ b/test/smp/regression/testcontrol.c
@@ -1,4 +1,16 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This is the test control routine of the ThreadX kernel. All tests are dispatched from this routine. */
+// Some portions generated by Codex (gpt 5.5).
#define TX_THREAD_SMP_SOURCE_CODE
@@ -209,7 +221,7 @@ void threadx_semaphore_information_application_define(void *);
void threadx_thread_basic_execution_application_define(void *);
void threadx_thread_completed_application_define(void *);
void threadx_thread_relinquish_application_define(void *);
-void threadx_thread_simple_supsend_application_define(void *);
+void threadx_thread_simple_suspend_application_define(void *);
void threadx_thread_multiple_suspension_application_define(void *);
void threadx_thread_multiple_non_current_suspension_application_define(void *);
void threadx_thread_multi_level_preemption_threshold_application_define(void *);
@@ -250,8 +262,8 @@ void threadx_smp_two_threads_one_core_test(void *first_unused_memory);
void threadx_smp_multiple_threads_one_core_test(void *first_unused_memory);
void threadx_smp_one_thread_dynamic_exclusion_test(void *first_unused_memory);
void threadx_smp_non_trivial_scheduling_test(void *first_unused_memory);
-void threadx_smp_resume_suspend_accending_order_test(void *first_unused_memory);
-void threadx_smp_resume_suspend_decending_order_test(void *first_unused_memory);
+void threadx_smp_resume_suspend_ascending_order_test(void *first_unused_memory);
+void threadx_smp_resume_suspend_descending_order_test(void *first_unused_memory);
void threadx_smp_preemption_threshold_test(void *first_unused_memory);
void threadx_smp_relinquish_test(void *first_unused_memory);
void threadx_smp_time_slice_test(void *first_unused_memory);
@@ -274,8 +286,8 @@ TEST_ENTRY test_control_tests[] =
threadx_smp_multiple_threads_one_core_test,
threadx_smp_one_thread_dynamic_exclusion_test,
threadx_smp_non_trivial_scheduling_test,
- threadx_smp_resume_suspend_accending_order_test,
- threadx_smp_resume_suspend_decending_order_test,
+ threadx_smp_resume_suspend_ascending_order_test,
+ threadx_smp_resume_suspend_descending_order_test,
threadx_smp_preemption_threshold_test,
threadx_smp_relinquish_test,
threadx_smp_time_slice_test,
@@ -353,7 +365,7 @@ TEST_ENTRY test_control_tests[] =
threadx_thread_basic_execution_application_define,
threadx_thread_completed_application_define,
threadx_thread_relinquish_application_define,
- threadx_thread_simple_supsend_application_define,
+ threadx_thread_simple_suspend_application_define,
threadx_thread_multiple_suspension_application_define,
threadx_thread_multiple_non_current_suspension_application_define,
threadx_thread_multi_level_preemption_threshold_application_define,
@@ -1355,6 +1367,10 @@ UINT i;
/* Clear the ISR dispatch. */
test_isr_dispatch = TX_NULL;
+#ifdef TX_WIN32_PROFILE_ENABLE
+ _tx_win32_profile_reset();
+#endif
+
/* Dispatch the test. */
(test_control_tests[i++].test_entry)(test_free_memory_ptr);
@@ -1429,12 +1445,16 @@ UINT old_posture = TX_INT_ENABLE;
/* Are interrupts disabled? */
if (old_posture == TX_INT_DISABLE)
{
-
- /* System error - interrupts should alwasy be enabled in our test threads! */
+
+ /* System error - interrupts should always be enabled in our test threads! */
printf(" ***** SYSTEM ERROR ***** test returned with interrupts disabled!\n");
test_control_system_errors++;
}
+#ifdef TX_WIN32_PROFILE_ENABLE
+ _tx_win32_profile_report("smp_test");
+#endif
+
/* Resume the control thread to fully exit the test. */
tx_thread_resume(&test_control_thread);
}
@@ -1447,6 +1467,51 @@ TX_MUTEX *mutex_ptr;
TX_THREAD *thread_ptr;
+ /* Delete all threads, except for timer thread, and test control thread.
+ This ensures application-owned objects are no longer referenced before
+ the object cleanup loops below attempt to delete them. */
+ while (_tx_thread_created_ptr)
+ {
+
+ /* Setup working pointer. */
+ thread_ptr = _tx_thread_created_ptr;
+
+
+#ifdef TX_TIMER_PROCESS_IN_ISR
+
+ /* Determine if there are more threads to delete. */
+ if (_tx_thread_created_count == 1)
+ break;
+
+ /* Determine if this thread is the test control thread. */
+ if (thread_ptr == &test_control_thread)
+ {
+
+ /* Move to the next thread pointer. */
+ thread_ptr = thread_ptr -> tx_thread_created_next;
+ }
+#else
+
+ /* Determine if there are more threads to delete. */
+ if (_tx_thread_created_count == 2)
+ break;
+
+ /* Move to the thread not protected. */
+ while ((thread_ptr == &_tx_timer_thread) || (thread_ptr == &test_control_thread))
+ {
+
+ /* Yes, move to the next thread. */
+ thread_ptr = thread_ptr -> tx_thread_created_next;
+ }
+#endif
+
+ /* First terminate the thread to ensure it is ready for deletion. */
+ tx_thread_terminate(thread_ptr);
+
+ /* Delete the thread. */
+ tx_thread_delete(thread_ptr);
+ }
+
/* Delete all queues. */
while(_tx_queue_created_ptr)
{
@@ -1524,49 +1589,6 @@ TX_THREAD *thread_ptr;
tx_mutex_delete(mutex_ptr);
}
- /* Delete all threads, except for timer thread, and test control thread. */
- while (_tx_thread_created_ptr)
- {
-
- /* Setup working pointer. */
- thread_ptr = _tx_thread_created_ptr;
-
-
-#ifdef TX_TIMER_PROCESS_IN_ISR
-
- /* Determine if there are more threads to delete. */
- if (_tx_thread_created_count == 1)
- break;
-
- /* Determine if this thread is the test control thread. */
- if (thread_ptr == &test_control_thread)
- {
-
- /* Move to the next thread pointer. */
- thread_ptr = thread_ptr -> tx_thread_created_next;
- }
-#else
-
- /* Determine if there are more threads to delete. */
- if (_tx_thread_created_count == 2)
- break;
-
- /* Move to the thread not protected. */
- while ((thread_ptr == &_tx_timer_thread) || (thread_ptr == &test_control_thread))
- {
-
- /* Yes, move to the next thread. */
- thread_ptr = thread_ptr -> tx_thread_created_next;
- }
-#endif
-
- /* First terminate the thread to ensure it is ready for deletion. */
- tx_thread_terminate(thread_ptr);
-
- /* Delete the thread. */
- tx_thread_delete(thread_ptr);
- }
-
/* At this point, only the test control thread and the system timer thread and/or mutex should still be
in the system. */
}
@@ -1609,15 +1631,3 @@ void test_exit_notify(TX_THREAD *thread_ptr, UINT type)
/* Clear the suspending flag to short-circuit the suspension. */
thread_ptr -> tx_thread_suspending = TX_FALSE;
}
-
-__attribute__((weak)) void abort_all_threads_suspended_on_mutex(void)
-{
-}
-
-__attribute__((weak)) void suspend_lowest_priority(void)
-{
-}
-
-__attribute__((weak)) void abort_and_resume_byte_allocating_thread(void)
-{
-}