From cbf6a2781090f0a21253e725f7bfa7528262d084 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Tue, 26 Aug 2025 18:04:56 +0100 Subject: [PATCH] tests: parameterize IO_BUFSIZE * src/getlimits.c (main): Output IO_BUFSIZE, useful for sizing data for tests. * tests/fold/fold-characters.sh: Use it rather than hardcoding. --- src/getlimits.c | 4 ++++ tests/fold/fold-characters.sh | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/getlimits.c b/src/getlimits.c index 7c902bc1d9..1cd10a6e98 100644 --- a/src/getlimits.c +++ b/src/getlimits.c @@ -23,6 +23,7 @@ #include "ftoastr.h" #include "system.h" +#include "ioblksize.h" #include "long-options.h" #define PROGRAM_NAME "getlimits" @@ -168,5 +169,8 @@ main (int argc, char **argv) print_float (DBL); print_float (LDBL); + /* Other useful constants */ + printf ("IO_BUFSIZE=%ju\n", (uintmax_t) IO_BUFSIZE); + return EXIT_SUCCESS; } diff --git a/tests/fold/fold-characters.sh b/tests/fold/fold-characters.sh index be17d80be1..7de718450c 100755 --- a/tests/fold/fold-characters.sh +++ b/tests/fold/fold-characters.sh @@ -18,6 +18,7 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ fold printf +getlimits_ test "$LOCALE_FR_UTF8" != none || skip_ "French UTF-8 locale not available" @@ -60,7 +61,9 @@ compare character-exp2 character-out2 || fail=1 # Test a Unicode character on the edge of the input buffer. # Keep in sync with IO_BUFSIZE - 1. -yes a | head -n 262143 | tr -d '\n' > input3 || framework_failure_ +IO_BUFSIZE_MINUS_1=$(($IO_BUFSIZE - 1)) +test $IO_BUFSIZE_MINUS_1 -gt 0 || framework_failure_ +yes a | head -n $IO_BUFSIZE_MINUS_1 | tr -d '\n' > input3 || framework_failure_ env printf '\uB250' >> input3 || framework_failure_ yes a | head -n 100 | tr -d '\n' >> input3 || framework_failure_ env printf '\n' >> input3 || framework_failure_ -- 2.47.3