From 1df431576f99c3cc26dd4ceb1a6eda864cc9f196 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sat, 23 May 2026 21:47:15 +0200 Subject: [PATCH] sh/tests: Cut down builtins/read12.0 by 2 seconds Since the test assumes a 250 ms response time, there is no need to delay for 3 seconds. Instead, delay for the minimum possible 1 second. Also, fix some assertions in builtins/read11.0 and builtins/read12.0. If `set -e` is in effect, `foo` in `foo && bar` is considered tested and therefore a failure does not cause the shell to exit. Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D55191 --- bin/sh/tests/builtins/read11.0 | 3 ++- bin/sh/tests/builtins/read12.0 | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bin/sh/tests/builtins/read11.0 b/bin/sh/tests/builtins/read11.0 index 07bd3e70644..e57dfdbc0ea 100644 --- a/bin/sh/tests/builtins/read11.0 +++ b/bin/sh/tests/builtins/read11.0 @@ -27,6 +27,7 @@ ts=$(date +%s%3N) read -t 0 v <&3 || r=$? te=$(date +%s%3N) kill -TERM "$!" || : -[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = ALRM ] +[ "$r" -gt 128 ] +[ "$(kill -l "$r")" = ALRM ] [ $((te-ts)) -lt 250 ] [ -z "$v" ] diff --git a/bin/sh/tests/builtins/read12.0 b/bin/sh/tests/builtins/read12.0 index 4551555adfe..3b501a56392 100644 --- a/bin/sh/tests/builtins/read12.0 +++ b/bin/sh/tests/builtins/read12.0 @@ -1,5 +1,5 @@ -# Verify that `read -t 3 v` succeeds immediately if input is available -# and times out after 3 s if not +# Verify that `read -t 1 v` succeeds immediately if input is available +# and times out after 1 s if not set -e @@ -15,7 +15,7 @@ exec 3