From e0b5d630215f5ac8d63fa1f17af2b1f653ba87ae Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Tue, 13 Jun 2023 22:01:29 +0200 Subject: [PATCH 1/2] tests/unittests: improve int size detection Deduce from the value of `INT_MAX` whether `int` is 16 bit or 32 bit, rather than check CPU names. --- tests/unittests/common/unittests-constants.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/unittests/common/unittests-constants.h b/tests/unittests/common/unittests-constants.h index e36e2ceac7..5d5a730624 100644 --- a/tests/unittests/common/unittests-constants.h +++ b/tests/unittests/common/unittests-constants.h @@ -8,6 +8,9 @@ #ifndef UNITTESTS_CONSTANTS_H #define UNITTESTS_CONSTANTS_H +#include +#include + #include "embUnit/embUnit.h" #ifdef __cplusplus @@ -55,7 +58,7 @@ extern "C" { #define TEST_UINT64 (13500266397057512199LLU) #endif -#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ) || defined(CPU_ATMEGA2560) +#if INT_MAX == INT16_MAX #define TEST_INT TEST_INT16 #else #define TEST_INT TEST_INT32 From ee79bb7d68129f3010e84d8c13d967a4c403c466 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Tue, 13 Jun 2023 22:10:50 +0200 Subject: [PATCH 2/2] tests: update tests for MSP430 CPU Using the builtin `__MSP430__` macro is fool-proof and stable even if one would try to rename and reorganize the MSP430 cpu code. --- tests/drivers/mtd_flashpage/main.c | 2 +- tests/periph/flashpage/main.c | 4 ++-- tests/sys/senml_phydat/main.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/drivers/mtd_flashpage/main.c b/tests/drivers/mtd_flashpage/main.c index 1ed470252b..c9f27fa788 100644 --- a/tests/drivers/mtd_flashpage/main.c +++ b/tests/drivers/mtd_flashpage/main.c @@ -21,7 +21,7 @@ /* For MSP430 cpu's the last page holds the interrupt vector, although the api should not limit erasing that page, we don't want to break when testing */ -#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ) +#ifdef __MSP430__ #define LAST_AVAILABLE_PAGE (FLASHPAGE_NUMOF - 2) #else #define LAST_AVAILABLE_PAGE (FLASHPAGE_NUMOF - 1) diff --git a/tests/periph/flashpage/main.c b/tests/periph/flashpage/main.c index 6f8e92d12b..d152b305a4 100644 --- a/tests/periph/flashpage/main.c +++ b/tests/periph/flashpage/main.c @@ -341,7 +341,7 @@ static int cmd_test_last(int argc, char **argv) fill = 'a'; } } -#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ) +#ifdef __MSP430__ printf("The last page holds the ISR vector, so test page %u\n", last_free); #endif if (flashpage_write_and_verify(last_free, page_mem) != FLASHPAGE_OK) { @@ -427,7 +427,7 @@ static int cmd_test_last_raw(int argc, char **argv) /* try to align */ memcpy(raw_buf, "test12344321tset", 16); -#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ) +#ifdef __MSP430__ printf("The last page holds the ISR vector, so test page %u\n", last_free); #endif diff --git a/tests/sys/senml_phydat/main.c b/tests/sys/senml_phydat/main.c index ef2217a852..56fb90bf66 100644 --- a/tests/sys/senml_phydat/main.c +++ b/tests/sys/senml_phydat/main.c @@ -157,7 +157,7 @@ Test *tests_senml(void) { EMB_UNIT_TESTFIXTURES(fixtures) { /* Don't run this test on CPUs with unpredictable rounding */ -#if !defined(__AVR__) && !defined(CPU_MSP430FXYZ) +#if !defined(__AVR__) && !defined(__MSP430__) new_TestFixture(test_phydat_to_senml_float), #endif new_TestFixture(test_phydat_to_senml_decimal),