Issues/issue 593 update to zephyr v3 6 0 (#601)

* [WIP] update manifest to zephyr v3.6.0

* [WIP] Deprecated ZTEST_NEW_API adjustments

Zephyr v3.6.0 removed Kconfig ZTEST_NEW_API.
The old ZTEST API is still used by non-Zephyr builds,
so the config setting is moved from `prj.conf` to
the test's CMakeLists.txt as `add_compile_definitions()`.

Verified by:

1. make clean all test

2. ./zephyr/scripts/twister -p unit_testing \
        -T bacnet-stack/zephyr/tests/

---------

Co-authored-by: Gregory Shue <gregory.shue@legrand.com>
This commit is contained in:
Greg Shue
2024-03-15 08:29:05 -07:00
committed by GitHub
parent f0760e2b96
commit 78f7340266
160 changed files with 293 additions and 76 deletions
@@ -19,7 +19,11 @@
/**
* @brief Test Calendar handling
*/
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_calendar, testCalendar)
#else
static void testCalendar(void)
#endif
{
uint8_t apdu[MAX_APDU] = { 0 };
int len = 0, test_len = 0;
@@ -123,7 +127,11 @@ static void testCalendar(void)
zassert_true(status, NULL);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_calendar, testPresentValue)
#else
static void testPresentValue(void)
#endif
{
const uint32_t instance = 1;
BACNET_DATE date;
@@ -228,6 +236,9 @@ static void testPresentValue(void)
* @}
*/
#ifdef CONFIG_ZTEST_NEW_API
ZTEST_SUITE(bacnet_calendar, NULL, NULL, NULL, NULL, NULL);
#else
void test_main(void)
{
ztest_test_suite(calendar_tests,
@@ -237,3 +248,4 @@ void test_main(void)
ztest_run_test_suite(calendar_tests);
}
#endif
@@ -19,7 +19,11 @@
/**
* @brief Test Time Value handling
*/
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_tv, testTimeValue)
#else
static void testTimeValue(void)
#endif
{
uint8_t apdu[MAX_APDU] = { 0 };
int len = 0, test_len = 0;
@@ -131,6 +135,9 @@ static void testTimeValue(void)
* @}
*/
#ifdef CONFIG_ZTEST_NEW_API
ZTEST_SUITE(bacnet_tv, NULL, NULL, NULL, NULL, NULL);
#else
void test_main(void)
{
ztest_test_suite(tv_tests,
@@ -139,3 +146,4 @@ void test_main(void)
ztest_run_test_suite(tv_tests);
}
#endif
+4
View File
@@ -602,7 +602,11 @@ static void testDatetimeConvertUTCSpecific(BACNET_DATE_TIME *utc_time,
local_time->time.hundredths, test_local_time.time.hundredths, NULL);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_datetime, testDatetimeConvertUTC)
#else
static void testDatetimeConvertUTC(void)
#endif
{
BACNET_DATE_TIME local_time;
BACNET_DATE_TIME utc_time;
+12
View File
@@ -149,7 +149,11 @@ static int decode_enumerated_custom_fake(
* Tests:
*/
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_bacerror_encode_apdu)
#else
static void test_bacerror_encode_apdu(void)
#endif
{
uint8_t test_apdu[32] = { 0 };
@@ -358,7 +362,11 @@ static void test_bacerror_encode_apdu(void)
}
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacerror, test_bacerror_decode_error_class_and_code)
#else
static void test_bacerror_decode_error_class_and_code(void)
#endif
{
#if !BACNET_SVC_SERVER
uint8_t test_apdu[32] = { 0 };
@@ -1118,6 +1126,9 @@ static void test_bacerror_decode_error_class_and_code(void)
#endif
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST_SUITE(bacnet_error, NULL, NULL, NULL, NULL, NULL);
#else
void test_main(void)
{
ztest_test_suite(bacnet_bacerror,
@@ -1125,3 +1136,4 @@ void test_main(void)
ztest_unit_test(test_bacerror_decode_error_class_and_code));
ztest_run_test_suite(bacnet_bacerror);
}
#endif
+56
View File
@@ -10,7 +10,11 @@
#include <string.h> // for memset(), memcpy
#include <limits.h>
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_unsigned16)
#else
static void test_unsigned16(void)
#endif
{
uint8_t apdu[8] = { 0 };
uint8_t test_apdu[8] = { 0 };
@@ -80,7 +84,11 @@ static void test_unsigned16(void)
zassert_equal(test_value, value, NULL);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_unsigned24)
#else
static void test_unsigned24(void)
#endif
{
uint8_t apdu[8] = { 0 };
uint8_t test_apdu[8] = { 0 };
@@ -154,7 +162,11 @@ static void test_unsigned24(void)
zassert_equal(test_value, value, NULL);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_unsigned32)
#else
static void test_unsigned32(void)
#endif
{
uint8_t apdu[8] = { 0 };
uint8_t test_apdu[8] = { 0 };
@@ -232,7 +244,11 @@ static void test_unsigned32(void)
zassert_equal(test_value, value, NULL);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_unsigned40)
#else
static void test_unsigned40(void)
#endif
{
#ifdef UINT64_MAX
uint8_t apdu[12] = { 0 };
@@ -322,7 +338,11 @@ static void test_unsigned40(void)
#endif /* defined(UINT64_MAX) */
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_unsigned48)
#else
static void test_unsigned48(void)
#endif
{
#ifdef UINT64_MAX
uint8_t apdu[12] = { 0 };
@@ -416,7 +436,11 @@ static void test_unsigned48(void)
#endif /* defined(UINT64_MAX) */
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_unsigned56)
#else
static void test_unsigned56(void)
#endif
{
#ifdef UINT64_MAX
uint8_t apdu[12] = { 0 };
@@ -514,7 +538,11 @@ static void test_unsigned56(void)
#endif /* defined(UINT64_MAX) */
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_unsigned64)
#else
static void test_unsigned64(void)
#endif
{
#ifdef UINT64_MAX
uint8_t apdu[12] = { 0 };
@@ -616,7 +644,11 @@ static void test_unsigned64(void)
#endif /* defined(UINT64_MAX) */
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_unsigned_length)
#else
static void test_unsigned_length(void)
#endif
{
zassert_equal(1, bacnet_unsigned_length(0), NULL);
zassert_equal(1, bacnet_unsigned_length(0x7EUL), NULL);
@@ -660,7 +692,11 @@ static void test_unsigned_length(void)
#endif
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_signed8)
#else
static void test_signed8(void)
#endif
{
#if BACNET_USE_SIGNED
uint8_t apdu[8] = { 0 };
@@ -734,7 +770,11 @@ static void test_signed8(void)
#endif /* BACNET_USE_SIGNED */
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_signed16)
#else
static void test_signed16(void)
#endif
{
#if BACNET_USE_SIGNED
uint8_t apdu[8] = { 0 };
@@ -808,7 +848,11 @@ static void test_signed16(void)
#endif /* BACNET_USE_SIGNED */
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_signed24)
#else
static void test_signed24(void)
#endif
{
#if BACNET_USE_SIGNED
uint8_t apdu[8] = { 0 };
@@ -886,7 +930,11 @@ static void test_signed24(void)
#endif /* BACNET_USE_SIGNED */
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_signed32)
#else
static void test_signed32(void)
#endif
{
#if BACNET_USE_SIGNED
uint8_t apdu[8] = { 0 };
@@ -968,7 +1016,11 @@ static void test_signed32(void)
#endif /* BACNET_USE_SIGNED */
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bacint, test_signed_length)
#else
static void test_signed_length(void)
#endif
{
#if BACNET_USE_SIGNED
const int32_t sint24_max = 0x7FFFFFL;
@@ -1000,6 +1052,9 @@ static void test_signed_length(void)
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST_SUITE(bacnet_bacint, NULL, NULL, NULL, NULL, NULL);
#else
void test_main(void)
{
ztest_test_suite(bacnet_bacint,
@@ -1019,3 +1074,4 @@ void test_main(void)
);
ztest_run_test_suite(bacnet_bacint);
}
#endif
+44
View File
@@ -25,7 +25,11 @@
* verify support for ULL.
*/
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bits, test_BIT)
#else
static void test_BIT(void)
#endif
{
unsigned int bitpos = sizeof(unsigned int) * 8;
@@ -35,7 +39,11 @@ static void test_BIT(void)
} while (bitpos > 0);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bits, test__BV)
#else
static void test__BV(void)
#endif
{
unsigned int bitpos = sizeof(unsigned int) * 8;
@@ -45,7 +53,11 @@ static void test__BV(void)
} while (bitpos > 0);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bits, test_BIT_SET)
#else
static void test_BIT_SET(void)
#endif
{
unsigned int bitpos = sizeof(unsigned int) * 8;
@@ -57,7 +69,11 @@ static void test_BIT_SET(void)
} while (bitpos > 0);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bits, test_BIT_CLEAR)
#else
static void test_BIT_CLEAR(void)
#endif
{
unsigned int bitpos = sizeof(unsigned int) * 8;
@@ -69,7 +85,11 @@ static void test_BIT_CLEAR(void)
} while (bitpos > 0);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bits, test_BIT_FLIP)
#else
static void test_BIT_FLIP(void)
#endif
{
unsigned int bitpos = sizeof(unsigned int) * 8;
@@ -90,7 +110,11 @@ static void test_BIT_FLIP(void)
} while (bitpos > 0);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bits, test_BIT_CHECK)
#else
static void test_BIT_CHECK(void)
#endif
{
unsigned int bitpos = sizeof(unsigned int) * 8;
@@ -105,7 +129,11 @@ static void test_BIT_CHECK(void)
} while (bitpos > 0);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bits, test_BITMASK_SET)
#else
static void test_BITMASK_SET(void)
#endif
{
unsigned int bitpos = sizeof(unsigned int) * 8;
@@ -117,7 +145,11 @@ static void test_BITMASK_SET(void)
} while (bitpos > 0);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bits, test_BITMASK_CLEAR)
#else
static void test_BITMASK_CLEAR(void)
#endif
{
unsigned int bitpos = sizeof(unsigned int) * 8;
@@ -129,7 +161,11 @@ static void test_BITMASK_CLEAR(void)
} while (bitpos > 0);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bits, test_BITMASK_FLIP)
#else
static void test_BITMASK_FLIP(void)
#endif
{
unsigned int bitpos = sizeof(unsigned int) * 8;
@@ -150,7 +186,11 @@ static void test_BITMASK_FLIP(void)
} while (bitpos > 0);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_bits, test_BITMASK_CHECK)
#else
static void test_BITMASK_CHECK(void)
#endif
{
unsigned int bitpos = sizeof(unsigned int) * 8;
@@ -165,6 +205,9 @@ static void test_BITMASK_CHECK(void)
} while (bitpos > 0);
}
#ifdef CONFIG_ZTEST_NEW_API
ZTEST_SUITE(bacnet_bits, NULL, NULL, NULL, NULL, NULL);
#else
void test_main(void)
{
ztest_test_suite(bacnet_bits,
@@ -181,3 +224,4 @@ void test_main(void)
);
ztest_run_test_suite(bacnet_bits);
}
#endif