Issue 187 enable skipped ztest suites (#189)

* Fix some ztests that were skipped

* Expose bacapp_same_value()

* Fix bacapp, ptransfer tests

* Fix bugs in Load_Control object & tests

* refactor days functions from datetime module

* fix legacy ctests

* Add bacnet/basic/sys/days.[ch] to Zephyr build

* Update ztest to match from Zephyr v2.6.0; update ringbuf, datetime to build

* Fixup ztest test for object/acc

* Fix bvlc_address_from_ascii; enable/fix bvlc test

* Comment cleanup

* test/bacnet/basic/object/lc partially enabled

* Fix bacapp_decode_data_len return status on erroneous input

* fix ztest include fatal error

* fix ztest strsignal reference fatal error

* fix zassert_mem_equal reference syntax error

* fix zassert_mem_equal reference syntax error

Co-authored-by: Gregory Shue <gregory.shue@legrand.us>
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Greg Shue
2021-08-16 15:29:40 -07:00
committed by GitHub
parent 541f4024fb
commit 8b8ef8f338
102 changed files with 3178 additions and 1208 deletions
+60 -9
View File
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __TC_UTIL_H__
#define __TC_UTIL_H__
#ifndef ZEPHYR_TESTSUITE_INCLUDE_TC_UTIL_H_
#define ZEPHYR_TESTSUITE_INCLUDE_TC_UTIL_H_
#include <zephyr.h>
@@ -92,6 +92,31 @@ static inline const char *TC_RESULT_TO_STR(int result)
}
}
static uint32_t tc_start_time;
static uint32_t tc_spend_time;
static inline void get_start_time_cyc(void)
{
/* Besides the ztest framework, some testcase will also call
* TC_START() in their code. But the caller thread cannot be
* in userspace.
*/
#if 0
if (!k_is_user_context()) {
tc_start_time = k_cycle_get_32();
}
#endif
}
static inline void test_time_ms(void)
{
#if 0
uint32_t spend_cycle = k_cycle_get_32() - tc_start_time;
tc_spend_time = k_cyc_to_ms_ceil32(spend_cycle);
#endif
}
#ifndef TC_ERROR
#define TC_ERROR(fmt, ...) \
do { \
@@ -105,7 +130,11 @@ static inline const char *TC_RESULT_TO_STR(int result)
#endif
#ifndef TC_START
#define TC_START(name) PRINT_DATA("starting test - %s\n", name)
#define TC_START(name) \
do { \
PRINT_DATA("START - %s\n", name); \
get_start_time_cyc(); \
} while (0)
#endif
#ifndef TC_END
@@ -114,10 +143,13 @@ static inline const char *TC_RESULT_TO_STR(int result)
#ifndef Z_TC_END_RESULT
/* prints result and the function name */
#define Z_TC_END_RESULT(result, func) \
do { \
TC_END(result, "%s - %s\n", TC_RESULT_TO_STR(result), func); \
PRINT_LINE; \
#define Z_TC_END_RESULT(result, func) \
do { \
test_time_ms(); \
TC_END(result, " %s - %s in %u.%u seconds\n", \
TC_RESULT_TO_STR(result), func, tc_spend_time/1000, \
tc_spend_time%1000); \
PRINT_LINE; \
} while (0)
#endif
@@ -126,6 +158,25 @@ static inline const char *TC_RESULT_TO_STR(int result)
Z_TC_END_RESULT((result), __func__)
#endif
#ifndef TC_SUITE_START
#define TC_SUITE_START(name) \
do { \
TC_PRINT("Running test suite %s\n", name); \
PRINT_LINE; \
} while (0)
#endif
#ifndef TC_SUITE_END
#define TC_SUITE_END(name, result) \
do { \
if (result == TC_PASS) { \
TC_PRINT("Test suite %s succeeded\n", name); \
} else { \
TC_PRINT("Test suite %s failed.\n", name); \
} \
} while (0)
#endif
#if defined(CONFIG_ARCH_POSIX)
#define TC_END_POST(result) posix_exit(result)
#else
@@ -157,7 +208,7 @@ static inline const char *TC_RESULT_TO_STR(int result)
#define TC_CMD_ITEM(name) cmd_##name
#else
#define TC_CMD_DEFINE(name) \
int cmd_##name(int argc, char *argv[]) \
int cmd_##name(int argc, char *argv[]) \
{ \
TC_START(__func__); \
name(); \
@@ -167,4 +218,4 @@ static inline const char *TC_RESULT_TO_STR(int result)
#define TC_CMD_ITEM(name) {STRINGIFY(name), cmd_##name, "none"}
#endif
#endif /* __TC_UTIL_H__ */
#endif /* ZEPHYR_TESTSUITE_INCLUDE_TC_UTIL_H_ */