Skip to content

Commit 4a84f6f

Browse files
maribumguetschow
andcommitted
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 <[email protected]>
1 parent 3415656 commit 4a84f6f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

tests/sys/snprintf/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ include ../Makefile.sys_common
44
# to compile due to PRI*64 macros not being defined
55
FEATURES_BLACKLIST := arch_avr8
66

7+
# This enables support for printing 64 bit numbers. You can comment this out
8+
# to shrink the test app. The test will skip the corresponding test
9+
# automatically if printf_long_long is not used.
10+
USEMODULE += printf_long_long
11+
712
include $(RIOTBASE)/Makefile.include

tests/sys/snprintf/main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include <string.h>
2828
#include <unistd.h>
2929

30+
#include "modules.h"
31+
3032
static bool failed = false;
3133

3234
static void check(const char *expected, const char *got, int retval)
@@ -277,7 +279,12 @@ int main(void)
277279
test_int8();
278280
test_int16();
279281
test_int32();
280-
test_int64();
282+
if (IS_USED(MODULE_PRINTF_LONG_LONG)) {
283+
test_int64();
284+
}
285+
else {
286+
puts("WARNING: Module printf_long_long not used, skipping test for 64 bit");
287+
}
281288
test_size();
282289
test_flags_widths();
283290

0 commit comments

Comments
 (0)