diff --git a/tests/misc/sleep.sh b/tests/misc/sleep.sh index c20ce011f..b5934d806 100755 --- a/tests/misc/sleep.sh +++ b/tests/misc/sleep.sh @@ -17,7 +17,7 @@ # along with this program. If not, see . . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -print_ver_ sleep +print_ver_ sleep printf getlimits_ # invalid timeouts @@ -39,4 +39,17 @@ returns_ 124 timeout 0.1 sleep 1d 2h 3m 4s || fail=1 returns_ 124 timeout 0.1 sleep inf || fail=1 returns_ 124 timeout 0.1 sleep $LDBL_MAX || fail=1 +# Test locale decimal handling for printf, sleep, timeout +: ${LOCALE_FR_UTF8=none} +if test "$LOCALE_FR_UTF8" != "none"; then + f=$LOCALE_FR_UTF8 + locale_decimal=$(LC_ALL=$f env printf '%0.3f' 0.001) || fail=1 + locale_decimal=$(LC_ALL=$f env printf '%0.3f' "$locale_decimal") || fail=1 + case "$locale_decimal" in + 0?001) + LC_ALL=$f timeout 1$locale_decimal sleep "$locale_decimal" || fail=1 ;; + *) fail=1 ;; + esac +fi + Exit $fail