From d790731a807021bf96750c2a57e28d8b15aca659 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Sat, 13 Feb 2021 13:48:35 +0000 Subject: [PATCH] github: Revert failed experiment (re: 2e6c56df, 9ad9a1de, 5c389035) .github/workflows/ci.yml: - Go back to wrapping the regression tests in script(1). src/cmd/ksh93/data/builtins.c: - Never mind about the stty builtin. src/cmd/ksh93/tests/pty.sh: - Refuse to run if there isn't a functioning tty. - Make sure stty(1) works on /dev/tty by redirecting stdin. --- .github/workflows/ci.yml | 8 ++++---- src/cmd/ksh93/data/builtins.c | 4 ---- src/cmd/ksh93/tests/pty.sh | 10 ++++------ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10564a075..7f8b55d64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,14 +19,14 @@ jobs: export TZ=UTC ulimit -n 1024 : default regression tests && - bin/shtests && + script -q -e -c "bin/shtests" && : regression tests with OS-provided UTF-8 locales && - LANG=nl_NL.UTF-8 bin/shtests --locale --nocompile && - LANG=ja_JP.UTF-8 bin/shtests --locale --nocompile && + LANG=nl_NL.UTF-8 script -q -e -c "bin/shtests --locale --nocompile" && + LANG=ja_JP.UTF-8 script -q -e -c "bin/shtests --locale --nocompile" && : disable most SHOPTs, rebuild ksh && sed --regexp-extended --in-place=.orig \ '/^SHOPT (2DMATCH|AUDIT|BGX|BRACEPAT|DYNAMIC|EDPREDICT|ESH|FIXEDARRAY|HISTEXPAND|MULTIBYTE|NAMESPACE|OPTIMIZE|SUID_EXEC|STATS|VSH)=/ s/=1/=0/' \ src/cmd/ksh93/SHOPT.sh && bin/package make && : default regression tests with SHOPTs disabled && - bin/shtests + script -q -e -c "bin/shtests" diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index 1345dd56d..4bb770404 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -153,10 +153,6 @@ const struct shtable3 shtab_builtins[] = #if !_std_malloc && !_AST_std_malloc CMDLIST(vmstate) #endif -#if !_AST_ksh_release - /* The pty.sh regression tests need the stty builtin */ - CMDLIST(stty) -#endif #endif #if SHOPT_REGRESS "__regress__", NV_BLTIN|BLT_ENV, bltin(__regress__), diff --git a/src/cmd/ksh93/tests/pty.sh b/src/cmd/ksh93/tests/pty.sh index 89e6a1bdb..a36e06bb2 100755 --- a/src/cmd/ksh93/tests/pty.sh +++ b/src/cmd/ksh93/tests/pty.sh @@ -47,12 +47,10 @@ integer Errors=0 lineno=1 [[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; } whence -q pty || { warning "pty command not found -- tests skipped"; exit 0; } -# On FreeBSD, or if there is no tty, the OS-provided stty command does not appear to work correctly on a pty pseudoterminal. -# To avoid false regressions, we have to either use the stty builtin, or set 'erase' and 'kill' on the real terminal. -if builtin stty 2>/dev/null -then PATH=/opt/ast/bin:$PATH # virtual path for ksh path-bound builtins, so child shells use the stty builtin -elif test -t 1 2>/dev/null 1>/dev/tty && stty_restore=$(stty -g) -then trap 'stty "$stty_restore"' EXIT # note: on ksh, the EXIT trap is also triggered for termination due to a signal +# On some systems, the stty command does not appear to work correctly on a pty pseudoterminal. +# To avoid false regressions, we have to set 'erase' and 'kill' on the real terminal. +if test -t 0 2>/dev/null