diff --git a/.gitmodules b/.gitmodules index 67c1b8c..13b579b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "lib/Unity"] path = lib/Unity - url = gitlab@git.stubbe.rocks:kttd/3rd-party-libs/Unity.git -[submodule "lib/fff"] - path = lib/fff - url = gitlab@git.stubbe.rocks:kttd/3rd-party-libs/fff.git \ No newline at end of file + url = gitea@gitea.stubbe.rocks:3rd-party/Unity.git \ No newline at end of file diff --git a/dev-utility/BuildKernelModule.cmake b/dev-utility/BuildKernelModule.cmake deleted file mode 100644 index bda7d71..0000000 --- a/dev-utility/BuildKernelModule.cmake +++ /dev/null @@ -1,88 +0,0 @@ -function(module_objects module_name input_files output_string) - foreach(module_file ${input_files}) - string(REGEX MATCH "^.*[oc]$" match_file ${module_file}) - if(NOT ${match_file}) - file(RELATIVE_PATH rel_file "${PROJECT_SOURCE_DIR}" ${module_file} ) - string(REPLACE ".c" ".o" module_object ${rel_file}) - list(APPEND module_objects "${module_name}-objs += ${module_object}") - endif() - endforeach() - string(REPLACE ";" "\n" module_objects_string "${module_objects}") - set(${output_string} ${module_objects_string} PARENT_SCOPE) -endfunction() - -function(get_directory_includes output_string) - get_property(input_dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) - foreach(include_dir ${input_dirs}) - get_filename_component(abs_path ${include_dir} REALPATH) - list(APPEND module_includes "ccflags-y += -I${abs_path}") - endforeach() - string(REPLACE ";" "\n" module_includes_string "${module_includes}") - set(${output_string} ${module_includes_string} PARENT_SCOPE) -endfunction() - -function(get_directory_definitions output_string) - get_property(input_definitions DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS) - foreach(input_definition ${input_definitions}) - list(APPEND module_definitions "ccflags-y += -D${input_definition}") - endforeach() - string(REPLACE ";" "\n" module_definitions_string "${module_definitions}") - set(${output_string} ${module_definitions_string} PARENT_SCOPE) -endfunction() - -function(module_kbuild module_name module_files output_string) - module_objects("${module_name}" "${module_files}" kobjects_string) - get_directory_definitions(kdefintions_string) - get_directory_includes(kincludes_string) - set(${output_string} -"obj-m += ${module_name}.o -${kobjects_string} - -${kincludes_string} - -${kdefintions_string}" PARENT_SCOPE) -endfunction() - -function(add_module module_name module_files kernel_dir) - set(module_build_path "${PROJECT_BINARY_DIR}/${module_name}") - module_kbuild("${module_name}" "${module_files}" Kbuild_string) - file(WRITE "${module_build_path}/Kbuild" ${Kbuild_string}) - - foreach(copy_file ${module_files}) - file(RELATIVE_PATH rel_copy_file "${PROJECT_SOURCE_DIR}" ${copy_file} ) - list(APPEND cmd_list "cp --parents ${rel_copy_file} ${module_build_path}") - endforeach() - string(REPLACE ";" "\n" cmd_list_string "${cmd_list}") - file(WRITE "${module_build_path}/cp.sh" "#!/bin/sh\n${cmd_list_string}") - file(COPY "${module_build_path}/cp.sh" - DESTINATION "${module_build_path}/.tmp" - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - file(REMOVE "${module_build_path}/cp.sh") - - message("${CMAKE_MAKE_PROGRAM} -C ${kernel_dir} M=${module_build_path} modules KBUILD_EXTRA_SYMBOLS=${module_build_path}/Module.symvers") - ADD_CUSTOM_COMMAND( - OUTPUT ${PROJECT_BINARY_DIR}/${module_name}.built - COMMAND ${CMAKE_MAKE_PROGRAM} -C ${kernel_dir} M=${module_build_path} modules KBUILD_EXTRA_SYMBOLS=${module_build_path}/Module.symvers - COMMAND cmake -E touch ${PROJECT_BINARY_DIR}/${module_name}.built - COMMENT "Kernel make modules ${module_name}:\n${Kbuild_string}\n" - DEPENDS ${PROJECT_SOURCE_DIR}/CMakeLists.txt ${module_files} ${module_include_dirs} - VERBATIM) - - ADD_CUSTOM_COMMAND( - OUTPUT ${PROJECT_BINARY_DIR}/${module_name}-copy.built - COMMAND "${module_build_path}/.tmp/cp.sh" - WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" - COMMAND cmake -E touch ${PROJECT_BINARY_DIR}/${module_name}-copy.built - DEPENDS ${PROJECT_SOURCE_DIR}/CMakeLists.txt ${module_files} ${module_include_dirs} - VERBATIM) - - ADD_CUSTOM_TARGET("${module_name}" ALL - DEPENDS ${PROJECT_BINARY_DIR}/${module_name}.built ${PROJECT_BINARY_DIR}/${module_name}-copy.built - SOURCES ${module_files} - COMMENT "Building Kernel Module ${module_name}") -endfunction() - - -#function(get_target_definitions output_list) - -#function(get_target_includes output_list) diff --git a/lib/fff b/lib/fff deleted file mode 160000 index 0fe36a9..0000000 --- a/lib/fff +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0fe36a9381806b05a925bcfb5bbbd2ef21cd03e1 diff --git a/src/kunity.c b/src/kunity.c index 86d092d..132b093 100644 --- a/src/kunity.c +++ b/src/kunity.c @@ -95,9 +95,12 @@ result_code_e run_unity_test(/* in */ const unity_test_function_ptr test_functio return result; } -result_code_e run_unity_printk_test(/* in */ const unity_test_function_ptr test_function, /* in */ const char* file_name, /* in */ const char* test_name, /* in */ int line_number) +result_code_e run_unity_printk_test(/* in */ const kunity_test_function_ptr test_function) { - return run_unity_test(test_function, file_name, test_name, line_number, &prink_output); + if (test_function == NULL) { + return ERROR_NULL_ARGUMENT; + } + return test_function(&prink_output); } //} @@ -110,7 +113,7 @@ static void printk_put_char(char letter) const char* c = (const char*)&string_builder.buffer[0]; printk(c); string_builder.write_postion = 0; - memset(string_builder.buffer, 0, 1024); + memset(string_builder.buffer, 0, KUNITY_LINE_SIZE); return; } diff --git a/src/kunity.h b/src/kunity.h index 853bf73..1c01439 100644 --- a/src/kunity.h +++ b/src/kunity.h @@ -2,8 +2,6 @@ #define KUNITY_H #include "kunity_t.h" -#ifndef TEST_MACRO - //{ global include region #include //} @@ -23,7 +21,7 @@ extern result_code_e create_default_test_output(/* out*/ ptr_output_functions_s* extern result_code_e run_unity_test(/* in */ const unity_test_function_ptr test_function, /* in */ const char* file_name, /* in */ const char* test_name, /* in */ int line_number, /* in */ const ptr_output_functions_s output); -extern result_code_e run_unity_printk_test(/* in */ const unity_test_function_ptr test_function, /* in */ const char* file_name, /* in */ const char* test_name, /* in */ int line_number); +extern result_code_e run_unity_printk_test(/* in */ const kunity_test_function_ptr test_function); //} @@ -31,6 +29,4 @@ extern result_code_e run_unity_printk_test(/* in */ const unity_test_function_pt } #endif -#endif // TEST_MACRO - #endif // KUNITY_H diff --git a/src/kunity_t.h b/src/kunity_t.h index 481f3af..240a37f 100644 --- a/src/kunity_t.h +++ b/src/kunity_t.h @@ -66,6 +66,7 @@ typedef enum result_code_eTag { typedef void (*redirect_char)(char a); typedef void (*unity_test_function_ptr)(void); + //} //{ struct region @@ -74,6 +75,7 @@ typedef struct output_functions_sTag { redirect_char redirect_char; } output_functions_s, *ptr_output_functions_s; + typedef result_code_e (*kunity_test_function_ptr)(ptr_output_functions_s); typedef struct test_sTag {