diff options
| author | Frédéric Desbiens <[email protected]> | 2026-06-08 10:01:32 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-06-08 10:01:32 +0200 |
| commit | 87ab09cce305eb9cd4aacac4e8c62af72f665bff (patch) | |
| tree | dd062ebbea5235d1921c64b396bf7e4ce79e9e15 /test | |
| parent | 9ab0cf9683f832cdb48e2099533a5b06a3afcd64 (diff) | |
| parent | 730b61874bc5cf40768987605ae5187fde0fa1e2 (diff) | |
Merge pull request #544 from eclipse-threadx/devv6.5.1.202602_rel
Merging changes for the v.6.5.1.202602 release
Diffstat (limited to 'test')
241 files changed, 4693 insertions, 593 deletions
diff --git a/test/shared/regression/testcontrol_weak_defaults.c b/test/shared/regression/testcontrol_weak_defaults.c new file mode 100644 index 00000000..b93a28e5 --- /dev/null +++ b/test/shared/regression/testcontrol_weak_defaults.c @@ -0,0 +1,49 @@ +/*************************************************************************** + * 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. + * + * AI Disclosure: This file was largely AI-generated by Codex (gpt 5.4). + * The AI-generated portions may be considered public domain (CC0-1.0) + * and not subject to the project's licence. The human contributor has + * reviewed and verified that the code is correct. + * + * SPDX-License-Identifier: MIT and CC0-1.0 + **************************************************************************/ + +#ifdef _MSC_VER +#if defined(_M_IX86) +#define TX_TEST_LINKER_ALIAS(symbol, default_symbol) __pragma(comment(linker, "/alternatename:_" #symbol "=_" #default_symbol)) +#else +#define TX_TEST_LINKER_ALIAS(symbol, default_symbol) __pragma(comment(linker, "/alternatename:" #symbol "=" #default_symbol)) +#endif + +void tx_test_default_abort_all_threads_suspended_on_mutex(void) +{ +} +TX_TEST_LINKER_ALIAS(abort_all_threads_suspended_on_mutex, tx_test_default_abort_all_threads_suspended_on_mutex) + +void tx_test_default_suspend_lowest_priority(void) +{ +} +TX_TEST_LINKER_ALIAS(suspend_lowest_priority, tx_test_default_suspend_lowest_priority) + +void tx_test_default_abort_and_resume_byte_allocating_thread(void) +{ +} +TX_TEST_LINKER_ALIAS(abort_and_resume_byte_allocating_thread, tx_test_default_abort_and_resume_byte_allocating_thread) +#else +__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) +{ +} +#endif diff --git a/test/smp/cmake/CMakeLists.txt b/test/smp/cmake/CMakeLists.txt index f57d253c..e2ca8627 100644 --- a/test/smp/cmake/CMakeLists.txt +++ b/test/smp/cmake/CMakeLists.txt @@ -2,11 +2,19 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0057 NEW) +if((DEFINED THREADX_ARCH) AND (THREADX_ARCH STREQUAL "win64")) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +endif() + project(threadx_smp_test LANGUAGES C) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_EXTENSIONS OFF) + # Set build configurations -set(BUILD_CONFIGURATIONS default_build_coverage - disable_notify_callbacks_build stack_checking_build stack_checking_rand_fill_build +set(BUILD_CONFIGURATIONS default_build_coverage disable_notify_callbacks_build + stack_checking_build stack_checking_rand_fill_build trace_build) set(CMAKE_CONFIGURATION_TYPES ${BUILD_CONFIGURATIONS} @@ -23,26 +31,31 @@ endif() message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.") -set(default_build_coverage -DTX_QUEUE_MESSAGE_MAX_SIZE=32) -set(disable_notify_callbacks_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_DISABLE_NOTIFY_CALLBACKS) -set(stack_checking_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_STACK_CHECKING) -set(stack_checking_rand_fill_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_STACK_CHECKING -DTX_ENABLE_RANDOM_NUMBER_STACK_FILLING) -set(trace_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_EVENT_TRACE) +set(default_build_coverage TX_QUEUE_MESSAGE_MAX_SIZE=32) +set(disable_notify_callbacks_build TX_QUEUE_MESSAGE_MAX_SIZE=32 TX_DISABLE_NOTIFY_CALLBACKS) +set(stack_checking_build TX_QUEUE_MESSAGE_MAX_SIZE=32 TX_ENABLE_STACK_CHECKING) +set(stack_checking_rand_fill_build TX_QUEUE_MESSAGE_MAX_SIZE=32 TX_ENABLE_STACK_CHECKING TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) +set(trace_build TX_QUEUE_MESSAGE_MAX_SIZE=32 TX_ENABLE_EVENT_TRACE) -add_compile_options( - -m32 - -std=c99 - -ggdb - -g3 - -gdwarf-2 - -fdiagnostics-color - # -Werror - -DTX_THREAD_SMP_ONLY_CORE_0_DEFAULT - -DTX_SMP_NOT_POSSIBLE - -DTX_REGRESSION_TEST - -DTEST_STACK_SIZE_PRINTF=4096 +add_compile_definitions( + TX_THREAD_SMP_ONLY_CORE_0_DEFAULT + TX_SMP_NOT_POSSIBLE + TX_REGRESSION_TEST + TEST_STACK_SIZE_PRINTF=4096 ${${CMAKE_BUILD_TYPE}}) -add_link_options(-m32) + +if(MSVC) + add_compile_options(/W3 /Zi) + add_link_options(/DEBUG /INCREMENTAL:NO) +else() + add_compile_options( + -m32 + -ggdb + -g3 + -gdwarf-2 + -fdiagnostics-color) + add_link_options(-m32) +endif() enable_testing() @@ -52,26 +65,31 @@ add_subdirectory(samples) # Coverage if(CMAKE_BUILD_TYPE MATCHES ".*_coverage") - target_compile_options(threadx_smp PRIVATE -fprofile-arcs -ftest-coverage) - target_link_options(threadx_smp PRIVATE -fprofile-arcs -ftest-coverage) + if(NOT MSVC) + target_compile_options(threadx_smp PRIVATE -fprofile-arcs -ftest-coverage) + target_link_options(threadx_smp PRIVATE -fprofile-arcs -ftest-coverage) + endif() endif() -target_compile_options( - threadx_smp - PRIVATE # -Werror - -Wall - -Wextra - -pedantic - -fmessage-length=0 - -fsigned-char - -ffunction-sections - -fdata-sections - -Wunused - -Wuninitialized - -Wmissing-declarations - -Wconversion - -Wpointer-arith - # -Wshadow - -Wlogical-op - -Waggregate-return - -Wfloat-equal) +if(MSVC) + target_compile_options(threadx_smp PRIVATE /W3) +else() + target_compile_options( + threadx_smp + PRIVATE + -Wall + -Wextra + -pedantic + -fmessage-length=0 + -fsigned-char + -ffunction-sections + -fdata-sections + -Wunused + -Wuninitialized + -Wmissing-declarations + -Wconversion + -Wpointer-arith + -Wlogical-op + -Waggregate-return + -Wfloat-equal) +endif() diff --git a/test/smp/cmake/coverage.sh b/test/smp/cmake/coverage.sh index 51b2e8ca..d35284f5 100755 --- a/test/smp/cmake/coverage.sh +++ b/test/smp/cmake/coverage.sh @@ -1,4 +1,15 @@ #!/bin/bash +############################################################################## +# 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 +############################################################################## + set -e diff --git a/test/smp/cmake/regression/CMakeLists.txt b/test/smp/cmake/regression/CMakeLists.txt index c2362620..b448ae3e 100644 --- a/test/smp/cmake/regression/CMakeLists.txt +++ b/test/smp/cmake/regression/CMakeLists.txt @@ -4,6 +4,16 @@ cmake_policy(SET CMP0057 NEW) project(regression_test LANGUAGES C) set(SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../regression) +set(REPO_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../..) +set(PORT_LOW_LEVEL_SOURCE ${REPO_ROOT}/ports_smp/${THREADX_ARCH}/${THREADX_TOOLCHAIN}/src/tx_initialize_low_level.c) +set(GENERATED_LOW_LEVEL_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/tx_initialize_low_level.c) +set(TESTCONTROL_WEAK_DEFAULTS_SOURCE ${REPO_ROOT}/test/shared/regression/testcontrol_weak_defaults.c) + +include_directories(${REPO_ROOT}/test/tx/regression) + +if(NOT EXISTS ${PORT_LOW_LEVEL_SOURCE}) + message(FATAL_ERROR "Unable to locate tx_initialize_low_level.c for ${THREADX_ARCH}/${THREADX_TOOLCHAIN}") +endif() set(regression_test_cases ${SOURCE_DIR}/threadx_block_memory_basic_test.c @@ -75,8 +85,8 @@ set(regression_test_cases ${SOURCE_DIR}/threadx_smp_random_resume_suspend_test.c ${SOURCE_DIR}/threadx_smp_rebalance_exclusion_test.c ${SOURCE_DIR}/threadx_smp_relinquish_test.c - ${SOURCE_DIR}/threadx_smp_resume_suspend_accending_order_test.c - ${SOURCE_DIR}/threadx_smp_resume_suspend_decending_order_test.c + ${SOURCE_DIR}/threadx_smp_resume_suspend_ascending_order_test.c + ${SOURCE_DIR}/threadx_smp_resume_suspend_descending_order_test.c ${SOURCE_DIR}/threadx_smp_time_slice_test.c ${SOURCE_DIR}/threadx_smp_two_threads_one_core_test.c ${SOURCE_DIR}/threadx_thread_basic_execution_test.c @@ -117,18 +127,38 @@ set(regression_test_cases ${SOURCE_DIR}/threadx_initialize_kernel_setup_test.c) add_custom_command( - OUTPUT ${SOURCE_DIR}/tx_initialize_low_level.c - COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/generate_test_file.sh + OUTPUT ${GENERATED_LOW_LEVEL_SOURCE} + COMMAND ${CMAKE_COMMAND} + -DSOURCE_FILE=${PORT_LOW_LEVEL_SOURCE} + -DOUTPUT_FILE=${GENERATED_LOW_LEVEL_SOURCE} + -P ${CMAKE_CURRENT_LIST_DIR}/generate_test_file.cmake + DEPENDS ${PORT_LOW_LEVEL_SOURCE} ${CMAKE_CURRENT_LIST_DIR}/generate_test_file.cmake COMMENT "Generating tx_initialize_low_level.c for test") -add_library(test_utility ${SOURCE_DIR}/tx_initialize_low_level.c - ${SOURCE_DIR}/testcontrol.c) -target_link_libraries(test_utility PUBLIC azrtos::threadx_smp) -target_compile_definitions(test_utility PUBLIC CTEST BATCH_TEST) +add_library(test_weak_defaults OBJECT ${TESTCONTROL_WEAK_DEFAULTS_SOURCE}) +target_link_libraries(test_weak_defaults PRIVATE azrtos::threadx_smp) +target_compile_definitions(test_weak_defaults PRIVATE CTEST BATCH_TEST + TEST_STACK_SIZE_PRINTF=4096) + +add_library(test_utility OBJECT ${GENERATED_LOW_LEVEL_SOURCE} + ${SOURCE_DIR}/testcontrol.c) +target_link_libraries(test_utility PRIVATE azrtos::threadx_smp) +target_compile_definitions(test_utility PRIVATE CTEST BATCH_TEST + TEST_STACK_SIZE_PRINTF=4096) foreach(test_case ${regression_test_cases}) get_filename_component(test_name ${test_case} NAME_WE) - add_executable(${test_name} ${test_case}) - target_link_libraries(${test_name} PRIVATE test_utility) + + if(test_name STREQUAL "threadx_initialize_kernel_setup_test") + add_executable(${test_name} ${test_case} $<TARGET_OBJECTS:test_weak_defaults>) + else() + add_executable(${test_name} ${test_case} + $<TARGET_OBJECTS:test_utility> + $<TARGET_OBJECTS:test_weak_defaults>) + target_compile_definitions(${test_name} PRIVATE CTEST BATCH_TEST + TEST_STACK_SIZE_PRINTF=4096) + endif() + + target_link_libraries(${test_name} PRIVATE azrtos::threadx_smp) add_test(${CMAKE_BUILD_TYPE}::${test_name} ${test_name}) endforeach() diff --git a/test/smp/cmake/regression/generate_test_file.cmake b/test/smp/cmake/regression/generate_test_file.cmake new file mode 100644 index 00000000..77cccaa5 --- /dev/null +++ b/test/smp/cmake/regression/generate_test_file.cmake @@ -0,0 +1,44 @@ +if(NOT DEFINED SOURCE_FILE) + message(FATAL_ERROR "SOURCE_FILE is required") +endif() + +if(NOT DEFINED OUTPUT_FILE) + message(FATAL_ERROR "OUTPUT_FILE is required") +endif() + +file(STRINGS "${SOURCE_FILE}" FILE_LINES) + +set(UPDATED_FILE_CONTENTS "") +set(DISPATCH_DECLARATION "VOID test_interrupt_dispatch(VOID);") +set(DISPATCH_CALL "test_interrupt_dispatch();") +set(DECLARATION_INSERTED FALSE) +set(CALL_INSERTED FALSE) + +foreach(FILE_LINE IN LISTS FILE_LINES) + if((NOT DECLARATION_INSERTED) AND + ((FILE_LINE MATCHES "^void[ \t]+\\*_tx_linux_timer_interrupt\\(void \\*p\\);[ \t]*$") + OR + (FILE_LINE MATCHES "^VOID[ \t]+_tx_win32_timer_interrupt\\(VOID\\);[ \t]*$") + OR + (FILE_LINE MATCHES "^VOID CALLBACK[ \t]+_tx_win32_timer_interrupt\\(UINT wTimerID, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2\\);[ \t]*$"))) + string(APPEND UPDATED_FILE_CONTENTS "${FILE_LINE}\n${DISPATCH_DECLARATION}\n") + set(DECLARATION_INSERTED TRUE) + elseif((NOT CALL_INSERTED) AND (FILE_LINE MATCHES "^([ \t]*)_tx_timer_interrupt\\(\\);[ \t]*$")) + string(APPEND UPDATED_FILE_CONTENTS "${CMAKE_MATCH_1}${DISPATCH_CALL}\n${FILE_LINE}\n") + set(CALL_INSERTED TRUE) + else() + string(APPEND UPDATED_FILE_CONTENTS "${FILE_LINE}\n") + endif() +endforeach() + +if(NOT CALL_INSERTED) + message(FATAL_ERROR "Unable to insert test interrupt dispatcher call into ${SOURCE_FILE}") +endif() + +if(NOT DECLARATION_INSERTED) + message(FATAL_ERROR "Unable to insert test interrupt dispatcher declaration into ${SOURCE_FILE}") +endif() + +get_filename_component(OUTPUT_DIRECTORY "${OUTPUT_FILE}" DIRECTORY) +file(MAKE_DIRECTORY "${OUTPUT_DIRECTORY}") +file(WRITE "${OUTPUT_FILE}" "${UPDATED_FILE_CONTENTS}") diff --git a/test/smp/cmake/regression/generate_test_file.sh b/test/smp/cmake/regression/generate_test_file.sh index 0172469a..495e363e 100755 --- a/test/smp/cmake/regression/generate_test_file.sh +++ b/test/smp/cmake/regression/generate_test_file.sh @@ -1,4 +1,15 @@ #!/bin/bash +############################################################################## +# 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 +############################################################################## + dst=$(dirname $0)/../../regression/tx_initialize_low_level.c src=$(dirname $0)/../../../../ports_smp/linux/gnu/src/tx_initialize_low_level.c diff --git a/test/smp/cmake/samples/fake.c b/test/smp/cmake/samples/fake.c index 8159fef4..f379e798 100644 --- a/test/smp/cmake/samples/fake.c +++ b/test/smp/cmake/samples/fake.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + #include "tx_api.h" typedef unsigned int TEST_FLAG; diff --git a/test/smp/cmake/threadx_smp/CMakeLists.txt b/test/smp/cmake/threadx_smp/CMakeLists.txt index f6596253..568fece4 100644 --- a/test/smp/cmake/threadx_smp/CMakeLists.txt +++ b/test/smp/cmake/threadx_smp/CMakeLists.txt @@ -1,11 +1,5 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) -# Set up the project -project(threadx_smp - VERSION 6.0.0 - LANGUAGES C ASM -) - if(NOT DEFINED THREADX_ARCH) message(FATAL_ERROR "Error: THREADX_ARCH not defined") endif() @@ -13,6 +7,17 @@ if(NOT DEFINED THREADX_TOOLCHAIN) message(FATAL_ERROR "Error: THREADX_TOOLCHAIN not defined") endif() +set(THREADX_SMP_PROJECT_LANGUAGES C) +if(NOT ((THREADX_ARCH STREQUAL "win64") AND (THREADX_TOOLCHAIN STREQUAL "vs_2022"))) + list(APPEND THREADX_SMP_PROJECT_LANGUAGES ASM) +endif() + +# Set up the project +project(threadx_smp + VERSION 6.0.0 + LANGUAGES ${THREADX_SMP_PROJECT_LANGUAGES} +) + set(PROJECT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../..) # Define our target library and an alias for consumers @@ -57,4 +62,4 @@ set(CPACK_SOURCE_IGNORE_FILES ".*~$" ) set(CPACK_VERBATIM_VARIABLES YES) -include(CPack)
\ No newline at end of file +include(CPack) diff --git a/test/smp/cmake/threadx_smp/ports_smp/win64/vs_2022/CMakeLists.txt b/test/smp/cmake/threadx_smp/ports_smp/win64/vs_2022/CMakeLists.txt new file mode 100644 index 00000000..6b219bb2 --- /dev/null +++ b/test/smp/cmake/threadx_smp/ports_smp/win64/vs_2022/CMakeLists.txt @@ -0,0 +1,29 @@ +set(CURRENT_DIR ${PROJECT_DIR}/ports_smp/win64/vs_2022) +target_sources(${PROJECT_NAME} + PRIVATE + # {{BEGIN_TARGET_SOURCES}} + ${CURRENT_DIR}/src/tx_initialize_low_level.c + ${CURRENT_DIR}/src/tx_thread_context_restore.c + ${CURRENT_DIR}/src/tx_thread_context_save.c + ${CURRENT_DIR}/src/tx_thread_interrupt_control.c + ${CURRENT_DIR}/src/tx_thread_schedule.c + ${CURRENT_DIR}/src/tx_thread_smp_core_get.c + ${CURRENT_DIR}/src/tx_thread_smp_core_preempt.c + ${CURRENT_DIR}/src/tx_thread_smp_current_state_get.c + ${CURRENT_DIR}/src/tx_thread_smp_current_thread_get.c + ${CURRENT_DIR}/src/tx_thread_smp_initialize_wait.c + ${CURRENT_DIR}/src/tx_thread_smp_low_level_initialize.c + ${CURRENT_DIR}/src/tx_thread_smp_protect.c + ${CURRENT_DIR}/src/tx_thread_smp_time_get.c + ${CURRENT_DIR}/src/tx_thread_smp_unprotect.c + ${CURRENT_DIR}/src/tx_thread_stack_build.c + ${CURRENT_DIR}/src/tx_thread_system_return.c + ${CURRENT_DIR}/src/tx_timer_interrupt.c + + # {{END_TARGET_SOURCES}} +) + +target_include_directories(${PROJECT_NAME} + PUBLIC + ${CURRENT_DIR}/inc +) 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) -{ -} diff --git a/test/smp/regression/threadx_block_memory_basic_test.c b/test/smp/regression/threadx_block_memory_basic_test.c index 12e301d1..28edee3f 100644 --- a/test/smp/regression/threadx_block_memory_basic_test.c +++ b/test/smp/regression/threadx_block_memory_basic_test.c @@ -1,8 +1,20 @@ +/***************************************************************************/ +/* 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 test is designed to test simple memory block pool creation, deletion, and allocates and releases. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" typedef struct BLOCK_MEMORY_TEST_STRUCT { @@ -86,7 +98,7 @@ CHAR *pointer; /* Attempt to create a block pool from a timer. */ pointer = (CHAR *) 0x30000; - status = tx_block_pool_create(&pool_3, "pool 3", 100, pointer, 320); + status = tx_block_pool_create(&pool_3, "pool 3", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); /* Check status. */ if (status != TX_CALLER_ERROR) @@ -146,7 +158,7 @@ UINT status; } /* Attempt to create a block pool from an ISR. */ - status = tx_block_pool_create(&pool_3, "pool 3", 100, (void *) 0x100000, 320); + status = tx_block_pool_create(&pool_3, "pool 3", 100, (void *) 0x100000, TX_TEST_BLOCK_POOL_BYTES(100, 3)); /* Check status. */ if (status != TX_CALLER_ERROR) @@ -217,8 +229,8 @@ CHAR *pointer; } /* Create block pools 0 and 1. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -228,8 +240,8 @@ CHAR *pointer; test_control_return(1); } - status = tx_block_pool_create(&pool_1, "pool 1", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_1, "pool 1", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -241,7 +253,7 @@ CHAR *pointer; /* Check the no-blocks path. */ status = _tx_block_pool_create(&pool_2, "pool 2", 100, pointer, 50); - pointer = pointer + 320; + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SIZE_ERROR) @@ -265,7 +277,7 @@ CHAR *pointer_2; CHAR *pointer_3; CHAR *pointer_4; INT i; -unsigned long fake_block[20]; +TX_TEST_POINTER_WORD fake_block[20]; /* Inform user. */ @@ -316,7 +328,7 @@ unsigned long fake_block[20]; /* Try to release a block that points to a non-pool. */ fake_block[0] = 0; - fake_block[1] = (unsigned long) &fake_block[0]; + TX_TEST_STORE_POINTER(fake_block[1], &fake_block[0]); status = tx_block_release(&fake_block[2]); /* Check status. */ @@ -519,7 +531,7 @@ unsigned long fake_block[20]; { /* Block memory error. */ - printf("ERROR #20\n"); + printf("ERROR #20 (%lu %lu %lu)\n", error, timer_executed, isr_executed); test_control_return(1); } diff --git a/test/smp/regression/threadx_block_memory_error_detection_test.c b/test/smp/regression/threadx_block_memory_error_detection_test.c index 7b7f2f61..41148120 100644 --- a/test/smp/regression/threadx_block_memory_error_detection_test.c +++ b/test/smp/regression/threadx_block_memory_error_detection_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test error detection for simple memory block operations. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -49,18 +61,18 @@ INT status; pointer = pointer + TEST_STACK_SIZE_PRINTF; /* Create block pool 0. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); #ifndef TX_DISABLE_ERROR_CHECKING /* skip this test and pretend it passed */ /* Create block pool again to get pool_ptr error. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); if (status != TX_POOL_ERROR) return; /* Create block pool with NULL pointer. */ - status = tx_block_pool_create(TX_NULL, "pool 0", 100, pointer, 320); + status = tx_block_pool_create(TX_NULL, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); if (status != TX_POOL_ERROR) { @@ -69,7 +81,7 @@ INT status; } /* Create block pool pointer if NULL start. */ - status = tx_block_pool_create(&pool_1, "pool 0", 100, NULL, 320); + status = tx_block_pool_create(&pool_1, "pool 0", 100, NULL, TX_TEST_BLOCK_POOL_BYTES(100, 3)); if (status != TX_PTR_ERROR) { @@ -128,11 +140,11 @@ INT i; #ifndef TX_DISABLE_ERROR_CHECKING /* skip this test and pretend it passed */ - status = tx_block_pool_create(&pool_1, "pool 1", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_1, "pool 1", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Attempt to create a pool with an invalid size. */ - status = _txe_block_pool_create(&pool_2, "pool 2", 100, pointer, 320, 777777); + status = _txe_block_pool_create(&pool_2, "pool 2", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3), 777777); if (status != TX_POOL_ERROR) { @@ -384,4 +396,3 @@ INT i; printf("SUCCESS!\n"); test_control_return(0); } - diff --git a/test/smp/regression/threadx_block_memory_information_test.c b/test/smp/regression/threadx_block_memory_information_test.c index 20e34d88..82d57f40 100644 --- a/test/smp/regression/threadx_block_memory_information_test.c +++ b/test/smp/regression/threadx_block_memory_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test block memory information services. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_block_memory_prioritize_test.c b/test/smp/regression/threadx_block_memory_prioritize_test.c index 6238aef8..3b2c4f0b 100644 --- a/test/smp/regression/threadx_block_memory_prioritize_test.c +++ b/test/smp/regression/threadx_block_memory_prioritize_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test block memory pool prioritize. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_block_memory_suspension_test.c b/test/smp/regression/threadx_block_memory_suspension_test.c index da14f454..fb68a6f9 100644 --- a/test/smp/regression/threadx_block_memory_suspension_test.c +++ b/test/smp/regression/threadx_block_memory_suspension_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test suspension on memory block pools. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -83,8 +95,8 @@ CHAR *pointer; } /* Create block pool. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -308,4 +320,3 @@ CHAR *pointer_1; } } - diff --git a/test/smp/regression/threadx_block_memory_suspension_timeout_test.c b/test/smp/regression/threadx_block_memory_suspension_timeout_test.c index dc460662..43477285 100644 --- a/test/smp/regression/threadx_block_memory_suspension_timeout_test.c +++ b/test/smp/regression/threadx_block_memory_suspension_timeout_test.c @@ -1,7 +1,21 @@ +/***************************************************************************/ +/* 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 test is designed to test timeouts on suspension on memory block pools. */ +// Some portions generated by Codex (gpt 5.4). + #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -84,8 +98,8 @@ CHAR *pointer; } /* Create block pool. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -135,15 +149,15 @@ CHAR *pointer_3; /* Set all the memory of the blocks. */ TX_MEMSET(pointer_3, (CHAR) 0xEF, 100); - /* Sleep for 64 ticks to allow the other thread 6 timeouts on the block - pool. */ + /* Sleep long enough to allow the other threads to complete their expected + timeout cycles on the block pool. */ tx_thread_sleep(64); /* Incrment the run counter. */ thread_0_counter++; /* Check the counter of the other thread. */ - if ((thread_1_counter != 6) || (thread_2_counter != 3)) + if ((thread_1_counter != 6UL) || (thread_2_counter != 3UL)) { /* Block memory error. */ @@ -209,4 +223,3 @@ CHAR *pointer_1; thread_2_counter++; } } - diff --git a/test/smp/regression/threadx_block_memory_thread_terminate_test.c b/test/smp/regression/threadx_block_memory_thread_terminate_test.c index 6064891d..89e0c787 100644 --- a/test/smp/regression/threadx_block_memory_thread_terminate_test.c +++ b/test/smp/regression/threadx_block_memory_thread_terminate_test.c @@ -1,8 +1,20 @@ +/***************************************************************************/ +/* 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 test is designed to test thread termination on a thread suspended on a block memory pool. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -69,8 +81,8 @@ CHAR *pointer; } /* Create block pool. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -182,4 +194,3 @@ CHAR *pointer_1; thread_1_counter++; } } - diff --git a/test/smp/regression/threadx_byte_memory_basic_test.c b/test/smp/regression/threadx_byte_memory_basic_test.c index 36f41331..45a2518d 100644 --- a/test/smp/regression/threadx_byte_memory_basic_test.c +++ b/test/smp/regression/threadx_byte_memory_basic_test.c @@ -1,8 +1,20 @@ +/***************************************************************************/ +/* 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 test is designed to test simple memory byte pool creation, deletion, and allocates and releases. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" typedef struct BYTE_MEMORY_TEST_STRUCT { @@ -91,7 +103,7 @@ CHAR *pointer; /* Attempt to create a byte pool from a timer. */ pointer = (CHAR *) 0x30000; - status = tx_byte_pool_create(&pool_2, "pool 2", pointer, 108); + status = tx_byte_pool_create(&pool_2, "pool 2", pointer, TX_TEST_BYTE_POOL_BYTES(108)); /* Check status. */ if (status != TX_CALLER_ERROR) @@ -103,7 +115,7 @@ CHAR *pointer; /* Attempt to create a byte pool with an invalid size. */ status = _txe_byte_pool_create(&pool_3, "pool 3", pointer, - 108, (sizeof(TX_BYTE_POOL)+1)); + TX_TEST_BYTE_POOL_BYTES(108), (sizeof(TX_BYTE_POOL)+1)); /* Check status. */ if (status != TX_POOL_ERROR) @@ -186,7 +198,7 @@ UINT status; /* Attempt to create a byte pool from an ISR. */ - status = tx_byte_pool_create(&pool_2, "pool 0", (void *) 0x100000, 108); + status = tx_byte_pool_create(&pool_2, "pool 0", (void *) 0x100000, TX_TEST_BYTE_POOL_BYTES(108)); /* Check status. */ if (status != TX_CALLER_ERROR) @@ -256,8 +268,8 @@ CHAR *pointer; } /* Create byte pools 0 and 1. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer, 108); - pointer = pointer + 108; + status = tx_byte_pool_create(&pool_0, "pool 0", pointer, TX_TEST_BYTE_POOL_CAPACITY_BYTES(24, 3)); + pointer = pointer + TX_TEST_BYTE_POOL_CAPACITY_BYTES(24, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -267,8 +279,8 @@ CHAR *pointer; test_control_return(1); } - status = tx_byte_pool_create(&pool_1, "pool 1", pointer, 200); - pointer = pointer + 200; + status = tx_byte_pool_create(&pool_1, "pool 1", pointer, TX_TEST_BYTE_POOL_BYTES(200)); + pointer = pointer + TX_TEST_BYTE_POOL_BYTES(200); /* Check status. */ if (status != TX_SUCCESS) @@ -279,9 +291,9 @@ CHAR *pointer; } /* Test for search pointer issue on wrapped seach with prior block to search pointer merged. */ - status = tx_byte_pool_create(&pool_4, "pool 4", pointer, 300); + status = tx_byte_pool_create(&pool_4, "pool 4", pointer, TX_TEST_BYTE_POOL_CAPACITY_BYTES(84, 3)); pool_4_memory = pointer; - pointer = pointer + 300; + pointer = pointer + TX_TEST_BYTE_POOL_CAPACITY_BYTES(84, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -353,7 +365,7 @@ CHAR *pointer_2; CHAR *pointer_3; CHAR *pointer_4; INT i; -ULONG array[20]; +TX_TEST_POINTER_WORD array[20]; UCHAR *save_search; @@ -394,7 +406,7 @@ UCHAR *save_search; /* Try to create a NULL pool. */ pointer_1 = (CHAR *) 0x30000; - status = tx_byte_pool_create(TX_NULL, "pool 0", pointer_1, 108); + status = tx_byte_pool_create(TX_NULL, "pool 0", pointer_1, TX_TEST_BYTE_POOL_BYTES(108)); /* Check status. */ if (status != TX_POOL_ERROR) @@ -406,7 +418,7 @@ UCHAR *save_search; } /* Try to create the same pool. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer_1, 108); + status = tx_byte_pool_create(&pool_0, "pool 0", pointer_1, TX_TEST_BYTE_POOL_BYTES(108)); /* Check status. */ if (status != TX_POOL_ERROR) @@ -418,7 +430,7 @@ UCHAR *save_search; } /* Try to create a pool with a NULL start address. */ - status = tx_byte_pool_create(&pool_2, "pool 2", TX_NULL, 108); + status = tx_byte_pool_create(&pool_2, "pool 2", TX_NULL, TX_TEST_BYTE_POOL_BYTES(108)); /* Check status. */ if (status != TX_PTR_ERROR) @@ -626,7 +638,7 @@ UCHAR *save_search; /* Test another bad block release.... pool pointer is not a valid pool! */ array[0] = 0; - array[1] = (ULONG) &array[3]; + TX_TEST_STORE_POINTER(array[1], &array[3]); array[2] = 0; array[3] = 0; status = _tx_byte_release(&array[2]); @@ -865,7 +877,7 @@ UCHAR *save_search; } /* Move the search pointer to the third block to exercise that code in the byte search algorithm. */ - pool_0.tx_byte_pool_search = (UCHAR *) pointer_3-8; + pool_0.tx_byte_pool_search = (UCHAR *) pointer_3 - TX_TEST_BYTE_POOL_SEARCH_OFFSET; /* Now allocate the block again. */ status = tx_byte_allocate(&pool_0, (VOID **) &pointer_2, 24, TX_NO_WAIT); @@ -885,7 +897,7 @@ UCHAR *save_search; status += tx_byte_release(pointer_1); /* Move the search pointer to the third block to exercise that code in the byte search algorithm. */ - pool_0.tx_byte_pool_search = (UCHAR *) pointer_3-8; + pool_0.tx_byte_pool_search = (UCHAR *) pointer_3 - TX_TEST_BYTE_POOL_SEARCH_OFFSET; /* Allocate a large block to force the search pointer update. */ status = tx_byte_allocate(&pool_0, (VOID **) &pointer_3, 88, TX_NO_WAIT); @@ -961,7 +973,7 @@ UCHAR *save_search; } /* Create pool 4. */ - status = tx_byte_pool_create(&pool_4, "pool 4", pool_4_memory, 300); + status = tx_byte_pool_create(&pool_4, "pool 4", pool_4_memory, TX_TEST_BYTE_POOL_CAPACITY_BYTES(84, 3)); /* Check status. */ if (status != TX_SUCCESS) @@ -1061,4 +1073,3 @@ UCHAR *save_search; printf("SUCCESS!\n"); test_control_return(0); } - diff --git a/test/smp/regression/threadx_byte_memory_information_test.c b/test/smp/regression/threadx_byte_memory_information_test.c index 8a619269..f1624a65 100644 --- a/test/smp/regression/threadx_byte_memory_information_test.c +++ b/test/smp/regression/threadx_byte_memory_information_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test byte memory information. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" #include "tx_byte_pool.h" @@ -193,7 +205,7 @@ CHAR *pointer; } /* Create the byte_pool with one byte. */ - status = tx_byte_pool_create(&byte_pool_0, "byte_pool 0", pointer, 100); + status = tx_byte_pool_create(&byte_pool_0, "byte_pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(100)); pointer = pointer + 100; /* Check for status. */ diff --git a/test/smp/regression/threadx_byte_memory_prioritize_test.c b/test/smp/regression/threadx_byte_memory_prioritize_test.c index 29407135..db36e386 100644 --- a/test/smp/regression/threadx_byte_memory_prioritize_test.c +++ b/test/smp/regression/threadx_byte_memory_prioritize_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test byte memory prioritize. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" /* Define the ISR dispatch. */ @@ -197,7 +209,7 @@ CHAR *pointer; } /* Create the byte_pool with one byte. */ - status = tx_byte_pool_create(&byte_pool_0, "byte_pool 0", pointer, 100); + status = tx_byte_pool_create(&byte_pool_0, "byte_pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(100)); pointer = pointer + 100; /* Check for status. */ @@ -495,4 +507,3 @@ VOID *pointer; thread_6_counter++; } } - diff --git a/test/smp/regression/threadx_byte_memory_suspension_test.c b/test/smp/regression/threadx_byte_memory_suspension_test.c index ba159894..3af5fc81 100644 --- a/test/smp/regression/threadx_byte_memory_suspension_test.c +++ b/test/smp/regression/threadx_byte_memory_suspension_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test suspension on a memory byte pool. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -121,8 +133,8 @@ CHAR *pointer; } /* Create byte pool 0. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer, 108); - pointer = pointer + 108; + status = tx_byte_pool_create(&pool_0, "pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(108)); + pointer = pointer + TX_TEST_BYTE_POOL_BYTES(108); /* Check status. */ if (status != TX_SUCCESS) diff --git a/test/smp/regression/threadx_byte_memory_suspension_timeout_test.c b/test/smp/regression/threadx_byte_memory_suspension_timeout_test.c index 5e94df97..c92f2be0 100644 --- a/test/smp/regression/threadx_byte_memory_suspension_timeout_test.c +++ b/test/smp/regression/threadx_byte_memory_suspension_timeout_test.c @@ -1,7 +1,21 @@ +/***************************************************************************/ +/* 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 test is designed to test suspension timeout on a memory byte pool. */ +// Some portions generated by Codex (gpt 5.4). + #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -85,8 +99,8 @@ CHAR *pointer; } /* Create byte pool 0. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer, 108); - pointer = pointer + 108; + status = tx_byte_pool_create(&pool_0, "pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(108)); + pointer = pointer + TX_TEST_BYTE_POOL_BYTES(108); /* Check status. */ if (status != TX_SUCCESS) @@ -126,12 +140,12 @@ CHAR *pointer; test_control_return(1); } - /* Sleep to allow the other thread to suspend and timeout on the memory - pool once. */ + /* Sleep long enough to allow the other threads to complete their expected + timeout cycles on the byte pool. */ tx_thread_sleep(64); /* Check the counter of the other thread. */ - if ((thread_1_counter != 6) || (thread_2_counter != 3)) + if ((thread_1_counter != 6UL) || (thread_2_counter != 3UL)) { /* Block memory error. */ diff --git a/test/smp/regression/threadx_byte_memory_thread_contention_test.c b/test/smp/regression/threadx_byte_memory_thread_contention_test.c index 899ed269..96573955 100644 --- a/test/smp/regression/threadx_byte_memory_thread_contention_test.c +++ b/test/smp/regression/threadx_byte_memory_thread_contention_test.c @@ -1,8 +1,20 @@ +/***************************************************************************/ +/* 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 test is designed to test contention of two threads on a single memory byte pool. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -89,8 +101,8 @@ CHAR *pointer; } /* Create byte pool 0. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer, 108); - pointer = pointer + 108; + status = tx_byte_pool_create(&pool_0, "pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(108)); + pointer = pointer + TX_TEST_BYTE_POOL_BYTES(108); /* Save off the intial pool size. */ initial_pool_size = pool_0.tx_byte_pool_available; @@ -126,7 +138,6 @@ CHAR *pointer; while(1) { - /* Allocate memory from the pool. This size will cause merge activity because the search pointer will sit in this large block about half the time. */ @@ -195,10 +206,8 @@ static void thread_1_entry(ULONG thread_input) UINT status; CHAR *pointer; - while(test_done == TX_FALSE) { - /* Allocate memory from the pool. */ status = tx_byte_allocate(&pool_0, (VOID **) &pointer, 30, TX_WAIT_FOREVER); @@ -228,10 +237,8 @@ static void thread_2_entry(ULONG thread_input) UINT status; CHAR *pointer; - while(test_done == TX_FALSE) { - /* Allocate memory from the pool. */ status = tx_byte_allocate(&pool_0, (VOID **) &pointer, 12, TX_WAIT_FOREVER); diff --git a/test/smp/regression/threadx_byte_memory_thread_terminate_test.c b/test/smp/regression/threadx_byte_memory_thread_terminate_test.c index 4805ba57..b752f340 100644 --- a/test/smp/regression/threadx_byte_memory_thread_terminate_test.c +++ b/test/smp/regression/threadx_byte_memory_thread_terminate_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test termination on thread suspended on memory byte pool. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -68,8 +80,8 @@ CHAR *pointer; } /* Create byte pools 0 and 1. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer, 108); - pointer = pointer + 108; + status = tx_byte_pool_create(&pool_0, "pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(108)); + pointer = pointer + TX_TEST_BYTE_POOL_BYTES(108); /* Check status. */ if (status != TX_SUCCESS) @@ -174,4 +186,3 @@ CHAR *pointer; thread_1_counter++; } } - diff --git a/test/smp/regression/threadx_event_flag_basic_test.c b/test/smp/regression/threadx_event_flag_basic_test.c index 3261f67f..8ab990f7 100644 --- a/test/smp/regression/threadx_event_flag_basic_test.c +++ b/test/smp/regression/threadx_event_flag_basic_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test simple event flag group creation, deletion, gets and sets. */ diff --git a/test/smp/regression/threadx_event_flag_information_test.c b/test/smp/regression/threadx_event_flag_information_test.c index d2404081..45e547f9 100644 --- a/test/smp/regression/threadx_event_flag_information_test.c +++ b/test/smp/regression/threadx_event_flag_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the event flag group information gathering services. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_event_flag_isr_set_clear_test.c b/test/smp/regression/threadx_event_flag_isr_set_clear_test.c index b1420d76..1dd95dc9 100644 --- a/test/smp/regression/threadx_event_flag_isr_set_clear_test.c +++ b/test/smp/regression/threadx_event_flag_isr_set_clear_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test for simultaneous thread event flag set AND ISR event flag set and clear. */ #include <stdio.h> @@ -240,14 +251,12 @@ ULONG actual; /* Inform user. */ printf("Running Event Flag Set/Clear from ISR Test.......................... "); - /* Setup the test ISR. */ test_isr_dispatch = test_isr; /* Loop to exploit the probability window inside tx_event_flags_set call. */ while (condition_count < 40) { - /* Suspend on the event_flags that is going to be set via the ISR. */ status = tx_event_flags_get(&event_flags_0, 2, TX_OR_CLEAR, &actual, 4); @@ -354,5 +363,3 @@ static void timer_0_entry(ULONG input) { timer_0_counter++; } - - diff --git a/test/smp/regression/threadx_event_flag_isr_wait_abort_test.c b/test/smp/regression/threadx_event_flag_isr_wait_abort_test.c index 95d3b5ab..3c170fd4 100644 --- a/test/smp/regression/threadx_event_flag_isr_wait_abort_test.c +++ b/test/smp/regression/threadx_event_flag_isr_wait_abort_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test for wait abort from an ISR. */ #include <stdio.h> @@ -32,7 +43,6 @@ static unsigned long condition_count = 0; static TX_EVENT_FLAGS_GROUP event_flags_0; - /* Define thread prototypes. */ static void thread_0_entry(ULONG thread_input); diff --git a/test/smp/regression/threadx_event_flag_single_thread_terminate_test.c b/test/smp/regression/threadx_event_flag_single_thread_terminate_test.c index 86675890..6ae7c712 100644 --- a/test/smp/regression/threadx_event_flag_single_thread_terminate_test.c +++ b/test/smp/regression/threadx_event_flag_single_thread_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension with a single suspended thread being terminated at the same priority level. */ diff --git a/test/smp/regression/threadx_event_flag_suspension_consume_test.c b/test/smp/regression/threadx_event_flag_suspension_consume_test.c index aae8f1b9..eaa40258 100644 --- a/test/smp/regression/threadx_event_flag_suspension_consume_test.c +++ b/test/smp/regression/threadx_event_flag_suspension_consume_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension and resumption of two threads waiting on the same event flag set with the consumption. */ diff --git a/test/smp/regression/threadx_event_flag_suspension_different_bits_consume_test.c b/test/smp/regression/threadx_event_flag_suspension_different_bits_consume_test.c index 595e60ed..5f4c9494 100644 --- a/test/smp/regression/threadx_event_flag_suspension_different_bits_consume_test.c +++ b/test/smp/regression/threadx_event_flag_suspension_different_bits_consume_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension and resumption of two threads waiting on different event flags with consumption. */ diff --git a/test/smp/regression/threadx_event_flag_suspension_different_bits_test.c b/test/smp/regression/threadx_event_flag_suspension_different_bits_test.c index f9e43cad..56f9c263 100644 --- a/test/smp/regression/threadx_event_flag_suspension_different_bits_test.c +++ b/test/smp/regression/threadx_event_flag_suspension_different_bits_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension and resumption of two threads waiting on different event flags. */ diff --git a/test/smp/regression/threadx_event_flag_suspension_test.c b/test/smp/regression/threadx_event_flag_suspension_test.c index 915e33db..1c98ab49 100644 --- a/test/smp/regression/threadx_event_flag_suspension_test.c +++ b/test/smp/regression/threadx_event_flag_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension and resumption of three threads waiting on the same event flag set. */ diff --git a/test/smp/regression/threadx_event_flag_suspension_timeout_test.c b/test/smp/regression/threadx_event_flag_suspension_timeout_test.c index 2772d391..730d5187 100644 --- a/test/smp/regression/threadx_event_flag_suspension_timeout_test.c +++ b/test/smp/regression/threadx_event_flag_suspension_timeout_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension timeout processing. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_event_flag_thread_terminate_test.c b/test/smp/regression/threadx_event_flag_thread_terminate_test.c index 166711f5..25536903 100644 --- a/test/smp/regression/threadx_event_flag_thread_terminate_test.c +++ b/test/smp/regression/threadx_event_flag_thread_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension with the suspended threads being terminated. */ diff --git a/test/smp/regression/threadx_initialize_kernel_setup_test.c b/test/smp/regression/threadx_initialize_kernel_setup_test.c index a1172ded..388f2cde 100644 --- a/test/smp/regression/threadx_initialize_kernel_setup_test.c +++ b/test/smp/regression/threadx_initialize_kernel_setup_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test kernel setup functionality in ThreadX. */ #include <stdio.h> @@ -33,18 +44,6 @@ UINT mutex_priority_change_extension_selection; UINT priority_change_extension_selection; -__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) -{ -} - void main() { @@ -80,4 +79,4 @@ void delete_timer_thread(void) _tx_thread_delete(&_tx_timer_thread); } -#endif
\ No newline at end of file +#endif diff --git a/test/smp/regression/threadx_interrupt_control_test.c b/test/smp/regression/threadx_interrupt_control_test.c index c573c098..ec797ac8 100644 --- a/test/smp/regression/threadx_interrupt_control_test.c +++ b/test/smp/regression/threadx_interrupt_control_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the interrupt control service call avaialbe to the application. */ diff --git a/test/smp/regression/threadx_mutex_basic_test.c b/test/smp/regression/threadx_mutex_basic_test.c index 419813d3..bb81eb9a 100644 --- a/test/smp/regression/threadx_mutex_basic_test.c +++ b/test/smp/regression/threadx_mutex_basic_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex create/delete and immediate return gets and puts. */ diff --git a/test/smp/regression/threadx_mutex_delete_test.c b/test/smp/regression/threadx_mutex_delete_test.c index af501488..c706cc66 100644 --- a/test/smp/regression/threadx_mutex_delete_test.c +++ b/test/smp/regression/threadx_mutex_delete_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension and mutex delete with suspended threads. */ diff --git a/test/smp/regression/threadx_mutex_information_test.c b/test/smp/regression/threadx_mutex_information_test.c index 55503002..3829122c 100644 --- a/test/smp/regression/threadx_mutex_information_test.c +++ b/test/smp/regression/threadx_mutex_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex information services. */ #include <stdio.h> @@ -312,7 +323,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(&mutex_2, &puts, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -325,8 +336,8 @@ ULONG inheritances; printf("ERROR #19\n"); test_control_return(1); } - - /* Now get the system performance inforamtion. */ + + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(&puts, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -342,7 +353,7 @@ ULONG inheritances; #else - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(&mutex_2, &puts, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -354,7 +365,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, &puts, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -366,7 +377,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -378,7 +389,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, TX_NULL, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -390,7 +401,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -402,7 +413,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, &inversions, &inheritances); /* Check status. */ @@ -414,7 +425,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, &inheritances); /* Check status. */ @@ -426,7 +437,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL); /* Check status. */ @@ -438,7 +449,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(&puts, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -450,7 +461,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -462,7 +473,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, TX_NULL, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -474,7 +485,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -486,7 +497,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, &inversions, &inheritances); /* Check status. */ @@ -498,7 +509,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, &inheritances); /* Check status. */ @@ -510,7 +521,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL); /* Check status. */ diff --git a/test/smp/regression/threadx_mutex_nested_priority_inheritance_test.c b/test/smp/regression/threadx_mutex_nested_priority_inheritance_test.c index 1439ca85..929ea0b9 100644 --- a/test/smp/regression/threadx_mutex_nested_priority_inheritance_test.c +++ b/test/smp/regression/threadx_mutex_nested_priority_inheritance_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test multiple mutex priority inheritance situations. */ #include <stdio.h> @@ -404,7 +415,7 @@ UINT status; tx_mutex_put(&mutex_2); - /* Should reurn us back to priority 15. */ + /* Should return us back to priority 15. */ if (thread_0.tx_thread_priority != 15) { @@ -441,7 +452,7 @@ UINT status; tx_mutex_put(&mutex_2); - /* Should reurn us back to priority 8. */ + /* Should return us back to priority 8. */ if (thread_0.tx_thread_priority != 8) { diff --git a/test/smp/regression/threadx_mutex_no_preemption_test.c b/test/smp/regression/threadx_mutex_no_preemption_test.c index 3cc21b62..2798a5d3 100644 --- a/test/smp/regression/threadx_mutex_no_preemption_test.c +++ b/test/smp/regression/threadx_mutex_no_preemption_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension and another thread resuming the same priority thread by doing a mutex put. */ diff --git a/test/smp/regression/threadx_mutex_preemption_test.c b/test/smp/regression/threadx_mutex_preemption_test.c index 495ae13c..5e3d4c4b 100644 --- a/test/smp/regression/threadx_mutex_preemption_test.c +++ b/test/smp/regression/threadx_mutex_preemption_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension and another thread resuming the higher priority thread by doing a mutex put. Higher-priority thread should preempt. */ diff --git a/test/smp/regression/threadx_mutex_priority_inheritance_test.c b/test/smp/regression/threadx_mutex_priority_inheritance_test.c index 87cc334c..078acb76 100644 --- a/test/smp/regression/threadx_mutex_priority_inheritance_test.c +++ b/test/smp/regression/threadx_mutex_priority_inheritance_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension and priority inheritance with another thread resuming the higher priority thread by doing a mutex put. Higher-priority thread should preempt. */ diff --git a/test/smp/regression/threadx_mutex_proritize_test.c b/test/smp/regression/threadx_mutex_proritize_test.c index bbc2845b..89988273 100644 --- a/test/smp/regression/threadx_mutex_proritize_test.c +++ b/test/smp/regression/threadx_mutex_proritize_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension prioritization. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_mutex_suspension_timeout_test.c b/test/smp/regression/threadx_mutex_suspension_timeout_test.c index 7460d367..46896762 100644 --- a/test/smp/regression/threadx_mutex_suspension_timeout_test.c +++ b/test/smp/regression/threadx_mutex_suspension_timeout_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension and timeout functionality. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_mutex_thread_terminate_test.c b/test/smp/regression/threadx_mutex_thread_terminate_test.c index ef21b92d..f4144524 100644 --- a/test/smp/regression/threadx_mutex_thread_terminate_test.c +++ b/test/smp/regression/threadx_mutex_thread_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread terminate calls when threads are suspended on a mutex. */ diff --git a/test/smp/regression/threadx_queue_basic_eight_word_test.c b/test/smp/regression/threadx_queue_basic_eight_word_test.c index fb4640cc..d3271f2c 100644 --- a/test/smp/regression/threadx_queue_basic_eight_word_test.c +++ b/test/smp/regression/threadx_queue_basic_eight_word_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 8 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/smp/regression/threadx_queue_basic_four_word_test.c b/test/smp/regression/threadx_queue_basic_four_word_test.c index 4c54d8bd..49eb9a85 100644 --- a/test/smp/regression/threadx_queue_basic_four_word_test.c +++ b/test/smp/regression/threadx_queue_basic_four_word_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 4 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/smp/regression/threadx_queue_basic_max_message_size_test.c b/test/smp/regression/threadx_queue_basic_max_message_size_test.c index d62e80ff..0ad2be4e 100644 --- a/test/smp/regression/threadx_queue_basic_max_message_size_test.c +++ b/test/smp/regression/threadx_queue_basic_max_message_size_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 16 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/smp/regression/threadx_queue_basic_one_word_test.c b/test/smp/regression/threadx_queue_basic_one_word_test.c index 0e2f1fbc..1abb6986 100644 --- a/test/smp/regression/threadx_queue_basic_one_word_test.c +++ b/test/smp/regression/threadx_queue_basic_one_word_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 1 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/smp/regression/threadx_queue_basic_sixteen_word_test.c b/test/smp/regression/threadx_queue_basic_sixteen_word_test.c index de3ede98..42205d90 100644 --- a/test/smp/regression/threadx_queue_basic_sixteen_word_test.c +++ b/test/smp/regression/threadx_queue_basic_sixteen_word_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 16 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/smp/regression/threadx_queue_basic_two_word_test.c b/test/smp/regression/threadx_queue_basic_two_word_test.c index 46d85a6d..fa2a2fed 100644 --- a/test/smp/regression/threadx_queue_basic_two_word_test.c +++ b/test/smp/regression/threadx_queue_basic_two_word_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 2 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/smp/regression/threadx_queue_empty_suspension_test.c b/test/smp/regression/threadx_queue_empty_suspension_test.c index c63b1715..c0858ac8 100644 --- a/test/smp/regression/threadx_queue_empty_suspension_test.c +++ b/test/smp/regression/threadx_queue_empty_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test empty queue suspension of queue that supports 3 messages that are each 2 ULONG in size. */ diff --git a/test/smp/regression/threadx_queue_flush_no_suspension_test.c b/test/smp/regression/threadx_queue_flush_no_suspension_test.c index 95bd5fed..5da58b74 100644 --- a/test/smp/regression/threadx_queue_flush_no_suspension_test.c +++ b/test/smp/regression/threadx_queue_flush_no_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the queue flush operation on a queue that has no threads suspended on it. */ diff --git a/test/smp/regression/threadx_queue_flush_test.c b/test/smp/regression/threadx_queue_flush_test.c index 77f8d2d5..a28e2288 100644 --- a/test/smp/regression/threadx_queue_flush_test.c +++ b/test/smp/regression/threadx_queue_flush_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the queue flush operation on a queue that has two threads suspended on it. */ diff --git a/test/smp/regression/threadx_queue_front_send_test.c b/test/smp/regression/threadx_queue_front_send_test.c index d03e7ac2..45b5dd65 100644 --- a/test/smp/regression/threadx_queue_front_send_test.c +++ b/test/smp/regression/threadx_queue_front_send_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including queue front send. This test is for queue sizes of 2 ULONG. */ diff --git a/test/smp/regression/threadx_queue_full_suspension_test.c b/test/smp/regression/threadx_queue_full_suspension_test.c index 687ef04a..d1e1759f 100644 --- a/test/smp/regression/threadx_queue_full_suspension_test.c +++ b/test/smp/regression/threadx_queue_full_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test queue full suspension of queue that supports 3 messages that are each 2 ULONG in size. */ diff --git a/test/smp/regression/threadx_queue_information_test.c b/test/smp/regression/threadx_queue_information_test.c index 5fcdbb8f..f884bd0d 100644 --- a/test/smp/regression/threadx_queue_information_test.c +++ b/test/smp/regression/threadx_queue_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the queue information services. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_queue_prioritize.c b/test/smp/regression/threadx_queue_prioritize.c index 53c19275..f904a525 100644 --- a/test/smp/regression/threadx_queue_prioritize.c +++ b/test/smp/regression/threadx_queue_prioritize.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test queue prioritize. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_queue_suspension_timeout_test.c b/test/smp/regression/threadx_queue_suspension_timeout_test.c index 92dca991..aa05c0dc 100644 --- a/test/smp/regression/threadx_queue_suspension_timeout_test.c +++ b/test/smp/regression/threadx_queue_suspension_timeout_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test queue full and empty suspension with timeouts on queues that supports 3 messages that are each 2 ULONG in size. */ diff --git a/test/smp/regression/threadx_queue_thread_terminate_test.c b/test/smp/regression/threadx_queue_thread_terminate_test.c index 97d8a569..42673c8d 100644 --- a/test/smp/regression/threadx_queue_thread_terminate_test.c +++ b/test/smp/regression/threadx_queue_thread_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread terminate when the terminated thread is suspeded on a queue. */ diff --git a/test/smp/regression/threadx_semaphore_basic_test.c b/test/smp/regression/threadx_semaphore_basic_test.c index 33ee3257..3209b586 100644 --- a/test/smp/regression/threadx_semaphore_basic_test.c +++ b/test/smp/regression/threadx_semaphore_basic_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore create/delete and immediate return gets and puts. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_semaphore_ceiling_put_test.c b/test/smp/regression/threadx_semaphore_ceiling_put_test.c index 7d4f5832..f7d7be73 100644 --- a/test/smp/regression/threadx_semaphore_ceiling_put_test.c +++ b/test/smp/regression/threadx_semaphore_ceiling_put_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore ceiling put. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_semaphore_delete_test.c b/test/smp/regression/threadx_semaphore_delete_test.c index 2c9bc1aa..272a0252 100644 --- a/test/smp/regression/threadx_semaphore_delete_test.c +++ b/test/smp/regression/threadx_semaphore_delete_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore suspension and semaphore delete with suspended threads. */ diff --git a/test/smp/regression/threadx_semaphore_information_test.c b/test/smp/regression/threadx_semaphore_information_test.c index d2e9bd57..ede276e9 100644 --- a/test/smp/regression/threadx_semaphore_information_test.c +++ b/test/smp/regression/threadx_semaphore_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore information services. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_semaphore_non_preemption_test.c b/test/smp/regression/threadx_semaphore_non_preemption_test.c index c075b16c..e3695e84 100644 --- a/test/smp/regression/threadx_semaphore_non_preemption_test.c +++ b/test/smp/regression/threadx_semaphore_non_preemption_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore suspension and another thread resuming the same priority thread by doing a semaphore put. */ diff --git a/test/smp/regression/threadx_semaphore_preemption_test.c b/test/smp/regression/threadx_semaphore_preemption_test.c index f14193a2..33677c01 100644 --- a/test/smp/regression/threadx_semaphore_preemption_test.c +++ b/test/smp/regression/threadx_semaphore_preemption_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore suspension and another thread resuming the higher priority thread by doing a semaphore put. Higher-priority thread should preempt. */ diff --git a/test/smp/regression/threadx_semaphore_prioritize.c b/test/smp/regression/threadx_semaphore_prioritize.c index 6bee4656..30d04590 100644 --- a/test/smp/regression/threadx_semaphore_prioritize.c +++ b/test/smp/regression/threadx_semaphore_prioritize.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test semaphore prioritize. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_semaphore_thread_terminate_test.c b/test/smp/regression/threadx_semaphore_thread_terminate_test.c index a15f5963..7055ed07 100644 --- a/test/smp/regression/threadx_semaphore_thread_terminate_test.c +++ b/test/smp/regression/threadx_semaphore_thread_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread terminate calls when threads are suspended on a semaphore. */ diff --git a/test/smp/regression/threadx_semaphore_timeout_test.c b/test/smp/regression/threadx_semaphore_timeout_test.c index 660891c9..3d41f5b2 100644 --- a/test/smp/regression/threadx_semaphore_timeout_test.c +++ b/test/smp/regression/threadx_semaphore_timeout_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore suspension and timeout functionality. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_smp_multiple_threads_one_core_test.c b/test/smp/regression/threadx_smp_multiple_threads_one_core_test.c index 533837bb..8dc05dd0 100644 --- a/test/smp/regression/threadx_smp_multiple_threads_one_core_test.c +++ b/test/smp/regression/threadx_smp_multiple_threads_one_core_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + /* Define the ThreadX SMP multiple threads excluded to one core test. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_smp_non_trivial_scheduling_test.c b/test/smp/regression/threadx_smp_non_trivial_scheduling_test.c index 4a0feec2..81598196 100644 --- a/test/smp/regression/threadx_smp_non_trivial_scheduling_test.c +++ b/test/smp/regression/threadx_smp_non_trivial_scheduling_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + /* Define the ThreadX SMP non-trivial scheduling test. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_smp_one_thread_dynamic_exclusion_test.c b/test/smp/regression/threadx_smp_one_thread_dynamic_exclusion_test.c index 34a6f9e4..b929c1ea 100644 --- a/test/smp/regression/threadx_smp_one_thread_dynamic_exclusion_test.c +++ b/test/smp/regression/threadx_smp_one_thread_dynamic_exclusion_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + /* Define the ThreadX SMP one thread dynamic thread exclusion test. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_smp_preemption_threshold_test.c b/test/smp/regression/threadx_smp_preemption_threshold_test.c index 50a696a4..47935034 100644 --- a/test/smp/regression/threadx_smp_preemption_threshold_test.c +++ b/test/smp/regression/threadx_smp_preemption_threshold_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + /* Define the ThreadX SMP preemption-threshold test. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_smp_random_resume_suspend_exclusion_pt_test.c b/test/smp/regression/threadx_smp_random_resume_suspend_exclusion_pt_test.c index db174ef2..a9ea93ad 100644 --- a/test/smp/regression/threadx_smp_random_resume_suspend_exclusion_pt_test.c +++ b/test/smp/regression/threadx_smp_random_resume_suspend_exclusion_pt_test.c @@ -1,7 +1,20 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + /* Define the ThreadX SMP random resume/suspend/exclude/pt test. */ +// Some portions generated by Codex (gpt 5.4). #include <stdio.h> #include "tx_api.h" +#include "tx_thread.h" //#define MAX_PASSES 50000000 //#define MAX_PASSES 50000 diff --git a/test/smp/regression/threadx_smp_random_resume_suspend_exclusion_test.c b/test/smp/regression/threadx_smp_random_resume_suspend_exclusion_test.c index 1a02cf19..36c00337 100644 --- a/test/smp/regression/threadx_smp_random_resume_suspend_exclusion_test.c +++ b/test/smp/regression/threadx_smp_random_resume_suspend_exclusion_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + /* Define the ThreadX SMP random resume/suspend/exclude test. */ #include <stdio.h> @@ -2370,4 +2381,3 @@ TX_THREAD *thread_ptr; tx_thread_suspend(thread_ptr); } } - diff --git a/test/smp/regression/threadx_smp_random_resume_suspend_test.c b/test/smp/regression/threadx_smp_random_resume_suspend_test.c index 8098dfe7..c4704da4 100644 --- a/test/smp/regression/threadx_smp_random_resume_suspend_test.c +++ b/test/smp/regression/threadx_smp_random_resume_suspend_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + /* Define the ThreadX SMP random resume/suspend test. */ #include <stdio.h> @@ -2325,5 +2336,3 @@ static void thread_entry(ULONG id) tx_thread_suspend(_smp_randomized_source_array[id]); } } - - diff --git a/test/smp/regression/threadx_smp_rebalance_exclusion_test.c b/test/smp/regression/threadx_smp_rebalance_exclusion_test.c index 9fe04bcf..050605da 100644 --- a/test/smp/regression/threadx_smp_rebalance_exclusion_test.c +++ b/test/smp/regression/threadx_smp_rebalance_exclusion_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + /* Define the ThreadX SMP rebalance exclusion test. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_smp_relinquish_test.c b/test/smp/regression/threadx_smp_relinquish_test.c index dddb13c2..250cc863 100644 --- a/test/smp/regression/threadx_smp_relinquish_test.c +++ b/test/smp/regression/threadx_smp_relinquish_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + /* Define the ThreadX SMP relinquish test. */ #include <stdio.h> @@ -362,4 +373,3 @@ static void thread_31h_entry(ULONG thread_input) thread_31h_counter++; } } - diff --git a/test/smp/regression/threadx_smp_resume_suspend_accending_order_test.c b/test/smp/regression/threadx_smp_resume_suspend_ascending_order_test.c index fe55660a..91a66bfe 100644 --- a/test/smp/regression/threadx_smp_resume_suspend_accending_order_test.c +++ b/test/smp/regression/threadx_smp_resume_suspend_ascending_order_test.c @@ -1,4 +1,15 @@ -/* Define the ThreadX SMP resume and suspend threads in accending order test. */ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + +/* Define the ThreadX SMP resume and suspend threads in ascending order test. */ #include <stdio.h> #include "tx_api.h" @@ -71,7 +82,7 @@ static void delay(UINT i) #ifdef CTEST void test_application_define(void *first_unused_memory) #else -void threadx_smp_resume_suspend_accending_order_test(void *first_unused_memory) +void threadx_smp_resume_suspend_ascending_order_test(void *first_unused_memory) #endif { @@ -969,7 +980,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(1); status = tx_thread_suspend(&thread_1); @@ -982,8 +993,8 @@ UINT status; printf("ERROR #65\n"); test_control_return(1); } - - /* Suspend thread in accending priority. */ + + /* Suspend thread in ascending priority. */ delay(2); status = tx_thread_suspend(&thread_2); @@ -997,7 +1008,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(3); status = tx_thread_suspend(&thread_3); @@ -1011,7 +1022,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(4); status = tx_thread_suspend(&thread_4); @@ -1025,7 +1036,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(5); status = tx_thread_suspend(&thread_5); @@ -1039,7 +1050,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(6); status = tx_thread_suspend(&thread_6); @@ -1053,7 +1064,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(7); status = tx_thread_suspend(&thread_7); @@ -1067,7 +1078,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(8); status = tx_thread_suspend(&thread_8); @@ -1081,7 +1092,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(9); status = tx_thread_suspend(&thread_9); @@ -1095,7 +1106,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(10); status = tx_thread_suspend(&thread_10); @@ -1109,7 +1120,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(11); status = tx_thread_suspend(&thread_11); @@ -1123,7 +1134,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(12); status = tx_thread_suspend(&thread_12); @@ -1137,7 +1148,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(13); status = tx_thread_suspend(&thread_13); @@ -1150,8 +1161,8 @@ UINT status; printf("ERROR #77\n"); test_control_return(1); } - - /* Suspend thread in accending priority. */ + + /* Suspend thread in ascending priority. */ delay(14); status = tx_thread_suspend(&thread_14); @@ -1164,8 +1175,8 @@ UINT status; printf("ERROR #78\n"); test_control_return(1); } - - /* Suspend thread in accending priority. */ + + /* Suspend thread in ascending priority. */ delay(15); status = tx_thread_suspend(&thread_15); @@ -1178,8 +1189,8 @@ UINT status; printf("ERROR #79\n"); test_control_return(1); } - - /* Suspend thread in accending priority. */ + + /* Suspend thread in ascending priority. */ delay(16); status = tx_thread_suspend(&thread_16); @@ -1193,7 +1204,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(17); status = tx_thread_suspend(&thread_17); @@ -1206,8 +1217,8 @@ UINT status; printf("ERROR #81\n"); test_control_return(1); } - - /* Suspend thread in accending priority. */ + + /* Suspend thread in ascending priority. */ delay(18); status = tx_thread_suspend(&thread_18); @@ -1221,7 +1232,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(19); status = tx_thread_suspend(&thread_19); @@ -1235,7 +1246,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(20); status = tx_thread_suspend(&thread_20); @@ -1249,7 +1260,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(21); status = tx_thread_suspend(&thread_21); @@ -1263,7 +1274,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(22); status = tx_thread_suspend(&thread_22); @@ -1277,7 +1288,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(23); status = tx_thread_suspend(&thread_23); @@ -1291,7 +1302,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(24); status = tx_thread_suspend(&thread_24); @@ -1305,7 +1316,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(25); status = tx_thread_suspend(&thread_25); @@ -1319,7 +1330,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(26); status = tx_thread_suspend(&thread_26); @@ -1333,7 +1344,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(27); status = tx_thread_suspend(&thread_27); @@ -1347,7 +1358,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(28); status = tx_thread_suspend(&thread_28); @@ -1361,7 +1372,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(29); status = tx_thread_suspend(&thread_29); @@ -1375,7 +1386,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(30); status = tx_thread_suspend(&thread_30); @@ -1389,7 +1400,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ delay(31); status = tx_thread_suspend(&thread_31); diff --git a/test/smp/regression/threadx_smp_resume_suspend_decending_order_test.c b/test/smp/regression/threadx_smp_resume_suspend_descending_order_test.c index 83b6f141..e4d202a5 100644 --- a/test/smp/regression/threadx_smp_resume_suspend_decending_order_test.c +++ b/test/smp/regression/threadx_smp_resume_suspend_descending_order_test.c @@ -1,4 +1,15 @@ -/* Define the ThreadX SMP resume and suspend threads in accending order test. */ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + +/* Define the ThreadX SMP resume and suspend threads in ascending order test. */ #include <stdio.h> #include "tx_api.h" @@ -71,7 +82,7 @@ static void delay(UINT i) #ifdef CTEST void test_application_define(void *first_unused_memory) #else -void threadx_smp_resume_suspend_decending_order_test(void *first_unused_memory) +void threadx_smp_resume_suspend_descending_order_test(void *first_unused_memory) #endif { @@ -96,7 +107,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #1\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #1\n"); test_control_return(1); } @@ -110,7 +121,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #2\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #2\n"); test_control_return(1); } @@ -124,7 +135,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #3\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #3\n"); test_control_return(1); } @@ -138,7 +149,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #4\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #4\n"); test_control_return(1); } @@ -152,7 +163,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #5\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #5\n"); test_control_return(1); } @@ -166,7 +177,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #6\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #6\n"); test_control_return(1); } @@ -180,7 +191,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #7\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #7\n"); test_control_return(1); } @@ -194,7 +205,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #8\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #8\n"); test_control_return(1); } @@ -208,7 +219,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #9\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #9\n"); test_control_return(1); } @@ -222,7 +233,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #9\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #9\n"); test_control_return(1); } @@ -236,7 +247,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #11\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #11\n"); test_control_return(1); } @@ -250,7 +261,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #12\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #12\n"); test_control_return(1); } @@ -264,7 +275,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #13\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #13\n"); test_control_return(1); } @@ -278,7 +289,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #14\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #14\n"); test_control_return(1); } @@ -292,7 +303,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #15\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #15\n"); test_control_return(1); } @@ -306,7 +317,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #16\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #16\n"); test_control_return(1); } @@ -320,7 +331,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #17\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #17\n"); test_control_return(1); } @@ -334,7 +345,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #18\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #18\n"); test_control_return(1); } @@ -348,7 +359,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #19\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #19\n"); test_control_return(1); } @@ -362,7 +373,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #20\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #20\n"); test_control_return(1); } @@ -376,7 +387,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #21\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #21\n"); test_control_return(1); } @@ -390,7 +401,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #22\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #22\n"); test_control_return(1); } @@ -404,7 +415,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #23\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #23\n"); test_control_return(1); } @@ -418,7 +429,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #24\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #24\n"); test_control_return(1); } @@ -432,7 +443,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #25\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #25\n"); test_control_return(1); } @@ -446,7 +457,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #26\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #26\n"); test_control_return(1); } @@ -460,7 +471,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #27\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #27\n"); test_control_return(1); } @@ -474,7 +485,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #28\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #28\n"); test_control_return(1); } @@ -488,7 +499,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #29\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #29\n"); test_control_return(1); } @@ -502,7 +513,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #30\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #30\n"); test_control_return(1); } @@ -516,7 +527,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #31\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #31\n"); test_control_return(1); } @@ -530,7 +541,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #32\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #32\n"); test_control_return(1); } @@ -547,7 +558,7 @@ UINT i; if (status != TX_SUCCESS) { - printf("Running SMP Resume-Suspend Decending Priority Order Test............ ERROR #33\n"); + printf("Running SMP Resume-Suspend descending Priority Order Test............ ERROR #33\n"); test_control_return(1); } } @@ -564,7 +575,7 @@ UINT status; /* Inform user. */ - printf("Running SMP Resume-Suspend Decending Priority Order Test............ "); + printf("Running SMP Resume-Suspend descending Priority Order Test............ "); /* Resume all the threads. */ status = tx_thread_resume(&thread_31); @@ -999,7 +1010,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in decending priority. */ + /* Suspend thread in descending priority. */ status = tx_thread_suspend(&thread_31); /* Check for the correct results. */ @@ -1011,8 +1022,8 @@ UINT status; printf("ERROR #65\n"); test_control_return(1); } - - /* Suspend thread in accending priority. */ + + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_30); /* Check for the correct results. */ @@ -1025,7 +1036,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_29); /* Check for the correct results. */ @@ -1038,7 +1049,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_28); /* Check for the correct results. */ @@ -1051,7 +1062,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_27); /* Check for the correct results. */ @@ -1064,7 +1075,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_26); /* Check for the correct results. */ @@ -1077,7 +1088,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_25); /* Check for the correct results. */ @@ -1090,7 +1101,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_24); /* Check for the correct results. */ @@ -1103,7 +1114,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_23); /* Check for the correct results. */ @@ -1116,7 +1127,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_22); /* Check for the correct results. */ @@ -1129,7 +1140,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_21); /* Check for the correct results. */ @@ -1142,7 +1153,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_20); /* Check for the correct results. */ @@ -1155,7 +1166,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_19); /* Check for the correct results. */ @@ -1167,8 +1178,8 @@ UINT status; printf("ERROR #77\n"); test_control_return(1); } - - /* Suspend thread in accending priority. */ + + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_18); /* Check for the correct results. */ @@ -1180,8 +1191,8 @@ UINT status; printf("ERROR #78\n"); test_control_return(1); } - - /* Suspend thread in accending priority. */ + + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_17); /* Check for the correct results. */ @@ -1193,8 +1204,8 @@ UINT status; printf("ERROR #79\n"); test_control_return(1); } - - /* Suspend thread in accending priority. */ + + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_16); /* Check for the correct results. */ @@ -1207,7 +1218,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_15); /* Check for the correct results. */ @@ -1219,8 +1230,8 @@ UINT status; printf("ERROR #81\n"); test_control_return(1); } - - /* Suspend thread in accending priority. */ + + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_14); /* Check for the correct results. */ @@ -1233,7 +1244,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_13); /* Check for the correct results. */ @@ -1246,7 +1257,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_12); /* Check for the correct results. */ @@ -1259,7 +1270,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_11); /* Check for the correct results. */ @@ -1272,7 +1283,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_10); /* Check for the correct results. */ @@ -1285,7 +1296,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_9); /* Check for the correct results. */ @@ -1298,7 +1309,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_8); /* Check for the correct results. */ @@ -1311,7 +1322,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_7); /* Check for the correct results. */ @@ -1324,7 +1335,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_6); /* Check for the correct results. */ @@ -1337,7 +1348,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_5); /* Check for the correct results. */ @@ -1350,7 +1361,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_4); /* Check for the correct results. */ @@ -1363,7 +1374,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_3); /* Check for the correct results. */ @@ -1376,7 +1387,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_2); /* Check for the correct results. */ @@ -1389,7 +1400,7 @@ UINT status; test_control_return(1); } - /* Suspend thread in accending priority. */ + /* Suspend thread in ascending priority. */ status = tx_thread_suspend(&thread_1); /* Check for the correct results. */ diff --git a/test/smp/regression/threadx_smp_time_slice_test.c b/test/smp/regression/threadx_smp_time_slice_test.c index fe97590a..370f5e37 100644 --- a/test/smp/regression/threadx_smp_time_slice_test.c +++ b/test/smp/regression/threadx_smp_time_slice_test.c @@ -1,5 +1,18 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + /* Define the ThreadX SMP time-slice test. */ +// Some portions generated by Codex (gpt 5.4). + #include <stdio.h> #include "tx_api.h" @@ -243,7 +256,7 @@ UINT status; status += tx_thread_resume(&thread_31g); status += tx_thread_resume(&thread_31h); - /* Now sleep for 20 ticks to let see if all the threads execute. */ + /* Sleep long enough to see if all the threads execute. */ tx_thread_sleep(20); /* Now check and make sure all the threads ran. */ @@ -358,4 +371,3 @@ static void thread_31h_entry(ULONG thread_input) thread_31h_counter++; } } - diff --git a/test/smp/regression/threadx_smp_two_threads_one_core_test.c b/test/smp/regression/threadx_smp_two_threads_one_core_test.c index 66ed9478..fe6df956 100644 --- a/test/smp/regression/threadx_smp_two_threads_one_core_test.c +++ b/test/smp/regression/threadx_smp_two_threads_one_core_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + /* Define the ThreadX SMP two threads excluded to one core test. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_thread_basic_execution_test.c b/test/smp/regression/threadx_thread_basic_execution_test.c index 5772f97e..d90d0769 100644 --- a/test/smp/regression/threadx_thread_basic_execution_test.c +++ b/test/smp/regression/threadx_thread_basic_execution_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if one thread can be created and executed. It thread_0_entry is hit, then the thread was successfully scheduled. On success, thread_0_counter gets incremented. */ @@ -11,6 +22,7 @@ #include "tx_queue.h" #include "tx_semaphore.h" #include "tx_thread.h" +#include "tx_timer.h" typedef struct THREAD_MEMORY_TEST_STRUCT @@ -33,6 +45,7 @@ static THREAD_MEMORY_TEST thread_memory; /* Define the ISR dispatch. */ extern VOID (*test_isr_dispatch)(void); +extern TX_TIMER_INTERNAL *_tx_timer_expired_timer_ptr; static unsigned long thread_0_counter = 0; @@ -314,7 +327,22 @@ VOID (*temp_mutex_release)(TX_THREAD *thread_ptr); test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL; test_thread.tx_thread_suspending = TX_TRUE; test_thread.tx_thread_delayed_suspend = TX_TRUE; +#if defined(_WIN64) + { + TX_TIMER_INTERNAL timeout_timer; + TX_TIMER_INTERNAL *saved_expired_timer_ptr; + + + TX_MEMSET(&timeout_timer, 0, sizeof(TX_TIMER_INTERNAL)); + saved_expired_timer_ptr = _tx_timer_expired_timer_ptr; + _tx_timer_expired_timer_ptr = &timeout_timer; + timeout_timer.tx_timer_internal_extension_ptr = (VOID *) &test_thread; + _tx_thread_timeout(0); + _tx_timer_expired_timer_ptr = saved_expired_timer_ptr; + } +#else _tx_thread_timeout((ULONG) &test_thread); +#endif /* Setup test thread to make sure _tx_thread_terminate can handle a NULL mutex release function pointer. */ temp_mutex_release = _tx_thread_mutex_release; @@ -741,7 +769,7 @@ VOID (*temp_mutex_release)(TX_THREAD *thread_ptr); test_control_return(1); } - /* Attempt a thread termiante with a NULL pointer. */ + /* Attempt a thread terminate with a NULL pointer. */ status = tx_thread_terminate(TX_NULL); /* Check for status. */ @@ -764,7 +792,7 @@ VOID (*temp_mutex_release)(TX_THREAD *thread_ptr); test_control_return(1); } - /* Attempt a thread time-slice chagne with a NULL pointer. */ + /* Attempt a thread time-slice change with a NULL pointer. */ status = tx_thread_time_slice_change(TX_NULL, 1, &old_time_slice); /* Check for status. */ diff --git a/test/smp/regression/threadx_thread_basic_time_slice_test.c b/test/smp/regression/threadx_thread_basic_time_slice_test.c index bb848b11..ed7a1fba 100644 --- a/test/smp/regression/threadx_thread_basic_time_slice_test.c +++ b/test/smp/regression/threadx_thread_basic_time_slice_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if a thread can be created with a time-slice. No time-slice occurs, only the processing to check for time-slicing. */ diff --git a/test/smp/regression/threadx_thread_completed_test.c b/test/smp/regression/threadx_thread_completed_test.c index adaf1683..e8b609e3 100644 --- a/test/smp/regression/threadx_thread_completed_test.c +++ b/test/smp/regression/threadx_thread_completed_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if one thread can be created, executed, and return to the thread shell function. The thread shell function places the thread in a finished state. */ diff --git a/test/smp/regression/threadx_thread_create_preemption_threshold_test.c b/test/smp/regression/threadx_thread_create_preemption_threshold_test.c index 58ce79fe..b53179cb 100644 --- a/test/smp/regression/threadx_thread_create_preemption_threshold_test.c +++ b/test/smp/regression/threadx_thread_create_preemption_threshold_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test for preemption-threshold use during thread creation during initialization. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_thread_delayed_suspension_test.c b/test/smp/regression/threadx_thread_delayed_suspension_test.c index 91128f83..fe0a82f8 100644 --- a/test/smp/regression/threadx_thread_delayed_suspension_test.c +++ b/test/smp/regression/threadx_thread_delayed_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test checks out the delayed suspension clear from tx_thread_resume. */ #include <stdio.h> @@ -56,7 +67,7 @@ static volatile ULONG destination = 0; static ULONG start_time; static ULONG lower_bound; static ULONG upper_bound; -static ULONG current_itterations; +static ULONG current_iterations; #ifdef DEBUG_1 static ULONG last_loop_count; #endif @@ -106,9 +117,9 @@ ULONG i; if (upper_bound > max_loop_count) lower_bound = max_loop_count; - if ((current_itterations < lower_bound) || (current_itterations > upper_bound)) - current_itterations = lower_bound; - + if ((current_iterations < lower_bound) || (current_iterations > upper_bound)) + current_iterations = lower_bound; + #ifdef DEBUG_1 /* Last loop count. */ last_loop_count = loop_count; @@ -227,7 +238,6 @@ UINT status; /* Inform user. */ printf("Running Thread Delayed Suspension Clearing Test..................... "); - /* Relinquish to the other thread. */ tx_thread_relinquish(); @@ -270,7 +280,6 @@ UINT status; /* Wait until we see the delayed suspension set flag. */ while(delayed_suspend_set == 0) { - /* Abort the suspension for thread 2. */ tx_thread_wait_abort(&thread_2); @@ -350,7 +359,7 @@ ULONG i; lower_bound = lower_bound - 5; upper_bound = max_loop_count + 5; - current_itterations = lower_bound; + current_iterations = lower_bound; /* This thread simply suspends over and over... */ while(1) @@ -366,20 +375,20 @@ ULONG i; /* Call delay function. */ delay_function(); loop_count++; - } while (loop_count < current_itterations); + } while (loop_count < current_iterations); /* Suspend this thread. */ tx_semaphore_get(&semaphore_1, TX_WAIT_FOREVER); - /* Adjust the current itterations. */ - current_itterations++; - if (current_itterations > upper_bound) + /* Adjust the current iterations. */ + current_iterations++; + if (current_iterations > upper_bound) { if (lower_bound > min_loop_count) lower_bound--; if (upper_bound < max_loop_count) upper_bound++; - current_itterations = lower_bound; + current_iterations = lower_bound; } /* Increment the thread counter. */ diff --git a/test/smp/regression/threadx_thread_information_test.c b/test/smp/regression/threadx_thread_information_test.c index 19107742..b5d06e71 100644 --- a/test/smp/regression/threadx_thread_information_test.c +++ b/test/smp/regression/threadx_thread_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is for the thread information services. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_thread_multi_level_preemption_threshold_test.c b/test/smp/regression/threadx_thread_multi_level_preemption_threshold_test.c index 1e18820b..1eb8f685 100644 --- a/test/smp/regression/threadx_thread_multi_level_preemption_threshold_test.c +++ b/test/smp/regression/threadx_thread_multi_level_preemption_threshold_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test multi-level preemption threshold. The protection placed by a thread must be preserved after higher-priority thread preemption that is above the threshold. */ diff --git a/test/smp/regression/threadx_thread_multiple_non_current_test.c b/test/smp/regression/threadx_thread_multiple_non_current_test.c index 50ed17a0..a0acc1b9 100644 --- a/test/smp/regression/threadx_thread_multiple_non_current_test.c +++ b/test/smp/regression/threadx_thread_multiple_non_current_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if multiple non-current threads can be suspended. The order the suspension and resumption occurs makes sure everything is working right. Thread execution should remain predictable even after suspension and diff --git a/test/smp/regression/threadx_thread_multiple_sleep_test.c b/test/smp/regression/threadx_thread_multiple_sleep_test.c index f2ae3b99..4dfe5bdc 100644 --- a/test/smp/regression/threadx_thread_multiple_sleep_test.c +++ b/test/smp/regression/threadx_thread_multiple_sleep_test.c @@ -1,5 +1,18 @@ +/***************************************************************************/ +/* 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 test is designed to test multiple threads sleeping for 33 ticks. */ +// Some portions generated by Codex (gpt 5.4). + #include <stdio.h> #include "tx_api.h" @@ -154,14 +167,14 @@ static void thread_2_entry(ULONG thread_input) static void thread_3_entry(ULONG thread_input) { - /* Inform user. */ printf("Running Thread Multiple Thread Sleep for 33 Test.................... "); /* Clear the tick count. */ tx_time_set(0); - /* Sleep for 100 ticks (+1 in case tick before threads 0,1,2 have run). */ + /* Sleep for the target interval, with one extra tick in the default case + in case the first tick arrives before threads 0, 1, and 2 have run. */ tx_thread_sleep(101); /* Determine if the sleep was accurate. */ @@ -181,4 +194,3 @@ static void thread_3_entry(ULONG thread_input) test_control_return(1); } } - diff --git a/test/smp/regression/threadx_thread_multiple_suspension_test.c b/test/smp/regression/threadx_thread_multiple_suspension_test.c index 01c42e8f..d6577b53 100644 --- a/test/smp/regression/threadx_thread_multiple_suspension_test.c +++ b/test/smp/regression/threadx_thread_multiple_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if multiple threads can be created and suspend. The order the suspension and resumption occurs makes sure everything is working right. All the counters should increment at the same rate. */ diff --git a/test/smp/regression/threadx_thread_multiple_time_slice_test.c b/test/smp/regression/threadx_thread_multiple_time_slice_test.c index f3e9fbf0..af3d8019 100644 --- a/test/smp/regression/threadx_thread_multiple_time_slice_test.c +++ b/test/smp/regression/threadx_thread_multiple_time_slice_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if two threads can be created and execute with a time-slice. Thread 7 should run twice as long because it has more of a time-slice. */ diff --git a/test/smp/regression/threadx_thread_preemptable_suspension_test.c b/test/smp/regression/threadx_thread_preemptable_suspension_test.c index 8e4dbdd6..acd426c6 100644 --- a/test/smp/regression/threadx_thread_preemptable_suspension_test.c +++ b/test/smp/regression/threadx_thread_preemptable_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if multiple threads can be created and suspended. The order the suspension and resumption occurs makes sure everything is working right. All the counters should increment at the same rate. This test differs from test 4 in diff --git a/test/smp/regression/threadx_thread_preemption_change_test.c b/test/smp/regression/threadx_thread_preemption_change_test.c index 5f9726c0..808344cf 100644 --- a/test/smp/regression/threadx_thread_preemption_change_test.c +++ b/test/smp/regression/threadx_thread_preemption_change_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the change preemption service call. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_thread_priority_change.c b/test/smp/regression/threadx_thread_priority_change.c index 63863544..e68eadf5 100644 --- a/test/smp/regression/threadx_thread_priority_change.c +++ b/test/smp/regression/threadx_thread_priority_change.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the change priority service call. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_thread_relinquish_test.c b/test/smp/regression/threadx_thread_relinquish_test.c index 7b46c820..b87d6a0b 100644 --- a/test/smp/regression/threadx_thread_relinquish_test.c +++ b/test/smp/regression/threadx_thread_relinquish_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if multiple threads can be created and relinquish control between them. */ #include <stdio.h> @@ -218,7 +229,6 @@ CHAR *pointer; static void thread_0_entry(ULONG thread_input) { - /* Check for correct input value and execution of other threads. */ if ((thread_input != 0) || (thread_1_counter) || (thread_2_counter) || (thread_3_counter)) @@ -234,7 +244,6 @@ static void thread_0_entry(ULONG thread_input) static void thread_1_entry(ULONG thread_input) { - /* Check for correct input value and execution of other threads. */ if ((thread_input != 1) || (thread_0_counter != 1) || (thread_2_counter) || (thread_3_counter)) @@ -250,7 +259,6 @@ static void thread_1_entry(ULONG thread_input) static void thread_2_entry(ULONG thread_input) { - /* Check for correct input value and execution of other threads. */ if ((thread_input != 2) || (thread_0_counter != 1) || (thread_1_counter != 1) || (thread_3_counter)) @@ -455,5 +463,3 @@ static void thread_9_entry(ULONG thread_input) tx_thread_relinquish(); } } - - diff --git a/test/smp/regression/threadx_thread_reset_test.c b/test/smp/regression/threadx_thread_reset_test.c index a709d163..56006be1 100644 --- a/test/smp/regression/threadx_thread_reset_test.c +++ b/test/smp/regression/threadx_thread_reset_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the tx_thread_reset function. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_thread_simple_sleep_non_clear_test.c b/test/smp/regression/threadx_thread_simple_sleep_non_clear_test.c index 67a2cf00..502fc71e 100644 --- a/test/smp/regression/threadx_thread_simple_sleep_non_clear_test.c +++ b/test/smp/regression/threadx_thread_simple_sleep_non_clear_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test a simple sleep for 18 ticks, with something in the remaining field of the thread control block. */ diff --git a/test/smp/regression/threadx_thread_simple_sleep_test.c b/test/smp/regression/threadx_thread_simple_sleep_test.c index 5b8b12b3..583e8e12 100644 --- a/test/smp/regression/threadx_thread_simple_sleep_test.c +++ b/test/smp/regression/threadx_thread_simple_sleep_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test a simple sleep for 18 ticks. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_thread_simple_suspend_test.c b/test/smp/regression/threadx_thread_simple_suspend_test.c index a05797ec..5089fd64 100644 --- a/test/smp/regression/threadx_thread_simple_suspend_test.c +++ b/test/smp/regression/threadx_thread_simple_suspend_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if a thread can successfully suspend itself in a single thread system. This also tests a thread created that is not automatically enabled. */ @@ -25,7 +36,7 @@ void test_control_return(UINT status); #ifdef CTEST void test_application_define(void *first_unused_memory) #else -void threadx_thread_simple_supsend_application_define(void *first_unused_memory) +void threadx_thread_simple_suspend_application_define(void *first_unused_memory) #endif { diff --git a/test/smp/regression/threadx_thread_sleep_for_100ticks_test.c b/test/smp/regression/threadx_thread_sleep_for_100ticks_test.c index d5c335f0..65a0bd5f 100644 --- a/test/smp/regression/threadx_thread_sleep_for_100ticks_test.c +++ b/test/smp/regression/threadx_thread_sleep_for_100ticks_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test a simple sleep for 100 ticks. */ #include <stdio.h> @@ -42,7 +53,7 @@ static ULONG array_delay[ARRAY_SIZE]; static ULONG start_time; static ULONG lower_bound; static ULONG upper_bound; -static ULONG current_itterations; +static ULONG current_iterations; #ifdef DEBUG_1 static ULONG last_loop_count; #endif @@ -108,9 +119,9 @@ ULONG i; if (upper_bound > max_loop_count) lower_bound = max_loop_count; - if ((current_itterations < lower_bound) || (current_itterations > upper_bound)) - current_itterations = lower_bound; - + if ((current_iterations < lower_bound) || (current_iterations > upper_bound)) + current_iterations = lower_bound; + #ifdef DEBUG_1 /* Last loop count. */ last_loop_count = loop_count; @@ -218,7 +229,7 @@ CHAR *pointer; min_loop_count = 0xFFFFFFFF; max_loop_count = 0; loop_count = 0xFFFFFFFF; - current_itterations = 0; + current_iterations = 0; #ifdef DEBUG_1 last_loop_count = 0x0; #endif @@ -305,13 +316,12 @@ volatile ULONG value = 0; upper_bound = max_loop_count; #endif - current_itterations = lower_bound; + current_iterations = lower_bound; #ifdef DEBUG i = 0; #endif while (isr_test_suspend_interrupted_condition != TX_TRUE) { - /* Sleep to get a frest timer slot. */ tx_thread_sleep(1); @@ -323,7 +333,7 @@ volatile ULONG value = 0; /* Call delay function. */ delay_function(); loop_count++; - } while (loop_count < current_itterations); + } while (loop_count < current_iterations); /* Check for a timer interrupt... if so, just skip the semaphore get. */ if (start_time != _tx_timer_system_clock) @@ -331,16 +341,16 @@ volatile ULONG value = 0; /* Suspend on the semaphore for 20 ticks... */ tx_semaphore_get(&test_semaphore, 20); - - /* Adjust the current itterations. */ - current_itterations++; - if (current_itterations > upper_bound) + + /* Adjust the current iterations. */ + current_iterations++; + if (current_iterations > upper_bound) { if (lower_bound > min_loop_count) lower_bound--; if (upper_bound < max_loop_count) upper_bound++; - current_itterations = lower_bound; + current_iterations = lower_bound; } /* Set the tick count simply to use value. */ @@ -355,7 +365,7 @@ volatile ULONG value = 0; printf("loop count: NA\n"); else printf("loop count: %lu\n", loop_count); - printf("current: %lu\n", current_itterations); + printf("current: %lu\n", current_iterations); printf("last loop count: %lu\n", last_loop_count); printf("minimum: %lu\n", min_loop_count); printf("maximum: %lu\n", max_loop_count); @@ -373,7 +383,7 @@ volatile ULONG value = 0; printf("loop count: NA\n"); else printf("loop count: %lu\n", loop_count); - printf("current: %lu\n", current_itterations); + printf("current: %lu\n", current_iterations); printf("last loop count: %lu\n", last_loop_count); printf("minimum: %lu\n", min_loop_count); printf("maximum: %lu\n", max_loop_count); @@ -432,4 +442,3 @@ volatile ULONG value = 0; test_control_return(0); } } - diff --git a/test/smp/regression/threadx_thread_sleep_terminate_test.c b/test/smp/regression/threadx_thread_sleep_terminate_test.c index 98862051..374f5d43 100644 --- a/test/smp/regression/threadx_thread_sleep_terminate_test.c +++ b/test/smp/regression/threadx_thread_sleep_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread termination of a thread in a sleep condition. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_thread_stack_checking_test.c b/test/smp/regression/threadx_thread_stack_checking_test.c index 940b6c6b..9db10d0a 100644 --- a/test/smp/regression/threadx_thread_stack_checking_test.c +++ b/test/smp/regression/threadx_thread_stack_checking_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is for the thread stack checking services. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_thread_terminate_delete_test.c b/test/smp/regression/threadx_thread_terminate_delete_test.c index 63fd6a69..2ca2de85 100644 --- a/test/smp/regression/threadx_thread_terminate_delete_test.c +++ b/test/smp/regression/threadx_thread_terminate_delete_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread terminate (self, and other), thread delete, and thread identify services. */ @@ -244,7 +255,7 @@ UINT status; test_control_return(1); } - /* Delete thread 1 (thread 1 alread terminated) and 2. */ + /* Delete thread 1 (thread 1 alreadyterminated) and 2. */ status = tx_thread_delete(&thread_2); /* Check for status. */ diff --git a/test/smp/regression/threadx_thread_time_slice_change_test.c b/test/smp/regression/threadx_thread_time_slice_change_test.c index 0122fc2a..ab35bd19 100644 --- a/test/smp/regression/threadx_thread_time_slice_change_test.c +++ b/test/smp/regression/threadx_thread_time_slice_change_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the change time-slice service call. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_thread_wait_abort_and_isr_test.c b/test/smp/regression/threadx_thread_wait_abort_and_isr_test.c index 5a65fced..75faf050 100644 --- a/test/smp/regression/threadx_thread_wait_abort_and_isr_test.c +++ b/test/smp/regression/threadx_thread_wait_abort_and_isr_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test for simultaneous thread suspension lifting AND thread wait abort calls. */ #include <stdio.h> @@ -269,4 +280,3 @@ static void timer_0_entry(ULONG input) { timer_0_counter++; } - diff --git a/test/smp/regression/threadx_thread_wait_abort_test.c b/test/smp/regression/threadx_thread_wait_abort_test.c index 49852ec1..0c3f21f2 100644 --- a/test/smp/regression/threadx_thread_wait_abort_test.c +++ b/test/smp/regression/threadx_thread_wait_abort_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread wait abort. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_time_get_set_test.c b/test/smp/regression/threadx_time_get_set_test.c index 8279cbd5..e166c313 100644 --- a/test/smp/regression/threadx_time_get_set_test.c +++ b/test/smp/regression/threadx_time_get_set_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test simple tx_time_get and set services. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_timer_activate_deactivate_test.c b/test/smp/regression/threadx_timer_activate_deactivate_test.c index 69f9b38f..ceaf79bf 100644 --- a/test/smp/regression/threadx_timer_activate_deactivate_test.c +++ b/test/smp/regression/threadx_timer_activate_deactivate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test application timer activation/deactivation services from threads and the activation routines. */ diff --git a/test/smp/regression/threadx_timer_deactivate_accuracy_test.c b/test/smp/regression/threadx_timer_deactivate_accuracy_test.c index 625b82a6..0da41a7a 100644 --- a/test/smp/regression/threadx_timer_deactivate_accuracy_test.c +++ b/test/smp/regression/threadx_timer_deactivate_accuracy_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test application timer activation/deactivation services from threads... Make sure the remaining ticks are being saved/restored properly. */ diff --git a/test/smp/regression/threadx_timer_information_test.c b/test/smp/regression/threadx_timer_information_test.c index 7954de2c..ae3bb414 100644 --- a/test/smp/regression/threadx_timer_information_test.c +++ b/test/smp/regression/threadx_timer_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test timer information services. */ #include <stdio.h> diff --git a/test/smp/regression/threadx_timer_large_timer_accuracy_test.c b/test/smp/regression/threadx_timer_large_timer_accuracy_test.c index 726523b9..f44d4f05 100644 --- a/test/smp/regression/threadx_timer_large_timer_accuracy_test.c +++ b/test/smp/regression/threadx_timer_large_timer_accuracy_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test application timer activation/deactivation services from threads... To make sure large timer expirations are being saved/restored properly. */ diff --git a/test/smp/regression/threadx_timer_multiple_accuracy_test.c b/test/smp/regression/threadx_timer_multiple_accuracy_test.c index af9957d8..a4cceefa 100644 --- a/test/smp/regression/threadx_timer_multiple_accuracy_test.c +++ b/test/smp/regression/threadx_timer_multiple_accuracy_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the accuracy of three free running timers. */ #include <stdio.h> @@ -183,4 +194,3 @@ static void timer_2_expiration(ULONG timer_input) /* Process timer expiration. */ timer_2_counter++; } - diff --git a/test/smp/regression/threadx_timer_multiple_test.c b/test/smp/regression/threadx_timer_multiple_test.c index 688a7d5b..a0f215dc 100644 --- a/test/smp/regression/threadx_timer_multiple_test.c +++ b/test/smp/regression/threadx_timer_multiple_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test a simple application timer services, including create, activate, deactivate, change, and delete with multiple timers. */ diff --git a/test/smp/regression/threadx_timer_simple_test.c b/test/smp/regression/threadx_timer_simple_test.c index b763ad55..e2272bd2 100644 --- a/test/smp/regression/threadx_timer_simple_test.c +++ b/test/smp/regression/threadx_timer_simple_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test a simple application timer services, including create, activate, deactivate, change, and delete. */ @@ -596,7 +607,6 @@ ULONG exclusion_map; /* Create a timer for the test. */ tx_timer_create(&timer_0, "timer 0", timer_entry, 0, 1, 1, TX_AUTO_ACTIVATE); - /* Setup the ISR. */ test_isr_dispatch = test_isr; diff --git a/test/smp/regression/threadx_trace_basic_test.c b/test/smp/regression/threadx_trace_basic_test.c index 2f3227f8..51fa6256 100644 --- a/test/smp/regression/threadx_trace_basic_test.c +++ b/test/smp/regression/threadx_trace_basic_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test trace functionality in ThreadX. */ #include <stdio.h> diff --git a/test/tx/cmake/CMakeLists.txt b/test/tx/cmake/CMakeLists.txt index 2dd16ade..97b3615b 100644 --- a/test/tx/cmake/CMakeLists.txt +++ b/test/tx/cmake/CMakeLists.txt @@ -2,8 +2,16 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0057 NEW) +if((DEFINED THREADX_ARCH) AND ((THREADX_ARCH STREQUAL "win32") OR (THREADX_ARCH STREQUAL "win64"))) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +endif() + project(threadx_test LANGUAGES C) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_EXTENSIONS OFF) + # Set build configurations set(BUILD_CONFIGURATIONS default_build_coverage disable_notify_callbacks_build stack_checking_build stack_checking_rand_fill_build trace_build) @@ -22,24 +30,30 @@ endif() message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.") -set(default_build_coverage -DTX_QUEUE_MESSAGE_MAX_SIZE=32) -set(disable_notify_callbacks_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_DISABLE_NOTIFY_CALLBACKS) -set(stack_checking_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_STACK_CHECKING) -set(stack_checking_rand_fill_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_STACK_CHECKING -DTX_ENABLE_RANDOM_NUMBER_STACK_FILLING) -set(trace_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_EVENT_TRACE) +set(default_build_coverage TX_QUEUE_MESSAGE_MAX_SIZE=32) +set(disable_notify_callbacks_build TX_QUEUE_MESSAGE_MAX_SIZE=32 TX_DISABLE_NOTIFY_CALLBACKS) +set(stack_checking_build TX_QUEUE_MESSAGE_MAX_SIZE=32 TX_ENABLE_STACK_CHECKING) +set(stack_checking_rand_fill_build TX_QUEUE_MESSAGE_MAX_SIZE=32 TX_ENABLE_STACK_CHECKING TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) +set(trace_build TX_QUEUE_MESSAGE_MAX_SIZE=32 TX_ENABLE_EVENT_TRACE) -add_compile_options( - -m32 - -std=c99 - -ggdb - -g3 - -gdwarf-2 - -fdiagnostics-color - -Werror - -DTX_REGRESSION_TEST - -DTEST_STACK_SIZE_PRINTF=4096 +add_compile_definitions( + TX_REGRESSION_TEST + TEST_STACK_SIZE_PRINTF=4096 ${${CMAKE_BUILD_TYPE}}) -add_link_options(-m32) + +if(MSVC) + add_compile_options(/W3 /Zi) + add_link_options(/DEBUG /INCREMENTAL:NO) +else() + add_compile_options( + -m32 + -ggdb + -g3 + -gdwarf-2 + -fdiagnostics-color + -Werror) + add_link_options(-m32) +endif() enable_testing() @@ -49,26 +63,32 @@ add_subdirectory(samples) # Coverage if(CMAKE_BUILD_TYPE MATCHES ".*_coverage") - target_compile_options(threadx PRIVATE -fprofile-arcs -ftest-coverage) - target_link_options(threadx PRIVATE -fprofile-arcs -ftest-coverage) + if(NOT MSVC) + target_compile_options(threadx PRIVATE -fprofile-arcs -ftest-coverage) + target_link_options(threadx PRIVATE -fprofile-arcs -ftest-coverage) + endif() endif() -target_compile_options( - threadx - PRIVATE -Werror - -Wall - -Wextra - -pedantic - -fmessage-length=0 - -fsigned-char - -ffunction-sections - -fdata-sections - -Wunused - -Wuninitialized - -Wmissing-declarations - -Wconversion - -Wpointer-arith - # -Wshadow - -Wlogical-op - -Waggregate-return - -Wfloat-equal) +if(MSVC) + target_compile_options(threadx PRIVATE /W3) +else() + target_compile_options( + threadx + PRIVATE -Werror + -Wall + -Wextra + -pedantic + -fmessage-length=0 + -fsigned-char + -ffunction-sections + -fdata-sections + -Wunused + -Wuninitialized + -Wmissing-declarations + -Wconversion + -Wpointer-arith + # -Wshadow + -Wlogical-op + -Waggregate-return + -Wfloat-equal) +endif() diff --git a/test/tx/cmake/coverage.sh b/test/tx/cmake/coverage.sh index ae2c7a4b..6dda78b3 100755 --- a/test/tx/cmake/coverage.sh +++ b/test/tx/cmake/coverage.sh @@ -1,4 +1,15 @@ #!/bin/bash +############################################################################## +# 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 +############################################################################## + set -e diff --git a/test/tx/cmake/regression/CMakeLists.txt b/test/tx/cmake/regression/CMakeLists.txt index d60743fa..34fba1b2 100644 --- a/test/tx/cmake/regression/CMakeLists.txt +++ b/test/tx/cmake/regression/CMakeLists.txt @@ -4,6 +4,14 @@ cmake_policy(SET CMP0057 NEW) project(regression_test LANGUAGES C) set(SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../regression) +set(REPO_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../..) +set(PORT_LOW_LEVEL_SOURCE ${REPO_ROOT}/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN}/src/tx_initialize_low_level.c) +set(GENERATED_LOW_LEVEL_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/tx_initialize_low_level.c) +set(TESTCONTROL_WEAK_DEFAULTS_SOURCE ${REPO_ROOT}/test/shared/regression/testcontrol_weak_defaults.c) + +if(NOT EXISTS ${PORT_LOW_LEVEL_SOURCE}) + message(FATAL_ERROR "Unable to locate tx_initialize_low_level.c for ${THREADX_ARCH}/${THREADX_TOOLCHAIN}") +endif() set(regression_test_cases ${SOURCE_DIR}/threadx_block_memory_basic_test.c @@ -104,19 +112,38 @@ set(regression_test_cases ${SOURCE_DIR}/threadx_initialize_kernel_setup_test.c) add_custom_command( - OUTPUT ${SOURCE_DIR}/tx_initialize_low_level.c - COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/generate_test_file.sh + OUTPUT ${GENERATED_LOW_LEVEL_SOURCE} + COMMAND ${CMAKE_COMMAND} + -DSOURCE_FILE=${PORT_LOW_LEVEL_SOURCE} + -DOUTPUT_FILE=${GENERATED_LOW_LEVEL_SOURCE} + -P ${CMAKE_CURRENT_LIST_DIR}/generate_test_file.cmake + DEPENDS ${PORT_LOW_LEVEL_SOURCE} ${CMAKE_CURRENT_LIST_DIR}/generate_test_file.cmake COMMENT "Generating tx_initialize_low_level.c for test") -add_library(test_utility ${SOURCE_DIR}/tx_initialize_low_level.c - ${SOURCE_DIR}/testcontrol.c) -target_link_libraries(test_utility PUBLIC azrtos::threadx) -target_compile_definitions(test_utility PUBLIC CTEST BATCH_TEST - TEST_STACK_SIZE_PRINTF=4096) +add_library(test_weak_defaults OBJECT ${TESTCONTROL_WEAK_DEFAULTS_SOURCE}) +target_compile_definitions(test_weak_defaults PRIVATE CTEST BATCH_TEST + TEST_STACK_SIZE_PRINTF=4096) +target_link_libraries(test_weak_defaults PRIVATE azrtos::threadx) + +add_library(test_utility OBJECT ${GENERATED_LOW_LEVEL_SOURCE} + ${SOURCE_DIR}/testcontrol.c) +target_compile_definitions(test_utility PRIVATE CTEST BATCH_TEST + TEST_STACK_SIZE_PRINTF=4096) +target_link_libraries(test_utility PRIVATE azrtos::threadx) foreach(test_case ${regression_test_cases}) get_filename_component(test_name ${test_case} NAME_WE) - add_executable(${test_name} ${test_case}) - target_link_libraries(${test_name} PRIVATE test_utility) + + if(test_name STREQUAL "threadx_initialize_kernel_setup_test") + add_executable(${test_name} ${test_case} $<TARGET_OBJECTS:test_weak_defaults>) + else() + add_executable(${test_name} ${test_case} + $<TARGET_OBJECTS:test_utility> + $<TARGET_OBJECTS:test_weak_defaults>) + target_compile_definitions(${test_name} PRIVATE CTEST BATCH_TEST + TEST_STACK_SIZE_PRINTF=4096) + endif() + + target_link_libraries(${test_name} PRIVATE azrtos::threadx) add_test(${CMAKE_BUILD_TYPE}::${test_name} ${test_name}) endforeach() diff --git a/test/tx/cmake/regression/generate_test_file.cmake b/test/tx/cmake/regression/generate_test_file.cmake new file mode 100644 index 00000000..d37e744b --- /dev/null +++ b/test/tx/cmake/regression/generate_test_file.cmake @@ -0,0 +1,42 @@ +if(NOT DEFINED SOURCE_FILE) + message(FATAL_ERROR "SOURCE_FILE is required") +endif() + +if(NOT DEFINED OUTPUT_FILE) + message(FATAL_ERROR "OUTPUT_FILE is required") +endif() + +file(STRINGS "${SOURCE_FILE}" FILE_LINES) + +set(UPDATED_FILE_CONTENTS "") +set(DISPATCH_DECLARATION "VOID test_interrupt_dispatch(VOID);") +set(DISPATCH_CALL "test_interrupt_dispatch();") +set(DECLARATION_INSERTED FALSE) +set(CALL_INSERTED FALSE) + +foreach(FILE_LINE IN LISTS FILE_LINES) + if((NOT DECLARATION_INSERTED) AND + ((FILE_LINE MATCHES "^void[ \t]+\\*_tx_linux_timer_interrupt\\(void \\*p\\);[ \t]*$") + OR + (FILE_LINE MATCHES "^VOID CALLBACK[ \t]+_tx_win32_timer_interrupt\\(UINT wTimerID, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2\\);[ \t]*$"))) + string(APPEND UPDATED_FILE_CONTENTS "${FILE_LINE}\n${DISPATCH_DECLARATION}\n") + set(DECLARATION_INSERTED TRUE) + elseif((NOT CALL_INSERTED) AND (FILE_LINE MATCHES "^([ \t]*)_tx_timer_interrupt\\(\\);[ \t]*$")) + string(APPEND UPDATED_FILE_CONTENTS "${CMAKE_MATCH_1}${DISPATCH_CALL}\n${FILE_LINE}\n") + set(CALL_INSERTED TRUE) + else() + string(APPEND UPDATED_FILE_CONTENTS "${FILE_LINE}\n") + endif() +endforeach() + +if(NOT CALL_INSERTED) + message(FATAL_ERROR "Unable to insert test interrupt dispatcher call into ${SOURCE_FILE}") +endif() + +if(NOT DECLARATION_INSERTED) + message(FATAL_ERROR "Unable to insert test interrupt dispatcher declaration into ${SOURCE_FILE}") +endif() + +get_filename_component(OUTPUT_DIRECTORY "${OUTPUT_FILE}" DIRECTORY) +file(MAKE_DIRECTORY "${OUTPUT_DIRECTORY}") +file(WRITE "${OUTPUT_FILE}" "${UPDATED_FILE_CONTENTS}") diff --git a/test/tx/cmake/regression/generate_test_file.sh b/test/tx/cmake/regression/generate_test_file.sh index ac0a70fa..67482c42 100755 --- a/test/tx/cmake/regression/generate_test_file.sh +++ b/test/tx/cmake/regression/generate_test_file.sh @@ -1,4 +1,15 @@ #!/bin/bash +############################################################################## +# 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 +############################################################################## + dst=$(dirname $0)/../../regression/tx_initialize_low_level.c src=$(dirname $0)/../../../../ports/linux/gnu/src/tx_initialize_low_level.c diff --git a/test/tx/cmake/riscv/CMakeLists.txt b/test/tx/cmake/riscv/CMakeLists.txt new file mode 100644 index 00000000..a4f7e7e8 --- /dev/null +++ b/test/tx/cmake/riscv/CMakeLists.txt @@ -0,0 +1,87 @@ +cmake_minimum_required(VERSION 3.13 FATAL_ERROR) +cmake_policy(SET CMP0054 NEW) +cmake_policy(SET CMP0057 NEW) + +project(threadx_riscv_test LANGUAGES C ASM) + +# Build configurations (same defines as Linux tests, minus coverage instrumentation) +set(BUILD_CONFIGURATIONS default_build disable_notify_callbacks_build + stack_checking_build stack_checking_rand_fill_build trace_build) +set(CMAKE_CONFIGURATION_TYPES + ${BUILD_CONFIGURATIONS} + CACHE STRING "list of supported configuration types" FORCE) +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + ${CMAKE_CONFIGURATION_TYPES}) +list(GET CMAKE_CONFIGURATION_TYPES 0 BUILD_TYPE) +if((NOT CMAKE_BUILD_TYPE) OR (NOT ("${CMAKE_BUILD_TYPE}" IN_LIST + CMAKE_CONFIGURATION_TYPES))) + set(CMAKE_BUILD_TYPE + "${BUILD_TYPE}" + CACHE STRING "Build Type of the project" FORCE) +endif() + +message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.") +message(STATUS "THREADX_ARCH: ${THREADX_ARCH}") + +# Per-configuration compile definitions +set(default_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32) +set(disable_notify_callbacks_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_DISABLE_NOTIFY_CALLBACKS) +set(stack_checking_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_STACK_CHECKING) +set(stack_checking_rand_fill_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_STACK_CHECKING -DTX_ENABLE_RANDOM_NUMBER_STACK_FILLING) +set(trace_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_EVENT_TRACE) + +add_compile_options( + -std=c99 + -O0 + -g3 + -fdiagnostics-color + -Werror + -ffunction-sections + -fdata-sections + -DTX_REGRESSION_TEST + -DTEST_STACK_SIZE_PRINTF=4096 + -DEXTERNAL_EXIT + ${${CMAKE_BUILD_TYPE}} +) + +enable_testing() + +# Add ThreadX library (uses the RISC-V toolchain set by CMAKE_TOOLCHAIN_FILE) +add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../../../.. threadx) + +# Add BSP +add_subdirectory(bsp) + +# Add regression tests +add_subdirectory(regression) + +# Strict warning flags for the ThreadX library build +target_compile_options( + threadx + PRIVATE -Werror + -Wall + -Wextra + -pedantic + -fmessage-length=0 + -fsigned-char + -ffunction-sections + -fdata-sections + -Wunused + -Wuninitialized + -Wmissing-declarations + # -Wconversion is disabled for RV64 because ULONG is intentionally 32-bit + # (for ThreadX ABI compatibility across all ports) while sizeof(VOID*) and + # sizeof(ALIGN_TYPE) return size_t (64-bit on RV64). This design matches + # ARM Cortex-A72 and other 64-bit ports. The implicit conversions in + # common/src/ byte/block pool code trigger -Wconversion warnings. Since + # pool sizes are inherently limited to 32-bit (ULONG), the conversions + # are safe. No other 64-bit port with 32-bit ULONG has been tested with + # -Wconversion enabled, so we disable it here for RV64. + $<$<STREQUAL:${THREADX_ARCH},risc-v32>:-Wconversion> + -Wpointer-arith + -Wlogical-op + -Waggregate-return + -Wfloat-equal + $<$<COMPILE_LANGUAGE:C>:-include$<SEMICOLON>stdlib.h> +) diff --git a/test/tx/cmake/riscv/bsp/CMakeLists.txt b/test/tx/cmake/riscv/bsp/CMakeLists.txt new file mode 100644 index 00000000..a6b8171a --- /dev/null +++ b/test/tx/cmake/riscv/bsp/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.13 FATAL_ERROR) + +# BSP library for RISC-V QEMU virt regression tests. +# Provides board init, UART, CLINT timer, PLIC, trap handler, +# newlib syscall stubs, and low-level ThreadX initialization. + +project(riscv_bsp LANGUAGES C ASM) + +set(BSP_DIR ${CMAKE_CURRENT_LIST_DIR}) + +add_library(riscv_bsp + ${BSP_DIR}/entry.S + ${BSP_DIR}/tx_initialize_low_level.S + ${BSP_DIR}/board.c + ${BSP_DIR}/trap.c + ${BSP_DIR}/hwtimer.c + ${BSP_DIR}/plic.c + ${BSP_DIR}/uart.c + ${BSP_DIR}/syscalls.c + ${BSP_DIR}/printf.c +) + +target_include_directories(riscv_bsp PUBLIC ${BSP_DIR}) +target_link_libraries(riscv_bsp PUBLIC azrtos::threadx) +target_compile_definitions(riscv_bsp PUBLIC EXTERNAL_EXIT) diff --git a/test/tx/cmake/riscv/bsp/board.c b/test/tx/cmake/riscv/bsp/board.c new file mode 100644 index 00000000..0891200e --- /dev/null +++ b/test/tx/cmake/riscv/bsp/board.c @@ -0,0 +1,30 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +#include "plic.h" +#include "hwtimer.h" +#include "uart.h" +#include <stdint.h> +#include <stddef.h> + +int board_init(void) +{ + int ret; + ret = plic_init(); + if (ret) + return ret; + ret = uart_init(); + if (ret) + return ret; + ret = hwtimer_init(); + if (ret) + return ret; + return 0; +} diff --git a/test/tx/cmake/riscv/bsp/csr.h b/test/tx/cmake/riscv/bsp/csr.h new file mode 100644 index 00000000..f3d15f82 --- /dev/null +++ b/test/tx/cmake/riscv/bsp/csr.h @@ -0,0 +1,84 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +#ifndef RISCV_CSR_H +#define RISCV_CSR_H + +/* Machine Status Register, mstatus */ +#define MSTATUS_MPP_MASK (3L << 11) +#define MSTATUS_MPP_M (3L << 11) +#define MSTATUS_MPP_S (1L << 11) +#define MSTATUS_MPP_U (0L << 11) +#define MSTATUS_MIE (1L << 3) +#define MSTATUS_MPIE (1L << 7) +#define MSTATUS_FS (1L << 13) + +/* Machine-mode Interrupt Enable */ +#define MIE_MTIE (1L << 7) +#define MIE_MSIE (1L << 3) +#define MIE_MEIE (1L << 11) +#define MIE_STIE (1L << 5) +#define MIE_SSIE (1L << 1) +#define MIE_SEIE (1L << 9) + +#ifndef __ASSEMBLER__ + +#include <stdint.h> + +static inline uintptr_t riscv_get_core(void) +{ + uintptr_t x; + __asm__ volatile("csrr %0, mhartid" : "=r" (x)); + return x; +} + +static inline uintptr_t riscv_get_mstatus(void) +{ + uintptr_t x; + __asm__ volatile("csrr %0, mstatus" : "=r" (x)); + return x; +} + +static inline void riscv_writ_mstatus(uintptr_t x) +{ + __asm__ volatile("csrw mstatus, %0" : : "r" (x)); +} + +static inline void riscv_mintr_on(void) +{ + uintptr_t mstatus = riscv_get_mstatus(); + mstatus |= MSTATUS_MIE; + riscv_writ_mstatus(mstatus); +} + +static inline void riscv_mintr_off(void) +{ + uintptr_t mstatus = riscv_get_mstatus(); + mstatus &= (~MSTATUS_MIE); + riscv_writ_mstatus(mstatus); +} + +static inline int riscv_mintr_get(void) +{ + uintptr_t x = riscv_get_mstatus(); + return (x & MSTATUS_MIE) != 0; +} + +static inline void riscv_mintr_restore(int x) +{ + if (x) + riscv_mintr_on(); + else + riscv_mintr_off(); +} + +#endif /* __ASSEMBLER__ */ + +#endif /* RISCV_CSR_H */ diff --git a/test/tx/cmake/riscv/bsp/entry.S b/test/tx/cmake/riscv/bsp/entry.S new file mode 100644 index 00000000..2f16c052 --- /dev/null +++ b/test/tx/cmake/riscv/bsp/entry.S @@ -0,0 +1,75 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +/* Boot code for RISC-V QEMU virt regression tests. + Works for both RV32 and RV64 (instructions are width-agnostic). */ + +.section .text.init +.align 4 +.global _start +.extern main +.extern _sysstack_end +.extern _bss_start +.extern _bss_end + +_start: + csrr t0, mhartid + bne t0, zero, _secondary_halt + + /* Zero all general-purpose registers. */ + li x1, 0 + li x2, 0 + li x3, 0 + li x4, 0 + li x5, 0 + li x6, 0 + li x7, 0 + li x8, 0 + li x9, 0 + li x10, 0 + li x11, 0 + li x12, 0 + li x13, 0 + li x14, 0 + li x15, 0 + li x16, 0 + li x17, 0 + li x18, 0 + li x19, 0 + li x20, 0 + li x21, 0 + li x22, 0 + li x23, 0 + li x24, 0 + li x25, 0 + li x26, 0 + li x27, 0 + li x28, 0 + li x29, 0 + li x30, 0 + li x31, 0 + + /* Set up stack pointer from linker symbol. */ + la sp, _sysstack_end + + /* Clear BSS. */ + la t0, _bss_start + la t1, _bss_end +_bss_clean: + bgeu t0, t1, _bss_done + sb zero, 0(t0) + addi t0, t0, 1 + j _bss_clean +_bss_done: + call main + +_secondary_halt: + wfi + j _secondary_halt diff --git a/test/tx/cmake/riscv/bsp/hwtimer.c b/test/tx/cmake/riscv/bsp/hwtimer.c new file mode 100644 index 00000000..99821f1e --- /dev/null +++ b/test/tx/cmake/riscv/bsp/hwtimer.c @@ -0,0 +1,33 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +#include "csr.h" +#include "hwtimer.h" +#include <tx_port.h> + +#define CLINT (0x02000000L) +#define CLINT_TIME (CLINT + 0xBFF8) +#define CLINT_TIMECMP(id) (CLINT + 0x4000 + 8 * (id)) + +int hwtimer_init(void) +{ + uintptr_t hart = riscv_get_core(); + uint64_t time = *((volatile uint64_t *)CLINT_TIME); + *((volatile uint64_t *)CLINT_TIMECMP(hart)) = time + TICKNUM_PER_TIMER; + return 0; +} + +int hwtimer_handler(void) +{ + uintptr_t hart = riscv_get_core(); + uint64_t time = *((volatile uint64_t *)CLINT_TIME); + *((volatile uint64_t *)CLINT_TIMECMP(hart)) = time + TICKNUM_PER_TIMER; + return 0; +} diff --git a/test/tx/cmake/riscv/bsp/hwtimer.h b/test/tx/cmake/riscv/bsp/hwtimer.h new file mode 100644 index 00000000..e6b9efa4 --- /dev/null +++ b/test/tx/cmake/riscv/bsp/hwtimer.h @@ -0,0 +1,22 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +#ifndef RISCV_HWTIMER_H +#define RISCV_HWTIMER_H + +#include <stdint.h> + +#define TICKNUM_PER_SECOND 10000000 +#define TICKNUM_PER_TIMER (TICKNUM_PER_SECOND / 10) + +int hwtimer_init(void); +int hwtimer_handler(void); + +#endif /* RISCV_HWTIMER_H */ diff --git a/test/tx/cmake/riscv/bsp/link.lds b/test/tx/cmake/riscv/bsp/link.lds new file mode 100644 index 00000000..42f08fb6 --- /dev/null +++ b/test/tx/cmake/riscv/bsp/link.lds @@ -0,0 +1,60 @@ +/*************************************************************************** + * Linker script for RISC-V QEMU virt regression tests. + * Provides 128 MB RAM starting at 0x80000000 (QEMU virt default). + * System stack is 16 KB to accommodate test framework overhead. + **************************************************************************/ + +OUTPUT_ARCH( "riscv" ) +ENTRY( _start ) + +MEMORY +{ + RAM (rwx) : ORIGIN = 0x80000000, LENGTH = 128M +} + +SECTIONS +{ + . = 0x80000000; + + .text : { + KEEP(*(.text.init)) + *(.text .text.*) + . = ALIGN(0x1000); + PROVIDE(etext = .); + } > RAM + + .rodata : { + . = ALIGN(16); + *(.srodata .srodata.*) + . = ALIGN(16); + *(.rodata .rodata.*) + } > RAM + + .data : { + . = ALIGN(16); + *(.sdata .sdata.*) + . = ALIGN(16); + *(.data .data.*) + } > RAM + + .bss : { + . = ALIGN(16); + _bss_start = .; + *(.sbss .sbss.*) + . = ALIGN(16); + *(.bss .bss.*) + *(COMMON) + _bss_end = .; + } > RAM + + .stack : { + . = ALIGN(4096); + _sysstack_start = .; + . += 0x4000; + _sysstack_end = .; + } > RAM + + PROVIDE(_end = .); + + ASSERT(. <= ORIGIN(RAM) + LENGTH(RAM), "Image exceeds available RAM") +} diff --git a/test/tx/cmake/riscv/bsp/plic.c b/test/tx/cmake/riscv/bsp/plic.c new file mode 100644 index 00000000..a2b44fec --- /dev/null +++ b/test/tx/cmake/riscv/bsp/plic.c @@ -0,0 +1,87 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +#include "plic.h" +#include <stddef.h> + +irq_callback callbacks[MAX_CALLBACK_NUM]; + +void plic_irq_enable(int irqno) +{ + uintptr_t hart = riscv_get_core(); + volatile uint32_t *reg = (volatile uint32_t *)(PLIC_MENABLE(hart) + (irqno / 32) * 4); + *reg = *reg | (1U << (irqno % 32)); +} + +void plic_irq_disable(int irqno) +{ + uintptr_t hart = riscv_get_core(); + volatile uint32_t *reg = (volatile uint32_t *)(PLIC_MENABLE(hart) + (irqno / 32) * 4); + *reg = *reg & ~(1U << (irqno % 32)); +} + +void plic_prio_set(int irqno, int prio) +{ + PLIC_SET_PRIO(irqno, prio); +} + +int plic_prio_get(int irqno) +{ + return (int)PLIC_GET_PRIO(irqno); +} + +int plic_register_callback(int irqno, irq_callback callback) +{ + if (!(irqno >= 0 && irqno < MAX_CALLBACK_NUM)) + return -1; + callbacks[irqno] = callback; + return 0; +} + +int plic_unregister_callback(int irqno) +{ + return plic_register_callback(irqno, NULL); +} + +int plic_init(void) +{ + for (int i = 0; i < MAX_CALLBACK_NUM; i++) + { + callbacks[i] = NULL; + } + return 0; +} + +int plic_claim(void) +{ + uintptr_t hart = riscv_get_core(); + return (int)(*(uint32_t *)PLIC_MCLAIM(hart)); +} + +void plic_complete(int irqno) +{ + uintptr_t hart = riscv_get_core(); + *(uint32_t *)(PLIC_MCOMPLETE(hart)) = (uint32_t)irqno; +} + +int plic_irq_intr(void) +{ + int ret = -1; + int irqno = plic_claim(); + if (irqno <= 0 || irqno >= MAX_CALLBACK_NUM) { + plic_complete(irqno); + return 0; // spurious or out-of-range, not an error + } + if (callbacks[irqno] != NULL) + ret = (callbacks[irqno])(irqno); + + plic_complete(irqno); + return ret; +} diff --git a/test/tx/cmake/riscv/bsp/plic.h b/test/tx/cmake/riscv/bsp/plic.h new file mode 100644 index 00000000..e2734ea6 --- /dev/null +++ b/test/tx/cmake/riscv/bsp/plic.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +#ifndef RISCV_PLIC_H +#define RISCV_PLIC_H + +#include "csr.h" +#include <stdint.h> + +#define PLIC 0x0c000000L +#define PLIC_PRIORITY (PLIC + 0x0) +#define PLIC_PENDING (PLIC + 0x1000) +#define PLIC_MENABLE(hart) (PLIC + 0x2000 + (hart) * 0x100) +#define PLIC_SENABLE(hart) (PLIC + 0x2080 + (hart) * 0x100) +#define PLIC_MPRIORITY(hart) (PLIC + 0x200000 + (hart) * 0x2000) +#define PLIC_SPRIORITY(hart) (PLIC + 0x201000 + (hart) * 0x2000) +#define PLIC_MCLAIM(hart) (PLIC + 0x200004 + (hart) * 0x2000) +#define PLIC_SCLAIM(hart) (PLIC + 0x201004 + (hart) * 0x2000) +#define PLIC_MCOMPLETE(hart) (PLIC + 0x200004 + (hart) * 0x2000) +#define PLIC_SCOMPLETE(hart) (PLIC + 0x201004 + (hart) * 0x2000) + +#define PLIC_GET_PRIO(irqno) (*(uint32_t *)(PLIC_PRIORITY + (irqno) * 4)) +#define PLIC_SET_PRIO(irqno, prio) (*(uint32_t *)(PLIC_PRIORITY + (irqno) * 4) = (prio)) + +#define MAX_CALLBACK_NUM 128 +typedef int (*irq_callback)(int irqno); + +void plic_irq_enable(int irqno); +void plic_irq_disable(int irqno); +int plic_prio_get(int irqno); +void plic_prio_set(int irqno, int prio); +int plic_register_callback(int irqno, irq_callback callback); +int plic_unregister_callback(int irqno); +int plic_init(void); +int plic_claim(void); +void plic_complete(int irqno); +int plic_irq_intr(void); + +#endif /* RISCV_PLIC_H */ diff --git a/test/tx/cmake/riscv/bsp/printf.c b/test/tx/cmake/riscv/bsp/printf.c new file mode 100644 index 00000000..4aa185cc --- /dev/null +++ b/test/tx/cmake/riscv/bsp/printf.c @@ -0,0 +1,168 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +/* Minimal printf/puts for RISC-V QEMU virt regression tests. + Avoids linking newlib's stdio which is compiled with mcmodel=medlow + and causes relocation overflow on RV64 (DRAM at 0x80000000). + Only the format specifiers used by the test suite are supported: + %s, %d, %u, %lu, %ld, %%, and plain strings. */ + +#include <stdarg.h> +#include <stddef.h> + +extern int _write(int fd, const char *buf, int count); + +static void print_str(const char *s) +{ + const char *p = s; + while (*p) + p++; + _write(1, s, (int)(p - s)); +} + +static void print_unsigned(unsigned long val) +{ + char buf[21]; + int i = 0; + + if (val == 0) + { + _write(1, "0", 1); + return; + } + + while (val > 0) + { + buf[i++] = (char)('0' + (int)(val % 10u)); + val /= 10u; + } + + /* Reverse. */ + for (int j = i - 1; j >= 0; j--) + _write(1, &buf[j], 1); +} + +static void print_hex(unsigned long val) +{ + static const char hex[] = "0123456789abcdef"; + char buf[17]; + int i = 0; + + if (val == 0) + { + _write(1, "0", 1); + return; + } + + while (val > 0) + { + buf[i++] = hex[val & 0xfu]; + val >>= 4; + } + + for (int j = i - 1; j >= 0; j--) + _write(1, &buf[j], 1); +} + +static void print_signed(long val) +{ + if (val < 0) + { + _write(1, "-", 1); + print_unsigned((unsigned long)(-val)); + } + else + { + print_unsigned((unsigned long)val); + } +} + +int printf(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + + const char *p = fmt; + const char *seg = p; + + while (*p) + { + if (*p == '%') + { + /* Flush preceding literal segment. */ + if (p > seg) + _write(1, seg, (int)(p - seg)); + + p++; + /* Check for 'l' length modifier. */ + int is_long = 0; + if (*p == 'l') + { + is_long = 1; + p++; + } + + switch (*p) + { + case 's': + print_str(va_arg(ap, const char *)); + break; + case 'd': + if (is_long) + print_signed(va_arg(ap, long)); + else + print_signed((long)va_arg(ap, int)); + break; + case 'u': + if (is_long) + print_unsigned(va_arg(ap, unsigned long)); + else + print_unsigned((unsigned long)va_arg(ap, unsigned int)); + break; + case 'x': + if (is_long) + print_hex(va_arg(ap, unsigned long)); + else + print_hex((unsigned long)va_arg(ap, unsigned int)); + break; + case '%': + _write(1, "%", 1); + break; + default: + /* Unknown specifier — print as-is. */ + _write(1, "%", 1); + if (is_long) + _write(1, "l", 1); + _write(1, p, 1); + break; + } + p++; + seg = p; + } + else + { + p++; + } + } + + /* Flush remaining literal segment. */ + if (p > seg) + _write(1, seg, (int)(p - seg)); + + va_end(ap); + return 0; +} + +int puts(const char *s) +{ + print_str(s); + _write(1, "\n", 1); + return 0; +} diff --git a/test/tx/cmake/riscv/bsp/syscalls.c b/test/tx/cmake/riscv/bsp/syscalls.c new file mode 100644 index 00000000..802fe8af --- /dev/null +++ b/test/tx/cmake/riscv/bsp/syscalls.c @@ -0,0 +1,128 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +/* Newlib system call stubs for RISC-V QEMU virt regression tests. + Provides _write (UART output for printf), _exit (QEMU test finisher), + and other minimal stubs needed by newlib. */ + +#include <sys/stat.h> +#include <errno.h> +#include <stdint.h> + +#define UART0_THR (*(volatile unsigned char *)0x10000000L) +#define UART0_LSR (*(volatile unsigned char *)0x10000005L) +#define LSR_TX_IDLE (1 << 5) + +/* QEMU virt sifive_test device for clean exit. */ +#define VIRT_TEST (*(volatile uint32_t *)0x100000L) +#define VIRT_TEST_PASS 0x5555u +#define VIRT_TEST_FAIL 0x3333u + +/* Called by testcontrol.c when EXTERNAL_EXIT is defined. */ +__attribute__((noreturn)) void external_exit(unsigned int code) +{ + if (code == 0) + VIRT_TEST = VIRT_TEST_PASS; + else + VIRT_TEST = (code << 16) | VIRT_TEST_FAIL; + + /* Should not reach here, but halt if it does. */ + while (1) + ; +} + +int _write(int fd, const char *buf, int count) +{ + (void)fd; + for (int i = 0; i < count; i++) + { + while ((UART0_LSR & LSR_TX_IDLE) == 0) + ; + UART0_THR = (unsigned char)buf[i]; + } + return count; +} + +extern char _end[]; +static char *heap_ptr = 0; + +void *_sbrk(int incr) +{ + if (heap_ptr == 0) + heap_ptr = _end; + + char *prev = heap_ptr; + heap_ptr += incr; + return prev; +} + +int _close(int fd) +{ + (void)fd; + errno = EBADF; + return -1; +} + +int _fstat(int fd, struct stat *st) +{ + (void)fd; + st->st_mode = S_IFCHR; + return 0; +} + +int _isatty(int fd) +{ + (void)fd; + return 1; +} + +int _lseek(int fd, int offset, int whence) +{ + (void)fd; + (void)offset; + (void)whence; + errno = ESPIPE; + return -1; +} + +int _read(int fd, char *buf, int count) +{ + (void)fd; + (void)buf; + (void)count; + return 0; +} + +__attribute__((noreturn)) void _exit(int code) +{ + external_exit((unsigned int)code); +} + +/* Override newlib's exit() to avoid pulling in __call_exitprocs and + __stdio_exit_handler (compiled with mcmodel=medlow). */ +__attribute__((noreturn)) void exit(int code) +{ + external_exit((unsigned int)code); +} + +/* Minimal rand/srand to avoid pulling newlib's version which uses + _impure_ptr (compiled with mcmodel=medlow, unreachable on RV64). */ +static unsigned long rand_seed = 1; + +int rand(void) +{ + rand_seed = rand_seed * 1103515245UL + 12345UL; + return (int)((rand_seed >> 16) & 0x7fff); +} + +void srand(unsigned int seed) +{ + rand_seed = seed; +} diff --git a/test/tx/cmake/riscv/bsp/trap.c b/test/tx/cmake/riscv/bsp/trap.c new file mode 100644 index 00000000..0ac7990a --- /dev/null +++ b/test/tx/cmake/riscv/bsp/trap.c @@ -0,0 +1,84 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +/* Trap handler for RISC-V QEMU virt regression tests. + Calls test_interrupt_dispatch() BEFORE _tx_timer_interrupt() to match + the Linux port's behavior (generate_test_file.sh injection order). */ + +#include "csr.h" +#include <stdint.h> +#include <stdio.h> +#include "uart.h" +#include "hwtimer.h" +#include "plic.h" +#include <tx_port.h> +#include <tx_api.h> +#include <tx_trace.h> + +/* Interrupt bit is the MSB of mcause */ +#define MCAUSE_INT_BIT ((uintptr_t)1 << (sizeof(uintptr_t) * 8 - 1)) + +#define OS_IS_INTERUPT(mcause) ((mcause) & MCAUSE_INT_BIT) +#define OS_IS_TICK_INT(mcause) ((mcause) == (MCAUSE_INT_BIT | 7u)) +#define OS_IS_SOFT_INT(mcause) ((mcause) == (MCAUSE_INT_BIT | 3u)) +#define OS_IS_EXT_INT(mcause) ((mcause) == (MCAUSE_INT_BIT | 11u)) + +extern void _tx_timer_interrupt(void); +extern void test_interrupt_dispatch(void) __attribute__((weak)); +extern void _exit(int code) __attribute__((noreturn)); + +void trap_handler(uintptr_t mcause, uintptr_t mepc, uintptr_t mtval) +{ + (void)mepc; + (void)mtval; + + if (OS_IS_INTERUPT(mcause)) + { + if (OS_IS_TICK_INT(mcause)) + { + hwtimer_handler(); + + /* Trace ISR enter event (matches Linux port behavior). */ + _tx_trace_isr_enter_insert(0); + + /* Call test ISR dispatch BEFORE timer interrupt (matches Linux). */ + if (test_interrupt_dispatch) + test_interrupt_dispatch(); + + _tx_timer_interrupt(); + + /* Trace ISR exit event. */ + _tx_trace_isr_exit_insert(0); + } + else if (OS_IS_EXT_INT(mcause)) + { + int ret = plic_irq_intr(); + if (ret) + { + uart_puts("[INTERRUPT]: handler irq error!"); + while (1) + ; + } + } + else + { + uart_puts("[INTERRUPT]: unhandled interrupt!"); + while (1) + ; + } + } + else + { + uart_puts("[EXCEPTION]: unhandled exception!"); + printf(" mcause=0x%lx mepc=0x%lx mtval=0x%lx\n", + (unsigned long)mcause, (unsigned long)mepc, (unsigned long)mtval); + _exit(1); + } +} diff --git a/test/tx/cmake/riscv/bsp/tx_initialize_low_level.S b/test/tx/cmake/riscv/bsp/tx_initialize_low_level.S new file mode 100644 index 00000000..8d474d66 --- /dev/null +++ b/test/tx/cmake/riscv/bsp/tx_initialize_low_level.S @@ -0,0 +1,100 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +/* Trap entry and low-level init for RISC-V QEMU virt regression tests. + Supports both RV32 and RV64 via __riscv_xlen conditionals. */ + +#include "csr.h" + +#if __riscv_xlen == 64 +#define STORE sd +#define LOAD ld +#define REGBYTES 8 +#else +#define STORE sw +#define LOAD lw +#define REGBYTES 4 +#endif + + .section .text + .align 4 + +/**************************************************************************/ +/* trap_entry — saves context, calls C trap_handler, restores context. */ +/**************************************************************************/ + .global trap_entry + .extern trap_handler + .extern _tx_thread_context_restore + +trap_entry: +#if defined(__riscv_float_abi_single) || defined(__riscv_float_abi_double) + addi sp, sp, -(65 * REGBYTES) +#else + addi sp, sp, -(32 * REGBYTES) +#endif + + STORE x1, (28 * REGBYTES)(sp) + + call _tx_thread_context_save + + csrr a0, mcause + csrr a1, mepc + csrr a2, mtval + addi sp, sp, -REGBYTES + STORE ra, 0(sp) + call trap_handler + LOAD ra, 0(sp) + addi sp, sp, REGBYTES + + call _tx_thread_context_restore + +_trap_err: + wfi + j _trap_err + +/**************************************************************************/ +/* _tx_initialize_low_level — hardware init for QEMU virt. */ +/**************************************************************************/ + .section .text + .global _tx_initialize_low_level + .extern _end + .extern board_init + +_tx_initialize_low_level: + + la t0, _tx_thread_system_stack_ptr + STORE sp, 0(t0) + + la t0, _end + la t1, _tx_initialize_unused_memory + STORE t0, 0(t1) + + li t0, MSTATUS_MIE + csrrc zero, mstatus, t0 + li t0, (MSTATUS_MPP_M | MSTATUS_MPIE) + csrrs zero, mstatus, t0 + li t0, (MIE_MTIE | MIE_MSIE | MIE_MEIE) + csrrs zero, mie, t0 + +#ifdef __riscv_flen + li t0, MSTATUS_FS + csrrs zero, mstatus, t0 + fscsr x0 +#endif + + addi sp, sp, -REGBYTES + STORE ra, 0(sp) + call board_init + LOAD ra, 0(sp) + addi sp, sp, REGBYTES + + la t0, trap_entry + csrw mtvec, t0 + ret diff --git a/test/tx/cmake/riscv/bsp/uart.c b/test/tx/cmake/riscv/bsp/uart.c new file mode 100644 index 00000000..c1a6b64b --- /dev/null +++ b/test/tx/cmake/riscv/bsp/uart.c @@ -0,0 +1,79 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +#include "uart.h" +#include "csr.h" +#include "plic.h" +#include <stdint.h> + +#define Reg(reg) ((volatile unsigned char *)(UART0 + (reg))) + +#define RHR 0 +#define THR 0 +#define IER 1 +#define IER_RX_ENABLE (1<<0) +#define IER_TX_ENABLE (1<<1) +#define FCR 2 +#define FCR_FIFO_ENABLE (1<<0) +#define FCR_FIFO_CLEAR (3<<1) +#define LCR 3 +#define LCR_EIGHT_BITS (3<<0) +#define LCR_BAUD_LATCH (1<<7) +#define LSR 5 +#define LSR_RX_READY (1<<0) +#define LSR_TX_IDLE (1<<5) + +#define ReadReg(reg) (*(Reg(reg))) +#define WriteReg(reg, v) (*(Reg(reg)) = (v)) + +int uart_init(void) +{ + WriteReg(IER, 0x00); + WriteReg(LCR, LCR_BAUD_LATCH); + WriteReg(0, 0x03); + WriteReg(1, 0x00); + WriteReg(LCR, LCR_EIGHT_BITS); + WriteReg(FCR, FCR_FIFO_ENABLE | FCR_FIFO_CLEAR); + + plic_irq_enable(UART0_IRQ); + plic_prio_set(UART0_IRQ, 1); + + return 0; +} + +void uart_putc_nolock(int ch) +{ + while ((ReadReg(LSR) & LSR_TX_IDLE) == 0) + ; + WriteReg(THR, ch); +} + +int uart_putc(int ch) +{ + int intr_enable = riscv_mintr_get(); + riscv_mintr_off(); + uart_putc_nolock(ch); + riscv_mintr_restore(intr_enable); + return 1; +} + +int uart_puts(const char *str) +{ + int i; + int intr_enable = riscv_mintr_get(); + riscv_mintr_off(); + for (i = 0; str[i] != 0; i++) + { + uart_putc_nolock(str[i]); + } + uart_putc_nolock('\n'); + riscv_mintr_restore(intr_enable); + return i; +} diff --git a/test/tx/cmake/riscv/bsp/uart.h b/test/tx/cmake/riscv/bsp/uart.h new file mode 100644 index 00000000..765ec38f --- /dev/null +++ b/test/tx/cmake/riscv/bsp/uart.h @@ -0,0 +1,22 @@ +/*************************************************************************** + * Copyright (c) 2026 10xEngineers + * + * 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 + **************************************************************************/ + +#ifndef RISCV_UART_H +#define RISCV_UART_H + +#define UART0 0x10000000L +#define UART0_IRQ 10 + +int uart_init(void); +int uart_putc(int ch); +void uart_putc_nolock(int ch); +int uart_puts(const char *str); + +#endif /* RISCV_UART_H */ diff --git a/test/tx/cmake/riscv/regression/CMakeLists.txt b/test/tx/cmake/riscv/regression/CMakeLists.txt new file mode 100644 index 00000000..80b6e3bd --- /dev/null +++ b/test/tx/cmake/riscv/regression/CMakeLists.txt @@ -0,0 +1,177 @@ +cmake_minimum_required(VERSION 3.13 FATAL_ERROR) +cmake_policy(SET CMP0057 NEW) + +project(riscv_regression_test LANGUAGES C ASM) + +set(SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../regression) +set(BSP_DIR ${CMAKE_CURRENT_LIST_DIR}/../bsp) + +# Determine QEMU arch from THREADX_ARCH +if(THREADX_ARCH STREQUAL "risc-v64") + set(QEMU_SYSTEM "qemu-system-riscv64") + set(XLEN_TAG "rv64") +else() + set(QEMU_SYSTEM "qemu-system-riscv32") + set(XLEN_TAG "rv32") +endif() + +set(regression_test_cases + ${SOURCE_DIR}/threadx_block_memory_basic_test.c + ${SOURCE_DIR}/threadx_block_memory_error_detection_test.c + ${SOURCE_DIR}/threadx_block_memory_information_test.c + ${SOURCE_DIR}/threadx_block_memory_prioritize_test.c + ${SOURCE_DIR}/threadx_block_memory_suspension_test.c + ${SOURCE_DIR}/threadx_block_memory_suspension_timeout_test.c + ${SOURCE_DIR}/threadx_block_memory_thread_terminate_test.c + ${SOURCE_DIR}/threadx_byte_memory_basic_test.c + ${SOURCE_DIR}/threadx_byte_memory_information_test.c + ${SOURCE_DIR}/threadx_byte_memory_prioritize_test.c + ${SOURCE_DIR}/threadx_byte_memory_suspension_test.c + ${SOURCE_DIR}/threadx_byte_memory_suspension_timeout_test.c + ${SOURCE_DIR}/threadx_byte_memory_thread_contention_test.c + ${SOURCE_DIR}/threadx_byte_memory_thread_terminate_test.c + ${SOURCE_DIR}/threadx_event_flag_basic_test.c + ${SOURCE_DIR}/threadx_event_flag_information_test.c + ${SOURCE_DIR}/threadx_event_flag_isr_set_clear_test.c + ${SOURCE_DIR}/threadx_event_flag_isr_wait_abort_test.c + ${SOURCE_DIR}/threadx_event_flag_single_thread_terminate_test.c + ${SOURCE_DIR}/threadx_event_flag_suspension_consume_test.c + ${SOURCE_DIR}/threadx_event_flag_suspension_different_bits_consume_test.c + ${SOURCE_DIR}/threadx_event_flag_suspension_different_bits_test.c + ${SOURCE_DIR}/threadx_event_flag_suspension_test.c + ${SOURCE_DIR}/threadx_event_flag_suspension_timeout_test.c + ${SOURCE_DIR}/threadx_event_flag_thread_terminate_test.c + ${SOURCE_DIR}/threadx_interrupt_control_test.c + ${SOURCE_DIR}/threadx_mutex_basic_test.c + ${SOURCE_DIR}/threadx_mutex_delete_test.c + ${SOURCE_DIR}/threadx_mutex_information_test.c + ${SOURCE_DIR}/threadx_mutex_nested_priority_inheritance_test.c + ${SOURCE_DIR}/threadx_mutex_no_preemption_test.c + ${SOURCE_DIR}/threadx_mutex_preemption_test.c + ${SOURCE_DIR}/threadx_mutex_priority_inheritance_test.c + ${SOURCE_DIR}/threadx_mutex_proritize_test.c + ${SOURCE_DIR}/threadx_mutex_suspension_timeout_test.c + ${SOURCE_DIR}/threadx_mutex_thread_terminate_test.c + ${SOURCE_DIR}/threadx_queue_basic_eight_word_test.c + ${SOURCE_DIR}/threadx_queue_basic_four_word_test.c + ${SOURCE_DIR}/threadx_queue_basic_one_word_test.c + ${SOURCE_DIR}/threadx_queue_basic_sixteen_word_test.c + ${SOURCE_DIR}/threadx_queue_basic_two_word_test.c + ${SOURCE_DIR}/threadx_queue_basic_max_message_size_test.c + ${SOURCE_DIR}/threadx_queue_empty_suspension_test.c + ${SOURCE_DIR}/threadx_queue_flush_no_suspension_test.c + ${SOURCE_DIR}/threadx_queue_flush_test.c + ${SOURCE_DIR}/threadx_queue_front_send_test.c + ${SOURCE_DIR}/threadx_queue_full_suspension_test.c + ${SOURCE_DIR}/threadx_queue_information_test.c + ${SOURCE_DIR}/threadx_queue_prioritize.c + ${SOURCE_DIR}/threadx_queue_suspension_timeout_test.c + ${SOURCE_DIR}/threadx_queue_thread_terminate_test.c + ${SOURCE_DIR}/threadx_semaphore_basic_test.c + ${SOURCE_DIR}/threadx_semaphore_ceiling_put_test.c + ${SOURCE_DIR}/threadx_semaphore_delete_test.c + ${SOURCE_DIR}/threadx_semaphore_information_test.c + ${SOURCE_DIR}/threadx_semaphore_non_preemption_test.c + ${SOURCE_DIR}/threadx_semaphore_preemption_test.c + ${SOURCE_DIR}/threadx_semaphore_prioritize.c + ${SOURCE_DIR}/threadx_semaphore_thread_terminate_test.c + ${SOURCE_DIR}/threadx_semaphore_timeout_test.c + ${SOURCE_DIR}/threadx_thread_basic_execution_test.c + ${SOURCE_DIR}/threadx_thread_basic_time_slice_test.c + ${SOURCE_DIR}/threadx_thread_completed_test.c + ${SOURCE_DIR}/threadx_thread_create_preemption_threshold_test.c + ${SOURCE_DIR}/threadx_thread_delayed_suspension_test.c + ${SOURCE_DIR}/threadx_thread_information_test.c + ${SOURCE_DIR}/threadx_thread_multi_level_preemption_threshold_test.c + ${SOURCE_DIR}/threadx_thread_multiple_non_current_test.c + ${SOURCE_DIR}/threadx_thread_multiple_sleep_test.c + ${SOURCE_DIR}/threadx_thread_multiple_suspension_test.c + ${SOURCE_DIR}/threadx_thread_multiple_time_slice_test.c + ${SOURCE_DIR}/threadx_thread_preemptable_suspension_test.c + ${SOURCE_DIR}/threadx_thread_preemption_change_test.c + ${SOURCE_DIR}/threadx_thread_priority_change.c + ${SOURCE_DIR}/threadx_thread_relinquish_test.c + ${SOURCE_DIR}/threadx_thread_reset_test.c + ${SOURCE_DIR}/threadx_thread_simple_sleep_non_clear_test.c + ${SOURCE_DIR}/threadx_thread_simple_sleep_test.c + ${SOURCE_DIR}/threadx_thread_simple_suspend_test.c + ${SOURCE_DIR}/threadx_thread_sleep_for_100ticks_test.c + ${SOURCE_DIR}/threadx_thread_sleep_terminate_test.c + ${SOURCE_DIR}/threadx_thread_stack_checking_test.c + ${SOURCE_DIR}/threadx_thread_terminate_delete_test.c + ${SOURCE_DIR}/threadx_thread_time_slice_change_test.c + ${SOURCE_DIR}/threadx_thread_wait_abort_and_isr_test.c + ${SOURCE_DIR}/threadx_thread_wait_abort_test.c + ${SOURCE_DIR}/threadx_time_get_set_test.c + ${SOURCE_DIR}/threadx_timer_activate_deactivate_test.c + ${SOURCE_DIR}/threadx_timer_deactivate_accuracy_test.c + ${SOURCE_DIR}/threadx_timer_information_test.c + ${SOURCE_DIR}/threadx_timer_large_timer_accuracy_test.c + ${SOURCE_DIR}/threadx_timer_multiple_accuracy_test.c + ${SOURCE_DIR}/threadx_timer_multiple_test.c + ${SOURCE_DIR}/threadx_timer_simple_test.c + # threadx_trace_basic_test.c excluded: references tx_saved_posture + # (the Linux port's interrupt save variable) which is named + # interrupt_save on RISC-V. +) + +# Tests that provide their own main() and must NOT link with testcontrol. +set(standalone_test_cases + ${SOURCE_DIR}/threadx_initialize_kernel_setup_test.c +) + +set(WEAK_DEFAULTS_SOURCE ${CMAKE_CURRENT_LIST_DIR}/../../../../shared/regression/testcontrol_weak_defaults.c) + +# Weak defaults must be an OBJECT library so all objects are always linked +# into each test executable, even though they only provide weak symbols. +# A STATIC library would have the linker skip them (weak defs don't satisfy +# undefined strong references during archive scanning). +add_library(riscv_test_weak_defaults OBJECT ${WEAK_DEFAULTS_SOURCE}) +target_compile_definitions(riscv_test_weak_defaults PRIVATE + CTEST BATCH_TEST EXTERNAL_EXIT TEST_STACK_SIZE_PRINTF=4096) +target_compile_options(riscv_test_weak_defaults PRIVATE -include stdlib.h) +target_link_libraries(riscv_test_weak_defaults PRIVATE azrtos::threadx) + +# Build testcontrol.c as a static library (no patched tx_initialize_low_level +# needed — the BSP provides it directly with test_interrupt_dispatch hook). +add_library(riscv_test_utility ${SOURCE_DIR}/testcontrol.c) +target_link_libraries(riscv_test_utility PUBLIC riscv_bsp azrtos::threadx) +target_compile_definitions(riscv_test_utility PUBLIC + CTEST BATCH_TEST EXTERNAL_EXIT TEST_STACK_SIZE_PRINTF=4096) +# Bare-metal newlib needs explicit stdlib.h for rand() used in some tests. +target_compile_options(riscv_test_utility PUBLIC -include stdlib.h) + +# Helper function to register a test executable with QEMU + CTest. +function(register_riscv_test test_name) + target_link_options(${test_name} PRIVATE + -T ${BSP_DIR}/link.lds -nostartfiles + -Wl,--gc-sections) + add_test( + NAME ${CMAKE_BUILD_TYPE}::${XLEN_TAG}::${test_name} + COMMAND ${QEMU_SYSTEM} -nographic -smp 1 -bios none -m 128M + -machine virt -kernel $<TARGET_FILE:${test_name}> + ) + set_tests_properties(${CMAKE_BUILD_TYPE}::${XLEN_TAG}::${test_name} + PROPERTIES TIMEOUT 120) +endfunction() + +# Regular tests (linked with testcontrol). +foreach(test_case ${regression_test_cases}) + get_filename_component(test_name ${test_case} NAME_WE) + add_executable(${test_name} ${test_case} $<TARGET_OBJECTS:riscv_test_weak_defaults>) + target_link_libraries(${test_name} PRIVATE + -Wl,--whole-archive riscv_bsp -Wl,--no-whole-archive + riscv_test_utility) + register_riscv_test(${test_name}) +endforeach() + +# Standalone tests (provide their own main, no testcontrol). +foreach(test_case ${standalone_test_cases}) + get_filename_component(test_name ${test_case} NAME_WE) + add_executable(${test_name} ${test_case} $<TARGET_OBJECTS:riscv_test_weak_defaults>) + target_link_libraries(${test_name} PRIVATE + -Wl,--whole-archive riscv_bsp -Wl,--no-whole-archive + azrtos::threadx) + target_compile_options(${test_name} PRIVATE -include stdlib.h) + register_riscv_test(${test_name}) +endforeach() diff --git a/test/tx/cmake/riscv/run.sh b/test/tx/cmake/riscv/run.sh new file mode 100755 index 00000000..3b0905e7 --- /dev/null +++ b/test/tx/cmake/riscv/run.sh @@ -0,0 +1,162 @@ +#!/bin/bash +############################################################################## +# 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 +############################################################################## + + +set -e + +# RISC-V regression test build/test runner. +# Usage: run.sh <arch> <build|test> [all|<config> ...] +# arch: riscv32 or riscv64 + +function help() { + echo "Usage: $0 <arch> <command> [all|<build_configuration> ...]" + echo "" + echo " arch: riscv32 | riscv64" + echo " command: build | test" + echo "" + echo "Available build configurations:" + for build in ${build_configurations[*]}; do + echo " $build" + done + exit 1 +} + +function validate() { + for build in ${build_configurations[*]}; do + if [ "$1" == "$build" ]; then + return + fi + done + help +} + +function generate() { + local arch=$1 + local build=$2 + local toolchain_file + local build_dir + + if [ "$arch" == "riscv32" ]; then + toolchain_file="${REPO_ROOT}/cmake/riscv32_gnu.cmake" + else + toolchain_file="${REPO_ROOT}/cmake/riscv64_gnu.cmake" + fi + + build_dir="build/${arch}_${build}" + cmake -B"$build_dir" -GNinja \ + -DCMAKE_TOOLCHAIN_FILE="$toolchain_file" \ + -DCMAKE_BUILD_TYPE="$build" \ + . +} + +function build() { + local arch=$1 + local build=$2 + cmake --build "build/${arch}_${build}" +} + +function run_test() { + local arch=$1 + local build=$2 + local parallel_jobs=$3 + + pushd "build/${arch}_${build}" + [ -z "${CTEST_PARALLEL_LEVEL}" ] && parallel="-j${parallel_jobs}" + if [ -z "${CTEST_REPEAT_FAIL}" ]; then + repeat_fail=2 + else + repeat_fail=${CTEST_REPEAT_FAIL} + fi + ctest $parallel --timeout 1000 \ + -O "${arch}_${build}.txt" \ + -T test --no-compress-output \ + --test-output-size-passed 4194304 \ + --test-output-size-failed 4194304 \ + --output-on-failure \ + --repeat until-pass:${repeat_fail} \ + --output-junit "${arch}_${build}.xml" + popd +} + +# Determine repo root and script directory +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/../../../.." && pwd)" +cd "$SCRIPT_DIR" + +# Parse build configurations from CMakeLists.txt +result=$(sed -n "/(BUILD_CONFIGURATIONS/,/)/p" CMakeLists.txt | sed ':label;N;s/\n/ /;b label' | grep -Pzo "[a-zA-Z0-9_]*build[a-zA-Z0-9_]*\s*" | tr -d '\0') +IFS=' ' +read -ra build_configurations <<< "$result" + +if [ $# -lt 2 ]; then + help +fi + +arch=$1 +shift + +if [ "$arch" != "riscv32" ] && [ "$arch" != "riscv64" ]; then + echo "Error: arch must be 'riscv32' or 'riscv64'" + help +fi + +command=$1 +shift + +if [ "$#" == "0" ]; then + builds=${build_configurations[0]} +elif [ "$*" == "all" ]; then + builds=${build_configurations[@]} +else + for item in $*; do + validate "$item" + done + builds=$* +fi + +if [ "$command" == "build" ]; then + for item in $builds; do + generate "$arch" "$item" + echo "" + done + + for item in $builds; do + echo "Building ${arch} ${item}" + build "$arch" "$item" + echo "" + done +elif [ "$command" == "test" ]; then + cores=$(nproc) + if [ -z "${CTEST_PARALLEL_LEVEL}" ]; then + build_counts=$(echo $builds | wc -w) + parallel_jobs=$(($cores / $build_counts)) + parallel_jobs=$(($parallel_jobs + 2)) + pids="" + for item in $builds; do + echo "Testing ${arch} ${item}" + run_test "$arch" "$item" "$parallel_jobs" & + pids+=" $!" + done + exit_code=0 + for p in $pids; do + wait $p || exit_code=$? + done + exit $exit_code + else + for item in $builds; do + echo "Testing ${arch} ${item}" + run_test "$arch" "$item" "$parallel_jobs" + done + fi +else + help +fi diff --git a/test/tx/cmake/samples/fake.c b/test/tx/cmake/samples/fake.c index 199f257e..138117b5 100644 --- a/test/tx/cmake/samples/fake.c +++ b/test/tx/cmake/samples/fake.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 */ +/***************************************************************************/ + #include "tx_api.h" typedef unsigned int TEST_FLAG; diff --git a/test/tx/regression/testcontrol.c b/test/tx/regression/testcontrol.c index 3d33bc7f..e2b3f725 100644 --- a/test/tx/regression/testcontrol.c +++ b/test/tx/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.4). #include "tx_api.h" #include <stdio.h> @@ -122,7 +134,6 @@ typedef struct TEST_ENTRY_STRUCT VOID (*test_entry)(void *); } TEST_ENTRY; - /* Define the prototypes for the test entry points. */ void threadx_block_memory_basic_application_define(void *); @@ -195,7 +206,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 *); @@ -312,7 +323,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, @@ -483,7 +494,6 @@ UINT i, j; TX_THREAD *thread_ptr; #endif - /* Initialize the test error/success counters. */ test_control_successful_tests = 0; test_control_failed_tests = 0; @@ -565,6 +575,7 @@ TX_THREAD *thread_ptr; /* Clear the ISR dispatch. */ test_isr_dispatch = TX_NULL; + /* Ensure that _tx_thread_time_slice can handle NULL thread, note that current thread pointer is NULL at this point. */ _tx_thread_time_slice(); @@ -586,7 +597,7 @@ TX_THREAD *thread_ptr; init_test_thread.tx_thread_ready_previous = &init_test_thread; _tx_thread_time_slice(); _tx_thread_current_ptr = TX_NULL; - +#ifndef TX_DISABLE_NOTIFY_CALLBACKS /* Test to make sure _tx_thread_shell_entry can handle a NULL mutex release function pointer. */ temp_mutex_release = _tx_thread_mutex_release; temp_thread = _tx_thread_execute_ptr; @@ -605,6 +616,7 @@ TX_THREAD *thread_ptr; _tx_thread_current_ptr = TX_NULL; _tx_thread_execute_ptr = temp_thread; _tx_thread_mutex_release = temp_mutex_release; /* Recover Mutex release pointer. */ +#endif /* Test _tx_thread_system_suspend when not current, preemption is needed but disabled. */ temp_thread = _tx_thread_execute_ptr; @@ -1232,8 +1244,8 @@ 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++; } @@ -1413,14 +1425,3 @@ void test_exit_notify(TX_THREAD *thread_ptr, UINT type) } -__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) -{ -} diff --git a/test/tx/regression/threadx_block_memory_basic_test.c b/test/tx/regression/threadx_block_memory_basic_test.c index 12e301d1..94cc8793 100644 --- a/test/tx/regression/threadx_block_memory_basic_test.c +++ b/test/tx/regression/threadx_block_memory_basic_test.c @@ -1,8 +1,20 @@ +/***************************************************************************/ +/* 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 test is designed to test simple memory block pool creation, deletion, and allocates and releases. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" typedef struct BLOCK_MEMORY_TEST_STRUCT { @@ -86,7 +98,7 @@ CHAR *pointer; /* Attempt to create a block pool from a timer. */ pointer = (CHAR *) 0x30000; - status = tx_block_pool_create(&pool_3, "pool 3", 100, pointer, 320); + status = tx_block_pool_create(&pool_3, "pool 3", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); /* Check status. */ if (status != TX_CALLER_ERROR) @@ -146,7 +158,7 @@ UINT status; } /* Attempt to create a block pool from an ISR. */ - status = tx_block_pool_create(&pool_3, "pool 3", 100, (void *) 0x100000, 320); + status = tx_block_pool_create(&pool_3, "pool 3", 100, (void *) 0x100000, TX_TEST_BLOCK_POOL_BYTES(100, 3)); /* Check status. */ if (status != TX_CALLER_ERROR) @@ -217,8 +229,8 @@ CHAR *pointer; } /* Create block pools 0 and 1. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -228,8 +240,8 @@ CHAR *pointer; test_control_return(1); } - status = tx_block_pool_create(&pool_1, "pool 1", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_1, "pool 1", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -265,7 +277,7 @@ CHAR *pointer_2; CHAR *pointer_3; CHAR *pointer_4; INT i; -unsigned long fake_block[20]; +TX_TEST_POINTER_WORD fake_block[20]; /* Inform user. */ @@ -316,7 +328,7 @@ unsigned long fake_block[20]; /* Try to release a block that points to a non-pool. */ fake_block[0] = 0; - fake_block[1] = (unsigned long) &fake_block[0]; + TX_TEST_STORE_POINTER(fake_block[1], &fake_block[0]); status = tx_block_release(&fake_block[2]); /* Check status. */ diff --git a/test/tx/regression/threadx_block_memory_error_detection_test.c b/test/tx/regression/threadx_block_memory_error_detection_test.c index 7b7f2f61..41148120 100644 --- a/test/tx/regression/threadx_block_memory_error_detection_test.c +++ b/test/tx/regression/threadx_block_memory_error_detection_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test error detection for simple memory block operations. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -49,18 +61,18 @@ INT status; pointer = pointer + TEST_STACK_SIZE_PRINTF; /* Create block pool 0. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); #ifndef TX_DISABLE_ERROR_CHECKING /* skip this test and pretend it passed */ /* Create block pool again to get pool_ptr error. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); if (status != TX_POOL_ERROR) return; /* Create block pool with NULL pointer. */ - status = tx_block_pool_create(TX_NULL, "pool 0", 100, pointer, 320); + status = tx_block_pool_create(TX_NULL, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); if (status != TX_POOL_ERROR) { @@ -69,7 +81,7 @@ INT status; } /* Create block pool pointer if NULL start. */ - status = tx_block_pool_create(&pool_1, "pool 0", 100, NULL, 320); + status = tx_block_pool_create(&pool_1, "pool 0", 100, NULL, TX_TEST_BLOCK_POOL_BYTES(100, 3)); if (status != TX_PTR_ERROR) { @@ -128,11 +140,11 @@ INT i; #ifndef TX_DISABLE_ERROR_CHECKING /* skip this test and pretend it passed */ - status = tx_block_pool_create(&pool_1, "pool 1", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_1, "pool 1", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Attempt to create a pool with an invalid size. */ - status = _txe_block_pool_create(&pool_2, "pool 2", 100, pointer, 320, 777777); + status = _txe_block_pool_create(&pool_2, "pool 2", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3), 777777); if (status != TX_POOL_ERROR) { @@ -384,4 +396,3 @@ INT i; printf("SUCCESS!\n"); test_control_return(0); } - diff --git a/test/tx/regression/threadx_block_memory_information_test.c b/test/tx/regression/threadx_block_memory_information_test.c index 20e34d88..82d57f40 100644 --- a/test/tx/regression/threadx_block_memory_information_test.c +++ b/test/tx/regression/threadx_block_memory_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test block memory information services. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_block_memory_prioritize_test.c b/test/tx/regression/threadx_block_memory_prioritize_test.c index 6238aef8..3b2c4f0b 100644 --- a/test/tx/regression/threadx_block_memory_prioritize_test.c +++ b/test/tx/regression/threadx_block_memory_prioritize_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test block memory pool prioritize. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_block_memory_suspension_test.c b/test/tx/regression/threadx_block_memory_suspension_test.c index da14f454..fb68a6f9 100644 --- a/test/tx/regression/threadx_block_memory_suspension_test.c +++ b/test/tx/regression/threadx_block_memory_suspension_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test suspension on memory block pools. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -83,8 +95,8 @@ CHAR *pointer; } /* Create block pool. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -308,4 +320,3 @@ CHAR *pointer_1; } } - diff --git a/test/tx/regression/threadx_block_memory_suspension_timeout_test.c b/test/tx/regression/threadx_block_memory_suspension_timeout_test.c index dc460662..257dd122 100644 --- a/test/tx/regression/threadx_block_memory_suspension_timeout_test.c +++ b/test/tx/regression/threadx_block_memory_suspension_timeout_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test timeouts on suspension on memory block pools. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -84,8 +96,8 @@ CHAR *pointer; } /* Create block pool. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -209,4 +221,3 @@ CHAR *pointer_1; thread_2_counter++; } } - diff --git a/test/tx/regression/threadx_block_memory_thread_terminate_test.c b/test/tx/regression/threadx_block_memory_thread_terminate_test.c index 6064891d..89e0c787 100644 --- a/test/tx/regression/threadx_block_memory_thread_terminate_test.c +++ b/test/tx/regression/threadx_block_memory_thread_terminate_test.c @@ -1,8 +1,20 @@ +/***************************************************************************/ +/* 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 test is designed to test thread termination on a thread suspended on a block memory pool. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -69,8 +81,8 @@ CHAR *pointer; } /* Create block pool. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -182,4 +194,3 @@ CHAR *pointer_1; thread_1_counter++; } } - diff --git a/test/tx/regression/threadx_byte_memory_basic_test.c b/test/tx/regression/threadx_byte_memory_basic_test.c index 36f41331..45f92e12 100644 --- a/test/tx/regression/threadx_byte_memory_basic_test.c +++ b/test/tx/regression/threadx_byte_memory_basic_test.c @@ -1,8 +1,29 @@ +/***************************************************************************/ +/* 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 test is designed to test simple memory byte pool creation, deletion, and allocates and releases. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" + +/* Per-allocation overhead in byte pools: next pointer + ALIGN_TYPE alignment marker. */ +#define BYTE_POOL_OVERHEAD (sizeof(UCHAR *) + sizeof(ALIGN_TYPE)) + +/* Pool size for pool_0: exactly fits 3 allocations of 24 bytes with no room for a 4th. */ +#define POOL_0_SIZE (ULONG)(3u * (24u + BYTE_POOL_OVERHEAD) + BYTE_POOL_OVERHEAD) + +/* Pool size for pool_4: must accommodate 3 allocations of 84 bytes (tightest pattern). */ +#define POOL_4_SIZE (ULONG)(3u * (84u + BYTE_POOL_OVERHEAD) + BYTE_POOL_OVERHEAD + 16u) typedef struct BYTE_MEMORY_TEST_STRUCT { @@ -91,7 +112,7 @@ CHAR *pointer; /* Attempt to create a byte pool from a timer. */ pointer = (CHAR *) 0x30000; - status = tx_byte_pool_create(&pool_2, "pool 2", pointer, 108); + status = tx_byte_pool_create(&pool_2, "pool 2", pointer, TX_TEST_BYTE_POOL_BYTES(108)); /* Check status. */ if (status != TX_CALLER_ERROR) @@ -103,7 +124,7 @@ CHAR *pointer; /* Attempt to create a byte pool with an invalid size. */ status = _txe_byte_pool_create(&pool_3, "pool 3", pointer, - 108, (sizeof(TX_BYTE_POOL)+1)); + TX_TEST_BYTE_POOL_BYTES(108), (sizeof(TX_BYTE_POOL)+1)); /* Check status. */ if (status != TX_POOL_ERROR) @@ -186,7 +207,7 @@ UINT status; /* Attempt to create a byte pool from an ISR. */ - status = tx_byte_pool_create(&pool_2, "pool 0", (void *) 0x100000, 108); + status = tx_byte_pool_create(&pool_2, "pool 0", (void *) 0x100000, TX_TEST_BYTE_POOL_BYTES(108)); /* Check status. */ if (status != TX_CALLER_ERROR) @@ -256,8 +277,8 @@ CHAR *pointer; } /* Create byte pools 0 and 1. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer, 108); - pointer = pointer + 108; + status = tx_byte_pool_create(&pool_0, "pool 0", pointer, TX_TEST_BYTE_POOL_CAPACITY_BYTES(24, 3)); + pointer = pointer + TX_TEST_BYTE_POOL_CAPACITY_BYTES(24, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -267,8 +288,8 @@ CHAR *pointer; test_control_return(1); } - status = tx_byte_pool_create(&pool_1, "pool 1", pointer, 200); - pointer = pointer + 200; + status = tx_byte_pool_create(&pool_1, "pool 1", pointer, TX_TEST_BYTE_POOL_BYTES(200)); + pointer = pointer + TX_TEST_BYTE_POOL_BYTES(200); /* Check status. */ if (status != TX_SUCCESS) @@ -279,9 +300,9 @@ CHAR *pointer; } /* Test for search pointer issue on wrapped seach with prior block to search pointer merged. */ - status = tx_byte_pool_create(&pool_4, "pool 4", pointer, 300); + status = tx_byte_pool_create(&pool_4, "pool 4", pointer, TX_TEST_BYTE_POOL_CAPACITY_BYTES(84, 3)); pool_4_memory = pointer; - pointer = pointer + 300; + pointer = pointer + TX_TEST_BYTE_POOL_CAPACITY_BYTES(84, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -353,7 +374,7 @@ CHAR *pointer_2; CHAR *pointer_3; CHAR *pointer_4; INT i; -ULONG array[20]; +TX_TEST_POINTER_WORD array[20]; UCHAR *save_search; @@ -394,7 +415,7 @@ UCHAR *save_search; /* Try to create a NULL pool. */ pointer_1 = (CHAR *) 0x30000; - status = tx_byte_pool_create(TX_NULL, "pool 0", pointer_1, 108); + status = tx_byte_pool_create(TX_NULL, "pool 0", pointer_1, TX_TEST_BYTE_POOL_BYTES(108)); /* Check status. */ if (status != TX_POOL_ERROR) @@ -406,7 +427,7 @@ UCHAR *save_search; } /* Try to create the same pool. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer_1, 108); + status = tx_byte_pool_create(&pool_0, "pool 0", pointer_1, TX_TEST_BYTE_POOL_BYTES(108)); /* Check status. */ if (status != TX_POOL_ERROR) @@ -418,7 +439,7 @@ UCHAR *save_search; } /* Try to create a pool with a NULL start address. */ - status = tx_byte_pool_create(&pool_2, "pool 2", TX_NULL, 108); + status = tx_byte_pool_create(&pool_2, "pool 2", TX_NULL, TX_TEST_BYTE_POOL_BYTES(108)); /* Check status. */ if (status != TX_PTR_ERROR) @@ -626,7 +647,7 @@ UCHAR *save_search; /* Test another bad block release.... pool pointer is not a valid pool! */ array[0] = 0; - array[1] = (ULONG) &array[3]; + TX_TEST_STORE_POINTER(array[1], &array[3]); array[2] = 0; array[3] = 0; status = _tx_byte_release(&array[2]); @@ -865,7 +886,7 @@ UCHAR *save_search; } /* Move the search pointer to the third block to exercise that code in the byte search algorithm. */ - pool_0.tx_byte_pool_search = (UCHAR *) pointer_3-8; + pool_0.tx_byte_pool_search = (UCHAR *) pointer_3 - TX_TEST_BYTE_POOL_SEARCH_OFFSET; /* Now allocate the block again. */ status = tx_byte_allocate(&pool_0, (VOID **) &pointer_2, 24, TX_NO_WAIT); @@ -885,7 +906,7 @@ UCHAR *save_search; status += tx_byte_release(pointer_1); /* Move the search pointer to the third block to exercise that code in the byte search algorithm. */ - pool_0.tx_byte_pool_search = (UCHAR *) pointer_3-8; + pool_0.tx_byte_pool_search = (UCHAR *) pointer_3 - TX_TEST_BYTE_POOL_SEARCH_OFFSET; /* Allocate a large block to force the search pointer update. */ status = tx_byte_allocate(&pool_0, (VOID **) &pointer_3, 88, TX_NO_WAIT); @@ -961,7 +982,7 @@ UCHAR *save_search; } /* Create pool 4. */ - status = tx_byte_pool_create(&pool_4, "pool 4", pool_4_memory, 300); + status = tx_byte_pool_create(&pool_4, "pool 4", pool_4_memory, TX_TEST_BYTE_POOL_CAPACITY_BYTES(84, 3)); /* Check status. */ if (status != TX_SUCCESS) @@ -1061,4 +1082,3 @@ UCHAR *save_search; printf("SUCCESS!\n"); test_control_return(0); } - diff --git a/test/tx/regression/threadx_byte_memory_information_test.c b/test/tx/regression/threadx_byte_memory_information_test.c index 8a619269..f1624a65 100644 --- a/test/tx/regression/threadx_byte_memory_information_test.c +++ b/test/tx/regression/threadx_byte_memory_information_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test byte memory information. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" #include "tx_byte_pool.h" @@ -193,7 +205,7 @@ CHAR *pointer; } /* Create the byte_pool with one byte. */ - status = tx_byte_pool_create(&byte_pool_0, "byte_pool 0", pointer, 100); + status = tx_byte_pool_create(&byte_pool_0, "byte_pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(100)); pointer = pointer + 100; /* Check for status. */ diff --git a/test/tx/regression/threadx_byte_memory_prioritize_test.c b/test/tx/regression/threadx_byte_memory_prioritize_test.c index 29407135..db36e386 100644 --- a/test/tx/regression/threadx_byte_memory_prioritize_test.c +++ b/test/tx/regression/threadx_byte_memory_prioritize_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test byte memory prioritize. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" /* Define the ISR dispatch. */ @@ -197,7 +209,7 @@ CHAR *pointer; } /* Create the byte_pool with one byte. */ - status = tx_byte_pool_create(&byte_pool_0, "byte_pool 0", pointer, 100); + status = tx_byte_pool_create(&byte_pool_0, "byte_pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(100)); pointer = pointer + 100; /* Check for status. */ @@ -495,4 +507,3 @@ VOID *pointer; thread_6_counter++; } } - diff --git a/test/tx/regression/threadx_byte_memory_suspension_test.c b/test/tx/regression/threadx_byte_memory_suspension_test.c index ba159894..3af5fc81 100644 --- a/test/tx/regression/threadx_byte_memory_suspension_test.c +++ b/test/tx/regression/threadx_byte_memory_suspension_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test suspension on a memory byte pool. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -121,8 +133,8 @@ CHAR *pointer; } /* Create byte pool 0. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer, 108); - pointer = pointer + 108; + status = tx_byte_pool_create(&pool_0, "pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(108)); + pointer = pointer + TX_TEST_BYTE_POOL_BYTES(108); /* Check status. */ if (status != TX_SUCCESS) diff --git a/test/tx/regression/threadx_byte_memory_suspension_timeout_test.c b/test/tx/regression/threadx_byte_memory_suspension_timeout_test.c index 5e94df97..5df63042 100644 --- a/test/tx/regression/threadx_byte_memory_suspension_timeout_test.c +++ b/test/tx/regression/threadx_byte_memory_suspension_timeout_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test suspension timeout on a memory byte pool. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -85,8 +97,8 @@ CHAR *pointer; } /* Create byte pool 0. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer, 108); - pointer = pointer + 108; + status = tx_byte_pool_create(&pool_0, "pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(108)); + pointer = pointer + TX_TEST_BYTE_POOL_BYTES(108); /* Check status. */ if (status != TX_SUCCESS) diff --git a/test/tx/regression/threadx_byte_memory_thread_contention_test.c b/test/tx/regression/threadx_byte_memory_thread_contention_test.c index da2634e3..8e92d44d 100644 --- a/test/tx/regression/threadx_byte_memory_thread_contention_test.c +++ b/test/tx/regression/threadx_byte_memory_thread_contention_test.c @@ -1,8 +1,20 @@ +/***************************************************************************/ +/* 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 test is designed to test contention of two threads on a single memory byte pool. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -89,8 +101,8 @@ CHAR *pointer; } /* Create byte pool 0. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer, 108); - pointer = pointer + 108; + status = tx_byte_pool_create(&pool_0, "pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(108)); + pointer = pointer + TX_TEST_BYTE_POOL_BYTES(108); /* Save off the intial pool size. */ initial_pool_size = pool_0.tx_byte_pool_available; diff --git a/test/tx/regression/threadx_byte_memory_thread_terminate_test.c b/test/tx/regression/threadx_byte_memory_thread_terminate_test.c index 4805ba57..b752f340 100644 --- a/test/tx/regression/threadx_byte_memory_thread_terminate_test.c +++ b/test/tx/regression/threadx_byte_memory_thread_terminate_test.c @@ -1,7 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test termination on thread suspended on memory byte pool. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" static unsigned long thread_0_counter = 0; static TX_THREAD thread_0; @@ -68,8 +80,8 @@ CHAR *pointer; } /* Create byte pools 0 and 1. */ - status = tx_byte_pool_create(&pool_0, "pool 0", pointer, 108); - pointer = pointer + 108; + status = tx_byte_pool_create(&pool_0, "pool 0", pointer, TX_TEST_BYTE_POOL_BYTES(108)); + pointer = pointer + TX_TEST_BYTE_POOL_BYTES(108); /* Check status. */ if (status != TX_SUCCESS) @@ -174,4 +186,3 @@ CHAR *pointer; thread_1_counter++; } } - diff --git a/test/tx/regression/threadx_event_flag_basic_test.c b/test/tx/regression/threadx_event_flag_basic_test.c index 3261f67f..8ab990f7 100644 --- a/test/tx/regression/threadx_event_flag_basic_test.c +++ b/test/tx/regression/threadx_event_flag_basic_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test simple event flag group creation, deletion, gets and sets. */ diff --git a/test/tx/regression/threadx_event_flag_information_test.c b/test/tx/regression/threadx_event_flag_information_test.c index d2404081..45e547f9 100644 --- a/test/tx/regression/threadx_event_flag_information_test.c +++ b/test/tx/regression/threadx_event_flag_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the event flag group information gathering services. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_event_flag_isr_set_clear_test.c b/test/tx/regression/threadx_event_flag_isr_set_clear_test.c index 7f89a06f..ff8674d9 100644 --- a/test/tx/regression/threadx_event_flag_isr_set_clear_test.c +++ b/test/tx/regression/threadx_event_flag_isr_set_clear_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test for simultaneous thread event flag set AND ISR event flag set and clear. */ #include <stdio.h> @@ -355,5 +366,3 @@ static void timer_0_entry(ULONG input) { timer_0_counter++; } - - diff --git a/test/tx/regression/threadx_event_flag_isr_wait_abort_test.c b/test/tx/regression/threadx_event_flag_isr_wait_abort_test.c index e1ec4e7c..b14e0cbd 100644 --- a/test/tx/regression/threadx_event_flag_isr_wait_abort_test.c +++ b/test/tx/regression/threadx_event_flag_isr_wait_abort_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test for wait abort from an ISR. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_event_flag_single_thread_terminate_test.c b/test/tx/regression/threadx_event_flag_single_thread_terminate_test.c index 86675890..6ae7c712 100644 --- a/test/tx/regression/threadx_event_flag_single_thread_terminate_test.c +++ b/test/tx/regression/threadx_event_flag_single_thread_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension with a single suspended thread being terminated at the same priority level. */ diff --git a/test/tx/regression/threadx_event_flag_suspension_consume_test.c b/test/tx/regression/threadx_event_flag_suspension_consume_test.c index aae8f1b9..eaa40258 100644 --- a/test/tx/regression/threadx_event_flag_suspension_consume_test.c +++ b/test/tx/regression/threadx_event_flag_suspension_consume_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension and resumption of two threads waiting on the same event flag set with the consumption. */ diff --git a/test/tx/regression/threadx_event_flag_suspension_different_bits_consume_test.c b/test/tx/regression/threadx_event_flag_suspension_different_bits_consume_test.c index 595e60ed..5f4c9494 100644 --- a/test/tx/regression/threadx_event_flag_suspension_different_bits_consume_test.c +++ b/test/tx/regression/threadx_event_flag_suspension_different_bits_consume_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension and resumption of two threads waiting on different event flags with consumption. */ diff --git a/test/tx/regression/threadx_event_flag_suspension_different_bits_test.c b/test/tx/regression/threadx_event_flag_suspension_different_bits_test.c index f9e43cad..56f9c263 100644 --- a/test/tx/regression/threadx_event_flag_suspension_different_bits_test.c +++ b/test/tx/regression/threadx_event_flag_suspension_different_bits_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension and resumption of two threads waiting on different event flags. */ diff --git a/test/tx/regression/threadx_event_flag_suspension_test.c b/test/tx/regression/threadx_event_flag_suspension_test.c index 915e33db..1c98ab49 100644 --- a/test/tx/regression/threadx_event_flag_suspension_test.c +++ b/test/tx/regression/threadx_event_flag_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension and resumption of three threads waiting on the same event flag set. */ diff --git a/test/tx/regression/threadx_event_flag_suspension_timeout_test.c b/test/tx/regression/threadx_event_flag_suspension_timeout_test.c index 149cb58f..fbfdcc4f 100644 --- a/test/tx/regression/threadx_event_flag_suspension_timeout_test.c +++ b/test/tx/regression/threadx_event_flag_suspension_timeout_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension timeout processing. */ #include <stdio.h> @@ -178,17 +189,12 @@ UINT status; /* Sleep for 63 ticks. */ tx_thread_sleep(63); - /* Check the run counters. */ - if (((thread_1_counter != 32) -#ifdef __linux__ - && (thread_1_counter != 33) /* Depending on the starting time, thread 1 can run either 32 or 33 rounds. */ -#endif - ) || - ((thread_2_counter != 13) -#ifdef __linux__ - && (thread_2_counter != 14) /* When CPU starves, the thread 2 can run 14 ronuds. */ -#endif - )) + /* Check the run counters. Depending on the starting time relative to + the tick boundary, thread 1 can run either 32 or 33 rounds and + thread 2 can run 13 or 14 rounds. This variance applies to any + platform with non-deterministic tick alignment (Linux, QEMU, Windows, etc.). */ + if (((thread_1_counter < 32UL) || (thread_1_counter > 33UL)) || + ((thread_2_counter < 13UL) || (thread_2_counter > 14UL))) { /* Event flag error. */ diff --git a/test/tx/regression/threadx_event_flag_thread_terminate_test.c b/test/tx/regression/threadx_event_flag_thread_terminate_test.c index 166711f5..25536903 100644 --- a/test/tx/regression/threadx_event_flag_thread_terminate_test.c +++ b/test/tx/regression/threadx_event_flag_thread_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test event flag suspension with the suspended threads being terminated. */ diff --git a/test/tx/regression/threadx_initialize_kernel_setup_test.c b/test/tx/regression/threadx_initialize_kernel_setup_test.c index 2ef8e158..057ac223 100644 --- a/test/tx/regression/threadx_initialize_kernel_setup_test.c +++ b/test/tx/regression/threadx_initialize_kernel_setup_test.c @@ -1,6 +1,19 @@ +/***************************************************************************/ +/* 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 test is designed to test kernel setup functionality in ThreadX. */ +// Some portions generated by Codex (gpt 5.4). #include <stdio.h> +#include <stdlib.h> #include "tx_api.h" #include "tx_initialize.h" #include "tx_thread.h" @@ -30,20 +43,7 @@ UINT test_byte_pool_create_init; UINT test_block_pool_create_init; UINT test_timer_create_init; - -__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) -{ -} - -void main() +int main(void) { /* Setup the ThreadX kernel. */ @@ -59,6 +59,8 @@ void main() printf("Running Initialize Kernel Setup Test................................ ERROR!\n"); exit(1); } + + return(0); } void test_application_define(void *first_unused_memory){} @@ -78,4 +80,4 @@ void delete_timer_thread(void) _tx_thread_delete(&_tx_timer_thread); } -#endif
\ No newline at end of file +#endif diff --git a/test/tx/regression/threadx_interrupt_control_test.c b/test/tx/regression/threadx_interrupt_control_test.c index c573c098..ec797ac8 100644 --- a/test/tx/regression/threadx_interrupt_control_test.c +++ b/test/tx/regression/threadx_interrupt_control_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the interrupt control service call avaialbe to the application. */ diff --git a/test/tx/regression/threadx_mutex_basic_test.c b/test/tx/regression/threadx_mutex_basic_test.c index 419813d3..bb81eb9a 100644 --- a/test/tx/regression/threadx_mutex_basic_test.c +++ b/test/tx/regression/threadx_mutex_basic_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex create/delete and immediate return gets and puts. */ diff --git a/test/tx/regression/threadx_mutex_delete_test.c b/test/tx/regression/threadx_mutex_delete_test.c index af501488..c706cc66 100644 --- a/test/tx/regression/threadx_mutex_delete_test.c +++ b/test/tx/regression/threadx_mutex_delete_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension and mutex delete with suspended threads. */ diff --git a/test/tx/regression/threadx_mutex_information_test.c b/test/tx/regression/threadx_mutex_information_test.c index 55503002..3829122c 100644 --- a/test/tx/regression/threadx_mutex_information_test.c +++ b/test/tx/regression/threadx_mutex_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex information services. */ #include <stdio.h> @@ -312,7 +323,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(&mutex_2, &puts, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -325,8 +336,8 @@ ULONG inheritances; printf("ERROR #19\n"); test_control_return(1); } - - /* Now get the system performance inforamtion. */ + + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(&puts, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -342,7 +353,7 @@ ULONG inheritances; #else - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(&mutex_2, &puts, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -354,7 +365,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, &puts, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -366,7 +377,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -378,7 +389,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, TX_NULL, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -390,7 +401,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -402,7 +413,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, &inversions, &inheritances); /* Check status. */ @@ -414,7 +425,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, &inheritances); /* Check status. */ @@ -426,7 +437,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the performance inforamtion. */ + /* Now get the performance information. */ status = tx_mutex_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL); /* Check status. */ @@ -438,7 +449,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(&puts, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -450,7 +461,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, &gets, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -462,7 +473,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, TX_NULL, &suspensions, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -474,7 +485,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, &timeouts, &inversions, &inheritances); /* Check status. */ @@ -486,7 +497,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, &inversions, &inheritances); /* Check status. */ @@ -498,7 +509,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, &inheritances); /* Check status. */ @@ -510,7 +521,7 @@ ULONG inheritances; test_control_return(1); } - /* Now get the system performance inforamtion. */ + /* Now get the system performance information. */ status = tx_mutex_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL); /* Check status. */ diff --git a/test/tx/regression/threadx_mutex_nested_priority_inheritance_test.c b/test/tx/regression/threadx_mutex_nested_priority_inheritance_test.c index 1439ca85..929ea0b9 100644 --- a/test/tx/regression/threadx_mutex_nested_priority_inheritance_test.c +++ b/test/tx/regression/threadx_mutex_nested_priority_inheritance_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test multiple mutex priority inheritance situations. */ #include <stdio.h> @@ -404,7 +415,7 @@ UINT status; tx_mutex_put(&mutex_2); - /* Should reurn us back to priority 15. */ + /* Should return us back to priority 15. */ if (thread_0.tx_thread_priority != 15) { @@ -441,7 +452,7 @@ UINT status; tx_mutex_put(&mutex_2); - /* Should reurn us back to priority 8. */ + /* Should return us back to priority 8. */ if (thread_0.tx_thread_priority != 8) { diff --git a/test/tx/regression/threadx_mutex_no_preemption_test.c b/test/tx/regression/threadx_mutex_no_preemption_test.c index 3cc21b62..2798a5d3 100644 --- a/test/tx/regression/threadx_mutex_no_preemption_test.c +++ b/test/tx/regression/threadx_mutex_no_preemption_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension and another thread resuming the same priority thread by doing a mutex put. */ diff --git a/test/tx/regression/threadx_mutex_preemption_test.c b/test/tx/regression/threadx_mutex_preemption_test.c index 495ae13c..5e3d4c4b 100644 --- a/test/tx/regression/threadx_mutex_preemption_test.c +++ b/test/tx/regression/threadx_mutex_preemption_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension and another thread resuming the higher priority thread by doing a mutex put. Higher-priority thread should preempt. */ diff --git a/test/tx/regression/threadx_mutex_priority_inheritance_test.c b/test/tx/regression/threadx_mutex_priority_inheritance_test.c index 0b76aba6..8352c9b1 100644 --- a/test/tx/regression/threadx_mutex_priority_inheritance_test.c +++ b/test/tx/regression/threadx_mutex_priority_inheritance_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension and priority inheritance with another thread resuming the higher priority thread by doing a mutex put. Higher-priority thread should preempt. */ diff --git a/test/tx/regression/threadx_mutex_proritize_test.c b/test/tx/regression/threadx_mutex_proritize_test.c index bbc2845b..89988273 100644 --- a/test/tx/regression/threadx_mutex_proritize_test.c +++ b/test/tx/regression/threadx_mutex_proritize_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension prioritization. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_mutex_suspension_timeout_test.c b/test/tx/regression/threadx_mutex_suspension_timeout_test.c index f1a9dfd0..84aed2e3 100644 --- a/test/tx/regression/threadx_mutex_suspension_timeout_test.c +++ b/test/tx/regression/threadx_mutex_suspension_timeout_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the mutex suspension and timeout functionality. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_mutex_thread_terminate_test.c b/test/tx/regression/threadx_mutex_thread_terminate_test.c index ef21b92d..f4144524 100644 --- a/test/tx/regression/threadx_mutex_thread_terminate_test.c +++ b/test/tx/regression/threadx_mutex_thread_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread terminate calls when threads are suspended on a mutex. */ diff --git a/test/tx/regression/threadx_queue_basic_eight_word_test.c b/test/tx/regression/threadx_queue_basic_eight_word_test.c index fb4640cc..d3271f2c 100644 --- a/test/tx/regression/threadx_queue_basic_eight_word_test.c +++ b/test/tx/regression/threadx_queue_basic_eight_word_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 8 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/tx/regression/threadx_queue_basic_four_word_test.c b/test/tx/regression/threadx_queue_basic_four_word_test.c index 4c54d8bd..49eb9a85 100644 --- a/test/tx/regression/threadx_queue_basic_four_word_test.c +++ b/test/tx/regression/threadx_queue_basic_four_word_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 4 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/tx/regression/threadx_queue_basic_max_message_size_test.c b/test/tx/regression/threadx_queue_basic_max_message_size_test.c index d62e80ff..0ad2be4e 100644 --- a/test/tx/regression/threadx_queue_basic_max_message_size_test.c +++ b/test/tx/regression/threadx_queue_basic_max_message_size_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 16 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/tx/regression/threadx_queue_basic_one_word_test.c b/test/tx/regression/threadx_queue_basic_one_word_test.c index 0e2f1fbc..1abb6986 100644 --- a/test/tx/regression/threadx_queue_basic_one_word_test.c +++ b/test/tx/regression/threadx_queue_basic_one_word_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 1 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/tx/regression/threadx_queue_basic_sixteen_word_test.c b/test/tx/regression/threadx_queue_basic_sixteen_word_test.c index de3ede98..42205d90 100644 --- a/test/tx/regression/threadx_queue_basic_sixteen_word_test.c +++ b/test/tx/regression/threadx_queue_basic_sixteen_word_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 16 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/tx/regression/threadx_queue_basic_two_word_test.c b/test/tx/regression/threadx_queue_basic_two_word_test.c index 46d85a6d..fa2a2fed 100644 --- a/test/tx/regression/threadx_queue_basic_two_word_test.c +++ b/test/tx/regression/threadx_queue_basic_two_word_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including create and delete. This test is for queue sizes of 2 ULONG. Two queues are used one with a capacity of 1 message and another with a capacity of 3 messages. */ diff --git a/test/tx/regression/threadx_queue_empty_suspension_test.c b/test/tx/regression/threadx_queue_empty_suspension_test.c index c63b1715..c0858ac8 100644 --- a/test/tx/regression/threadx_queue_empty_suspension_test.c +++ b/test/tx/regression/threadx_queue_empty_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test empty queue suspension of queue that supports 3 messages that are each 2 ULONG in size. */ diff --git a/test/tx/regression/threadx_queue_flush_no_suspension_test.c b/test/tx/regression/threadx_queue_flush_no_suspension_test.c index 95bd5fed..5da58b74 100644 --- a/test/tx/regression/threadx_queue_flush_no_suspension_test.c +++ b/test/tx/regression/threadx_queue_flush_no_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the queue flush operation on a queue that has no threads suspended on it. */ diff --git a/test/tx/regression/threadx_queue_flush_test.c b/test/tx/regression/threadx_queue_flush_test.c index 77f8d2d5..a28e2288 100644 --- a/test/tx/regression/threadx_queue_flush_test.c +++ b/test/tx/regression/threadx_queue_flush_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the queue flush operation on a queue that has two threads suspended on it. */ diff --git a/test/tx/regression/threadx_queue_front_send_test.c b/test/tx/regression/threadx_queue_front_send_test.c index d03e7ac2..45b5dd65 100644 --- a/test/tx/regression/threadx_queue_front_send_test.c +++ b/test/tx/regression/threadx_queue_front_send_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test immediate response queue services including queue front send. This test is for queue sizes of 2 ULONG. */ diff --git a/test/tx/regression/threadx_queue_full_suspension_test.c b/test/tx/regression/threadx_queue_full_suspension_test.c index 687ef04a..d1e1759f 100644 --- a/test/tx/regression/threadx_queue_full_suspension_test.c +++ b/test/tx/regression/threadx_queue_full_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test queue full suspension of queue that supports 3 messages that are each 2 ULONG in size. */ diff --git a/test/tx/regression/threadx_queue_information_test.c b/test/tx/regression/threadx_queue_information_test.c index 5fcdbb8f..f884bd0d 100644 --- a/test/tx/regression/threadx_queue_information_test.c +++ b/test/tx/regression/threadx_queue_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the queue information services. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_queue_prioritize.c b/test/tx/regression/threadx_queue_prioritize.c index 53c19275..f904a525 100644 --- a/test/tx/regression/threadx_queue_prioritize.c +++ b/test/tx/regression/threadx_queue_prioritize.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test queue prioritize. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_queue_suspension_timeout_test.c b/test/tx/regression/threadx_queue_suspension_timeout_test.c index 92dca991..aa05c0dc 100644 --- a/test/tx/regression/threadx_queue_suspension_timeout_test.c +++ b/test/tx/regression/threadx_queue_suspension_timeout_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test queue full and empty suspension with timeouts on queues that supports 3 messages that are each 2 ULONG in size. */ diff --git a/test/tx/regression/threadx_queue_thread_terminate_test.c b/test/tx/regression/threadx_queue_thread_terminate_test.c index 97d8a569..42673c8d 100644 --- a/test/tx/regression/threadx_queue_thread_terminate_test.c +++ b/test/tx/regression/threadx_queue_thread_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread terminate when the terminated thread is suspeded on a queue. */ diff --git a/test/tx/regression/threadx_semaphore_basic_test.c b/test/tx/regression/threadx_semaphore_basic_test.c index 33ee3257..3209b586 100644 --- a/test/tx/regression/threadx_semaphore_basic_test.c +++ b/test/tx/regression/threadx_semaphore_basic_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore create/delete and immediate return gets and puts. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_semaphore_ceiling_put_test.c b/test/tx/regression/threadx_semaphore_ceiling_put_test.c index 7d4f5832..f7d7be73 100644 --- a/test/tx/regression/threadx_semaphore_ceiling_put_test.c +++ b/test/tx/regression/threadx_semaphore_ceiling_put_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore ceiling put. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_semaphore_delete_test.c b/test/tx/regression/threadx_semaphore_delete_test.c index 2c9bc1aa..272a0252 100644 --- a/test/tx/regression/threadx_semaphore_delete_test.c +++ b/test/tx/regression/threadx_semaphore_delete_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore suspension and semaphore delete with suspended threads. */ diff --git a/test/tx/regression/threadx_semaphore_information_test.c b/test/tx/regression/threadx_semaphore_information_test.c index d2e9bd57..ede276e9 100644 --- a/test/tx/regression/threadx_semaphore_information_test.c +++ b/test/tx/regression/threadx_semaphore_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore information services. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_semaphore_non_preemption_test.c b/test/tx/regression/threadx_semaphore_non_preemption_test.c index c075b16c..e3695e84 100644 --- a/test/tx/regression/threadx_semaphore_non_preemption_test.c +++ b/test/tx/regression/threadx_semaphore_non_preemption_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore suspension and another thread resuming the same priority thread by doing a semaphore put. */ diff --git a/test/tx/regression/threadx_semaphore_preemption_test.c b/test/tx/regression/threadx_semaphore_preemption_test.c index f14193a2..33677c01 100644 --- a/test/tx/regression/threadx_semaphore_preemption_test.c +++ b/test/tx/regression/threadx_semaphore_preemption_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore suspension and another thread resuming the higher priority thread by doing a semaphore put. Higher-priority thread should preempt. */ diff --git a/test/tx/regression/threadx_semaphore_prioritize.c b/test/tx/regression/threadx_semaphore_prioritize.c index 6bee4656..30d04590 100644 --- a/test/tx/regression/threadx_semaphore_prioritize.c +++ b/test/tx/regression/threadx_semaphore_prioritize.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test semaphore prioritize. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_semaphore_thread_terminate_test.c b/test/tx/regression/threadx_semaphore_thread_terminate_test.c index a15f5963..7055ed07 100644 --- a/test/tx/regression/threadx_semaphore_thread_terminate_test.c +++ b/test/tx/regression/threadx_semaphore_thread_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread terminate calls when threads are suspended on a semaphore. */ diff --git a/test/tx/regression/threadx_semaphore_timeout_test.c b/test/tx/regression/threadx_semaphore_timeout_test.c index 96585337..07e25596 100644 --- a/test/tx/regression/threadx_semaphore_timeout_test.c +++ b/test/tx/regression/threadx_semaphore_timeout_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the semaphore suspension and timeout functionality. */ #include <stdio.h> @@ -163,5 +174,3 @@ ULONG now; test_control_return(0); } } - - diff --git a/test/tx/regression/threadx_test_port.h b/test/tx/regression/threadx_test_port.h new file mode 100644 index 00000000..b8502b4d --- /dev/null +++ b/test/tx/regression/threadx_test_port.h @@ -0,0 +1,37 @@ +/*************************************************************************** + * 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. + * + * AI Disclosure: This file was largely AI-generated by Codex (gpt 5.4). + * The AI-generated portions may be considered public domain (CC0-1.0) + * and not subject to the project's licence. The human contributor has + * reviewed and verified that the code is correct. + * + * SPDX-License-Identifier: MIT and CC0-1.0 + **************************************************************************/ + +#ifndef THREADX_TEST_PORT_H +#define THREADX_TEST_PORT_H + +#include "tx_api.h" + +/* Preserve the original 32-bit test expectations for pool capacity. */ + +#define TX_TEST_BYTE_POOL_BASELINE_OVERHEAD ((ULONG) (2U * sizeof(ULONG))) +#define TX_TEST_BYTE_POOL_OVERHEAD ((ULONG) (sizeof(VOID *) + sizeof(ALIGN_TYPE))) +#define TX_TEST_BYTE_POOL_ALIGN(a) ((ULONG) (((((ULONG) (a)) + ((ULONG) sizeof(ALIGN_TYPE)) - ((ULONG) 1)) / ((ULONG) sizeof(ALIGN_TYPE))) * ((ULONG) sizeof(ALIGN_TYPE)))) +#define TX_TEST_BYTE_POOL_BYTES(a) ((ULONG) ((a) + (2U * (TX_TEST_BYTE_POOL_OVERHEAD - TX_TEST_BYTE_POOL_BASELINE_OVERHEAD)))) +#define TX_TEST_BYTE_POOL_CAPACITY_BYTES(a, b) ((ULONG) (((b) * TX_TEST_BYTE_POOL_ALIGN(a)) + (((b) + 1U) * TX_TEST_BYTE_POOL_OVERHEAD))) +#define TX_TEST_BYTE_POOL_SEARCH_OFFSET TX_TEST_BYTE_POOL_OVERHEAD + +#define TX_TEST_BLOCK_POOL_ALIGN(a) ((ULONG) (((((ULONG) (a)) + ((ULONG) sizeof(ALIGN_TYPE)) - ((ULONG) 1)) / ((ULONG) sizeof(ALIGN_TYPE))) * ((ULONG) sizeof(ALIGN_TYPE)))) +#define TX_TEST_BLOCK_POOL_BYTES(a, b) ((ULONG) ((b) * (TX_TEST_BLOCK_POOL_ALIGN(a) + ((ULONG) sizeof(UCHAR *))))) + +typedef ALIGN_TYPE TX_TEST_POINTER_WORD; + +#define TX_TEST_STORE_POINTER(a, b) (a) = ((TX_TEST_POINTER_WORD) TX_POINTER_TO_ALIGN_TYPE_CONVERT(b)) + +#endif diff --git a/test/tx/regression/threadx_thread_basic_execution_test.c b/test/tx/regression/threadx_thread_basic_execution_test.c index 9949eac8..c51a677c 100644 --- a/test/tx/regression/threadx_thread_basic_execution_test.c +++ b/test/tx/regression/threadx_thread_basic_execution_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if one thread can be created and executed. It thread_0_entry is hit, then the thread was successfully scheduled. On success, thread_0_counter gets incremented. */ @@ -11,6 +22,7 @@ #include "tx_queue.h" #include "tx_semaphore.h" #include "tx_thread.h" +#include "tx_timer.h" typedef struct THREAD_MEMORY_TEST_STRUCT @@ -52,6 +64,9 @@ static unsigned long timer_executed = 0; static unsigned long isr_executed = 0; +extern TX_TIMER_INTERNAL *_tx_timer_expired_timer_ptr; + + /* Define task prototypes. */ static void thread_0_entry(ULONG task_input); @@ -386,7 +401,21 @@ VOID (*temp_mutex_release)(TX_THREAD *thread_ptr); test_thread.tx_thread_timer.tx_timer_internal_list_head = TX_NULL; test_thread.tx_thread_suspending = TX_TRUE; test_thread.tx_thread_delayed_suspend = TX_TRUE; +#if defined(_WIN64) || defined(TX_TIMER_EXTENSION_PTR_DEFINED) + { + TX_TIMER_INTERNAL timeout_timer; + TX_TIMER_INTERNAL *saved_expired_timer_ptr; + + TX_MEMSET(&timeout_timer, 0, sizeof(TX_TIMER_INTERNAL)); + saved_expired_timer_ptr = _tx_timer_expired_timer_ptr; + _tx_timer_expired_timer_ptr = &timeout_timer; + timeout_timer.tx_timer_internal_extension_ptr = (VOID *) &test_thread; + _tx_thread_timeout(0); + _tx_timer_expired_timer_ptr = saved_expired_timer_ptr; + } +#else _tx_thread_timeout((ULONG) &test_thread); +#endif /* Setup test thread to make sure _tx_thread_terminate can handle a NULL mutex release function pointer. */ temp_mutex_release = _tx_thread_mutex_release; @@ -813,7 +842,7 @@ VOID (*temp_mutex_release)(TX_THREAD *thread_ptr); test_control_return(1); } - /* Attempt a thread termiante with a NULL pointer. */ + /* Attempt a thread terminate with a NULL pointer. */ status = tx_thread_terminate(TX_NULL); /* Check for status. */ @@ -836,7 +865,7 @@ VOID (*temp_mutex_release)(TX_THREAD *thread_ptr); test_control_return(1); } - /* Attempt a thread time-slice chagne with a NULL pointer. */ + /* Attempt a thread time-slice change with a NULL pointer. */ status = tx_thread_time_slice_change(TX_NULL, 1, &old_time_slice); /* Check for status. */ @@ -975,5 +1004,3 @@ TX_INTERRUPT_SAVE_AREA #endif #endif - - diff --git a/test/tx/regression/threadx_thread_basic_time_slice_test.c b/test/tx/regression/threadx_thread_basic_time_slice_test.c index 7c83a715..a4adf72d 100644 --- a/test/tx/regression/threadx_thread_basic_time_slice_test.c +++ b/test/tx/regression/threadx_thread_basic_time_slice_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if a thread can be created with a time-slice. No time-slice occurs, only the processing to check for time-slicing. */ diff --git a/test/tx/regression/threadx_thread_completed_test.c b/test/tx/regression/threadx_thread_completed_test.c index adaf1683..e8b609e3 100644 --- a/test/tx/regression/threadx_thread_completed_test.c +++ b/test/tx/regression/threadx_thread_completed_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if one thread can be created, executed, and return to the thread shell function. The thread shell function places the thread in a finished state. */ diff --git a/test/tx/regression/threadx_thread_create_preemption_threshold_test.c b/test/tx/regression/threadx_thread_create_preemption_threshold_test.c index 58ce79fe..b53179cb 100644 --- a/test/tx/regression/threadx_thread_create_preemption_threshold_test.c +++ b/test/tx/regression/threadx_thread_create_preemption_threshold_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test for preemption-threshold use during thread creation during initialization. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_thread_delayed_suspension_test.c b/test/tx/regression/threadx_thread_delayed_suspension_test.c index 91128f83..2bf26421 100644 --- a/test/tx/regression/threadx_thread_delayed_suspension_test.c +++ b/test/tx/regression/threadx_thread_delayed_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test checks out the delayed suspension clear from tx_thread_resume. */ #include <stdio.h> @@ -56,7 +67,7 @@ static volatile ULONG destination = 0; static ULONG start_time; static ULONG lower_bound; static ULONG upper_bound; -static ULONG current_itterations; +static ULONG current_iterations; #ifdef DEBUG_1 static ULONG last_loop_count; #endif @@ -106,9 +117,9 @@ ULONG i; if (upper_bound > max_loop_count) lower_bound = max_loop_count; - if ((current_itterations < lower_bound) || (current_itterations > upper_bound)) - current_itterations = lower_bound; - + if ((current_iterations < lower_bound) || (current_iterations > upper_bound)) + current_iterations = lower_bound; + #ifdef DEBUG_1 /* Last loop count. */ last_loop_count = loop_count; @@ -350,7 +361,7 @@ ULONG i; lower_bound = lower_bound - 5; upper_bound = max_loop_count + 5; - current_itterations = lower_bound; + current_iterations = lower_bound; /* This thread simply suspends over and over... */ while(1) @@ -366,20 +377,20 @@ ULONG i; /* Call delay function. */ delay_function(); loop_count++; - } while (loop_count < current_itterations); + } while (loop_count < current_iterations); /* Suspend this thread. */ tx_semaphore_get(&semaphore_1, TX_WAIT_FOREVER); - /* Adjust the current itterations. */ - current_itterations++; - if (current_itterations > upper_bound) + /* Adjust the current iterations. */ + current_iterations++; + if (current_iterations > upper_bound) { if (lower_bound > min_loop_count) lower_bound--; if (upper_bound < max_loop_count) upper_bound++; - current_itterations = lower_bound; + current_iterations = lower_bound; } /* Increment the thread counter. */ diff --git a/test/tx/regression/threadx_thread_information_test.c b/test/tx/regression/threadx_thread_information_test.c index 19107742..b5d06e71 100644 --- a/test/tx/regression/threadx_thread_information_test.c +++ b/test/tx/regression/threadx_thread_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is for the thread information services. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_thread_multi_level_preemption_threshold_test.c b/test/tx/regression/threadx_thread_multi_level_preemption_threshold_test.c index 8944da46..59ed4f4d 100644 --- a/test/tx/regression/threadx_thread_multi_level_preemption_threshold_test.c +++ b/test/tx/regression/threadx_thread_multi_level_preemption_threshold_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test multi-level preemption threshold. The protection placed by a thread must be preserved after higher-priority thread preemption that is above the threshold. */ diff --git a/test/tx/regression/threadx_thread_multiple_non_current_test.c b/test/tx/regression/threadx_thread_multiple_non_current_test.c index 50ed17a0..a0acc1b9 100644 --- a/test/tx/regression/threadx_thread_multiple_non_current_test.c +++ b/test/tx/regression/threadx_thread_multiple_non_current_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if multiple non-current threads can be suspended. The order the suspension and resumption occurs makes sure everything is working right. Thread execution should remain predictable even after suspension and diff --git a/test/tx/regression/threadx_thread_multiple_sleep_test.c b/test/tx/regression/threadx_thread_multiple_sleep_test.c index f2ae3b99..8c5db032 100644 --- a/test/tx/regression/threadx_thread_multiple_sleep_test.c +++ b/test/tx/regression/threadx_thread_multiple_sleep_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test multiple threads sleeping for 33 ticks. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_thread_multiple_suspension_test.c b/test/tx/regression/threadx_thread_multiple_suspension_test.c index 01c42e8f..d6577b53 100644 --- a/test/tx/regression/threadx_thread_multiple_suspension_test.c +++ b/test/tx/regression/threadx_thread_multiple_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if multiple threads can be created and suspend. The order the suspension and resumption occurs makes sure everything is working right. All the counters should increment at the same rate. */ diff --git a/test/tx/regression/threadx_thread_multiple_time_slice_test.c b/test/tx/regression/threadx_thread_multiple_time_slice_test.c index f3e9fbf0..af3d8019 100644 --- a/test/tx/regression/threadx_thread_multiple_time_slice_test.c +++ b/test/tx/regression/threadx_thread_multiple_time_slice_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if two threads can be created and execute with a time-slice. Thread 7 should run twice as long because it has more of a time-slice. */ diff --git a/test/tx/regression/threadx_thread_preemptable_suspension_test.c b/test/tx/regression/threadx_thread_preemptable_suspension_test.c index 8e4dbdd6..acd426c6 100644 --- a/test/tx/regression/threadx_thread_preemptable_suspension_test.c +++ b/test/tx/regression/threadx_thread_preemptable_suspension_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if multiple threads can be created and suspended. The order the suspension and resumption occurs makes sure everything is working right. All the counters should increment at the same rate. This test differs from test 4 in diff --git a/test/tx/regression/threadx_thread_preemption_change_test.c b/test/tx/regression/threadx_thread_preemption_change_test.c index ca0a3c72..2144df19 100644 --- a/test/tx/regression/threadx_thread_preemption_change_test.c +++ b/test/tx/regression/threadx_thread_preemption_change_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the change preemption service call. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_thread_priority_change.c b/test/tx/regression/threadx_thread_priority_change.c index 6a61e2cf..1cb52ff9 100644 --- a/test/tx/regression/threadx_thread_priority_change.c +++ b/test/tx/regression/threadx_thread_priority_change.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the change priority service call. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_thread_relinquish_test.c b/test/tx/regression/threadx_thread_relinquish_test.c index 5b180d84..fc8b09ed 100644 --- a/test/tx/regression/threadx_thread_relinquish_test.c +++ b/test/tx/regression/threadx_thread_relinquish_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if multiple threads can be created and relinquish control between them. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_thread_reset_test.c b/test/tx/regression/threadx_thread_reset_test.c index a709d163..56006be1 100644 --- a/test/tx/regression/threadx_thread_reset_test.c +++ b/test/tx/regression/threadx_thread_reset_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the tx_thread_reset function. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_thread_simple_sleep_non_clear_test.c b/test/tx/regression/threadx_thread_simple_sleep_non_clear_test.c index df8bb62b..16bd5096 100644 --- a/test/tx/regression/threadx_thread_simple_sleep_non_clear_test.c +++ b/test/tx/regression/threadx_thread_simple_sleep_non_clear_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test a simple sleep for 18 ticks, with something in the remaining field of the thread control block. */ @@ -89,4 +100,3 @@ ULONG now; test_control_return(1); } } - diff --git a/test/tx/regression/threadx_thread_simple_sleep_test.c b/test/tx/regression/threadx_thread_simple_sleep_test.c index f038fafd..f7af480c 100644 --- a/test/tx/regression/threadx_thread_simple_sleep_test.c +++ b/test/tx/regression/threadx_thread_simple_sleep_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test a simple sleep for 18 ticks. */ #include <stdio.h> @@ -84,4 +95,3 @@ ULONG now; test_control_return(1); } } - diff --git a/test/tx/regression/threadx_thread_simple_suspend_test.c b/test/tx/regression/threadx_thread_simple_suspend_test.c index a05797ec..5089fd64 100644 --- a/test/tx/regression/threadx_thread_simple_suspend_test.c +++ b/test/tx/regression/threadx_thread_simple_suspend_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to see if a thread can successfully suspend itself in a single thread system. This also tests a thread created that is not automatically enabled. */ @@ -25,7 +36,7 @@ void test_control_return(UINT status); #ifdef CTEST void test_application_define(void *first_unused_memory) #else -void threadx_thread_simple_supsend_application_define(void *first_unused_memory) +void threadx_thread_simple_suspend_application_define(void *first_unused_memory) #endif { diff --git a/test/tx/regression/threadx_thread_sleep_for_100ticks_test.c b/test/tx/regression/threadx_thread_sleep_for_100ticks_test.c index d5c335f0..e6ebf170 100644 --- a/test/tx/regression/threadx_thread_sleep_for_100ticks_test.c +++ b/test/tx/regression/threadx_thread_sleep_for_100ticks_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test a simple sleep for 100 ticks. */ #include <stdio.h> @@ -42,7 +53,7 @@ static ULONG array_delay[ARRAY_SIZE]; static ULONG start_time; static ULONG lower_bound; static ULONG upper_bound; -static ULONG current_itterations; +static ULONG current_iterations; #ifdef DEBUG_1 static ULONG last_loop_count; #endif @@ -108,9 +119,9 @@ ULONG i; if (upper_bound > max_loop_count) lower_bound = max_loop_count; - if ((current_itterations < lower_bound) || (current_itterations > upper_bound)) - current_itterations = lower_bound; - + if ((current_iterations < lower_bound) || (current_iterations > upper_bound)) + current_iterations = lower_bound; + #ifdef DEBUG_1 /* Last loop count. */ last_loop_count = loop_count; @@ -218,7 +229,7 @@ CHAR *pointer; min_loop_count = 0xFFFFFFFF; max_loop_count = 0; loop_count = 0xFFFFFFFF; - current_itterations = 0; + current_iterations = 0; #ifdef DEBUG_1 last_loop_count = 0x0; #endif @@ -305,7 +316,7 @@ volatile ULONG value = 0; upper_bound = max_loop_count; #endif - current_itterations = lower_bound; + current_iterations = lower_bound; #ifdef DEBUG i = 0; #endif @@ -323,7 +334,7 @@ volatile ULONG value = 0; /* Call delay function. */ delay_function(); loop_count++; - } while (loop_count < current_itterations); + } while (loop_count < current_iterations); /* Check for a timer interrupt... if so, just skip the semaphore get. */ if (start_time != _tx_timer_system_clock) @@ -331,16 +342,16 @@ volatile ULONG value = 0; /* Suspend on the semaphore for 20 ticks... */ tx_semaphore_get(&test_semaphore, 20); - - /* Adjust the current itterations. */ - current_itterations++; - if (current_itterations > upper_bound) + + /* Adjust the current iterations. */ + current_iterations++; + if (current_iterations > upper_bound) { if (lower_bound > min_loop_count) lower_bound--; if (upper_bound < max_loop_count) upper_bound++; - current_itterations = lower_bound; + current_iterations = lower_bound; } /* Set the tick count simply to use value. */ @@ -355,7 +366,7 @@ volatile ULONG value = 0; printf("loop count: NA\n"); else printf("loop count: %lu\n", loop_count); - printf("current: %lu\n", current_itterations); + printf("current: %lu\n", current_iterations); printf("last loop count: %lu\n", last_loop_count); printf("minimum: %lu\n", min_loop_count); printf("maximum: %lu\n", max_loop_count); @@ -373,7 +384,7 @@ volatile ULONG value = 0; printf("loop count: NA\n"); else printf("loop count: %lu\n", loop_count); - printf("current: %lu\n", current_itterations); + printf("current: %lu\n", current_iterations); printf("last loop count: %lu\n", last_loop_count); printf("minimum: %lu\n", min_loop_count); printf("maximum: %lu\n", max_loop_count); @@ -432,4 +443,3 @@ volatile ULONG value = 0; test_control_return(0); } } - diff --git a/test/tx/regression/threadx_thread_sleep_terminate_test.c b/test/tx/regression/threadx_thread_sleep_terminate_test.c index 98862051..374f5d43 100644 --- a/test/tx/regression/threadx_thread_sleep_terminate_test.c +++ b/test/tx/regression/threadx_thread_sleep_terminate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread termination of a thread in a sleep condition. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_thread_stack_checking_test.c b/test/tx/regression/threadx_thread_stack_checking_test.c index 940b6c6b..9db10d0a 100644 --- a/test/tx/regression/threadx_thread_stack_checking_test.c +++ b/test/tx/regression/threadx_thread_stack_checking_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is for the thread stack checking services. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_thread_terminate_delete_test.c b/test/tx/regression/threadx_thread_terminate_delete_test.c index 63fd6a69..2ca2de85 100644 --- a/test/tx/regression/threadx_thread_terminate_delete_test.c +++ b/test/tx/regression/threadx_thread_terminate_delete_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread terminate (self, and other), thread delete, and thread identify services. */ @@ -244,7 +255,7 @@ UINT status; test_control_return(1); } - /* Delete thread 1 (thread 1 alread terminated) and 2. */ + /* Delete thread 1 (thread 1 alreadyterminated) and 2. */ status = tx_thread_delete(&thread_2); /* Check for status. */ diff --git a/test/tx/regression/threadx_thread_time_slice_change_test.c b/test/tx/regression/threadx_thread_time_slice_change_test.c index 0122fc2a..ab35bd19 100644 --- a/test/tx/regression/threadx_thread_time_slice_change_test.c +++ b/test/tx/regression/threadx_thread_time_slice_change_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the change time-slice service call. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_thread_wait_abort_and_isr_test.c b/test/tx/regression/threadx_thread_wait_abort_and_isr_test.c index bc7446f7..e15b410f 100644 --- a/test/tx/regression/threadx_thread_wait_abort_and_isr_test.c +++ b/test/tx/regression/threadx_thread_wait_abort_and_isr_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test for simultaneous thread suspension lifting AND thread wait abort calls. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_thread_wait_abort_test.c b/test/tx/regression/threadx_thread_wait_abort_test.c index 49852ec1..0c3f21f2 100644 --- a/test/tx/regression/threadx_thread_wait_abort_test.c +++ b/test/tx/regression/threadx_thread_wait_abort_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test thread wait abort. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_time_get_set_test.c b/test/tx/regression/threadx_time_get_set_test.c index 06b8e6f5..242735ec 100644 --- a/test/tx/regression/threadx_time_get_set_test.c +++ b/test/tx/regression/threadx_time_get_set_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test simple tx_time_get and set services. */ #include <stdio.h> @@ -104,4 +115,3 @@ ULONG current_time; test_control_return(0); } } - diff --git a/test/tx/regression/threadx_timer_activate_deactivate_test.c b/test/tx/regression/threadx_timer_activate_deactivate_test.c index 69f9b38f..ceaf79bf 100644 --- a/test/tx/regression/threadx_timer_activate_deactivate_test.c +++ b/test/tx/regression/threadx_timer_activate_deactivate_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test application timer activation/deactivation services from threads and the activation routines. */ diff --git a/test/tx/regression/threadx_timer_deactivate_accuracy_test.c b/test/tx/regression/threadx_timer_deactivate_accuracy_test.c index 625b82a6..0da41a7a 100644 --- a/test/tx/regression/threadx_timer_deactivate_accuracy_test.c +++ b/test/tx/regression/threadx_timer_deactivate_accuracy_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test application timer activation/deactivation services from threads... Make sure the remaining ticks are being saved/restored properly. */ diff --git a/test/tx/regression/threadx_timer_information_test.c b/test/tx/regression/threadx_timer_information_test.c index 7954de2c..ae3bb414 100644 --- a/test/tx/regression/threadx_timer_information_test.c +++ b/test/tx/regression/threadx_timer_information_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test timer information services. */ #include <stdio.h> diff --git a/test/tx/regression/threadx_timer_large_timer_accuracy_test.c b/test/tx/regression/threadx_timer_large_timer_accuracy_test.c index 726523b9..f44d4f05 100644 --- a/test/tx/regression/threadx_timer_large_timer_accuracy_test.c +++ b/test/tx/regression/threadx_timer_large_timer_accuracy_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test application timer activation/deactivation services from threads... To make sure large timer expirations are being saved/restored properly. */ diff --git a/test/tx/regression/threadx_timer_multiple_accuracy_test.c b/test/tx/regression/threadx_timer_multiple_accuracy_test.c index af9957d8..a4cceefa 100644 --- a/test/tx/regression/threadx_timer_multiple_accuracy_test.c +++ b/test/tx/regression/threadx_timer_multiple_accuracy_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test the accuracy of three free running timers. */ #include <stdio.h> @@ -183,4 +194,3 @@ static void timer_2_expiration(ULONG timer_input) /* Process timer expiration. */ timer_2_counter++; } - diff --git a/test/tx/regression/threadx_timer_multiple_test.c b/test/tx/regression/threadx_timer_multiple_test.c index 688a7d5b..f8d99e5c 100644 --- a/test/tx/regression/threadx_timer_multiple_test.c +++ b/test/tx/regression/threadx_timer_multiple_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test a simple application timer services, including create, activate, deactivate, change, and delete with multiple timers. */ @@ -346,4 +357,3 @@ static void timer_2_expiration(ULONG timer_input) /* Process timer expiration. */ timer_2_counter++; } - diff --git a/test/tx/regression/threadx_timer_simple_test.c b/test/tx/regression/threadx_timer_simple_test.c index 7fdf022e..cad67086 100644 --- a/test/tx/regression/threadx_timer_simple_test.c +++ b/test/tx/regression/threadx_timer_simple_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test a simple application timer services, including create, activate, deactivate, change, and delete. */ diff --git a/test/tx/regression/threadx_trace_basic_test.c b/test/tx/regression/threadx_trace_basic_test.c index 0914650f..c40be8f1 100644 --- a/test/tx/regression/threadx_trace_basic_test.c +++ b/test/tx/regression/threadx_trace_basic_test.c @@ -1,3 +1,14 @@ +/***************************************************************************/ +/* 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 test is designed to test trace functionality in ThreadX. */ |
