system/mksh: Only run tests if stdin/out are TTYs.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2023-07-06 16:09:00 -04:00 committed by Willy Sudiarto Raharjo
parent 49703e7c02
commit 8159498005
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
1 changed files with 11 additions and 1 deletions

View File

@ -7,6 +7,9 @@
# Original author: Markus Reichelt, Aachen, DE
# Now maintained by B. Watson <urchlay@slackware.uk>
# 20230706 bkw:
# - only run test.sh if both stdin and stdout are TTYs.
# 20230102 bkw: BUILD=2
# - take over maintenance.
# - relicense as WTFPL.
@ -94,6 +97,13 @@ chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# 20230706 bkw: only run test.sh if stdin and stdout are TTYs, to avoid
# the test script hanging forever.
T=no
[ -t 0 -a -t 1 ] && T=yes
TESTS=${TESTS:-$T}
echo "=== run tests? $TESTS"
LDFLAGS="$LDFLAGS" \
CPPFLAGS="$CPPFLAGS" \
CFLAGS="$SLKCFLAGS" \
@ -106,7 +116,7 @@ CC="$CC" \
# thanks alpine maintainers.
# 20230102 bkw: make tests optional with TESTS=no. This is a maintainer-mode
# option (saves me time if I'm repeatedly editing/running the script).
if [ "${TESTS:-yes}" = "yes" ]; then
if [ "$TESTS" = "yes" ]; then
sed -i -e '/^name: selftest-tty-absent$/,/^---$/d' check.t
./test.sh -C regress:no-ctty
fi