From df83fe12f3d60cd2b6183125a6d01ebb583bbfe6 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 16 Apr 2021 11:41:06 -0400 Subject: [PATCH 1/2] Fix #59, replace direct ref to ArgPtr with macro The UT_Hook_GetArgValueByName macro provided by UT assert is the preferred way to get an argument in the current version. Reading the pointer directly is not advised as it depends on how the stub was actually implemented, whereas the macro should produce consistent results. --- unit-test/coveragetest/coveragetest_sample_lib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/unit-test/coveragetest/coveragetest_sample_lib.c b/unit-test/coveragetest/coveragetest_sample_lib.c index 08d0a28..4c8030d 100644 --- a/unit-test/coveragetest/coveragetest_sample_lib.c +++ b/unit-test/coveragetest/coveragetest_sample_lib.c @@ -68,7 +68,8 @@ typedef struct static int32 UT_printf_hook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context, va_list va) { - SAMPLE_LIB_Function_TestState_t *State = UserObj; + SAMPLE_LIB_Function_TestState_t *State = UserObj; + const char * string = UT_Hook_GetArgValueByName(Context, "string", const char *); /* * The OS_printf() stub passes format string as the argument @@ -76,7 +77,7 @@ static int32 UT_printf_hook(void *UserObj, int32 StubRetcode, uint32 CallCount, * detail would not be needed, but this serves as an example * of how it can be done. */ - if (Context->ArgCount > 0 && strcmp(Context->ArgPtr[0], "SAMPLE_LIB_Function called, buffer=\'%s\'\n") == 0) + if (Context->ArgCount > 0 && strcmp(string, "SAMPLE_LIB_Function called, buffer=\'%s\'\n") == 0) { State->format_string_valid = true; From a571b067e3057d8e4ce9dc1a910f3a21f230451a Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Wed, 28 Apr 2021 18:09:21 -0400 Subject: [PATCH 2/2] IC:2021-04-27, Bump to v1.2.0-rc1+dev34 --- README.md | 5 +++++ fsw/src/sample_lib_version.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 50f89a8..34e155f 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,11 @@ sample_lib implements SAMPLE_Function, as an example for how to build and link a ## Version History +### Development Build: v1.2.0-rc1+dev34 + +- Replace direct ref to ArgPtr with `UT_Hook_GetArgValueByName` macro. Reading the pointer directly is not advised. +- See and + ### Development Build: v1.2.0-rc1+dev30 - Replace <> with " for local includes diff --git a/fsw/src/sample_lib_version.h b/fsw/src/sample_lib_version.h index 47296d1..766b4e5 100644 --- a/fsw/src/sample_lib_version.h +++ b/fsw/src/sample_lib_version.h @@ -32,7 +32,7 @@ /* Development Build Macro Definitions */ -#define SAMPLE_LIB_BUILD_NUMBER 30 /*!< Development Build: Number of commits since baseline */ +#define SAMPLE_LIB_BUILD_NUMBER 34 /*!< Development Build: Number of commits since baseline */ #define SAMPLE_LIB_BUILD_BASELINE \ "v1.2.0-rc1" /*!< Development Build: git tag that is the base for the current development */