Release ThreadX regression system

This commit is contained in:
Tiejun Zhou
2023-04-03 07:24:52 +00:00
parent ac3b6b326c
commit ebeb02b958
229 changed files with 87243 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0057 NEW)
project(threadx_test LANGUAGES C)
# Set build configurations
set(BUILD_CONFIGURATIONS default_build_coverage disable_notify_callbacks_build
stack_checking_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}.")
set(default_build_coverage "")
set(disable_notify_callbacks_build -DTX_DISABLE_NOTIFY_CALLBACKS)
set(stack_checking_build -DTX_ENABLE_STACK_CHECKING)
set(trace_build -DTX_ENABLE_EVENT_TRACE)
add_compile_options(
-m32
-std=c99
-ggdb
-g3
-gdwarf-2
-fdiagnostics-color
-Werror
-DTX_REGRESSION_TEST
-DTEST_STACK_SIZE_PRINTF=4096
${${CMAKE_BUILD_TYPE}})
add_link_options(-m32)
enable_testing()
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../../.. threadx)
add_subdirectory(regression)
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)
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)

8
test/tx/cmake/coverage.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
set -e
cd $(dirname $0)
mkdir -p coverage_report/$1
gcovr --object-directory=build/$1/threadx/CMakeFiles/threadx.dir/common/src -r build/$1 -f ../../../common/src --xml-pretty --output coverage_report/$1.xml
gcovr --object-directory=build/$1/threadx/CMakeFiles/threadx.dir/common/src -r build/$1 -f ../../../common/src --html --html-details --output coverage_report/$1/index.html

View File

@@ -0,0 +1,121 @@
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
cmake_policy(SET CMP0057 NEW)
project(regression_test LANGUAGES C)
set(SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../regression)
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_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
${SOURCE_DIR}/threadx_trace_basic_test.c
${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
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)
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)
add_test(${CMAKE_BUILD_TYPE}::${test_name} ${test_name})
endforeach()

View File

@@ -0,0 +1,10 @@
#!/bin/bash
dst=$(dirname $0)/../../regression/tx_initialize_low_level.c
src=$(dirname $0)/../../../../ports/linux/gnu/src/tx_initialize_low_level.c
line=`sed -n '/_tx_linux_timer_interrupt/=' $src | tail -n 1`
sed "${line}iVOID test_interrupt_dispatch(VOID);" $src > tmp1
line=`sed -n '/_tx_timer_interrupt/=' $src | tail -n 1`
sed "${line}itest_interrupt_dispatch();" tmp1 > $dst
rm tmp1

1
test/tx/cmake/run.sh Symbolic link
View File

@@ -0,0 +1 @@
../../../tools/cmake_bootstrap.sh

View File

@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
cmake_policy(SET CMP0057 NEW)
project(samples LANGUAGES C)
set(SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../ports/linux/gnu/example_build)
set(sample_files
${SOURCE_DIR}/sample_threadx.c)
foreach(sample_file ${sample_files})
get_filename_component(sample_file_name ${sample_file} NAME_WE)
add_executable(${sample_file_name} ${sample_file} ${CMAKE_CURRENT_LIST_DIR}/fake.c)
target_link_libraries(${sample_file_name} PRIVATE azrtos::threadx)
endforeach()

View File

@@ -0,0 +1,20 @@
#include "tx_api.h"
typedef unsigned int TEST_FLAG;
TEST_FLAG threadx_byte_allocate_loop_test;
TEST_FLAG threadx_byte_release_loop_test;
TEST_FLAG threadx_mutex_suspension_put_test;
TEST_FLAG threadx_mutex_suspension_priority_test;
#ifndef TX_TIMER_PROCESS_IN_ISR
TEST_FLAG threadx_delete_timer_thread;
#endif
void abort_and_resume_byte_allocating_thread(void){}
void abort_all_threads_suspended_on_mutex(void){}
void suspend_lowest_priority(void){}
#ifndef TX_TIMER_PROCESS_IN_ISR
void delete_timer_thread(void){}
#endif
TEST_FLAG test_stack_analyze_flag;
TEST_FLAG test_initialize_flag;
TEST_FLAG test_forced_mutex_timeout;