adds all regression tests
This commit is contained in:
@@ -5,8 +5,8 @@ get_filename_component(THREADX4TGFS_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE
|
||||
|
||||
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||
set(CMAKE_TOOLCHAIN_FILE
|
||||
${THREADX4TGFS_ROOT}/cmake/rv32imac_gnu.cmake
|
||||
CACHE FILEPATH "Toolchain file")
|
||||
${THREADX4TGFS_ROOT}/cmake/rv32imac_gnu.cmake
|
||||
CACHE FILEPATH "Toolchain file")
|
||||
endif()
|
||||
include(${CMAKE_TOOLCHAIN_FILE})
|
||||
|
||||
@@ -24,12 +24,14 @@ enable_testing()
|
||||
set(TARGET_MEM "ram_dram" CACHE STRING "memory map to use")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX_C ".elf")
|
||||
|
||||
# The regression tests require the Timer ISR to call the function test_interrupt_dispatch(void)
|
||||
# We patch the current trap handler and include it using MOONLIGHT_TRAP_SOURCE
|
||||
set(MOONLIGHT_TRAP_SOURCE_INPUT ${THREADX4TGFS_ROOT}/port/moonlight/src/trap_non_vectored.c)
|
||||
set(MOONLIGHT_TRAP_SOURCE ${CMAKE_BINARY_DIR}/generated/trap_non_vectored.c)
|
||||
execute_process(
|
||||
COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/threadx/generate_trap_file.sh
|
||||
${MOONLIGHT_TRAP_SOURCE_INPUT}
|
||||
${MOONLIGHT_TRAP_SOURCE}
|
||||
${MOONLIGHT_TRAP_SOURCE_INPUT}
|
||||
${MOONLIGHT_TRAP_SOURCE}
|
||||
RESULT_VARIABLE MOONLIGHT_TRAP_GENERATE_RESULT
|
||||
)
|
||||
if(NOT MOONLIGHT_TRAP_GENERATE_RESULT EQUAL 0)
|
||||
@@ -70,9 +72,9 @@ function(setup_target TARGET)
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${OBJCOPY} -O ihex $<TARGET_FILE:${TARGET}> ${CMAKE_BINARY_DIR}/${TARGET}.hex
|
||||
COMMAND ${OBJCOPY} -O binary $<TARGET_FILE:${TARGET}> ${CMAKE_BINARY_DIR}/${TARGET}.bin
|
||||
COMMAND ${SIZE} $<TARGET_FILE:${TARGET}>
|
||||
#COMMAND ${SIZE} $<TARGET_FILE:${TARGET}>
|
||||
COMMAND ${OBJDUMP} -S $<TARGET_FILE:${TARGET}> > ${CMAKE_BINARY_DIR}/${TARGET}.dis
|
||||
COMMENT "Creating collateral for ${TARGET}"
|
||||
#COMMENT "Creating collateral for ${TARGET}"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
|
||||
@@ -5,15 +5,117 @@ set(TX_CMAKE_DIR
|
||||
${THREADX4TGFS_ROOT}/third-party/threadx/test/tx/cmake
|
||||
)
|
||||
|
||||
# This time patch a test. Since we use a patched trap vector, we need the function test_interrupt_dispatch(void) to exist
|
||||
# As this test is not using testcontrol.c to provide the symbol, we do so in this workaround
|
||||
set(TX_KERNEL_SETUP_TEST_SOURCE_INPUT ${THREADX4TGFS_ROOT}/third-party/threadx/test/tx/regression/threadx_initialize_kernel_setup_test.c)
|
||||
set(TX_KERNEL_SETUP_TEST_SOURCE ${CMAKE_BINARY_DIR}/generated/threadx_initialize_kernel_setup_test.c)
|
||||
execute_process(
|
||||
COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/generate_kernel_setup_test_file.sh
|
||||
${TX_KERNEL_SETUP_TEST_SOURCE_INPUT}
|
||||
${TX_KERNEL_SETUP_TEST_SOURCE}
|
||||
RESULT_VARIABLE TX_KERNEL_SETUP_TEST_GENERATE_RESULT
|
||||
)
|
||||
if(NOT TX_KERNEL_SETUP_TEST_GENERATE_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to generate patched kernel setup test source")
|
||||
endif()
|
||||
|
||||
set(TX_REGRESSION_CASES
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_error_detection_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_prioritize_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_prioritize_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_thread_contention_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_isr_set_clear_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_isr_wait_abort_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_single_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_consume_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_different_bits_consume_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_different_bits_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_interrupt_control_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_delete_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_nested_priority_inheritance_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_no_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_priority_inheritance_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_proritize_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_eight_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_four_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_one_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_sixteen_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_two_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_max_message_size_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_empty_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_flush_no_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_flush_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_front_send_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_full_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_prioritize.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_ceiling_put_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_delete_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_non_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_prioritize.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_basic_execution_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_basic_time_slice_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_completed_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_create_preemption_threshold_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_delayed_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multi_level_preemption_threshold_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_non_current_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_sleep_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_time_slice_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_preemptable_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_preemption_change_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_priority_change.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_relinquish_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_reset_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_simple_sleep_non_clear_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_simple_sleep_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_simple_suspend_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_sleep_for_100ticks_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_sleep_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_stack_checking_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_terminate_delete_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_time_slice_change_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_wait_abort_and_isr_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_wait_abort_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_time_get_set_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_activate_deactivate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_deactivate_accuracy_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_large_timer_accuracy_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_multiple_accuracy_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_multiple_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_simple_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_trace_basic_test.c
|
||||
${TX_KERNEL_SETUP_TEST_SOURCE}
|
||||
)
|
||||
|
||||
set(TX_REGRESSION_TARGETS)
|
||||
@@ -36,9 +138,15 @@ target_compile_definitions(
|
||||
function(add_threadx_regression_test TEST_SOURCE)
|
||||
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)
|
||||
|
||||
if(TEST_NAME STREQUAL "threadx_initialize_kernel_setup_test")
|
||||
set(test_libraries threadx)
|
||||
else()
|
||||
set(test_libraries threadx_regression_support)
|
||||
endif()
|
||||
|
||||
setup_target(
|
||||
${TEST_NAME}
|
||||
LIBRARIES threadx_regression_support
|
||||
LIBRARIES ${test_libraries}
|
||||
SOURCES ${TEST_SOURCE}
|
||||
)
|
||||
|
||||
|
||||
16
test/threadx/generate_kernel_setup_test_file.sh
Executable file
16
test/threadx/generate_kernel_setup_test_file.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
src="$1"
|
||||
dst="$2"
|
||||
|
||||
anchor='void tx_application_define(void *first_unused_memory){}'
|
||||
|
||||
line=$(grep -n -F "$anchor" "$src" | head -n 1 | cut -d: -f1)
|
||||
if [ -z "$line" ]; then
|
||||
echo "failed to find tx_application_define anchor in kernel setup test source" >&2
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "$(dirname "$dst")"
|
||||
sed "${line}a\\
|
||||
void test_interrupt_dispatch(void){}" "$src" > "$dst"
|
||||
@@ -7,21 +7,23 @@ dst="$2"
|
||||
extern_anchor='extern void _tx_timer_interrupt(void);'
|
||||
call_anchor='_tx_timer_interrupt();'
|
||||
|
||||
mkdir -p "$(dirname "$dst")"
|
||||
tmp1="${dst}.tmp1"
|
||||
|
||||
line=$(grep -n -F "$extern_anchor" "$src" | head -n 1 | cut -d: -f1)
|
||||
if [ -z "$line" ]; then
|
||||
echo "failed to find _tx_timer_interrupt declaration anchor in trap source" >&2
|
||||
exit 1
|
||||
fi
|
||||
sed "${line}a\\
|
||||
extern void test_interrupt_dispatch(void);" "$src" > "$dst.tmp1"
|
||||
extern void test_interrupt_dispatch(void);" "$src" > "$tmp1"
|
||||
|
||||
line=$(grep -n -F "$call_anchor" "$dst.tmp1" | head -n 1 | cut -d: -f1)
|
||||
line=$(grep -n -F "$call_anchor" "$tmp1" | head -n 1 | cut -d: -f1)
|
||||
if [ -z "$line" ]; then
|
||||
echo "failed to find _tx_timer_interrupt call anchor in trap source" >&2
|
||||
rm -f "$dst.tmp1"
|
||||
rm -f "$tmp1"
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "$(dirname "$dst")"
|
||||
sed "${line}i\\
|
||||
test_interrupt_dispatch();" "$dst.tmp1" > "$dst"
|
||||
rm -f "$dst.tmp1"
|
||||
test_interrupt_dispatch();" "$tmp1" > "$dst"
|
||||
rm -f "$tmp1"
|
||||
|
||||
Reference in New Issue
Block a user