Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast Track for Integration Candidate 2020-06-10 #513

Merged
merged 5 commits into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@ This distribution contains:
### Development Build: 5.0.20
- Add "non-zero" to the out variable description for OS_Create (and related) API's.
- Increases the buffer for context info from 128 to 256 bytes and the total report buffer to 320 bytes.
- Add stub functions for `OS_TaskFindIdBySystemData()`, `OS_FileSysAddFixedMap()`,
`OS_TimedRead()`, `OS_TimedWrite()`, and `OS_FileSysAddFixedMap()`
- See <https://github.com/nasa/osal/pull/511>
- Add stub functions for `OS_TaskFindIdBySystemData()`, `OS_FileSysAddFixedMap()`, `OS_TimedRead()`, `OS_TimedWrite()`, and `OS_FileSysAddFixedMap()`
- Added the following wrappers macros around `UtAssert_True` for commonly-used asserts:
- `UtAssert_INT32_EQ` - check equality as 32 bit signed int
- `UtAssert_UINT32_EQ` - check equality as 32 bit unsigned int
- `UtAssert_NOT_NULL` - check pointer not null
- `UtAssert_NULL` - check pointer is null
- `UtAssert_NONZERO` - check integer is nonzero
- `UtAssert_ZERO` - check integer is zero
- `UtAssert_STUB_COUNT` - check stub count
- Using `unsigned long` instead of `uintmax_t` to fix support for VxWorks

- See <https://github.com/nasa/osal/pull/511> and <https://github.com/nasa/osal/pull/513>

### Development Build: 5.0.19

Expand Down
78 changes: 78 additions & 0 deletions ut_assert/inc/utassert.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,84 @@ typedef struct
#define UtAssert_Type(Type,Expression,...) \
UtAssertEx(Expression, UTASSERT_CASETYPE_##Type, __FILE__, __LINE__, __VA_ARGS__)

/**
* \brief Compare two values for equality with an auto-generated description message
* Values will be compared in an "int32" type context.
*/
#define UtAssert_INT32_EQ(actual,expect) do \
{ \
int32 rcexp = (int32)(expect); \
int32 rcact = (int32)(actual); \
UtAssert_True(rcact == rcexp, "%s (%ld) == %s (%ld)", \
#actual, (long)rcact, \
#expect, (long)rcexp); \
} while(0)

/**
* \brief Compare two values for equality with an auto-generated description message
* Values will be compared in an "uint32" type context.
*/
#define UtAssert_UINT32_EQ(actual,expect) do \
{ \
uint32 rcexp = (uint32)(expect); \
uint32 rcact = (uint32)(actual); \
UtAssert_True(rcact == rcexp, "%s (%lu) == %s (%lu)", \
#actual, (unsigned long)rcact, \
#expect, (unsigned long)rcexp); \
} while(0)

/**
* \brief Confirm a pointer value is not NULL
*/
#define UtAssert_NOT_NULL(actual) do \
{ \
void* ptr = (void*)(actual); \
UtAssert_True(ptr != NULL, "%s (%p) != NULL", \
#actual, ptr); \
} while(0)

/**
* \brief Confirm a pointer value is NULL
*/
#define UtAssert_NULL(actual) do \
{ \
void* ptr = (void*)(actual); \
UtAssert_True(ptr == NULL, "%s (%p) == NULL", \
#actual, ptr); \
} while(0)

/**
* \brief Confirm an integer value is nonzero
*/
#define UtAssert_NONZERO(actual) do \
{ \
long val = (long)(actual); \
UtAssert_True(val != 0, "%s (%ld) != 0", \
#actual, val); \
} while(0)

/**
* \brief Confirm an integer value is nonzero
*/
#define UtAssert_ZERO(actual) do \
{ \
long val = (long)(actual); \
UtAssert_True(val == 0, "%s (%ld) == 0", \
#actual, val); \
} while(0)

/**
* \brief Confirm that a stub function has been invoked the expected number of times
*/
#define UtAssert_STUB_COUNT(stub,expected) do \
{ \
uint32 expval = (uint32)(expected); \
uint32 actval = UT_GetStubCount(UT_KEY(stub)); \
UtAssert_True(actval == expval, "%s() count (%lu) == %s (%lu)", \
#stub, (unsigned long)actval, \
#expected, (unsigned long)expval); \
} while(0)

/*
* Exported Functions
*/
Expand Down
2 changes: 1 addition & 1 deletion ut_assert/src/utstubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ const void* UT_Hook_GetArgPtr(const UT_StubContext_t *ContextPtr, const char *Na

static const union
{
uintmax_t AsInt;
unsigned long AsInt;
void *AsPtr;
double AsFloat;
} ARG_DEFAULT_ZERO_VALUE = { 0 };
Expand Down