Transition FileX to Eclipse Fundation

This commit is contained in:
TiejunZhou
2024-01-02 07:35:14 +00:00
commit 14884808b5
406 changed files with 143803 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
threadx
+105
View File
@@ -0,0 +1,105 @@
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 no_cache_build no_cache_standalone_build
fault_tolerant_build_coverage no_check_build no_cache_fault_tolerant_build
standalone_build_coverage standalone_fault_tolerant_build_coverage
standalone_no_cache_fault_tolerant_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(FX_FAULT_TOLERANT_DEFINITIONS
-DFX_ENABLE_FAULT_TOLERANT -DFX_UPDATE_FILE_SIZE_ON_ALLOCATE
-DFX_FAULT_TOLERANT_TRANSACTION_FAIL_FUNCTION)
set(default_build_coverage "")
set(no_cache_build -DFX_DISABLE_CACHE -DFX_DISABLE_FAT_ENTRY_REFRESH)
set(fault_tolerant_build_coverage ${FX_FAULT_TOLERANT_DEFINITIONS})
set(standalone_build_coverage -DFX_STANDALONE_ENABLE)
set(standalone_fault_tolerant_build_coverage ${FX_FAULT_TOLERANT_DEFINITIONS}
-DFX_STANDALONE_ENABLE)
set(no_cache_standalone_build -DFX_DISABLE_CACHE -DFX_STANDALONE_ENABLE)
set(no_check_build ${FX_COMPILE_DEFINITIONS} -DFX_DISABLE_ERROR_CHECKING)
set(no_cache_fault_tolerant_build ${no_cache_build} ${FX_FAULT_TOLERANT_DEFINITIONS})
set(standalone_no_cache_fault_tolerant_build ${no_cache_build} ${FX_FAULT_TOLERANT_DEFINITIONS} -DFX_STANDALONE_ENABLE)
add_compile_options(
-m32
-std=c99
-ggdb
-g3
-gdwarf-2
-fdiagnostics-color
-Werror
-DFX_REGRESSION_TEST
${${CMAKE_BUILD_TYPE}})
add_link_options(-m32)
if(CMAKE_BUILD_TYPE MATCHES ".*standalone.*")
set(FX_STANDALONE_ENABLE
ON
CACHE BOOL "Enable Filex in standalone mode")
endif()
enable_testing()
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../.. filex)
add_subdirectory(regression)
add_subdirectory(samples)
# Coverage
if(CMAKE_BUILD_TYPE MATCHES ".*_coverage")
target_compile_options(filex PRIVATE -fprofile-arcs -ftest-coverage)
target_link_options(filex PRIVATE -fprofile-arcs -ftest-coverage)
endif()
# Build ThreadX library once
if(NOT FX_STANDALONE_ENABLE)
execute_process(COMMAND ${CMAKE_CURRENT_LIST_DIR}/run.sh build_libs)
add_custom_target(build_libs ALL COMMAND ${CMAKE_CURRENT_LIST_DIR}/run.sh
build_libs)
add_dependencies(filex build_libs)
target_include_directories(filex PUBLIC ${CMAKE_BINARY_DIR}/../libs/inc)
add_library(threadx SHARED IMPORTED GLOBAL)
add_library("azrtos::threadx" ALIAS threadx)
set_target_properties(
threadx PROPERTIES IMPORTED_LOCATION
${CMAKE_BINARY_DIR}/../libs/threadx/libthreadx.so)
endif()
target_compile_options(
filex
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
View File
@@ -0,0 +1,8 @@
#!/bin/bash
set -e
cd $(dirname $0)
mkdir -p coverage_report/$1
gcovr --object-directory=build/$1/filex/CMakeFiles/filex.dir/common/src -r ../../common/src -e ".*driver.*" --xml-pretty --output coverage_report/$1.xml
gcovr --object-directory=build/$1/filex/CMakeFiles/filex.dir/common/src -r ../../common/src -e ".*driver.*" --html --html-details --output coverage_report/$1/index.html
+24
View File
@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(libs LANGUAGES C)
if(ENABLE_64)
message(STATUS "Building for 64bit")
else()
add_compile_options(-m32)
add_link_options(-m32)
message(STATUS "Building for 32bit")
endif()
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../threadx threadx)
target_compile_options(threadx PRIVATE -DTX_ENABLE_EVENT_TRACE -DTX_LINUX_NO_IDLE_ENABLE)
get_target_property(dirs threadx INCLUDE_DIRECTORIES)
execute_process(COMMAND mkdir -p ${CMAKE_BINARY_DIR}/inc)
foreach(dir ${dirs})
file(GLOB header_files ${dir}/*.h)
foreach(header_file ${header_files})
execute_process(COMMAND ln -sf ${header_file} ${CMAKE_BINARY_DIR}/inc)
endforeach()
endforeach()
+156
View File
@@ -0,0 +1,156 @@
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_test)
set(regression_test_cases
${SOURCE_DIR}/filex_directory_attributes_read_set_test.c
${SOURCE_DIR}/filex_directory_create_delete_test.c
${SOURCE_DIR}/filex_directory_default_path_get_set_test.c
${SOURCE_DIR}/filex_directory_duplicate_entries_test.c
${SOURCE_DIR}/filex_directory_first_next_find_test.c
${SOURCE_DIR}/filex_directory_local_path_test.c
${SOURCE_DIR}/filex_directory_long_short_get_test.c
${SOURCE_DIR}/filex_directory_naming_test.c
${SOURCE_DIR}/filex_directory_rename_test.c
${SOURCE_DIR}/filex_fault_tolerant_corrupted_log_file_test.c
${SOURCE_DIR}/filex_fault_tolerant_delete_large_data_test.c
${SOURCE_DIR}/filex_fault_tolerant_directory_attributes_set_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_directory_attributes_set_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_directory_create_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_directory_create_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_directory_delete_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_directory_delete_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_directory_rename_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_directory_rename_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_enable_test.c
${SOURCE_DIR}/filex_fault_tolerant_enable_1_test.c
${SOURCE_DIR}/filex_fault_tolerant_enable_2_test.c
${SOURCE_DIR}/filex_fault_tolerant_enable_3_test.c
${SOURCE_DIR}/filex_fault_tolerant_enable_4_test.c
${SOURCE_DIR}/filex_fault_tolerant_media_check_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_seek_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_random_seek_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_allocate_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_allocate_fat_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_allocate_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_allocate_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_allocate_undo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_attributes_set_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_attributes_set_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_best_allocate_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_best_allocate_fat_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_best_allocate_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_best_allocate_undo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_create_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_create_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_delete_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_delete_fat_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_delete_fat_multiple_sectors_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_delete_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_delete_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_delete_undo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_rename_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_rename_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_truncate_release_available_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_truncate_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_truncate_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_truncate_release_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_truncate_release_fat_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_truncate_release_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_truncate_release_undo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_write_available_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_write_data_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_write_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_write_fat_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_write_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_write_undo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_corruption_test.c
${SOURCE_DIR}/filex_fault_tolerant_log_full_test.c
${SOURCE_DIR}/filex_fault_tolerant_log_recover_directory_test.c
${SOURCE_DIR}/filex_fault_tolerant_log_recover_fat_test.c
${SOURCE_DIR}/filex_fault_tolerant_long_directory_create_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_long_directory_create_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_long_directory_rename_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_long_directory_rename_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_long_directory_rename_io_error_test.c
${SOURCE_DIR}/filex_fault_tolerant_long_file_create_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_long_file_create_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_loop_write_data_test.c
${SOURCE_DIR}/filex_fault_tolerant_media_full_test.c
${SOURCE_DIR}/filex_fault_tolerant_write_large_data_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_write_large_data_fat_chain_cleanup_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_write_large_data_fat_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_write_large_data_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_write_large_data_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_write_large_data_test.c
${SOURCE_DIR}/filex_fault_tolerant_write_large_data_undo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_recover_fail_test.c
${SOURCE_DIR}/filex_fault_tolerant_unicode_directory_create_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_unicode_directory_create_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_unicode_directory_rename_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_unicode_directory_rename_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_unicode_file_create_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_unicode_file_create_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_unicode_file_rename_directory_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_unicode_file_rename_redo_log_interrupt_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_write_fat_crossover_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_write_fat_crossover_2_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_allocate_fat_crossover_test.c
${SOURCE_DIR}/filex_fault_tolerant_file_best_effort_allocate_fat_crossover_test.c
${SOURCE_DIR}/filex_file_allocate_truncate_test.c
${SOURCE_DIR}/filex_file_allocate_test.c
${SOURCE_DIR}/filex_file_attributes_read_set_test.c
${SOURCE_DIR}/filex_file_create_delete_test.c
${SOURCE_DIR}/filex_file_date_time_set_test.c
${SOURCE_DIR}/filex_file_naming_test.c
${SOURCE_DIR}/filex_file_read_write_test.c
${SOURCE_DIR}/filex_file_rename_test.c
${SOURCE_DIR}/filex_file_seek_test.c
${SOURCE_DIR}/filex_file_name_test.c
${SOURCE_DIR}/filex_media_abort_test.c
${SOURCE_DIR}/filex_media_cache_invalidate_test.c
${SOURCE_DIR}/filex_media_check_test.c
${SOURCE_DIR}/filex_media_flush_test.c
${SOURCE_DIR}/filex_media_format_open_close_test.c
${SOURCE_DIR}/filex_media_multiple_open_close_test.c
${SOURCE_DIR}/filex_media_read_write_sector_test.c
${SOURCE_DIR}/filex_media_volume_directory_entry_test.c
${SOURCE_DIR}/filex_media_volume_get_set_test.c
${SOURCE_DIR}/filex_media_hidden_sectors_test.c
${SOURCE_DIR}/filex_system_date_time_test.c
${SOURCE_DIR}/filex_unicode_directory_rename_test.c
${SOURCE_DIR}/filex_unicode_file_directory_rename_extra_test.c
${SOURCE_DIR}/filex_unicode_file_directory_rename_extra_2_test.c
${SOURCE_DIR}/filex_unicode_file_rename_test.c
${SOURCE_DIR}/filex_unicode_test.c
${SOURCE_DIR}/filex_unicode_2_test.c
${SOURCE_DIR}/filex_unicode_3_test.c
${SOURCE_DIR}/filex_unicode_4_test.c
${SOURCE_DIR}/filex_unicode_name_string_test.c
${SOURCE_DIR}/filex_unicode_directory_entry_test.c
${SOURCE_DIR}/filex_unicode_directory_entry_2_test.c
${SOURCE_DIR}/filex_unicode_directory_entry_change_test.c
${SOURCE_DIR}/filex_unicode_fat_entry_test.c
${SOURCE_DIR}/filex_unicode_fat_entry_1_test.c
${SOURCE_DIR}/filex_unicode_fat_entry_2_test.c
${SOURCE_DIR}/filex_unicode_fat_entry_3_test.c
${SOURCE_DIR}/filex_file_write_seek_test.c
${SOURCE_DIR}/filex_file_write_notify_test.c
${SOURCE_DIR}/filex_file_write_available_cluster_test.c
${SOURCE_DIR}/filex_utility_test.c
${SOURCE_DIR}/filex_utility_fat_flush_test.c)
add_library(test_utility ${SOURCE_DIR}/fx_ram_driver_test.c
${SOURCE_DIR}/filextestcontrol.c)
target_link_libraries(test_utility PUBLIC azrtos::filex)
target_compile_definitions(test_utility PUBLIC BATCH_TEST CTEST)
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()
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
cd $(dirname $0)
# if threadx repo does not exist, clone it
[ -d threadx ] || git clone https://github.com/azure-rtos/threadx.git --depth 1
[ -f .run.sh ] || ln -sf threadx/scripts/cmake_bootstrap.sh .run.sh
./.run.sh $*
+17
View File
@@ -0,0 +1,17 @@
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}/../../../samples)
set(sample_files
${SOURCE_DIR}/demo_filex.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}/../../regression_test/fx_ram_driver_test.c)
target_compile_options(${sample_file_name} PRIVATE -DSAMPLE_BUILD)
target_link_libraries(${sample_file_name} PRIVATE azrtos::filex)
endforeach()