* tests/init.sh (warn_, gl_shell_test_script_): Avoid the use of grep, as that introduces an unwanted dependency. On older systems like Solaris there can be many greps and they can be buggy, so it’s better to not rely on them in a central part of the test harness. --- ChangeLog | 7 +++++++ tests/init.sh | 18 +++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog index feb005dfbe..270fa5168d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2025-09-21 Paul Eggert <[email protected]> + tests: avoid grep in init.sh + * tests/init.sh (warn_, gl_shell_test_script_): + Avoid the use of grep, as that introduces an unwanted dependency. + On older systems like Solaris there can be many greps and they + can be buggy, so it’s better to not rely on them in a central + part of the test harness. + tests: avoid test failure due to rmdir race * tests/init.sh (remove_tmp_): If the rm -rf fails, wait a second and try again. This works around a problem I observed on Solaris diff --git a/tests/init.sh b/tests/init.sh index 1c81eb7537..21a438987b 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -103,7 +103,11 @@ warn_ () case $IFS in ' '*) printf '%s\n' "$*" >&2 test $stderr_fileno_ = 2 \ - || { printf '%s\n' "$*" | sed 1q >&$stderr_fileno_ ; } ;; + || { local args=$* + local firstline=${args%%"$gl_init_sh_nl_"*} + printf '%s\n' "$firstline" >&$stderr_fileno_ + } + ;; *) (IFS=' '; warn_ "$@");; esac } @@ -160,12 +164,12 @@ fi # ? - not ok gl_shell_test_script_=' test $(echo y) = y || exit 1 -LC_ALL=en_US.UTF-8 printf "\\351" 2>/dev/null \ - | LC_ALL=C tr "\\351" x | LC_ALL=C grep "^x$" > /dev/null \ - || exit 1 -printf "\\351" 2>/dev/null \ - | LC_ALL=C tr "\\351" x | LC_ALL=C grep "^x$" > /dev/null \ - || exit 1 +case $({ LC_ALL=en_US.UTF-8 printf "\\351" + printf "\\351\\n" + } 2>/dev/null | LC_ALL=C tr "\\351" x) in + xx) ;; + *) exit 1;; +esac f_local_() { local v=1; }; f_local_ || exit 1 f_dash_local_fail_() { local t=$(printf " 1"); }; f_dash_local_fail_ score_=10 -- 2.48.1
