From 775707879feb6fdfbf3f74a2d2227d4a3be250d1 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 16 Apr 2021 09:12:34 -0400 Subject: [PATCH] Fix #832, update coverage test to use generated stubs Update the coverage-specific (shared layer internal) stubs to use generated stubs. --- src/unit-test-coverage/shared/CMakeLists.txt | 2 + .../ut-stubs/CMakeLists.txt | 195 +++++-- .../src/os-shared-binsem-impl-stubs.c | 144 +++++ .../src/os-shared-binsem-init-stubs.c | 42 ++ .../ut-stubs/src/os-shared-clock-impl-stubs.c | 60 +++ ...-stubs.c => os-shared-common-impl-stubs.c} | 38 +- .../src/os-shared-common-init-stubs.c | 44 ++ .../ut-stubs/src/os-shared-common-stubs.c | 46 ++ .../src/os-shared-console-impl-stubs.c | 56 ++ ...stubs.c => os-shared-console-init-stubs.c} | 32 +- .../src/os-shared-countsem-impl-stubs.c | 128 +++++ .../src/os-shared-countsem-init-stubs.c | 42 ++ .../ut-stubs/src/os-shared-dir-impl-stubs.c | 127 +++++ ...mpl-stubs.c => os-shared-dir-init-stubs.c} | 33 +- .../ut-stubs/src/os-shared-file-impl-hooks.c | 71 +++ .../ut-stubs/src/os-shared-file-impl-stubs.c | 206 +++++++ ...ug-stubs.c => os-shared-file-init-stubs.c} | 29 +- .../ut-stubs/src/os-shared-file-stubs.c | 45 ++ ...stubs.c => os-shared-filesys-impl-hooks.c} | 39 +- .../src/os-shared-filesys-impl-stubs.c | 144 +++++ .../src/os-shared-filesys-init-stubs.c | 42 ++ .../ut-stubs/src/os-shared-filesys-stubs.c | 86 +++ .../ut-stubs/src/os-shared-globaldefs-stubs.c | 49 ++ .../ut-stubs/src/os-shared-heap-impl-stubs.c | 44 ++ .../ut-stubs/src/os-shared-idmap-hooks.c | 402 ++++++++++++++ .../ut-stubs/src/os-shared-idmap-impl-stubs.c | 65 +++ .../ut-stubs/src/os-shared-idmap-stubs.c | 509 ++++++++++++++++++ .../src/os-shared-module-impl-stubs.c | 130 +++++ .../src/os-shared-module-init-stubs.c | 42 ++ .../ut-stubs/src/os-shared-module-stubs.c | 62 +++ .../ut-stubs/src/os-shared-mutex-impl-stubs.c | 110 ++++ .../ut-stubs/src/os-shared-mutex-init-stubs.c | 42 ++ .../src/os-shared-network-impl-hooks.c | 53 ++ .../src/os-shared-network-impl-stubs.c | 63 +++ .../src/os-shared-network-init-stubs.c | 42 ++ ...-stubs.c => os-shared-printf-impl-stubs.c} | 23 +- .../ut-stubs/src/os-shared-queue-impl-stubs.c | 117 ++++ .../ut-stubs/src/os-shared-queue-init-stubs.c | 42 ++ .../src/os-shared-select-impl-stubs.c | 64 +++ .../ut-stubs/src/os-shared-shell-impl-stubs.c | 45 ++ .../src/os-shared-sockets-impl-stubs.c | 243 +++++++++ .../src/os-shared-sockets-init-stubs.c | 42 ++ .../ut-stubs/src/os-shared-sockets-stubs.c | 42 ++ .../ut-stubs/src/os-shared-task-impl-stubs.c | 219 ++++++++ .../ut-stubs/src/os-shared-task-init-stubs.c | 42 ++ ...ap-impl-stubs.c => os-shared-task-stubs.c} | 26 +- .../ut-stubs/src/os-shared-time-init-stubs.c | 42 ++ .../src/os-shared-timebase-impl-stubs.c | 119 ++++ .../src/os-shared-timebase-init-stubs.c | 42 ++ .../ut-stubs/src/os-shared-timebase-stubs.c | 57 ++ .../ut-stubs/src/osapi-binsem-impl-stubs.c | 47 -- .../ut-stubs/src/osapi-countsem-impl-stubs.c | 46 -- .../ut-stubs/src/osapi-file-impl-stubs.c | 87 --- .../ut-stubs/src/osapi-loader-impl-stubs.c | 45 -- .../ut-stubs/src/osapi-mutex-impl-stubs.c | 45 -- .../ut-stubs/src/osapi-network-impl-stubs.c | 67 --- .../ut-stubs/src/osapi-queue-impl-stubs.c | 46 -- .../ut-stubs/src/osapi-select-impl-stubs.c | 52 -- ... => osapi-shared-error-impl-table-stubs.c} | 0 ...ubs.c => osapi-shared-idmap-table-stubs.c} | 0 .../ut-stubs/src/osapi-task-impl-stubs.c | 73 --- .../ut-stubs/src/osapi-timer-impl-stubs.c | 59 -- src/unit-test-coverage/vxworks/CMakeLists.txt | 2 + 63 files changed, 4274 insertions(+), 724 deletions(-) create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-binsem-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-binsem-init-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-clock-impl-stubs.c rename src/unit-test-coverage/ut-stubs/src/{osapi-common-impl-stubs.c => os-shared-common-impl-stubs.c} (61%) create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-common-init-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-common-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-console-impl-stubs.c rename src/unit-test-coverage/ut-stubs/src/{osapi-idmap-impl-stubs.c => os-shared-console-init-stubs.c} (60%) create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-countsem-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-countsem-init-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-dir-impl-stubs.c rename src/unit-test-coverage/ut-stubs/src/{osapi-console-impl-stubs.c => os-shared-dir-init-stubs.c} (62%) create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-hooks.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-stubs.c rename src/unit-test-coverage/ut-stubs/src/{osapi-shared-debug-stubs.c => os-shared-file-init-stubs.c} (61%) create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-file-stubs.c rename src/unit-test-coverage/ut-stubs/src/{osapi-filesys-impl-stubs.c => os-shared-filesys-impl-hooks.c} (54%) create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-filesys-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-filesys-init-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-filesys-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-globaldefs-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-heap-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-idmap-hooks.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-idmap-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-idmap-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-module-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-module-init-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-module-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-mutex-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-mutex-init-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-hooks.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-network-init-stubs.c rename src/unit-test-coverage/ut-stubs/src/{portable-console-bsp-impl-stubs.c => os-shared-printf-impl-stubs.c} (68%) create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-queue-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-queue-init-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-select-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-shell-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-sockets-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-sockets-init-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-sockets-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-task-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-task-init-stubs.c rename src/unit-test-coverage/ut-stubs/src/{osapi-heap-impl-stubs.c => os-shared-task-stubs.c} (63%) create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-time-init-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-timebase-impl-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-timebase-init-stubs.c create mode 100644 src/unit-test-coverage/ut-stubs/src/os-shared-timebase-stubs.c delete mode 100644 src/unit-test-coverage/ut-stubs/src/osapi-binsem-impl-stubs.c delete mode 100644 src/unit-test-coverage/ut-stubs/src/osapi-countsem-impl-stubs.c delete mode 100644 src/unit-test-coverage/ut-stubs/src/osapi-file-impl-stubs.c delete mode 100644 src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c delete mode 100644 src/unit-test-coverage/ut-stubs/src/osapi-mutex-impl-stubs.c delete mode 100644 src/unit-test-coverage/ut-stubs/src/osapi-network-impl-stubs.c delete mode 100644 src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c delete mode 100644 src/unit-test-coverage/ut-stubs/src/osapi-select-impl-stubs.c rename src/unit-test-coverage/ut-stubs/src/{osapi-error-impl-stubs.c => osapi-shared-error-impl-table-stubs.c} (100%) rename src/unit-test-coverage/ut-stubs/src/{osapi-shared-idmap-stubs.c => osapi-shared-idmap-table-stubs.c} (100%) delete mode 100644 src/unit-test-coverage/ut-stubs/src/osapi-task-impl-stubs.c delete mode 100644 src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c diff --git a/src/unit-test-coverage/shared/CMakeLists.txt b/src/unit-test-coverage/shared/CMakeLists.txt index defe74c08..7c51940aa 100644 --- a/src/unit-test-coverage/shared/CMakeLists.txt +++ b/src/unit-test-coverage/shared/CMakeLists.txt @@ -30,7 +30,9 @@ set(SHARED_COVERAGE_LINK_LIST os-shared-coverage-support ut-adaptor-shared ut_osapi_impl_stubs + ut_osapi_init_stubs ut_osapi_shared_stubs + ut_osapi_table_stubs ut_osapi_stubs ut_libc_stubs ) diff --git a/src/unit-test-coverage/ut-stubs/CMakeLists.txt b/src/unit-test-coverage/ut-stubs/CMakeLists.txt index ba4714dbb..82efb42b3 100644 --- a/src/unit-test-coverage/ut-stubs/CMakeLists.txt +++ b/src/unit-test-coverage/ut-stubs/CMakeLists.txt @@ -2,7 +2,7 @@ # Stub libraries for coverage testing # ---------------------------------------- -# This provides suitable "stub" implementations of every +# This provides suitable "stub" implementations of every # function call used internally by the various OSAL modules # for which there is not a stub already defined. # @@ -13,27 +13,27 @@ # i.e. memset, strcmp, etc - these should be relevant for all # supported operating systems as they are standard C # - Stub versions of internal "shared" OSAL implementation functions -# i.e. everything declared in the internal API. These are needed by +# i.e. everything declared in the internal API. These are needed by # any coverage test referencing on the shared/ng OSAL layer. # # The "ut_libc_stubs" target provides stub versions of C library calls. # They are prefixed with "OCS_" and target code must be recompiled to # call the OCS_ version of the syscall instead of the regular syscall. -# This is because in some circumstances for these calls the stub actually -# needs to invoke the real version or else weird things happen. +# This is because in some circumstances for these calls the stub actually +# needs to invoke the real version or else weird things happen. # This library includes stubs from all supported operating systems. This # is generally OK as we do not use any actual OS system headers # -# These files are generally organized to match whatever header file +# These files are generally organized to match whatever header file # defines the function. For instance, POSIX defines the "mqueue.h" # header file which in turn provides mq_open, mq_close, etc. So -# the OCS_mq_open, OCS_mq_close declarations are in overrides/mqueue.h, and +# the OCS_mq_open, OCS_mq_close declarations are in overrides/mqueue.h, and # the respective implementation is in posix-mqueue-stubs.c. # -# This keeps things relatively organized, and by keeping the source files +# This keeps things relatively organized, and by keeping the source files # relatively small and targeted like this the linker should only pull in -# the OCS functions that are actually used. +# the OCS functions that are actually used. # add_library(ut_libc_stubs STATIC EXCLUDE_FROM_ALL src/arpa-inet-stubs.c @@ -74,49 +74,163 @@ add_library(ut_libc_stubs STATIC EXCLUDE_FROM_ALL src/vxworks-taskLib-stubs.c src/vxworks-taskVarLib-stubs.c src/vxworks-xbdBlkDev-stubs.c) - -target_include_directories(ut_libc_stubs PUBLIC + +target_include_directories(ut_libc_stubs PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc ) - - -# The "ut_osapi_impl_stubs" provides stub functions for internal -# OSAL calls used by or implemented by the shared layer. These -# are not public API calls. This is only compiled if used. + +# About the generated UT stub sources +# +# The interface between "shared" (upper) and "impl" (lower) layers presents a few +# complexities for stubs, because the os/shared/inc headers define prototypes for +# functions that are both referenced from upper and implemented in lower level, as +# well as some functions that are referenced from lower and implemented in upper. +# +# it is important _NOT_ to mix these into the same stub units, even if they are +# declared in the same header file, or else link-time errors are likely to occur. +# +# However, this is eased to some degree because of the naming conventions. All +# functions that are intended to be implemented in the lower layer have an "_Impl" +# suffix on their name. +# +# The stubs are generated in three sets +# impl-stubs : for all "Impl" routines, normally implemented in lower layer. No handlers. +# init-stubs : for all "Init" routines, normally implemented in upper layer. No handlers. +# stubs : for everything else, normally implemented in upper layer. Has handlers. +# +set(OSAL_SHARED_IMPL_HEADERS + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-binsem.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-clock.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-common.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-console.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-countsem.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-dir.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-errors.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-file.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-filesys.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-globaldefs.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-heap.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-idmap.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-module.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-mutex.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-network.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-printf.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-queue.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-select.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-shell.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-sockets.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-task.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-timebase.h + ${OSAL_SOURCE_DIR}/src/os/shared/inc/os-shared-time.h +) + +# The following target rule contains the specific commands required +# to auto-generate the stub implementations from the headers +add_custom_target(generate_osal_coverage_stubs + COMMAND ${UT_ASSERT_SOURCE_DIR}/scripts/generate_stubs.pl + --filter=/_Impl$/ + --stub-suffix=impl-stubs + --hook-suffix=impl-hooks + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${OSAL_SHARED_IMPL_HEADERS} + COMMAND ${UT_ASSERT_SOURCE_DIR}/scripts/generate_stubs.pl + --filter=/_Init$/ + --stub-suffix=init-stubs + --hook-suffix=init-hooks + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${OSAL_SHARED_IMPL_HEADERS} + COMMAND ${UT_ASSERT_SOURCE_DIR}/scripts/generate_stubs.pl + --filter=!/_Init$|_Impl$/ + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${OSAL_SHARED_IMPL_HEADERS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM +) + +# The "ut_osapi_impl_stubs" provides stub functions for the +# implementation-specific function calls that are declared under os/shared/inc +# header directory. These are the functions that all end in an "_Impl" suffix, +# and are not public API calls. This is only compiled if used. add_library(ut_osapi_impl_stubs STATIC EXCLUDE_FROM_ALL - src/osapi-binsem-impl-stubs.c - src/osapi-common-impl-stubs.c - src/osapi-console-impl-stubs.c - src/osapi-countsem-impl-stubs.c - src/osapi-error-impl-stubs.c - src/osapi-file-impl-stubs.c - src/osapi-filesys-impl-stubs.c - src/osapi-heap-impl-stubs.c - src/osapi-idmap-impl-stubs.c - src/osapi-loader-impl-stubs.c - src/osapi-mutex-impl-stubs.c - src/osapi-network-impl-stubs.c - src/osapi-queue-impl-stubs.c - src/osapi-select-impl-stubs.c - src/osapi-shared-common-stubs.c - src/osapi-shared-debug-stubs.c - src/osapi-shared-idmap-stubs.c - src/osapi-task-impl-stubs.c - src/osapi-timer-impl-stubs.c - src/portable-console-bsp-impl-stubs.c + src/os-shared-binsem-impl-stubs.c + src/os-shared-clock-impl-stubs.c + src/os-shared-common-impl-stubs.c + src/os-shared-console-impl-stubs.c + src/os-shared-countsem-impl-stubs.c + src/os-shared-dir-impl-stubs.c + src/os-shared-file-impl-hooks.c + src/os-shared-file-impl-stubs.c + src/os-shared-filesys-impl-hooks.c + src/os-shared-filesys-impl-stubs.c + src/os-shared-heap-impl-stubs.c + src/os-shared-idmap-impl-stubs.c + src/os-shared-module-impl-stubs.c + src/os-shared-mutex-impl-stubs.c + src/os-shared-network-impl-hooks.c + src/os-shared-network-impl-stubs.c + src/os-shared-printf-impl-stubs.c + src/os-shared-queue-impl-stubs.c + src/os-shared-select-impl-stubs.c + src/os-shared-shell-impl-stubs.c + src/os-shared-sockets-impl-stubs.c + src/os-shared-task-impl-stubs.c + src/os-shared-timebase-impl-stubs.c ) -# The "ut_osapi_shared_stubs" provides stub objects for shared -# objects used by the implementation layer. These -# are not public. This is only compiled if used. +# The "ut_osapi_init_stubs" provides stub functions for the +# initialization function calls that are declared under os/shared/inc +# header directory. These are the functions that all end in an "_Init" suffix, +# and are not public API calls. This is only compiled if used. +add_library(ut_osapi_init_stubs STATIC EXCLUDE_FROM_ALL + src/os-shared-binsem-init-stubs.c + src/os-shared-common-init-stubs.c + src/os-shared-console-init-stubs.c + src/os-shared-countsem-init-stubs.c + src/os-shared-dir-init-stubs.c + src/os-shared-file-init-stubs.c + src/os-shared-filesys-init-stubs.c + src/os-shared-module-init-stubs.c + src/os-shared-mutex-init-stubs.c + src/os-shared-network-init-stubs.c + src/os-shared-queue-init-stubs.c + src/os-shared-sockets-init-stubs.c + src/os-shared-task-init-stubs.c + src/os-shared-timebase-init-stubs.c + src/os-shared-time-init-stubs.c +) + +# The "ut_osapi_shared_stubs" provides stub functions for the +# all other function calls that are declared under os/shared/inc +# header directory. These are the non-public functions that do +# NOT end in either _Init or _Impl suffix, and are normally +# implemented in the shared (upper) layer. +# Unlike the others, these stubs have default handler/hook functions. add_library(ut_osapi_shared_stubs STATIC EXCLUDE_FROM_ALL - src/osapi-shared-common-stubs.c - src/osapi-shared-idmap-stubs.c + src/os-shared-common-stubs.c + src/os-shared-file-stubs.c + src/os-shared-filesys-stubs.c + src/os-shared-globaldefs-stubs.c + src/os-shared-idmap-hooks.c + src/os-shared-idmap-stubs.c + src/os-shared-module-stubs.c + src/os-shared-sockets-stubs.c + src/os-shared-task-stubs.c + src/os-shared-timebase-stubs.c +) + + +# The "ut_osapi_table_stubs" provides stub objects for shared +# table objects used by the implementation layer. These +# are not public. This is only compiled if used. +add_library(ut_osapi_table_stubs STATIC EXCLUDE_FROM_ALL src/osapi-shared-binsem-table-stubs.c src/osapi-shared-console-table-stubs.c + src/osapi-shared-common-stubs.c src/osapi-shared-countsem-table-stubs.c + src/osapi-shared-error-impl-table-stubs.c src/osapi-shared-dir-table-stubs.c src/osapi-shared-filesys-table-stubs.c + src/osapi-shared-idmap-table-stubs.c src/osapi-shared-module-table-stubs.c src/osapi-shared-mutex-table-stubs.c src/osapi-shared-queue-table-stubs.c @@ -124,7 +238,6 @@ add_library(ut_osapi_shared_stubs STATIC EXCLUDE_FROM_ALL src/osapi-shared-task-table-stubs.c src/osapi-shared-timebase-table-stubs.c src/osapi-shared-timecb-table-stubs.c - src/osapi-shared-debug-stubs.c ) add_library(ut_bsp_impl_stubs STATIC EXCLUDE_FROM_ALL diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-binsem-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-binsem-impl-stubs.c new file mode 100644 index 000000000..1db968593 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-binsem-impl-stubs.c @@ -0,0 +1,144 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-binsem header + */ + +#include "os-shared-binsem.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_BinSemCreate_Impl() + * ---------------------------------------------------- + */ +int32 OS_BinSemCreate_Impl(const OS_object_token_t *token, uint32 sem_initial_value, uint32 options) +{ + UT_GenStub_SetupReturnBuffer(OS_BinSemCreate_Impl, int32); + + UT_GenStub_AddParam(OS_BinSemCreate_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_BinSemCreate_Impl, uint32, sem_initial_value); + UT_GenStub_AddParam(OS_BinSemCreate_Impl, uint32, options); + + UT_GenStub_Execute(OS_BinSemCreate_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_BinSemCreate_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_BinSemDelete_Impl() + * ---------------------------------------------------- + */ +int32 OS_BinSemDelete_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_BinSemDelete_Impl, int32); + + UT_GenStub_AddParam(OS_BinSemDelete_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_BinSemDelete_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_BinSemDelete_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_BinSemFlush_Impl() + * ---------------------------------------------------- + */ +int32 OS_BinSemFlush_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_BinSemFlush_Impl, int32); + + UT_GenStub_AddParam(OS_BinSemFlush_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_BinSemFlush_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_BinSemFlush_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_BinSemGetInfo_Impl() + * ---------------------------------------------------- + */ +int32 OS_BinSemGetInfo_Impl(const OS_object_token_t *token, OS_bin_sem_prop_t *bin_prop) +{ + UT_GenStub_SetupReturnBuffer(OS_BinSemGetInfo_Impl, int32); + + UT_GenStub_AddParam(OS_BinSemGetInfo_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_BinSemGetInfo_Impl, OS_bin_sem_prop_t *, bin_prop); + + UT_GenStub_Execute(OS_BinSemGetInfo_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_BinSemGetInfo_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_BinSemGive_Impl() + * ---------------------------------------------------- + */ +int32 OS_BinSemGive_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_BinSemGive_Impl, int32); + + UT_GenStub_AddParam(OS_BinSemGive_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_BinSemGive_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_BinSemGive_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_BinSemTake_Impl() + * ---------------------------------------------------- + */ +int32 OS_BinSemTake_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_BinSemTake_Impl, int32); + + UT_GenStub_AddParam(OS_BinSemTake_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_BinSemTake_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_BinSemTake_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_BinSemTimedWait_Impl() + * ---------------------------------------------------- + */ +int32 OS_BinSemTimedWait_Impl(const OS_object_token_t *token, uint32 msecs) +{ + UT_GenStub_SetupReturnBuffer(OS_BinSemTimedWait_Impl, int32); + + UT_GenStub_AddParam(OS_BinSemTimedWait_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_BinSemTimedWait_Impl, uint32, msecs); + + UT_GenStub_Execute(OS_BinSemTimedWait_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_BinSemTimedWait_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-binsem-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-binsem-init-stubs.c new file mode 100644 index 000000000..9e43aa906 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-binsem-init-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-binsem header + */ + +#include "os-shared-binsem.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_BinSemAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_BinSemAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_BinSemAPI_Init, int32); + + UT_GenStub_Execute(OS_BinSemAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_BinSemAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-clock-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-clock-impl-stubs.c new file mode 100644 index 000000000..98e028211 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-clock-impl-stubs.c @@ -0,0 +1,60 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-clock header + */ + +#include "os-shared-clock.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_GetLocalTime_Impl() + * ---------------------------------------------------- + */ +int32 OS_GetLocalTime_Impl(OS_time_t *time_struct) +{ + UT_GenStub_SetupReturnBuffer(OS_GetLocalTime_Impl, int32); + + UT_GenStub_AddParam(OS_GetLocalTime_Impl, OS_time_t *, time_struct); + + UT_GenStub_Execute(OS_GetLocalTime_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_GetLocalTime_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SetLocalTime_Impl() + * ---------------------------------------------------- + */ +int32 OS_SetLocalTime_Impl(const OS_time_t *time_struct) +{ + UT_GenStub_SetupReturnBuffer(OS_SetLocalTime_Impl, int32); + + UT_GenStub_AddParam(OS_SetLocalTime_Impl, const OS_time_t *, time_struct); + + UT_GenStub_Execute(OS_SetLocalTime_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SetLocalTime_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-common-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-common-impl-stubs.c similarity index 61% rename from src/unit-test-coverage/ut-stubs/src/osapi-common-impl-stubs.c rename to src/unit-test-coverage/ut-stubs/src/os-shared-common-impl-stubs.c index 07edfa887..bc9591309 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-common-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-common-impl-stubs.c @@ -19,34 +19,32 @@ */ /** - * \file osapi-common-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov + * @file * + * Auto-Generated stub implementations for functions defined in os-shared-common header */ -#include -#include -#include -#include - -#include "utstubs.h" - #include "os-shared-common.h" +#include "utgenstub.h" -UT_DEFAULT_STUB(OS_API_Impl_Init, (osal_objtype_t idtype)) - -void OS_IdleLoop_Impl(void) -{ - UT_DEFAULT_IMPL(OS_IdleLoop_Impl); -} - +/* + * ---------------------------------------------------- + * Generated stub function for OS_ApplicationShutdown_Impl() + * ---------------------------------------------------- + */ void OS_ApplicationShutdown_Impl(void) { - UT_DEFAULT_IMPL(OS_ApplicationShutdown_Impl); + + UT_GenStub_Execute(OS_ApplicationShutdown_Impl, Basic, NULL); } -void OS_WaitForStateChange_Impl(osal_objtype_t objtype, uint32 attempts) +/* + * ---------------------------------------------------- + * Generated stub function for OS_IdleLoop_Impl() + * ---------------------------------------------------- + */ +void OS_IdleLoop_Impl(void) { - UT_DEFAULT_IMPL(OS_WaitForStateChange_Impl); + + UT_GenStub_Execute(OS_IdleLoop_Impl, Basic, NULL); } diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-common-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-common-init-stubs.c new file mode 100644 index 000000000..c8746a6d3 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-common-init-stubs.c @@ -0,0 +1,44 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-common header + */ + +#include "os-shared-common.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_API_Impl_Init() + * ---------------------------------------------------- + */ +int32 OS_API_Impl_Init(osal_objtype_t idtype) +{ + UT_GenStub_SetupReturnBuffer(OS_API_Impl_Init, int32); + + UT_GenStub_AddParam(OS_API_Impl_Init, osal_objtype_t, idtype); + + UT_GenStub_Execute(OS_API_Impl_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_API_Impl_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-common-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-common-stubs.c new file mode 100644 index 000000000..488d67cc7 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-common-stubs.c @@ -0,0 +1,46 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-common header + */ + +#include "os-shared-common.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_NotifyEvent() + * ---------------------------------------------------- + */ +int32 OS_NotifyEvent(OS_Event_t event, osal_id_t object_id, void *data) +{ + UT_GenStub_SetupReturnBuffer(OS_NotifyEvent, int32); + + UT_GenStub_AddParam(OS_NotifyEvent, OS_Event_t, event); + UT_GenStub_AddParam(OS_NotifyEvent, osal_id_t, object_id); + UT_GenStub_AddParam(OS_NotifyEvent, void *, data); + + UT_GenStub_Execute(OS_NotifyEvent, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_NotifyEvent, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-console-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-console-impl-stubs.c new file mode 100644 index 000000000..0767427b6 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-console-impl-stubs.c @@ -0,0 +1,56 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-console header + */ + +#include "os-shared-console.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ConsoleCreate_Impl() + * ---------------------------------------------------- + */ +int32 OS_ConsoleCreate_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ConsoleCreate_Impl, int32); + + UT_GenStub_AddParam(OS_ConsoleCreate_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ConsoleCreate_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ConsoleCreate_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ConsoleWakeup_Impl() + * ---------------------------------------------------- + */ +void OS_ConsoleWakeup_Impl(const OS_object_token_t *token) +{ + UT_GenStub_AddParam(OS_ConsoleWakeup_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ConsoleWakeup_Impl, Basic, NULL); +} diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-idmap-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-console-init-stubs.c similarity index 60% rename from src/unit-test-coverage/ut-stubs/src/osapi-idmap-impl-stubs.c rename to src/unit-test-coverage/ut-stubs/src/os-shared-console-init-stubs.c index 7bff71d1e..d1253c95a 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-idmap-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-console-init-stubs.c @@ -19,30 +19,24 @@ */ /** - * \file osapi-idmap-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov + * @file * + * Auto-Generated stub implementations for functions defined in os-shared-console header */ -#include -#include -#include -#include - -#include "utstubs.h" - -#include "os-shared-idmap.h" +#include "os-shared-console.h" +#include "utgenstub.h" /* - * Table locking and unlocking for global objects can be done at the shared code - * layer but the actual implementation is OS-specific + * ---------------------------------------------------- + * Generated stub function for OS_ConsoleAPI_Init() + * ---------------------------------------------------- */ -void OS_Lock_Global_Impl(osal_objtype_t idtype) -{ - UT_DEFAULT_IMPL(OS_Lock_Global_Impl); -} -void OS_Unlock_Global_Impl(osal_objtype_t idtype) +int32 OS_ConsoleAPI_Init(void) { - UT_DEFAULT_IMPL(OS_Unlock_Global_Impl); + UT_GenStub_SetupReturnBuffer(OS_ConsoleAPI_Init, int32); + + UT_GenStub_Execute(OS_ConsoleAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ConsoleAPI_Init, int32); } diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-countsem-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-countsem-impl-stubs.c new file mode 100644 index 000000000..7a5672c9d --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-countsem-impl-stubs.c @@ -0,0 +1,128 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-countsem header + */ + +#include "os-shared-countsem.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_CountSemCreate_Impl() + * ---------------------------------------------------- + */ +int32 OS_CountSemCreate_Impl(const OS_object_token_t *token, uint32 sem_initial_value, uint32 options) +{ + UT_GenStub_SetupReturnBuffer(OS_CountSemCreate_Impl, int32); + + UT_GenStub_AddParam(OS_CountSemCreate_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_CountSemCreate_Impl, uint32, sem_initial_value); + UT_GenStub_AddParam(OS_CountSemCreate_Impl, uint32, options); + + UT_GenStub_Execute(OS_CountSemCreate_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_CountSemCreate_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_CountSemDelete_Impl() + * ---------------------------------------------------- + */ +int32 OS_CountSemDelete_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_CountSemDelete_Impl, int32); + + UT_GenStub_AddParam(OS_CountSemDelete_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_CountSemDelete_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_CountSemDelete_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_CountSemGetInfo_Impl() + * ---------------------------------------------------- + */ +int32 OS_CountSemGetInfo_Impl(const OS_object_token_t *token, OS_count_sem_prop_t *count_prop) +{ + UT_GenStub_SetupReturnBuffer(OS_CountSemGetInfo_Impl, int32); + + UT_GenStub_AddParam(OS_CountSemGetInfo_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_CountSemGetInfo_Impl, OS_count_sem_prop_t *, count_prop); + + UT_GenStub_Execute(OS_CountSemGetInfo_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_CountSemGetInfo_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_CountSemGive_Impl() + * ---------------------------------------------------- + */ +int32 OS_CountSemGive_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_CountSemGive_Impl, int32); + + UT_GenStub_AddParam(OS_CountSemGive_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_CountSemGive_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_CountSemGive_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_CountSemTake_Impl() + * ---------------------------------------------------- + */ +int32 OS_CountSemTake_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_CountSemTake_Impl, int32); + + UT_GenStub_AddParam(OS_CountSemTake_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_CountSemTake_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_CountSemTake_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_CountSemTimedWait_Impl() + * ---------------------------------------------------- + */ +int32 OS_CountSemTimedWait_Impl(const OS_object_token_t *token, uint32 msecs) +{ + UT_GenStub_SetupReturnBuffer(OS_CountSemTimedWait_Impl, int32); + + UT_GenStub_AddParam(OS_CountSemTimedWait_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_CountSemTimedWait_Impl, uint32, msecs); + + UT_GenStub_Execute(OS_CountSemTimedWait_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_CountSemTimedWait_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-countsem-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-countsem-init-stubs.c new file mode 100644 index 000000000..29b52291f --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-countsem-init-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-countsem header + */ + +#include "os-shared-countsem.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_CountSemAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_CountSemAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_CountSemAPI_Init, int32); + + UT_GenStub_Execute(OS_CountSemAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_CountSemAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-dir-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-dir-impl-stubs.c new file mode 100644 index 000000000..b0f83640b --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-dir-impl-stubs.c @@ -0,0 +1,127 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-dir header + */ + +#include "os-shared-dir.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_DirClose_Impl() + * ---------------------------------------------------- + */ +int32 OS_DirClose_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_DirClose_Impl, int32); + + UT_GenStub_AddParam(OS_DirClose_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_DirClose_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_DirClose_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_DirCreate_Impl() + * ---------------------------------------------------- + */ +int32 OS_DirCreate_Impl(const char *local_path, uint32 access) +{ + UT_GenStub_SetupReturnBuffer(OS_DirCreate_Impl, int32); + + UT_GenStub_AddParam(OS_DirCreate_Impl, const char *, local_path); + UT_GenStub_AddParam(OS_DirCreate_Impl, uint32, access); + + UT_GenStub_Execute(OS_DirCreate_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_DirCreate_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_DirOpen_Impl() + * ---------------------------------------------------- + */ +int32 OS_DirOpen_Impl(const OS_object_token_t *token, const char *local_path) +{ + UT_GenStub_SetupReturnBuffer(OS_DirOpen_Impl, int32); + + UT_GenStub_AddParam(OS_DirOpen_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_DirOpen_Impl, const char *, local_path); + + UT_GenStub_Execute(OS_DirOpen_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_DirOpen_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_DirRead_Impl() + * ---------------------------------------------------- + */ +int32 OS_DirRead_Impl(const OS_object_token_t *token, os_dirent_t *dirent) +{ + UT_GenStub_SetupReturnBuffer(OS_DirRead_Impl, int32); + + UT_GenStub_AddParam(OS_DirRead_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_DirRead_Impl, os_dirent_t *, dirent); + + UT_GenStub_Execute(OS_DirRead_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_DirRead_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_DirRemove_Impl() + * ---------------------------------------------------- + */ +int32 OS_DirRemove_Impl(const char *local_path) +{ + UT_GenStub_SetupReturnBuffer(OS_DirRemove_Impl, int32); + + UT_GenStub_AddParam(OS_DirRemove_Impl, const char *, local_path); + + UT_GenStub_Execute(OS_DirRemove_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_DirRemove_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_DirRewind_Impl() + * ---------------------------------------------------- + */ +int32 OS_DirRewind_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_DirRewind_Impl, int32); + + UT_GenStub_AddParam(OS_DirRewind_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_DirRewind_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_DirRewind_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-console-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-dir-init-stubs.c similarity index 62% rename from src/unit-test-coverage/ut-stubs/src/osapi-console-impl-stubs.c rename to src/unit-test-coverage/ut-stubs/src/os-shared-dir-init-stubs.c index 99dc96511..358408013 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-console-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-dir-init-stubs.c @@ -19,29 +19,24 @@ */ /** - * \file osapi-console-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov + * @file * + * Auto-Generated stub implementations for functions defined in os-shared-dir header */ -#include -#include -#include -#include - -#include "utstubs.h" - -#include "os-shared-printf.h" +#include "os-shared-dir.h" +#include "utgenstub.h" /* -** Console output API (printf) -*/ -void OS_ConsoleWakeup_Impl(const OS_object_token_t *token) -{ - UT_DEFAULT_IMPL(OS_ConsoleWakeup_Impl); -} -int32 OS_ConsoleCreate_Impl(const OS_object_token_t *token) + * ---------------------------------------------------- + * Generated stub function for OS_DirAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_DirAPI_Init(void) { - return UT_DEFAULT_IMPL(OS_ConsoleCreate_Impl); + UT_GenStub_SetupReturnBuffer(OS_DirAPI_Init, int32); + + UT_GenStub_Execute(OS_DirAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_DirAPI_Init, int32); } diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-hooks.c b/src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-hooks.c new file mode 100644 index 000000000..ec4f1cd23 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-hooks.c @@ -0,0 +1,71 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * \file osapi-utstub-idmap.c + * \author joseph.p.hickey@nasa.gov + * + * Stub implementations for the functions defined in the OSAL API + * + * The stub implementation can be used for unit testing applications built + * on top of OSAL. The stubs do not do any real function, but allow + * the return code to be crafted such that error paths in the application + * can be executed. + */ + +#include "osapi-file.h" /* OSAL public API for this subsystem */ +#include "os-shared-file.h" +#include "utstubs.h" + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_GenericRead_Impl' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_GenericRead_Impl(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + void * buffer = UT_Hook_GetArgValueByName(Context, "buffer", void *); + size_t nbytes = UT_Hook_GetArgValueByName(Context, "nbytes", size_t); + int32 status; + + if (!UT_Stub_GetInt32StatusCode(Context, &status)) + { + status = UT_Stub_CopyToLocal(UT_KEY(OS_GenericRead_Impl), buffer, nbytes); + UT_Stub_SetReturnValue(FuncKey, status); + } +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_GenericWrite_Impl' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_GenericWrite_Impl(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + const void *buffer = UT_Hook_GetArgValueByName(Context, "buffer", const void *); + size_t nbytes = UT_Hook_GetArgValueByName(Context, "nbytes", size_t); + int32 status; + + if (!UT_Stub_GetInt32StatusCode(Context, &status)) + { + status = UT_Stub_CopyFromLocal(UT_KEY(OS_GenericWrite_Impl), buffer, nbytes); + UT_Stub_SetReturnValue(FuncKey, status); + } +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-stubs.c new file mode 100644 index 000000000..baccbafd5 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-file-impl-stubs.c @@ -0,0 +1,206 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-file header + */ + +#include "os-shared-file.h" +#include "utgenstub.h" + +extern void UT_DefaultHandler_OS_GenericRead_Impl(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_GenericWrite_Impl(void *, UT_EntryKey_t, const UT_StubContext_t *); + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileChmod_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileChmod_Impl(const char *local_path, uint32 access) +{ + UT_GenStub_SetupReturnBuffer(OS_FileChmod_Impl, int32); + + UT_GenStub_AddParam(OS_FileChmod_Impl, const char *, local_path); + UT_GenStub_AddParam(OS_FileChmod_Impl, uint32, access); + + UT_GenStub_Execute(OS_FileChmod_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileChmod_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileOpen_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileOpen_Impl(const OS_object_token_t *token, const char *local_path, int32 flags, int32 access) +{ + UT_GenStub_SetupReturnBuffer(OS_FileOpen_Impl, int32); + + UT_GenStub_AddParam(OS_FileOpen_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_FileOpen_Impl, const char *, local_path); + UT_GenStub_AddParam(OS_FileOpen_Impl, int32, flags); + UT_GenStub_AddParam(OS_FileOpen_Impl, int32, access); + + UT_GenStub_Execute(OS_FileOpen_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileOpen_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileRemove_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileRemove_Impl(const char *local_path) +{ + UT_GenStub_SetupReturnBuffer(OS_FileRemove_Impl, int32); + + UT_GenStub_AddParam(OS_FileRemove_Impl, const char *, local_path); + + UT_GenStub_Execute(OS_FileRemove_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileRemove_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileRename_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileRename_Impl(const char *old_path, const char *new_path) +{ + UT_GenStub_SetupReturnBuffer(OS_FileRename_Impl, int32); + + UT_GenStub_AddParam(OS_FileRename_Impl, const char *, old_path); + UT_GenStub_AddParam(OS_FileRename_Impl, const char *, new_path); + + UT_GenStub_Execute(OS_FileRename_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileRename_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileStat_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileStat_Impl(const char *local_path, os_fstat_t *filestat) +{ + UT_GenStub_SetupReturnBuffer(OS_FileStat_Impl, int32); + + UT_GenStub_AddParam(OS_FileStat_Impl, const char *, local_path); + UT_GenStub_AddParam(OS_FileStat_Impl, os_fstat_t *, filestat); + + UT_GenStub_Execute(OS_FileStat_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileStat_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_GenericClose_Impl() + * ---------------------------------------------------- + */ +int32 OS_GenericClose_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_GenericClose_Impl, int32); + + UT_GenStub_AddParam(OS_GenericClose_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_GenericClose_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_GenericClose_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_GenericRead_Impl() + * ---------------------------------------------------- + */ +int32 OS_GenericRead_Impl(const OS_object_token_t *token, void *buffer, size_t nbytes, int32 timeout) +{ + UT_GenStub_SetupReturnBuffer(OS_GenericRead_Impl, int32); + + UT_GenStub_AddParam(OS_GenericRead_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_GenericRead_Impl, void *, buffer); + UT_GenStub_AddParam(OS_GenericRead_Impl, size_t, nbytes); + UT_GenStub_AddParam(OS_GenericRead_Impl, int32, timeout); + + UT_GenStub_Execute(OS_GenericRead_Impl, Basic, UT_DefaultHandler_OS_GenericRead_Impl); + + return UT_GenStub_GetReturnValue(OS_GenericRead_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_GenericSeek_Impl() + * ---------------------------------------------------- + */ +int32 OS_GenericSeek_Impl(const OS_object_token_t *token, int32 offset, uint32 whence) +{ + UT_GenStub_SetupReturnBuffer(OS_GenericSeek_Impl, int32); + + UT_GenStub_AddParam(OS_GenericSeek_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_GenericSeek_Impl, int32, offset); + UT_GenStub_AddParam(OS_GenericSeek_Impl, uint32, whence); + + UT_GenStub_Execute(OS_GenericSeek_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_GenericSeek_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_GenericWrite_Impl() + * ---------------------------------------------------- + */ +int32 OS_GenericWrite_Impl(const OS_object_token_t *token, const void *buffer, size_t nbytes, int32 timeout) +{ + UT_GenStub_SetupReturnBuffer(OS_GenericWrite_Impl, int32); + + UT_GenStub_AddParam(OS_GenericWrite_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_GenericWrite_Impl, const void *, buffer); + UT_GenStub_AddParam(OS_GenericWrite_Impl, size_t, nbytes); + UT_GenStub_AddParam(OS_GenericWrite_Impl, int32, timeout); + + UT_GenStub_Execute(OS_GenericWrite_Impl, Basic, UT_DefaultHandler_OS_GenericWrite_Impl); + + return UT_GenStub_GetReturnValue(OS_GenericWrite_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ShellOutputToFile_Impl() + * ---------------------------------------------------- + */ +int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd) +{ + UT_GenStub_SetupReturnBuffer(OS_ShellOutputToFile_Impl, int32); + + UT_GenStub_AddParam(OS_ShellOutputToFile_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_ShellOutputToFile_Impl, const char *, Cmd); + + UT_GenStub_Execute(OS_ShellOutputToFile_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ShellOutputToFile_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-shared-debug-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-file-init-stubs.c similarity index 61% rename from src/unit-test-coverage/ut-stubs/src/osapi-shared-debug-stubs.c rename to src/unit-test-coverage/ut-stubs/src/os-shared-file-init-stubs.c index d2973e5de..0e9c6e08b 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-shared-debug-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-file-init-stubs.c @@ -19,17 +19,24 @@ */ /** - * \file osapi-shared-debug-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov + * @file * + * Auto-Generated stub implementations for functions defined in os-shared-file header */ -#include "os-shared-globaldefs.h" -/***************************************************************************** - * - * Stub function for OS_DebugPrintf() - * This is only relevant when building OSAL with OSAL_CONFIG_DEBUG_PRINTF enabled - * - *****************************************************************************/ -void OS_DebugPrintf(uint32 Level, const char *Func, uint32 Line, const char *Format, ...) {} +#include "os-shared-file.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_FileAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_FileAPI_Init, int32); + + UT_GenStub_Execute(OS_FileAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-file-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-file-stubs.c new file mode 100644 index 000000000..d5dfa49a0 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-file-stubs.c @@ -0,0 +1,45 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-file header + */ + +#include "os-shared-file.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileIteratorClose() + * ---------------------------------------------------- + */ +int32 OS_FileIteratorClose(osal_id_t filedes, void *arg) +{ + UT_GenStub_SetupReturnBuffer(OS_FileIteratorClose, int32); + + UT_GenStub_AddParam(OS_FileIteratorClose, osal_id_t, filedes); + UT_GenStub_AddParam(OS_FileIteratorClose, void *, arg); + + UT_GenStub_Execute(OS_FileIteratorClose, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileIteratorClose, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-filesys-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-impl-hooks.c similarity index 54% rename from src/unit-test-coverage/ut-stubs/src/osapi-filesys-impl-stubs.c rename to src/unit-test-coverage/ut-stubs/src/os-shared-filesys-impl-hooks.c index 0dd5577e0..b49982cf7 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-filesys-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-impl-hooks.c @@ -19,39 +19,36 @@ */ /** - * \file osapi-filesys-impl-stubs.c - * \ingroup ut-stubs + * \file osapi-utstub-idmap.c * \author joseph.p.hickey@nasa.gov * + * Stub implementations for the functions defined in the OSAL API + * + * The stub implementation can be used for unit testing applications built + * on top of OSAL. The stubs do not do any real function, but allow + * the return code to be crafted such that error paths in the application + * can be executed. */ -#include -#include -#include -#include - -#include "utstubs.h" +#include "osapi-filesys.h" /* OSAL public API for this subsystem */ #include "os-shared-filesys.h" +#include "utstubs.h" /* - * File system abstraction layer + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_FileSysStatVolume_Impl' stub + * ----------------------------------------------------------------- */ -UT_DEFAULT_STUB(OS_FileSysStartVolume_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_FileSysStopVolume_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_FileSysFormatVolume_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_FileSysCheckVolume_Impl, (const OS_object_token_t *token, bool repair)) -UT_DEFAULT_STUB(OS_FileSysMountVolume_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_FileSysUnmountVolume_Impl, (const OS_object_token_t *token)) - -int32 OS_FileSysStatVolume_Impl(const OS_object_token_t *token, OS_statvfs_t *result) +void UT_DefaultHandler_OS_FileSysStatVolume_Impl(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { - int32 Status = UT_DEFAULT_IMPL(OS_FileSysStatVolume_Impl); + OS_statvfs_t *result = UT_Hook_GetArgValueByName(Context, "result", OS_statvfs_t *); + int32 status; + + UT_Stub_GetInt32StatusCode(Context, &status); - if (Status == OS_SUCCESS && + if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_FileSysStatVolume_Impl), result, sizeof(*result)) < sizeof(*result)) { memset(result, 0, sizeof(*result)); } - - return Status; } diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-impl-stubs.c new file mode 100644 index 000000000..90be32598 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-impl-stubs.c @@ -0,0 +1,144 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-filesys header + */ + +#include "os-shared-filesys.h" +#include "utgenstub.h" + +extern void UT_DefaultHandler_OS_FileSysStatVolume_Impl(void *, UT_EntryKey_t, const UT_StubContext_t *); + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileSysCheckVolume_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileSysCheckVolume_Impl(const OS_object_token_t *token, bool repair) +{ + UT_GenStub_SetupReturnBuffer(OS_FileSysCheckVolume_Impl, int32); + + UT_GenStub_AddParam(OS_FileSysCheckVolume_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_FileSysCheckVolume_Impl, bool, repair); + + UT_GenStub_Execute(OS_FileSysCheckVolume_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileSysCheckVolume_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileSysFormatVolume_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileSysFormatVolume_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_FileSysFormatVolume_Impl, int32); + + UT_GenStub_AddParam(OS_FileSysFormatVolume_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_FileSysFormatVolume_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileSysFormatVolume_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileSysMountVolume_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileSysMountVolume_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_FileSysMountVolume_Impl, int32); + + UT_GenStub_AddParam(OS_FileSysMountVolume_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_FileSysMountVolume_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileSysMountVolume_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileSysStartVolume_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileSysStartVolume_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_FileSysStartVolume_Impl, int32); + + UT_GenStub_AddParam(OS_FileSysStartVolume_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_FileSysStartVolume_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileSysStartVolume_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileSysStatVolume_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileSysStatVolume_Impl(const OS_object_token_t *token, OS_statvfs_t *result) +{ + UT_GenStub_SetupReturnBuffer(OS_FileSysStatVolume_Impl, int32); + + UT_GenStub_AddParam(OS_FileSysStatVolume_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_FileSysStatVolume_Impl, OS_statvfs_t *, result); + + UT_GenStub_Execute(OS_FileSysStatVolume_Impl, Basic, UT_DefaultHandler_OS_FileSysStatVolume_Impl); + + return UT_GenStub_GetReturnValue(OS_FileSysStatVolume_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileSysStopVolume_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileSysStopVolume_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_FileSysStopVolume_Impl, int32); + + UT_GenStub_AddParam(OS_FileSysStopVolume_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_FileSysStopVolume_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileSysStopVolume_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileSysUnmountVolume_Impl() + * ---------------------------------------------------- + */ +int32 OS_FileSysUnmountVolume_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_FileSysUnmountVolume_Impl, int32); + + UT_GenStub_AddParam(OS_FileSysUnmountVolume_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_FileSysUnmountVolume_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileSysUnmountVolume_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-init-stubs.c new file mode 100644 index 000000000..7841b6e5b --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-init-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-filesys header + */ + +#include "os-shared-filesys.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileSysAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_FileSysAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_FileSysAPI_Init, int32); + + UT_GenStub_Execute(OS_FileSysAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileSysAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-stubs.c new file mode 100644 index 000000000..17fe72be0 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-filesys-stubs.c @@ -0,0 +1,86 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-filesys header + */ + +#include "os-shared-filesys.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileSysFilterFree() + * ---------------------------------------------------- + */ +bool OS_FileSysFilterFree(void *ref, const OS_object_token_t *token, const OS_common_record_t *obj) +{ + UT_GenStub_SetupReturnBuffer(OS_FileSysFilterFree, bool); + + UT_GenStub_AddParam(OS_FileSysFilterFree, void *, ref); + UT_GenStub_AddParam(OS_FileSysFilterFree, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_FileSysFilterFree, const OS_common_record_t *, obj); + + UT_GenStub_Execute(OS_FileSysFilterFree, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileSysFilterFree, bool); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileSys_FindVirtMountPoint() + * ---------------------------------------------------- + */ +bool OS_FileSys_FindVirtMountPoint(void *ref, const OS_object_token_t *token, const OS_common_record_t *obj) +{ + UT_GenStub_SetupReturnBuffer(OS_FileSys_FindVirtMountPoint, bool); + + UT_GenStub_AddParam(OS_FileSys_FindVirtMountPoint, void *, ref); + UT_GenStub_AddParam(OS_FileSys_FindVirtMountPoint, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_FileSys_FindVirtMountPoint, const OS_common_record_t *, obj); + + UT_GenStub_Execute(OS_FileSys_FindVirtMountPoint, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileSys_FindVirtMountPoint, bool); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_FileSys_Initialize() + * ---------------------------------------------------- + */ +int32 OS_FileSys_Initialize(char *address, const char *fsdevname, const char *fsvolname, size_t blocksize, + osal_blockcount_t numblocks, bool should_format) +{ + UT_GenStub_SetupReturnBuffer(OS_FileSys_Initialize, int32); + + UT_GenStub_AddParam(OS_FileSys_Initialize, char *, address); + UT_GenStub_AddParam(OS_FileSys_Initialize, const char *, fsdevname); + UT_GenStub_AddParam(OS_FileSys_Initialize, const char *, fsvolname); + UT_GenStub_AddParam(OS_FileSys_Initialize, size_t, blocksize); + UT_GenStub_AddParam(OS_FileSys_Initialize, osal_blockcount_t, numblocks); + UT_GenStub_AddParam(OS_FileSys_Initialize, bool, should_format); + + UT_GenStub_Execute(OS_FileSys_Initialize, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_FileSys_Initialize, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-globaldefs-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-globaldefs-stubs.c new file mode 100644 index 000000000..92cfe839e --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-globaldefs-stubs.c @@ -0,0 +1,49 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-globaldefs header + */ + +#include + +#include "os-shared-globaldefs.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_DebugPrintf() + * ---------------------------------------------------- + */ +void OS_DebugPrintf(uint32 Level, const char *Func, uint32 Line, const char *Format, ...) +{ + va_list UtStub_ArgList; + + UT_GenStub_AddParam(OS_DebugPrintf, uint32, Level); + UT_GenStub_AddParam(OS_DebugPrintf, const char *, Func); + UT_GenStub_AddParam(OS_DebugPrintf, uint32, Line); + UT_GenStub_AddParam(OS_DebugPrintf, const char *, Format); + + va_start(UtStub_ArgList, Format); + UT_GenStub_Execute(OS_DebugPrintf, Va, NULL, UtStub_ArgList); + va_end(UtStub_ArgList); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-heap-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-heap-impl-stubs.c new file mode 100644 index 000000000..024fbcca9 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-heap-impl-stubs.c @@ -0,0 +1,44 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-heap header + */ + +#include "os-shared-heap.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_HeapGetInfo_Impl() + * ---------------------------------------------------- + */ +int32 OS_HeapGetInfo_Impl(OS_heap_prop_t *heap_prop) +{ + UT_GenStub_SetupReturnBuffer(OS_HeapGetInfo_Impl, int32); + + UT_GenStub_AddParam(OS_HeapGetInfo_Impl, OS_heap_prop_t *, heap_prop); + + UT_GenStub_Execute(OS_HeapGetInfo_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_HeapGetInfo_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-idmap-hooks.c b/src/unit-test-coverage/ut-stubs/src/os-shared-idmap-hooks.c new file mode 100644 index 000000000..d6c91b80b --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-idmap-hooks.c @@ -0,0 +1,402 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * \file osapi-utstub-idmap.c + * \author joseph.p.hickey@nasa.gov + * + * Stub implementations for the functions defined in the OSAL API + * + * The stub implementation can be used for unit testing applications built + * on top of OSAL. The stubs do not do any real function, but allow + * the return code to be crafted such that error paths in the application + * can be executed. + * + * NOTE: The Object ID manipulation calls would not be called by applications. + * However stubs are still defined in order to support things such as + * coverage testing of the low-level implementation. This set of stubs + * is implemented separately here as it is only needed when coverage testing + * OSAL itself (not for coverage testing other units). + */ + +#include "osapi-idmap.h" /* OSAL public API for this subsystem */ +#include "os-shared-idmap.h" +#include "utstubs.h" + +#define OSAL_MAX_VALID_PER_TYPE 16 + +/* + * Note that fabricates IDs that are compatible with the IDs from the other (public) API stubs + */ +static void UT_ObjIdCompose(uint32 indx, osal_objtype_t objtype, osal_id_t *id) +{ + *id = OS_ObjectIdFromInteger((unsigned long)indx | ((0x4000UL | objtype) << 16)); +} + +/* + * UT Helper function to create a fake object lock token + */ +static void UT_TokenCompose(uint32 lock_mode, uint32 indx, osal_objtype_t objtype, OS_object_token_t *token) +{ + token->lock_mode = lock_mode; + token->obj_type = objtype; + token->obj_idx = indx; + UT_ObjIdCompose(indx, objtype, &token->obj_id); +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_GetMaxForObjectType' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_GetMaxForObjectType(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + osal_objtype_t idtype = UT_Hook_GetArgValueByName(Context, "idtype", osal_objtype_t); + int32 status; + uint32 max; + + if (UT_Stub_GetInt32StatusCode(Context, &status)) + { + /* interpret the registered status code as a max */ + max = status; + } + else if (idtype > OS_OBJECT_TYPE_UNDEFINED && idtype < OS_OBJECT_TYPE_USER) + { + max = OSAL_MAX_VALID_PER_TYPE; + } + else + { + max = 0; + } + + UT_Stub_SetReturnValue(FuncKey, max); +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_GetBaseForObjectType' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_GetBaseForObjectType(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + osal_objtype_t idtype = UT_Hook_GetArgValueByName(Context, "idtype", osal_objtype_t); + int32 status; + uint32 base; + + if (UT_Stub_GetInt32StatusCode(Context, &status)) + { + /* interpret the registered status code as a max */ + base = status; + } + else if (idtype > OS_OBJECT_TYPE_UNDEFINED && idtype < OS_OBJECT_TYPE_USER) + { + base = OSAL_MAX_VALID_PER_TYPE * (idtype - 1); + } + else + { + base = 0; + } + + UT_Stub_SetReturnValue(FuncKey, base); +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdGlobalFromToken' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdGlobalFromToken(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + static OS_common_record_t fake_record; + int32 status; + OS_common_record_t * recptr = &fake_record; + + UT_Stub_GetInt32StatusCode(Context, &status); + + if (status == 0 && + UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdGlobalFromToken), &recptr, sizeof(recptr)) < sizeof(recptr)) + { + /* This function should never return null */ + recptr = &fake_record; + } + + UT_Stub_SetReturnValue(FuncKey, recptr); +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdFinalizeNew' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdFinalizeNew(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + int32 operation_status = UT_Hook_GetArgValueByName(Context, "operation_status", int32); + OS_object_token_t *token = UT_Hook_GetArgValueByName(Context, "token", OS_object_token_t *); + osal_id_t * outid = UT_Hook_GetArgValueByName(Context, "outid", osal_id_t *); + int32 Status; + + if (!UT_Stub_GetInt32StatusCode(Context, &Status)) + { + /* pass through the argument status unless overridden */ + Status = operation_status; + } + + /* need to actually write something to the output buffer */ + if (Status == OS_SUCCESS && token != NULL && outid != NULL && + UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdFinalizeNew), outid, sizeof(*outid)) < sizeof(*outid)) + { + *outid = token->obj_id; + } + + UT_Stub_SetReturnValue(FuncKey, Status); +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdFinalizeDelete' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdFinalizeDelete(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + int32 operation_status = UT_Hook_GetArgValueByName(Context, "operation_status", int32); + int32 Status; + + if (!UT_Stub_GetInt32StatusCode(Context, &Status)) + { + /* pass through the argument status unless overridden */ + Status = operation_status; + } + + UT_Stub_SetReturnValue(FuncKey, Status); +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdGetBySearch' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdGetBySearch(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + OS_lock_mode_t lock_mode = UT_Hook_GetArgValueByName(Context, "lock_mode", OS_lock_mode_t); + osal_objtype_t idtype = UT_Hook_GetArgValueByName(Context, "idtype", osal_objtype_t); + OS_object_token_t *token = UT_Hook_GetArgValueByName(Context, "token", OS_object_token_t *); + int32 Status; + + /* by default this stub should return NAME_NOT_FOUND + * unless the test case has set up otherwise. To set + * up a success response, just register a buffer for + * the function + */ + UT_Stub_GetInt32StatusCode(Context, &Status); + + if (Status == OS_SUCCESS && + UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdGetBySearch), token, sizeof(*token)) < sizeof(*token)) + { + UT_TokenCompose(lock_mode, 1, idtype, token); + } +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdTransactionInit' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdTransactionInit(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + OS_object_token_t *token = UT_Hook_GetArgValueByName(Context, "token", OS_object_token_t *); + int32 Status; + + UT_Stub_GetInt32StatusCode(Context, &Status); + + if (Status == OS_SUCCESS && + UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdTransactionInit), token, sizeof(*token)) < sizeof(*token)) + { + memset(&token, 0, sizeof(token)); + } +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdFindByName' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdFindByName(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + osal_objtype_t idtype = UT_Hook_GetArgValueByName(Context, "idtype", osal_objtype_t); + osal_id_t * object_id = UT_Hook_GetArgValueByName(Context, "object_id", osal_id_t *); + int32 Status; + + /* by default this stub should return NAME_NOT_FOUND + * unless the test case has set up otherwise. To set + * up a success response, just register a buffer for + * the function + */ + if (!UT_Stub_GetInt32StatusCode(Context, &Status)) + { + Status = OS_ERR_NAME_NOT_FOUND; + } + + if (Status == OS_SUCCESS && + UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdFindByName), object_id, sizeof(*object_id)) < sizeof(*object_id)) + { + UT_ObjIdCompose(1, idtype, object_id); + } + + UT_Stub_SetReturnValue(FuncKey, Status); +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdGetByName' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdGetByName(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + OS_lock_mode_t lock_mode = UT_Hook_GetArgValueByName(Context, "lock_mode", OS_lock_mode_t); + osal_objtype_t idtype = UT_Hook_GetArgValueByName(Context, "idtype", osal_objtype_t); + OS_object_token_t *token = UT_Hook_GetArgValueByName(Context, "token", OS_object_token_t *); + int32 Status; + + UT_Stub_GetInt32StatusCode(Context, &Status); + + if (Status == OS_SUCCESS && + UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdGetByName), token, sizeof(*token)) < sizeof(*token)) + { + UT_TokenCompose(lock_mode, 1, idtype, token); + } +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdGetById' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdGetById(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + OS_lock_mode_t lock_mode = UT_Hook_GetArgValueByName(Context, "lock_mode", OS_lock_mode_t); + osal_objtype_t idtype = UT_Hook_GetArgValueByName(Context, "idtype", osal_objtype_t); + osal_id_t id = UT_Hook_GetArgValueByName(Context, "id", osal_id_t); + OS_object_token_t *token = UT_Hook_GetArgValueByName(Context, "token", OS_object_token_t *); + int32 Status; + + UT_Stub_GetInt32StatusCode(Context, &Status); + + if (Status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdGetById), token, sizeof(*token)) < sizeof(*token)) + { + UT_TokenCompose(lock_mode, OS_ObjectIdToInteger(id) & 0xFFFF, idtype, token); + } +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdTransferToken' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdTransferToken(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + OS_object_token_t *token_from = UT_Hook_GetArgValueByName(Context, "token_from", OS_object_token_t *); + OS_object_token_t *token_to = UT_Hook_GetArgValueByName(Context, "token_to", OS_object_token_t *); + int32 Status; + + UT_Stub_GetInt32StatusCode(Context, &Status); + + if (Status == OS_SUCCESS && + UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdTransferToken), token_to, sizeof(*token_to)) < sizeof(*token_to)) + { + /* just copy it if nothing specified */ + *token_to = *token_from; + } +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdAllocateNew' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdAllocateNew(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + osal_objtype_t idtype = UT_Hook_GetArgValueByName(Context, "idtype", osal_objtype_t); + OS_object_token_t *token = UT_Hook_GetArgValueByName(Context, "token", OS_object_token_t *); + int32 Status; + + UT_Stub_GetInt32StatusCode(Context, &Status); + + if (Status == OS_SUCCESS && + UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdAllocateNew), token, sizeof(*token)) < sizeof(*token)) + { + UT_TokenCompose(OS_LOCK_MODE_GLOBAL, UT_GetStubCount(UT_KEY(OS_ObjectIdAllocateNew)), idtype, token); + } +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdIteratorInit' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdIteratorInit(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + OS_object_iter_t *iter = UT_Hook_GetArgValueByName(Context, "iter", OS_object_iter_t *); + + if (!UT_Stub_GetInt32StatusCode(Context, NULL) && + UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdIteratorGetNext), iter, sizeof(*iter)) < sizeof(*iter)) + { + memset(iter, 0, sizeof(*iter)); + } +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdIterateActive' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdIterateActive(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + OS_object_iter_t *iter = UT_Hook_GetArgValueByName(Context, "iter", OS_object_iter_t *); + + if (!UT_Stub_GetInt32StatusCode(Context, NULL) && + UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdIterateActive), iter, sizeof(*iter)) < sizeof(*iter)) + { + memset(iter, 0, sizeof(*iter)); + } +} + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_ObjectIdIteratorGetNext' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_ObjectIdIteratorGetNext(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + OS_object_iter_t *iter = UT_Hook_GetArgValueByName(Context, "iter", OS_object_iter_t *); + bool ReturnCode; + int32 Status; + + if (UT_Stub_GetInt32StatusCode(Context, &Status)) + { + ReturnCode = Status; + } + else + { + /* if test case has registered something, return true, otherwise return false */ + ReturnCode = (UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdIteratorGetNext), &iter->token, sizeof(iter->token)) == + sizeof(iter->token)); + } + UT_Stub_SetReturnValue(FuncKey, ReturnCode); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-idmap-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-idmap-impl-stubs.c new file mode 100644 index 000000000..92a6e007a --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-idmap-impl-stubs.c @@ -0,0 +1,65 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-idmap header + */ + +#include "os-shared-idmap.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_Lock_Global_Impl() + * ---------------------------------------------------- + */ +void OS_Lock_Global_Impl(osal_objtype_t idtype) +{ + UT_GenStub_AddParam(OS_Lock_Global_Impl, osal_objtype_t, idtype); + + UT_GenStub_Execute(OS_Lock_Global_Impl, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_Unlock_Global_Impl() + * ---------------------------------------------------- + */ +void OS_Unlock_Global_Impl(osal_objtype_t idtype) +{ + UT_GenStub_AddParam(OS_Unlock_Global_Impl, osal_objtype_t, idtype); + + UT_GenStub_Execute(OS_Unlock_Global_Impl, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_WaitForStateChange_Impl() + * ---------------------------------------------------- + */ +void OS_WaitForStateChange_Impl(osal_objtype_t objtype, uint32 attempts) +{ + UT_GenStub_AddParam(OS_WaitForStateChange_Impl, osal_objtype_t, objtype); + UT_GenStub_AddParam(OS_WaitForStateChange_Impl, uint32, attempts); + + UT_GenStub_Execute(OS_WaitForStateChange_Impl, Basic, NULL); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-idmap-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-idmap-stubs.c new file mode 100644 index 000000000..2d371a1bb --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-idmap-stubs.c @@ -0,0 +1,509 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-idmap header + */ + +#include "os-shared-idmap.h" +#include "utgenstub.h" + +extern void UT_DefaultHandler_OS_GetBaseForObjectType(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_GetMaxForObjectType(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdAllocateNew(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdFinalizeDelete(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdFinalizeNew(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdFindByName(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdGetById(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdGetByName(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdGetBySearch(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdGlobalFromToken(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdIterateActive(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdIteratorGetNext(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdIteratorInit(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdTransactionInit(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_OS_ObjectIdTransferToken(void *, UT_EntryKey_t, const UT_StubContext_t *); + +/* + * ---------------------------------------------------- + * Generated stub function for OS_GetBaseForObjectType() + * ---------------------------------------------------- + */ +uint32 OS_GetBaseForObjectType(osal_objtype_t idtype) +{ + UT_GenStub_SetupReturnBuffer(OS_GetBaseForObjectType, uint32); + + UT_GenStub_AddParam(OS_GetBaseForObjectType, osal_objtype_t, idtype); + + UT_GenStub_Execute(OS_GetBaseForObjectType, Basic, UT_DefaultHandler_OS_GetBaseForObjectType); + + return UT_GenStub_GetReturnValue(OS_GetBaseForObjectType, uint32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_GetMaxForObjectType() + * ---------------------------------------------------- + */ +uint32 OS_GetMaxForObjectType(osal_objtype_t idtype) +{ + UT_GenStub_SetupReturnBuffer(OS_GetMaxForObjectType, uint32); + + UT_GenStub_AddParam(OS_GetMaxForObjectType, osal_objtype_t, idtype); + + UT_GenStub_Execute(OS_GetMaxForObjectType, Basic, UT_DefaultHandler_OS_GetMaxForObjectType); + + return UT_GenStub_GetReturnValue(OS_GetMaxForObjectType, uint32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_Lock_Global() + * ---------------------------------------------------- + */ +void OS_Lock_Global(OS_object_token_t *token) +{ + UT_GenStub_AddParam(OS_Lock_Global, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_Lock_Global, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectFilterActive() + * ---------------------------------------------------- + */ +bool OS_ObjectFilterActive(void *ref, const OS_object_token_t *token, const OS_common_record_t *obj) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectFilterActive, bool); + + UT_GenStub_AddParam(OS_ObjectFilterActive, void *, ref); + UT_GenStub_AddParam(OS_ObjectFilterActive, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_ObjectFilterActive, const OS_common_record_t *, obj); + + UT_GenStub_Execute(OS_ObjectFilterActive, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ObjectFilterActive, bool); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdAllocateNew() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdAllocateNew(osal_objtype_t idtype, const char *name, OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdAllocateNew, int32); + + UT_GenStub_AddParam(OS_ObjectIdAllocateNew, osal_objtype_t, idtype); + UT_GenStub_AddParam(OS_ObjectIdAllocateNew, const char *, name); + UT_GenStub_AddParam(OS_ObjectIdAllocateNew, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdAllocateNew, Basic, UT_DefaultHandler_OS_ObjectIdAllocateNew); + + return UT_GenStub_GetReturnValue(OS_ObjectIdAllocateNew, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdConvertToken() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdConvertToken(OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdConvertToken, int32); + + UT_GenStub_AddParam(OS_ObjectIdConvertToken, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdConvertToken, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ObjectIdConvertToken, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdFinalizeDelete() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdFinalizeDelete(int32 operation_status, OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdFinalizeDelete, int32); + + UT_GenStub_AddParam(OS_ObjectIdFinalizeDelete, int32, operation_status); + UT_GenStub_AddParam(OS_ObjectIdFinalizeDelete, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdFinalizeDelete, Basic, UT_DefaultHandler_OS_ObjectIdFinalizeDelete); + + return UT_GenStub_GetReturnValue(OS_ObjectIdFinalizeDelete, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdFinalizeNew() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdFinalizeNew(int32 operation_status, OS_object_token_t *token, osal_id_t *outid) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdFinalizeNew, int32); + + UT_GenStub_AddParam(OS_ObjectIdFinalizeNew, int32, operation_status); + UT_GenStub_AddParam(OS_ObjectIdFinalizeNew, OS_object_token_t *, token); + UT_GenStub_AddParam(OS_ObjectIdFinalizeNew, osal_id_t *, outid); + + UT_GenStub_Execute(OS_ObjectIdFinalizeNew, Basic, UT_DefaultHandler_OS_ObjectIdFinalizeNew); + + return UT_GenStub_GetReturnValue(OS_ObjectIdFinalizeNew, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdFindByName() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdFindByName(osal_objtype_t idtype, const char *name, osal_id_t *object_id) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdFindByName, int32); + + UT_GenStub_AddParam(OS_ObjectIdFindByName, osal_objtype_t, idtype); + UT_GenStub_AddParam(OS_ObjectIdFindByName, const char *, name); + UT_GenStub_AddParam(OS_ObjectIdFindByName, osal_id_t *, object_id); + + UT_GenStub_Execute(OS_ObjectIdFindByName, Basic, UT_DefaultHandler_OS_ObjectIdFindByName); + + return UT_GenStub_GetReturnValue(OS_ObjectIdFindByName, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdFindNextFree() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdFindNextFree(OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdFindNextFree, int32); + + UT_GenStub_AddParam(OS_ObjectIdFindNextFree, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdFindNextFree, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ObjectIdFindNextFree, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdFindNextMatch() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdFindNextMatch(OS_ObjectMatchFunc_t MatchFunc, void *arg, OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdFindNextMatch, int32); + + UT_GenStub_AddParam(OS_ObjectIdFindNextMatch, OS_ObjectMatchFunc_t, MatchFunc); + UT_GenStub_AddParam(OS_ObjectIdFindNextMatch, void *, arg); + UT_GenStub_AddParam(OS_ObjectIdFindNextMatch, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdFindNextMatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ObjectIdFindNextMatch, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdGetById() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdGetById(OS_lock_mode_t lock_mode, osal_objtype_t idtype, osal_id_t id, OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdGetById, int32); + + UT_GenStub_AddParam(OS_ObjectIdGetById, OS_lock_mode_t, lock_mode); + UT_GenStub_AddParam(OS_ObjectIdGetById, osal_objtype_t, idtype); + UT_GenStub_AddParam(OS_ObjectIdGetById, osal_id_t, id); + UT_GenStub_AddParam(OS_ObjectIdGetById, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdGetById, Basic, UT_DefaultHandler_OS_ObjectIdGetById); + + return UT_GenStub_GetReturnValue(OS_ObjectIdGetById, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdGetByName() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdGetByName(OS_lock_mode_t lock_mode, osal_objtype_t idtype, const char *name, OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdGetByName, int32); + + UT_GenStub_AddParam(OS_ObjectIdGetByName, OS_lock_mode_t, lock_mode); + UT_GenStub_AddParam(OS_ObjectIdGetByName, osal_objtype_t, idtype); + UT_GenStub_AddParam(OS_ObjectIdGetByName, const char *, name); + UT_GenStub_AddParam(OS_ObjectIdGetByName, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdGetByName, Basic, UT_DefaultHandler_OS_ObjectIdGetByName); + + return UT_GenStub_GetReturnValue(OS_ObjectIdGetByName, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdGetBySearch() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdGetBySearch(OS_lock_mode_t lock_mode, osal_objtype_t idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg, + OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdGetBySearch, int32); + + UT_GenStub_AddParam(OS_ObjectIdGetBySearch, OS_lock_mode_t, lock_mode); + UT_GenStub_AddParam(OS_ObjectIdGetBySearch, osal_objtype_t, idtype); + UT_GenStub_AddParam(OS_ObjectIdGetBySearch, OS_ObjectMatchFunc_t, MatchFunc); + UT_GenStub_AddParam(OS_ObjectIdGetBySearch, void *, arg); + UT_GenStub_AddParam(OS_ObjectIdGetBySearch, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdGetBySearch, Basic, UT_DefaultHandler_OS_ObjectIdGetBySearch); + + return UT_GenStub_GetReturnValue(OS_ObjectIdGetBySearch, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdGlobalFromToken() + * ---------------------------------------------------- + */ +OS_common_record_t *OS_ObjectIdGlobalFromToken(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdGlobalFromToken, OS_common_record_t *); + + UT_GenStub_AddParam(OS_ObjectIdGlobalFromToken, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdGlobalFromToken, Basic, UT_DefaultHandler_OS_ObjectIdGlobalFromToken); + + return UT_GenStub_GetReturnValue(OS_ObjectIdGlobalFromToken, OS_common_record_t *); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdInit() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdInit(void) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdInit, int32); + + UT_GenStub_Execute(OS_ObjectIdInit, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ObjectIdInit, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdIterateActive() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdIterateActive(osal_objtype_t objtype, OS_object_iter_t *iter) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdIterateActive, int32); + + UT_GenStub_AddParam(OS_ObjectIdIterateActive, osal_objtype_t, objtype); + UT_GenStub_AddParam(OS_ObjectIdIterateActive, OS_object_iter_t *, iter); + + UT_GenStub_Execute(OS_ObjectIdIterateActive, Basic, UT_DefaultHandler_OS_ObjectIdIterateActive); + + return UT_GenStub_GetReturnValue(OS_ObjectIdIterateActive, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdIteratorDestroy() + * ---------------------------------------------------- + */ +void OS_ObjectIdIteratorDestroy(OS_object_iter_t *iter) +{ + UT_GenStub_AddParam(OS_ObjectIdIteratorDestroy, OS_object_iter_t *, iter); + + UT_GenStub_Execute(OS_ObjectIdIteratorDestroy, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdIteratorGetNext() + * ---------------------------------------------------- + */ +bool OS_ObjectIdIteratorGetNext(OS_object_iter_t *iter) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdIteratorGetNext, bool); + + UT_GenStub_AddParam(OS_ObjectIdIteratorGetNext, OS_object_iter_t *, iter); + + UT_GenStub_Execute(OS_ObjectIdIteratorGetNext, Basic, UT_DefaultHandler_OS_ObjectIdIteratorGetNext); + + return UT_GenStub_GetReturnValue(OS_ObjectIdIteratorGetNext, bool); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdIteratorInit() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdIteratorInit(OS_ObjectMatchFunc_t matchfunc, void *matcharg, osal_objtype_t objtype, + OS_object_iter_t *iter) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdIteratorInit, int32); + + UT_GenStub_AddParam(OS_ObjectIdIteratorInit, OS_ObjectMatchFunc_t, matchfunc); + UT_GenStub_AddParam(OS_ObjectIdIteratorInit, void *, matcharg); + UT_GenStub_AddParam(OS_ObjectIdIteratorInit, osal_objtype_t, objtype); + UT_GenStub_AddParam(OS_ObjectIdIteratorInit, OS_object_iter_t *, iter); + + UT_GenStub_Execute(OS_ObjectIdIteratorInit, Basic, UT_DefaultHandler_OS_ObjectIdIteratorInit); + + return UT_GenStub_GetReturnValue(OS_ObjectIdIteratorInit, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdIteratorProcessEntry() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdIteratorProcessEntry(OS_object_iter_t *iter, OS_ObjectIdIteratorProcessFunc_t func) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdIteratorProcessEntry, int32); + + UT_GenStub_AddParam(OS_ObjectIdIteratorProcessEntry, OS_object_iter_t *, iter); + UT_GenStub_AddParam(OS_ObjectIdIteratorProcessEntry, OS_ObjectIdIteratorProcessFunc_t, func); + + UT_GenStub_Execute(OS_ObjectIdIteratorProcessEntry, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ObjectIdIteratorProcessEntry, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdRelease() + * ---------------------------------------------------- + */ +void OS_ObjectIdRelease(OS_object_token_t *token) +{ + UT_GenStub_AddParam(OS_ObjectIdRelease, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdRelease, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdTransactionCancel() + * ---------------------------------------------------- + */ +void OS_ObjectIdTransactionCancel(OS_object_token_t *token) +{ + UT_GenStub_AddParam(OS_ObjectIdTransactionCancel, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdTransactionCancel, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdTransactionFinish() + * ---------------------------------------------------- + */ +void OS_ObjectIdTransactionFinish(OS_object_token_t *token, const osal_id_t *final_id) +{ + UT_GenStub_AddParam(OS_ObjectIdTransactionFinish, OS_object_token_t *, token); + UT_GenStub_AddParam(OS_ObjectIdTransactionFinish, const osal_id_t *, final_id); + + UT_GenStub_Execute(OS_ObjectIdTransactionFinish, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdTransactionInit() + * ---------------------------------------------------- + */ +int32 OS_ObjectIdTransactionInit(OS_lock_mode_t lock_mode, osal_objtype_t idtype, OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectIdTransactionInit, int32); + + UT_GenStub_AddParam(OS_ObjectIdTransactionInit, OS_lock_mode_t, lock_mode); + UT_GenStub_AddParam(OS_ObjectIdTransactionInit, osal_objtype_t, idtype); + UT_GenStub_AddParam(OS_ObjectIdTransactionInit, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ObjectIdTransactionInit, Basic, UT_DefaultHandler_OS_ObjectIdTransactionInit); + + return UT_GenStub_GetReturnValue(OS_ObjectIdTransactionInit, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectIdTransferToken() + * ---------------------------------------------------- + */ +void OS_ObjectIdTransferToken(OS_object_token_t *token_from, OS_object_token_t *token_to) +{ + UT_GenStub_AddParam(OS_ObjectIdTransferToken, OS_object_token_t *, token_from); + UT_GenStub_AddParam(OS_ObjectIdTransferToken, OS_object_token_t *, token_to); + + UT_GenStub_Execute(OS_ObjectIdTransferToken, Basic, UT_DefaultHandler_OS_ObjectIdTransferToken); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ObjectNameMatch() + * ---------------------------------------------------- + */ +bool OS_ObjectNameMatch(void *ref, const OS_object_token_t *token, const OS_common_record_t *obj) +{ + UT_GenStub_SetupReturnBuffer(OS_ObjectNameMatch, bool); + + UT_GenStub_AddParam(OS_ObjectNameMatch, void *, ref); + UT_GenStub_AddParam(OS_ObjectNameMatch, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_ObjectNameMatch, const OS_common_record_t *, obj); + + UT_GenStub_Execute(OS_ObjectNameMatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ObjectNameMatch, bool); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_Unlock_Global() + * ---------------------------------------------------- + */ +void OS_Unlock_Global(OS_object_token_t *token) +{ + UT_GenStub_AddParam(OS_Unlock_Global, OS_object_token_t *, token); + + UT_GenStub_Execute(OS_Unlock_Global, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_WaitForStateChange() + * ---------------------------------------------------- + */ +void OS_WaitForStateChange(OS_object_token_t *token, uint32 attempts) +{ + UT_GenStub_AddParam(OS_WaitForStateChange, OS_object_token_t *, token); + UT_GenStub_AddParam(OS_WaitForStateChange, uint32, attempts); + + UT_GenStub_Execute(OS_WaitForStateChange, Basic, NULL); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-module-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-module-impl-stubs.c new file mode 100644 index 000000000..6413b0b05 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-module-impl-stubs.c @@ -0,0 +1,130 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-module header + */ + +#include "os-shared-module.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_GlobalSymbolLookup_Impl() + * ---------------------------------------------------- + */ +int32 OS_GlobalSymbolLookup_Impl(cpuaddr *SymbolAddress, const char *SymbolName) +{ + UT_GenStub_SetupReturnBuffer(OS_GlobalSymbolLookup_Impl, int32); + + UT_GenStub_AddParam(OS_GlobalSymbolLookup_Impl, cpuaddr *, SymbolAddress); + UT_GenStub_AddParam(OS_GlobalSymbolLookup_Impl, const char *, SymbolName); + + UT_GenStub_Execute(OS_GlobalSymbolLookup_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_GlobalSymbolLookup_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ModuleGetInfo_Impl() + * ---------------------------------------------------- + */ +int32 OS_ModuleGetInfo_Impl(const OS_object_token_t *token, OS_module_prop_t *module_prop) +{ + UT_GenStub_SetupReturnBuffer(OS_ModuleGetInfo_Impl, int32); + + UT_GenStub_AddParam(OS_ModuleGetInfo_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_ModuleGetInfo_Impl, OS_module_prop_t *, module_prop); + + UT_GenStub_Execute(OS_ModuleGetInfo_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ModuleGetInfo_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ModuleLoad_Impl() + * ---------------------------------------------------- + */ +int32 OS_ModuleLoad_Impl(const OS_object_token_t *token, const char *translated_path) +{ + UT_GenStub_SetupReturnBuffer(OS_ModuleLoad_Impl, int32); + + UT_GenStub_AddParam(OS_ModuleLoad_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_ModuleLoad_Impl, const char *, translated_path); + + UT_GenStub_Execute(OS_ModuleLoad_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ModuleLoad_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ModuleSymbolLookup_Impl() + * ---------------------------------------------------- + */ +int32 OS_ModuleSymbolLookup_Impl(const OS_object_token_t *token, cpuaddr *SymbolAddress, const char *SymbolName) +{ + UT_GenStub_SetupReturnBuffer(OS_ModuleSymbolLookup_Impl, int32); + + UT_GenStub_AddParam(OS_ModuleSymbolLookup_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_ModuleSymbolLookup_Impl, cpuaddr *, SymbolAddress); + UT_GenStub_AddParam(OS_ModuleSymbolLookup_Impl, const char *, SymbolName); + + UT_GenStub_Execute(OS_ModuleSymbolLookup_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ModuleSymbolLookup_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ModuleUnload_Impl() + * ---------------------------------------------------- + */ +int32 OS_ModuleUnload_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_ModuleUnload_Impl, int32); + + UT_GenStub_AddParam(OS_ModuleUnload_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ModuleUnload_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ModuleUnload_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SymbolTableDump_Impl() + * ---------------------------------------------------- + */ +int32 OS_SymbolTableDump_Impl(const char *filename, size_t size_limit) +{ + UT_GenStub_SetupReturnBuffer(OS_SymbolTableDump_Impl, int32); + + UT_GenStub_AddParam(OS_SymbolTableDump_Impl, const char *, filename); + UT_GenStub_AddParam(OS_SymbolTableDump_Impl, size_t, size_limit); + + UT_GenStub_Execute(OS_SymbolTableDump_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SymbolTableDump_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-module-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-module-init-stubs.c new file mode 100644 index 000000000..20b61f4aa --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-module-init-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-module header + */ + +#include "os-shared-module.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ModuleAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_ModuleAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_ModuleAPI_Init, int32); + + UT_GenStub_Execute(OS_ModuleAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ModuleAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-module-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-module-stubs.c new file mode 100644 index 000000000..4335cf31a --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-module-stubs.c @@ -0,0 +1,62 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-module header + */ + +#include "os-shared-module.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ModuleLoad_Static() + * ---------------------------------------------------- + */ +int32 OS_ModuleLoad_Static(const char *ModuleName) +{ + UT_GenStub_SetupReturnBuffer(OS_ModuleLoad_Static, int32); + + UT_GenStub_AddParam(OS_ModuleLoad_Static, const char *, ModuleName); + + UT_GenStub_Execute(OS_ModuleLoad_Static, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ModuleLoad_Static, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SymbolLookup_Static() + * ---------------------------------------------------- + */ +int32 OS_SymbolLookup_Static(cpuaddr *SymbolAddress, const char *SymbolName, const char *ModuleName) +{ + UT_GenStub_SetupReturnBuffer(OS_SymbolLookup_Static, int32); + + UT_GenStub_AddParam(OS_SymbolLookup_Static, cpuaddr *, SymbolAddress); + UT_GenStub_AddParam(OS_SymbolLookup_Static, const char *, SymbolName); + UT_GenStub_AddParam(OS_SymbolLookup_Static, const char *, ModuleName); + + UT_GenStub_Execute(OS_SymbolLookup_Static, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SymbolLookup_Static, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-mutex-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-mutex-impl-stubs.c new file mode 100644 index 000000000..cb2656cf9 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-mutex-impl-stubs.c @@ -0,0 +1,110 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-mutex header + */ + +#include "os-shared-mutex.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_MutSemCreate_Impl() + * ---------------------------------------------------- + */ +int32 OS_MutSemCreate_Impl(const OS_object_token_t *token, uint32 options) +{ + UT_GenStub_SetupReturnBuffer(OS_MutSemCreate_Impl, int32); + + UT_GenStub_AddParam(OS_MutSemCreate_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_MutSemCreate_Impl, uint32, options); + + UT_GenStub_Execute(OS_MutSemCreate_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_MutSemCreate_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_MutSemDelete_Impl() + * ---------------------------------------------------- + */ +int32 OS_MutSemDelete_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_MutSemDelete_Impl, int32); + + UT_GenStub_AddParam(OS_MutSemDelete_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_MutSemDelete_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_MutSemDelete_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_MutSemGetInfo_Impl() + * ---------------------------------------------------- + */ +int32 OS_MutSemGetInfo_Impl(const OS_object_token_t *token, OS_mut_sem_prop_t *mut_prop) +{ + UT_GenStub_SetupReturnBuffer(OS_MutSemGetInfo_Impl, int32); + + UT_GenStub_AddParam(OS_MutSemGetInfo_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_MutSemGetInfo_Impl, OS_mut_sem_prop_t *, mut_prop); + + UT_GenStub_Execute(OS_MutSemGetInfo_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_MutSemGetInfo_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_MutSemGive_Impl() + * ---------------------------------------------------- + */ +int32 OS_MutSemGive_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_MutSemGive_Impl, int32); + + UT_GenStub_AddParam(OS_MutSemGive_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_MutSemGive_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_MutSemGive_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_MutSemTake_Impl() + * ---------------------------------------------------- + */ +int32 OS_MutSemTake_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_MutSemTake_Impl, int32); + + UT_GenStub_AddParam(OS_MutSemTake_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_MutSemTake_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_MutSemTake_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-mutex-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-mutex-init-stubs.c new file mode 100644 index 000000000..ddcd517e7 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-mutex-init-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-mutex header + */ + +#include "os-shared-mutex.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_MutexAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_MutexAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_MutexAPI_Init, int32); + + UT_GenStub_Execute(OS_MutexAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_MutexAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-hooks.c b/src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-hooks.c new file mode 100644 index 000000000..5b7b8f3c4 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-hooks.c @@ -0,0 +1,53 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * \file osapi-utstub-idmap.c + * \author joseph.p.hickey@nasa.gov + * + * Stub implementations for the functions defined in the OSAL API + * + * The stub implementation can be used for unit testing applications built + * on top of OSAL. The stubs do not do any real function, but allow + * the return code to be crafted such that error paths in the application + * can be executed. + */ + +#include "osapi-network.h" /* OSAL public API for this subsystem */ +#include "os-shared-network.h" +#include "utstubs.h" + +/* + * ----------------------------------------------------------------- + * Default handler implementation for 'OS_NetworkGetID_Impl' stub + * ----------------------------------------------------------------- + */ +void UT_DefaultHandler_OS_NetworkGetID_Impl(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + int32 *IdBuf = UT_Hook_GetArgValueByName(Context, "IdBuf", int32 *); + int32 status; + + UT_Stub_GetInt32StatusCode(Context, &status); + + if (status == 0) + { + *IdBuf = 42; + } +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-stubs.c new file mode 100644 index 000000000..b4bf6e9f1 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-network-impl-stubs.c @@ -0,0 +1,63 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-network header + */ + +#include "os-shared-network.h" +#include "utgenstub.h" + +extern void UT_DefaultHandler_OS_NetworkGetID_Impl(void *, UT_EntryKey_t, const UT_StubContext_t *); + +/* + * ---------------------------------------------------- + * Generated stub function for OS_NetworkGetHostName_Impl() + * ---------------------------------------------------- + */ +int32 OS_NetworkGetHostName_Impl(char *host_name, size_t name_len) +{ + UT_GenStub_SetupReturnBuffer(OS_NetworkGetHostName_Impl, int32); + + UT_GenStub_AddParam(OS_NetworkGetHostName_Impl, char *, host_name); + UT_GenStub_AddParam(OS_NetworkGetHostName_Impl, size_t, name_len); + + UT_GenStub_Execute(OS_NetworkGetHostName_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_NetworkGetHostName_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_NetworkGetID_Impl() + * ---------------------------------------------------- + */ +int32 OS_NetworkGetID_Impl(int32 *IdBuf) +{ + UT_GenStub_SetupReturnBuffer(OS_NetworkGetID_Impl, int32); + + UT_GenStub_AddParam(OS_NetworkGetID_Impl, int32 *, IdBuf); + + UT_GenStub_Execute(OS_NetworkGetID_Impl, Basic, UT_DefaultHandler_OS_NetworkGetID_Impl); + + return UT_GenStub_GetReturnValue(OS_NetworkGetID_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-network-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-network-init-stubs.c new file mode 100644 index 000000000..5fd4daf56 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-network-init-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-network header + */ + +#include "os-shared-network.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_NetworkAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_NetworkAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_NetworkAPI_Init, int32); + + UT_GenStub_Execute(OS_NetworkAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_NetworkAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/portable-console-bsp-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-printf-impl-stubs.c similarity index 68% rename from src/unit-test-coverage/ut-stubs/src/portable-console-bsp-impl-stubs.c rename to src/unit-test-coverage/ut-stubs/src/os-shared-printf-impl-stubs.c index 60fab614f..782b8136a 100644 --- a/src/unit-test-coverage/ut-stubs/src/portable-console-bsp-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-printf-impl-stubs.c @@ -19,25 +19,22 @@ */ /** - * \file portable-console-bsp-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov + * @file * + * Auto-Generated stub implementations for functions defined in os-shared-printf header */ -#include -#include -#include -#include - -#include "utstubs.h" - #include "os-shared-printf.h" +#include "utgenstub.h" /* -** Console output API (printf) -*/ + * ---------------------------------------------------- + * Generated stub function for OS_ConsoleOutput_Impl() + * ---------------------------------------------------- + */ void OS_ConsoleOutput_Impl(const OS_object_token_t *token) { - UT_DEFAULT_IMPL(OS_ConsoleOutput_Impl); + UT_GenStub_AddParam(OS_ConsoleOutput_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_ConsoleOutput_Impl, Basic, NULL); } diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-queue-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-queue-impl-stubs.c new file mode 100644 index 000000000..2fb30de83 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-queue-impl-stubs.c @@ -0,0 +1,117 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-queue header + */ + +#include "os-shared-queue.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_QueueCreate_Impl() + * ---------------------------------------------------- + */ +int32 OS_QueueCreate_Impl(const OS_object_token_t *token, uint32 flags) +{ + UT_GenStub_SetupReturnBuffer(OS_QueueCreate_Impl, int32); + + UT_GenStub_AddParam(OS_QueueCreate_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_QueueCreate_Impl, uint32, flags); + + UT_GenStub_Execute(OS_QueueCreate_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_QueueCreate_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_QueueDelete_Impl() + * ---------------------------------------------------- + */ +int32 OS_QueueDelete_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_QueueDelete_Impl, int32); + + UT_GenStub_AddParam(OS_QueueDelete_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_QueueDelete_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_QueueDelete_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_QueueGetInfo_Impl() + * ---------------------------------------------------- + */ +int32 OS_QueueGetInfo_Impl(const OS_object_token_t *token, OS_queue_prop_t *queue_prop) +{ + UT_GenStub_SetupReturnBuffer(OS_QueueGetInfo_Impl, int32); + + UT_GenStub_AddParam(OS_QueueGetInfo_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_QueueGetInfo_Impl, OS_queue_prop_t *, queue_prop); + + UT_GenStub_Execute(OS_QueueGetInfo_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_QueueGetInfo_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_QueueGet_Impl() + * ---------------------------------------------------- + */ +int32 OS_QueueGet_Impl(const OS_object_token_t *token, void *data, size_t size, size_t *size_copied, int32 timeout) +{ + UT_GenStub_SetupReturnBuffer(OS_QueueGet_Impl, int32); + + UT_GenStub_AddParam(OS_QueueGet_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_QueueGet_Impl, void *, data); + UT_GenStub_AddParam(OS_QueueGet_Impl, size_t, size); + UT_GenStub_AddParam(OS_QueueGet_Impl, size_t *, size_copied); + UT_GenStub_AddParam(OS_QueueGet_Impl, int32, timeout); + + UT_GenStub_Execute(OS_QueueGet_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_QueueGet_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_QueuePut_Impl() + * ---------------------------------------------------- + */ +int32 OS_QueuePut_Impl(const OS_object_token_t *token, const void *data, size_t size, uint32 flags) +{ + UT_GenStub_SetupReturnBuffer(OS_QueuePut_Impl, int32); + + UT_GenStub_AddParam(OS_QueuePut_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_QueuePut_Impl, const void *, data); + UT_GenStub_AddParam(OS_QueuePut_Impl, size_t, size); + UT_GenStub_AddParam(OS_QueuePut_Impl, uint32, flags); + + UT_GenStub_Execute(OS_QueuePut_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_QueuePut_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-queue-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-queue-init-stubs.c new file mode 100644 index 000000000..444481596 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-queue-init-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-queue header + */ + +#include "os-shared-queue.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_QueueAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_QueueAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_QueueAPI_Init, int32); + + UT_GenStub_Execute(OS_QueueAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_QueueAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-select-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-select-impl-stubs.c new file mode 100644 index 000000000..24bd2dd86 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-select-impl-stubs.c @@ -0,0 +1,64 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-select header + */ + +#include "os-shared-select.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SelectMultiple_Impl() + * ---------------------------------------------------- + */ +int32 OS_SelectMultiple_Impl(OS_FdSet *ReadSet, OS_FdSet *WriteSet, int32 msecs) +{ + UT_GenStub_SetupReturnBuffer(OS_SelectMultiple_Impl, int32); + + UT_GenStub_AddParam(OS_SelectMultiple_Impl, OS_FdSet *, ReadSet); + UT_GenStub_AddParam(OS_SelectMultiple_Impl, OS_FdSet *, WriteSet); + UT_GenStub_AddParam(OS_SelectMultiple_Impl, int32, msecs); + + UT_GenStub_Execute(OS_SelectMultiple_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SelectMultiple_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SelectSingle_Impl() + * ---------------------------------------------------- + */ +int32 OS_SelectSingle_Impl(const OS_object_token_t *token, uint32 *SelectFlags, int32 msecs) +{ + UT_GenStub_SetupReturnBuffer(OS_SelectSingle_Impl, int32); + + UT_GenStub_AddParam(OS_SelectSingle_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_SelectSingle_Impl, uint32 *, SelectFlags); + UT_GenStub_AddParam(OS_SelectSingle_Impl, int32, msecs); + + UT_GenStub_Execute(OS_SelectSingle_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SelectSingle_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-shell-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-shell-impl-stubs.c new file mode 100644 index 000000000..071d9824b --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-shell-impl-stubs.c @@ -0,0 +1,45 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-shell header + */ + +#include "os-shared-shell.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_ShellOutputToFile_Impl() + * ---------------------------------------------------- + */ +int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd) +{ + UT_GenStub_SetupReturnBuffer(OS_ShellOutputToFile_Impl, int32); + + UT_GenStub_AddParam(OS_ShellOutputToFile_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_ShellOutputToFile_Impl, const char *, Cmd); + + UT_GenStub_Execute(OS_ShellOutputToFile_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_ShellOutputToFile_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-sockets-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-sockets-impl-stubs.c new file mode 100644 index 000000000..22d8af09c --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-sockets-impl-stubs.c @@ -0,0 +1,243 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-sockets header + */ + +#include "os-shared-sockets.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketAccept_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketAccept_Impl(const OS_object_token_t *sock_token, const OS_object_token_t *conn_token, + OS_SockAddr_t *Addr, int32 timeout) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketAccept_Impl, int32); + + UT_GenStub_AddParam(OS_SocketAccept_Impl, const OS_object_token_t *, sock_token); + UT_GenStub_AddParam(OS_SocketAccept_Impl, const OS_object_token_t *, conn_token); + UT_GenStub_AddParam(OS_SocketAccept_Impl, OS_SockAddr_t *, Addr); + UT_GenStub_AddParam(OS_SocketAccept_Impl, int32, timeout); + + UT_GenStub_Execute(OS_SocketAccept_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketAccept_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketAddrFromString_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketAddrFromString_Impl(OS_SockAddr_t *Addr, const char *string) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketAddrFromString_Impl, int32); + + UT_GenStub_AddParam(OS_SocketAddrFromString_Impl, OS_SockAddr_t *, Addr); + UT_GenStub_AddParam(OS_SocketAddrFromString_Impl, const char *, string); + + UT_GenStub_Execute(OS_SocketAddrFromString_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketAddrFromString_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketAddrGetPort_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketAddrGetPort_Impl(uint16 *PortNum, const OS_SockAddr_t *Addr) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketAddrGetPort_Impl, int32); + + UT_GenStub_AddParam(OS_SocketAddrGetPort_Impl, uint16 *, PortNum); + UT_GenStub_AddParam(OS_SocketAddrGetPort_Impl, const OS_SockAddr_t *, Addr); + + UT_GenStub_Execute(OS_SocketAddrGetPort_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketAddrGetPort_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketAddrInit_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketAddrInit_Impl(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketAddrInit_Impl, int32); + + UT_GenStub_AddParam(OS_SocketAddrInit_Impl, OS_SockAddr_t *, Addr); + UT_GenStub_AddParam(OS_SocketAddrInit_Impl, OS_SocketDomain_t, Domain); + + UT_GenStub_Execute(OS_SocketAddrInit_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketAddrInit_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketAddrSetPort_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketAddrSetPort_Impl(OS_SockAddr_t *Addr, uint16 PortNum) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketAddrSetPort_Impl, int32); + + UT_GenStub_AddParam(OS_SocketAddrSetPort_Impl, OS_SockAddr_t *, Addr); + UT_GenStub_AddParam(OS_SocketAddrSetPort_Impl, uint16, PortNum); + + UT_GenStub_Execute(OS_SocketAddrSetPort_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketAddrSetPort_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketAddrToString_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketAddrToString_Impl(char *buffer, size_t buflen, const OS_SockAddr_t *Addr) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketAddrToString_Impl, int32); + + UT_GenStub_AddParam(OS_SocketAddrToString_Impl, char *, buffer); + UT_GenStub_AddParam(OS_SocketAddrToString_Impl, size_t, buflen); + UT_GenStub_AddParam(OS_SocketAddrToString_Impl, const OS_SockAddr_t *, Addr); + + UT_GenStub_Execute(OS_SocketAddrToString_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketAddrToString_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketBind_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketBind_Impl(const OS_object_token_t *token, const OS_SockAddr_t *Addr) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketBind_Impl, int32); + + UT_GenStub_AddParam(OS_SocketBind_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_SocketBind_Impl, const OS_SockAddr_t *, Addr); + + UT_GenStub_Execute(OS_SocketBind_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketBind_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketConnect_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketConnect_Impl(const OS_object_token_t *token, const OS_SockAddr_t *Addr, int32 timeout) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketConnect_Impl, int32); + + UT_GenStub_AddParam(OS_SocketConnect_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_SocketConnect_Impl, const OS_SockAddr_t *, Addr); + UT_GenStub_AddParam(OS_SocketConnect_Impl, int32, timeout); + + UT_GenStub_Execute(OS_SocketConnect_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketConnect_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketGetInfo_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketGetInfo_Impl(const OS_object_token_t *token, OS_socket_prop_t *sock_prop) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketGetInfo_Impl, int32); + + UT_GenStub_AddParam(OS_SocketGetInfo_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_SocketGetInfo_Impl, OS_socket_prop_t *, sock_prop); + + UT_GenStub_Execute(OS_SocketGetInfo_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketGetInfo_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketOpen_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketOpen_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketOpen_Impl, int32); + + UT_GenStub_AddParam(OS_SocketOpen_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_SocketOpen_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketOpen_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketRecvFrom_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketRecvFrom_Impl(const OS_object_token_t *token, void *buffer, size_t buflen, OS_SockAddr_t *RemoteAddr, + int32 timeout) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketRecvFrom_Impl, int32); + + UT_GenStub_AddParam(OS_SocketRecvFrom_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_SocketRecvFrom_Impl, void *, buffer); + UT_GenStub_AddParam(OS_SocketRecvFrom_Impl, size_t, buflen); + UT_GenStub_AddParam(OS_SocketRecvFrom_Impl, OS_SockAddr_t *, RemoteAddr); + UT_GenStub_AddParam(OS_SocketRecvFrom_Impl, int32, timeout); + + UT_GenStub_Execute(OS_SocketRecvFrom_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketRecvFrom_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketSendTo_Impl() + * ---------------------------------------------------- + */ +int32 OS_SocketSendTo_Impl(const OS_object_token_t *token, const void *buffer, size_t buflen, + const OS_SockAddr_t *RemoteAddr) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketSendTo_Impl, int32); + + UT_GenStub_AddParam(OS_SocketSendTo_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_SocketSendTo_Impl, const void *, buffer); + UT_GenStub_AddParam(OS_SocketSendTo_Impl, size_t, buflen); + UT_GenStub_AddParam(OS_SocketSendTo_Impl, const OS_SockAddr_t *, RemoteAddr); + + UT_GenStub_Execute(OS_SocketSendTo_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketSendTo_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-sockets-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-sockets-init-stubs.c new file mode 100644 index 000000000..1424819be --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-sockets-init-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-sockets header + */ + +#include "os-shared-sockets.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_SocketAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_SocketAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_SocketAPI_Init, int32); + + UT_GenStub_Execute(OS_SocketAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_SocketAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-sockets-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-sockets-stubs.c new file mode 100644 index 000000000..9f7ebb928 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-sockets-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-sockets header + */ + +#include "os-shared-sockets.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_CreateSocketName() + * ---------------------------------------------------- + */ +void OS_CreateSocketName(const OS_object_token_t *token, const OS_SockAddr_t *Addr, const char *parent_name) +{ + UT_GenStub_AddParam(OS_CreateSocketName, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_CreateSocketName, const OS_SockAddr_t *, Addr); + UT_GenStub_AddParam(OS_CreateSocketName, const char *, parent_name); + + UT_GenStub_Execute(OS_CreateSocketName, Basic, NULL); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-task-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-task-impl-stubs.c new file mode 100644 index 000000000..959acb7b6 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-task-impl-stubs.c @@ -0,0 +1,219 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-task header + */ + +#include "os-shared-task.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskCreate_Impl() + * ---------------------------------------------------- + */ +int32 OS_TaskCreate_Impl(const OS_object_token_t *token, uint32 flags) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskCreate_Impl, int32); + + UT_GenStub_AddParam(OS_TaskCreate_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_TaskCreate_Impl, uint32, flags); + + UT_GenStub_Execute(OS_TaskCreate_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskCreate_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskDelay_Impl() + * ---------------------------------------------------- + */ +int32 OS_TaskDelay_Impl(uint32 millisecond) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskDelay_Impl, int32); + + UT_GenStub_AddParam(OS_TaskDelay_Impl, uint32, millisecond); + + UT_GenStub_Execute(OS_TaskDelay_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskDelay_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskDelete_Impl() + * ---------------------------------------------------- + */ +int32 OS_TaskDelete_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskDelete_Impl, int32); + + UT_GenStub_AddParam(OS_TaskDelete_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_TaskDelete_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskDelete_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskDetach_Impl() + * ---------------------------------------------------- + */ +int32 OS_TaskDetach_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskDetach_Impl, int32); + + UT_GenStub_AddParam(OS_TaskDetach_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_TaskDetach_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskDetach_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskExit_Impl() + * ---------------------------------------------------- + */ +void OS_TaskExit_Impl(void) +{ + + UT_GenStub_Execute(OS_TaskExit_Impl, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskGetId_Impl() + * ---------------------------------------------------- + */ +osal_id_t OS_TaskGetId_Impl(void) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskGetId_Impl, osal_id_t); + + UT_GenStub_Execute(OS_TaskGetId_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskGetId_Impl, osal_id_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskGetInfo_Impl() + * ---------------------------------------------------- + */ +int32 OS_TaskGetInfo_Impl(const OS_object_token_t *token, OS_task_prop_t *task_prop) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskGetInfo_Impl, int32); + + UT_GenStub_AddParam(OS_TaskGetInfo_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_TaskGetInfo_Impl, OS_task_prop_t *, task_prop); + + UT_GenStub_Execute(OS_TaskGetInfo_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskGetInfo_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskIdMatchSystemData_Impl() + * ---------------------------------------------------- + */ +bool OS_TaskIdMatchSystemData_Impl(void *ref, const OS_object_token_t *token, const OS_common_record_t *obj) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskIdMatchSystemData_Impl, bool); + + UT_GenStub_AddParam(OS_TaskIdMatchSystemData_Impl, void *, ref); + UT_GenStub_AddParam(OS_TaskIdMatchSystemData_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_TaskIdMatchSystemData_Impl, const OS_common_record_t *, obj); + + UT_GenStub_Execute(OS_TaskIdMatchSystemData_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskIdMatchSystemData_Impl, bool); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskMatch_Impl() + * ---------------------------------------------------- + */ +int32 OS_TaskMatch_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskMatch_Impl, int32); + + UT_GenStub_AddParam(OS_TaskMatch_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_TaskMatch_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskMatch_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskRegister_Impl() + * ---------------------------------------------------- + */ +int32 OS_TaskRegister_Impl(osal_id_t global_task_id) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskRegister_Impl, int32); + + UT_GenStub_AddParam(OS_TaskRegister_Impl, osal_id_t, global_task_id); + + UT_GenStub_Execute(OS_TaskRegister_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskRegister_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskSetPriority_Impl() + * ---------------------------------------------------- + */ +int32 OS_TaskSetPriority_Impl(const OS_object_token_t *token, osal_priority_t new_priority) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskSetPriority_Impl, int32); + + UT_GenStub_AddParam(OS_TaskSetPriority_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_TaskSetPriority_Impl, osal_priority_t, new_priority); + + UT_GenStub_Execute(OS_TaskSetPriority_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskSetPriority_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskValidateSystemData_Impl() + * ---------------------------------------------------- + */ +int32 OS_TaskValidateSystemData_Impl(const void *sysdata, size_t sysdata_size) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskValidateSystemData_Impl, int32); + + UT_GenStub_AddParam(OS_TaskValidateSystemData_Impl, const void *, sysdata); + UT_GenStub_AddParam(OS_TaskValidateSystemData_Impl, size_t, sysdata_size); + + UT_GenStub_Execute(OS_TaskValidateSystemData_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskValidateSystemData_Impl, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-task-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-task-init-stubs.c new file mode 100644 index 000000000..95653c225 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-task-init-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-task header + */ + +#include "os-shared-task.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TaskAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_TaskAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_TaskAPI_Init, int32); + + UT_GenStub_Execute(OS_TaskAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TaskAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-heap-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-task-stubs.c similarity index 63% rename from src/unit-test-coverage/ut-stubs/src/osapi-heap-impl-stubs.c rename to src/unit-test-coverage/ut-stubs/src/os-shared-task-stubs.c index 00b07fb04..4476e7060 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-heap-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-task-stubs.c @@ -19,22 +19,22 @@ */ /** - * \file osapi-heap-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov + * @file * + * Auto-Generated stub implementations for functions defined in os-shared-task header */ -#include -#include -#include -#include - -#include "utstubs.h" - -#include "os-shared-heap.h" +#include "os-shared-task.h" +#include "utgenstub.h" /* - * Heap API low-level handler + * ---------------------------------------------------- + * Generated stub function for OS_TaskEntryPoint() + * ---------------------------------------------------- */ -UT_DEFAULT_STUB(OS_HeapGetInfo_Impl, (OS_heap_prop_t * heap_prop)) +void OS_TaskEntryPoint(osal_id_t global_task_id) +{ + UT_GenStub_AddParam(OS_TaskEntryPoint, osal_id_t, global_task_id); + + UT_GenStub_Execute(OS_TaskEntryPoint, Basic, NULL); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-time-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-time-init-stubs.c new file mode 100644 index 000000000..6cabe9887 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-time-init-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-time header + */ + +#include "os-shared-time.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TimerCbAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_TimerCbAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_TimerCbAPI_Init, int32); + + UT_GenStub_Execute(OS_TimerCbAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TimerCbAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-timebase-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-timebase-impl-stubs.c new file mode 100644 index 000000000..a8618d953 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-timebase-impl-stubs.c @@ -0,0 +1,119 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-timebase header + */ + +#include "os-shared-timebase.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TimeBaseCreate_Impl() + * ---------------------------------------------------- + */ +int32 OS_TimeBaseCreate_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_TimeBaseCreate_Impl, int32); + + UT_GenStub_AddParam(OS_TimeBaseCreate_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_TimeBaseCreate_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TimeBaseCreate_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TimeBaseDelete_Impl() + * ---------------------------------------------------- + */ +int32 OS_TimeBaseDelete_Impl(const OS_object_token_t *token) +{ + UT_GenStub_SetupReturnBuffer(OS_TimeBaseDelete_Impl, int32); + + UT_GenStub_AddParam(OS_TimeBaseDelete_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_TimeBaseDelete_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TimeBaseDelete_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TimeBaseGetInfo_Impl() + * ---------------------------------------------------- + */ +int32 OS_TimeBaseGetInfo_Impl(const OS_object_token_t *token, OS_timebase_prop_t *timer_prop) +{ + UT_GenStub_SetupReturnBuffer(OS_TimeBaseGetInfo_Impl, int32); + + UT_GenStub_AddParam(OS_TimeBaseGetInfo_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_TimeBaseGetInfo_Impl, OS_timebase_prop_t *, timer_prop); + + UT_GenStub_Execute(OS_TimeBaseGetInfo_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TimeBaseGetInfo_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TimeBaseLock_Impl() + * ---------------------------------------------------- + */ +void OS_TimeBaseLock_Impl(const OS_object_token_t *token) +{ + UT_GenStub_AddParam(OS_TimeBaseLock_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_TimeBaseLock_Impl, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TimeBaseSet_Impl() + * ---------------------------------------------------- + */ +int32 OS_TimeBaseSet_Impl(const OS_object_token_t *token, uint32 start_time, uint32 interval_time) +{ + UT_GenStub_SetupReturnBuffer(OS_TimeBaseSet_Impl, int32); + + UT_GenStub_AddParam(OS_TimeBaseSet_Impl, const OS_object_token_t *, token); + UT_GenStub_AddParam(OS_TimeBaseSet_Impl, uint32, start_time); + UT_GenStub_AddParam(OS_TimeBaseSet_Impl, uint32, interval_time); + + UT_GenStub_Execute(OS_TimeBaseSet_Impl, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TimeBaseSet_Impl, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TimeBaseUnlock_Impl() + * ---------------------------------------------------- + */ +void OS_TimeBaseUnlock_Impl(const OS_object_token_t *token) +{ + UT_GenStub_AddParam(OS_TimeBaseUnlock_Impl, const OS_object_token_t *, token); + + UT_GenStub_Execute(OS_TimeBaseUnlock_Impl, Basic, NULL); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-timebase-init-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-timebase-init-stubs.c new file mode 100644 index 000000000..07d69d682 --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-timebase-init-stubs.c @@ -0,0 +1,42 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-timebase header + */ + +#include "os-shared-timebase.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TimeBaseAPI_Init() + * ---------------------------------------------------- + */ +int32 OS_TimeBaseAPI_Init(void) +{ + UT_GenStub_SetupReturnBuffer(OS_TimeBaseAPI_Init, int32); + + UT_GenStub_Execute(OS_TimeBaseAPI_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_TimeBaseAPI_Init, int32); +} diff --git a/src/unit-test-coverage/ut-stubs/src/os-shared-timebase-stubs.c b/src/unit-test-coverage/ut-stubs/src/os-shared-timebase-stubs.c new file mode 100644 index 000000000..0452a47dd --- /dev/null +++ b/src/unit-test-coverage/ut-stubs/src/os-shared-timebase-stubs.c @@ -0,0 +1,57 @@ +/* + * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" + * + * Copyright (c) 2019 United States Government as represented by + * the Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in os-shared-timebase header + */ + +#include "os-shared-timebase.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for OS_Milli2Ticks() + * ---------------------------------------------------- + */ +int32 OS_Milli2Ticks(uint32 milli_seconds, int *ticks) +{ + UT_GenStub_SetupReturnBuffer(OS_Milli2Ticks, int32); + + UT_GenStub_AddParam(OS_Milli2Ticks, uint32, milli_seconds); + UT_GenStub_AddParam(OS_Milli2Ticks, int *, ticks); + + UT_GenStub_Execute(OS_Milli2Ticks, Basic, NULL); + + return UT_GenStub_GetReturnValue(OS_Milli2Ticks, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for OS_TimeBase_CallbackThread() + * ---------------------------------------------------- + */ +void OS_TimeBase_CallbackThread(osal_id_t timebase_id) +{ + UT_GenStub_AddParam(OS_TimeBase_CallbackThread, osal_id_t, timebase_id); + + UT_GenStub_Execute(OS_TimeBase_CallbackThread, Basic, NULL); +} diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-binsem-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-binsem-impl-stubs.c deleted file mode 100644 index cee315962..000000000 --- a/src/unit-test-coverage/ut-stubs/src/osapi-binsem-impl-stubs.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" - * - * Copyright (c) 2019 United States Government as represented by - * the Administrator of the National Aeronautics and Space Administration. - * All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file osapi-binsem-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov - * - */ - -#include -#include -#include -#include - -#include "utstubs.h" - -#include "os-shared-binsem.h" - -/* -** Semaphore API -*/ - -UT_DEFAULT_STUB(OS_BinSemCreate_Impl, (const OS_object_token_t *token, uint32 sem_initial_value, uint32 options)) -UT_DEFAULT_STUB(OS_BinSemFlush_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_BinSemGive_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_BinSemTake_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_BinSemTimedWait_Impl, (const OS_object_token_t *token, uint32 msecs)) -UT_DEFAULT_STUB(OS_BinSemDelete_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_BinSemGetInfo_Impl, (const OS_object_token_t *token, OS_bin_sem_prop_t *bin_prop)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-countsem-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-countsem-impl-stubs.c deleted file mode 100644 index d6dcf2a54..000000000 --- a/src/unit-test-coverage/ut-stubs/src/osapi-countsem-impl-stubs.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" - * - * Copyright (c) 2019 United States Government as represented by - * the Administrator of the National Aeronautics and Space Administration. - * All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file osapi-countsem-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov - * - */ - -#include -#include -#include -#include - -#include "utstubs.h" - -#include "os-shared-countsem.h" - -/* -** Semaphore API -*/ - -UT_DEFAULT_STUB(OS_CountSemCreate_Impl, (const OS_object_token_t *token, uint32 sem_initial_value, uint32 options)) -UT_DEFAULT_STUB(OS_CountSemGive_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_CountSemTake_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_CountSemTimedWait_Impl, (const OS_object_token_t *token, uint32 msecs)) -UT_DEFAULT_STUB(OS_CountSemDelete_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_CountSemGetInfo_Impl, (const OS_object_token_t *token, OS_count_sem_prop_t *count_prop)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-file-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-file-impl-stubs.c deleted file mode 100644 index e5f0d52f5..000000000 --- a/src/unit-test-coverage/ut-stubs/src/osapi-file-impl-stubs.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" - * - * Copyright (c) 2019 United States Government as represented by - * the Administrator of the National Aeronautics and Space Administration. - * All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file osapi-file-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov - * - */ - -#include -#include -#include -#include - -#include "utstubs.h" - -#include "os-shared-file.h" -#include "os-shared-dir.h" - -/* - * File API abstraction layer - */ - -UT_DEFAULT_STUB(OS_FileOpen_Impl, (const OS_object_token_t *token, const char *local_path, int32 flags, int32 access)) -UT_DEFAULT_STUB(OS_FileStat_Impl, (const char *local_path, os_fstat_t *filestat)) -UT_DEFAULT_STUB(OS_FileRemove_Impl, (const char *local_path)) -UT_DEFAULT_STUB(OS_FileRename_Impl, (const char *old_path, const char *new_path)) -UT_DEFAULT_STUB(OS_FileChmod_Impl, (const char *local_path, uint32 access)) -UT_DEFAULT_STUB(OS_ShellOutputToFile_Impl, (const OS_object_token_t *token, const char *Cmd)) - -/* - * Directory API abstraction layer - */ -UT_DEFAULT_STUB(OS_DirCreate_Impl, (const char *local_path, uint32 access)) -UT_DEFAULT_STUB(OS_DirOpen_Impl, (const OS_object_token_t *token, const char *local_path)) -UT_DEFAULT_STUB(OS_DirClose_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_DirRead_Impl, (const OS_object_token_t *token, os_dirent_t *dirent)) -UT_DEFAULT_STUB(OS_DirRewind_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_DirRemove_Impl, (const char *local_path)) - -/* - * Stream abstraction layer (applies to sockets and files) - */ -int32 OS_GenericRead_Impl(const OS_object_token_t *token, void *buffer, size_t nbytes, int32 timeout) -{ - int32 Status = UT_DEFAULT_IMPL(OS_GenericRead_Impl); - - if (Status == OS_SUCCESS) - { - Status = UT_Stub_CopyToLocal(UT_KEY(OS_GenericRead_Impl), buffer, nbytes); - } - - return Status; -} - -int32 OS_GenericWrite_Impl(const OS_object_token_t *token, const void *buffer, size_t nbytes, int32 timeout) -{ - int32 Status = UT_DEFAULT_IMPL(OS_GenericWrite_Impl); - - if (Status == OS_SUCCESS) - { - Status = UT_Stub_CopyFromLocal(UT_KEY(OS_GenericWrite_Impl), (const uint8 *)buffer, nbytes); - } - - return Status; -} - -UT_DEFAULT_STUB(OS_GenericSeek_Impl, (const OS_object_token_t *token, int32 offset, uint32 whence)) -UT_DEFAULT_STUB(OS_GenericClose_Impl, (const OS_object_token_t *token)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c deleted file mode 100644 index fedb8593b..000000000 --- a/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" - * - * Copyright (c) 2019 United States Government as represented by - * the Administrator of the National Aeronautics and Space Administration. - * All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file osapi-loader-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov - * - */ - -#include -#include -#include -#include - -#include "utstubs.h" -#include "os-shared-module.h" - -/* - * Module Loader API - */ -UT_DEFAULT_STUB(OS_ModuleLoad_Impl, (const OS_object_token_t *token, const char *translated_path)) -UT_DEFAULT_STUB(OS_ModuleUnload_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_ModuleGetInfo_Impl, (const OS_object_token_t *token, OS_module_prop_t *module_prop)) -UT_DEFAULT_STUB(OS_GlobalSymbolLookup_Impl, (cpuaddr * SymbolAddress, const char *SymbolName)) -UT_DEFAULT_STUB(OS_ModuleSymbolLookup_Impl, - (const OS_object_token_t *token, cpuaddr *SymbolAddress, const char *SymbolName)) -UT_DEFAULT_STUB(OS_SymbolTableDump_Impl, (const char *filename, size_t size_limit)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-mutex-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-mutex-impl-stubs.c deleted file mode 100644 index f106785f4..000000000 --- a/src/unit-test-coverage/ut-stubs/src/osapi-mutex-impl-stubs.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" - * - * Copyright (c) 2019 United States Government as represented by - * the Administrator of the National Aeronautics and Space Administration. - * All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file osapi-mutex-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov - * - */ - -#include -#include -#include -#include - -#include "utstubs.h" - -#include "os-shared-mutex.h" - -/* -** Mutex API -*/ - -UT_DEFAULT_STUB(OS_MutSemCreate_Impl, (const OS_object_token_t *token, uint32 options)) -UT_DEFAULT_STUB(OS_MutSemGive_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_MutSemTake_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_MutSemDelete_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_MutSemGetInfo_Impl, (const OS_object_token_t *token, OS_mut_sem_prop_t *mut_prop)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-network-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-network-impl-stubs.c deleted file mode 100644 index f797457e7..000000000 --- a/src/unit-test-coverage/ut-stubs/src/osapi-network-impl-stubs.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" - * - * Copyright (c) 2019 United States Government as represented by - * the Administrator of the National Aeronautics and Space Administration. - * All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file osapi-network-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov - * - */ - -#include -#include -#include -#include - -#include "utstubs.h" -#include "os-shared-network.h" -#include "os-shared-sockets.h" - -/* - * Sockets API abstraction layer - */ -UT_DEFAULT_STUB(OS_SocketOpen_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_SocketClose_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_SocketBind_Impl, (const OS_object_token_t *token, const OS_SockAddr_t *Addr)) -UT_DEFAULT_STUB(OS_SocketAccept_Impl, (const OS_object_token_t *sock_token, const OS_object_token_t *conn_token, - OS_SockAddr_t *Addr, int32 timeout)) -UT_DEFAULT_STUB(OS_SocketConnect_Impl, (const OS_object_token_t *token, const OS_SockAddr_t *Addr, int32 timeout)) -UT_DEFAULT_STUB(OS_SocketRecvFrom_Impl, - (const OS_object_token_t *token, void *buffer, size_t buflen, OS_SockAddr_t *RemoteAddr, int32 timeout)) -UT_DEFAULT_STUB(OS_SocketSendTo_Impl, - (const OS_object_token_t *token, const void *buffer, size_t buflen, const OS_SockAddr_t *RemoteAddr)) -UT_DEFAULT_STUB(OS_SocketGetInfo_Impl, (const OS_object_token_t *token, OS_socket_prop_t *sock_prop)) - -UT_DEFAULT_STUB(OS_SocketAddrInit_Impl, (OS_SockAddr_t * Addr, OS_SocketDomain_t Domain)) -UT_DEFAULT_STUB(OS_SocketAddrToString_Impl, (char *buffer, size_t buflen, const OS_SockAddr_t *Addr)) -UT_DEFAULT_STUB(OS_SocketAddrGetPort_Impl, (uint16 * PortNum, const OS_SockAddr_t *Addr)) -UT_DEFAULT_STUB(OS_SocketAddrFromString_Impl, (OS_SockAddr_t * Addr, const char *string)) -UT_DEFAULT_STUB(OS_SocketAddrSetPort_Impl, (OS_SockAddr_t * Addr, uint16 PortNum)) -UT_DEFAULT_STUB(OS_NetworkGetHostName_Impl, (char *host_name, size_t name_len)) - -int32 OS_NetworkGetID_Impl(int32 *IdBuf) -{ - int32 Status = UT_DEFAULT_IMPL(OS_NetworkGetID_Impl); - if (Status == 0) - { - *IdBuf = 42; - } - return Status; -} diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c deleted file mode 100644 index 238a8831f..000000000 --- a/src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" - * - * Copyright (c) 2019 United States Government as represented by - * the Administrator of the National Aeronautics and Space Administration. - * All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file osapi-queue-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov - * - */ - -#include -#include -#include -#include - -#include "utstubs.h" - -#include "os-shared-queue.h" - -/* -** Message Queue API -*/ - -UT_DEFAULT_STUB(OS_QueueCreate_Impl, (const OS_object_token_t *token, uint32 flags)) -UT_DEFAULT_STUB(OS_QueueDelete_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_QueueGet_Impl, - (const OS_object_token_t *token, void *data, size_t size, size_t *size_copied, int32 timeout)) -UT_DEFAULT_STUB(OS_QueuePut_Impl, (const OS_object_token_t *token, const void *data, size_t size, uint32 flags)) -UT_DEFAULT_STUB(OS_QueueGetInfo_Impl, (const OS_object_token_t *token, OS_queue_prop_t *queue_prop)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-select-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-select-impl-stubs.c deleted file mode 100644 index 4b8cff505..000000000 --- a/src/unit-test-coverage/ut-stubs/src/osapi-select-impl-stubs.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" - * - * Copyright (c) 2019 United States Government as represented by - * the Administrator of the National Aeronautics and Space Administration. - * All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file osapi-select-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov - * - */ - -#include -#include -#include -#include - -#include "utstubs.h" -#include "os-shared-select.h" - -int32 OS_SelectSingle_Impl(const OS_object_token_t *token, uint32 *SelectFlags, int32 msecs) -{ - UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectSingle_Impl), token); - UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectSingle_Impl), SelectFlags); - UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectSingle_Impl), msecs); - - return UT_DEFAULT_IMPL(OS_SelectSingle_Impl); -} - -int32 OS_SelectMultiple_Impl(OS_FdSet *ReadSet, OS_FdSet *WriteSet, int32 msecs) -{ - UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectMultiple_Impl), ReadSet); - UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectMultiple_Impl), WriteSet); - UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectMultiple_Impl), msecs); - - return UT_DEFAULT_IMPL(OS_SelectMultiple_Impl); -} diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-error-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-shared-error-impl-table-stubs.c similarity index 100% rename from src/unit-test-coverage/ut-stubs/src/osapi-error-impl-stubs.c rename to src/unit-test-coverage/ut-stubs/src/osapi-shared-error-impl-table-stubs.c diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-shared-idmap-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-shared-idmap-table-stubs.c similarity index 100% rename from src/unit-test-coverage/ut-stubs/src/osapi-shared-idmap-stubs.c rename to src/unit-test-coverage/ut-stubs/src/osapi-shared-idmap-table-stubs.c diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-task-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-task-impl-stubs.c deleted file mode 100644 index fd3dd43d2..000000000 --- a/src/unit-test-coverage/ut-stubs/src/osapi-task-impl-stubs.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" - * - * Copyright (c) 2019 United States Government as represented by - * the Administrator of the National Aeronautics and Space Administration. - * All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file osapi-task-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov - * - */ - -#include -#include -#include -#include - -#include "utstubs.h" - -#include "os-shared-task.h" -#include "osapi-idmap.h" - -/* -** Task API -*/ -UT_DEFAULT_STUB(OS_TaskMatch_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_TaskDetach_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_TaskCreate_Impl, (const OS_object_token_t *token, uint32 flags)) -UT_DEFAULT_STUB(OS_TaskDelete_Impl, (const OS_object_token_t *token)) -void OS_TaskExit_Impl(void) -{ - UT_DEFAULT_IMPL(OS_TaskExit_Impl); -} - -UT_DEFAULT_STUB(OS_TaskDelay_Impl, (uint32 millisecond)) -UT_DEFAULT_STUB(OS_TaskSetPriority_Impl, (const OS_object_token_t *token, osal_priority_t new_priority)) -osal_id_t OS_TaskGetId_Impl(void) -{ - int32 status; - osal_id_t id; - - status = UT_DEFAULT_IMPL_RC(OS_TaskGetId_Impl, 1); - - /* convert the int32 status value to an osal_id_t - - * (this assumes the types are compatible) */ - id = OS_ObjectIdFromInteger(status); - - return id; -} -UT_DEFAULT_STUB(OS_TaskGetInfo_Impl, (const OS_object_token_t *token, OS_task_prop_t *task_prop)) -UT_DEFAULT_STUB(OS_TaskRegister_Impl, (osal_id_t global_task_id)) - -bool OS_TaskIdMatchSystemData_Impl(void *ref, const OS_object_token_t *token, const OS_common_record_t *obj) -{ - return UT_DEFAULT_IMPL(OS_TaskIdMatchSystemData_Impl); -} - -UT_DEFAULT_STUB(OS_TaskValidateSystemData_Impl, (const void *sysdata, size_t sysdata_size)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c deleted file mode 100644 index f04c150ca..000000000 --- a/src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer" - * - * Copyright (c) 2019 United States Government as represented by - * the Administrator of the National Aeronautics and Space Administration. - * All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file osapi-timer-impl-stubs.c - * \ingroup ut-stubs - * \author joseph.p.hickey@nasa.gov - * - */ - -#include -#include -#include -#include - -#include "utstubs.h" -#include "os-shared-timebase.h" -#include "os-shared-clock.h" - -/* -** OS Time/Tick related API -*/ -UT_DEFAULT_STUB(OS_TimeBaseCreate_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_TimeBaseSet_Impl, (const OS_object_token_t *token, uint32 start_time, uint32 interval_time)) -UT_DEFAULT_STUB(OS_TimeBaseDelete_Impl, (const OS_object_token_t *token)) -void OS_TimeBaseLock_Impl(const OS_object_token_t *token) -{ - UT_DEFAULT_IMPL(OS_TimeBaseLock_Impl); -} - -void OS_TimeBaseUnlock_Impl(const OS_object_token_t *token) -{ - UT_DEFAULT_IMPL(OS_TimeBaseUnlock_Impl); -} - -UT_DEFAULT_STUB(OS_TimeBaseGetInfo_Impl, (const OS_object_token_t *token, OS_timebase_prop_t *timer_prop)) - -/* - * Clock API low-level handlers - */ -UT_DEFAULT_STUB(OS_GetLocalTime_Impl, (OS_time_t * time_struct)) -UT_DEFAULT_STUB(OS_SetLocalTime_Impl, (const OS_time_t *time_struct)) diff --git a/src/unit-test-coverage/vxworks/CMakeLists.txt b/src/unit-test-coverage/vxworks/CMakeLists.txt index ec994c992..b97b2edd1 100644 --- a/src/unit-test-coverage/vxworks/CMakeLists.txt +++ b/src/unit-test-coverage/vxworks/CMakeLists.txt @@ -52,7 +52,9 @@ set(VXWORKS_COVERAGE_LINK_LIST ut_vxworks_impl_stubs ut_bsp_impl_stubs ut_osapi_impl_stubs + ut_osapi_init_stubs ut_osapi_shared_stubs + ut_osapi_table_stubs ut_osapi_stubs ut_libc_stubs )