From 4a84f6f58e47c330c813a5eba5ab6efe45d6c64c Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Thu, 21 Aug 2025 10:35:46 +0200 Subject: [PATCH] tests/sys/snprintf: use printf_long_long This is required to support printing 64 bit numbers, as is done in the test. In addition that 64 bit formatting test is feature gated, so that users can simply comment out the `USEMODULE += printf_long_long` to fit tiny boards. Co-authored-by: mguetschow --- tests/sys/snprintf/Makefile | 5 +++++ tests/sys/snprintf/main.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/sys/snprintf/Makefile b/tests/sys/snprintf/Makefile index d5e587b491..db6f70cd75 100644 --- a/tests/sys/snprintf/Makefile +++ b/tests/sys/snprintf/Makefile @@ -4,4 +4,9 @@ include ../Makefile.sys_common # to compile due to PRI*64 macros not being defined FEATURES_BLACKLIST := arch_avr8 +# This enables support for printing 64 bit numbers. You can comment this out +# to shrink the test app. The test will skip the corresponding test +# automatically if printf_long_long is not used. +USEMODULE += printf_long_long + include $(RIOTBASE)/Makefile.include diff --git a/tests/sys/snprintf/main.c b/tests/sys/snprintf/main.c index bf9b338867..29a61f2586 100644 --- a/tests/sys/snprintf/main.c +++ b/tests/sys/snprintf/main.c @@ -27,6 +27,8 @@ #include #include +#include "modules.h" + static bool failed = false; static void check(const char *expected, const char *got, int retval) @@ -277,7 +279,12 @@ int main(void) test_int8(); test_int16(); test_int32(); - test_int64(); + if (IS_USED(MODULE_PRINTF_LONG_LONG)) { + test_int64(); + } + else { + puts("WARNING: Module printf_long_long not used, skipping test for 64 bit"); + } test_size(); test_flags_widths();