From 64050f763522e1eaf3f05ae0efbf5a68aa087627 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Sat, 28 Dec 2024 21:35:40 +0100 Subject: [PATCH] shtests: do not run locale.sh with shcomp(1) by default In the ja_JP.SJIS locale, running the locale.sh tests under shcomp triggers a syntax error due to literal UTF-8 strings in the test scripts. Reproducer on macOS: $ LANG=ja_JP.SJIS bin/shtests -lc locale (result: syntax error in locale.sh) We could work around that with trickery, but it's not worth it, because running locale.sh under shcomp doesn't really make sense. The locale.sh tests change the locale on the fly, and as the shell parser is also affected by the locale, the parsing of each line in the script depends on the execution of prior lines in certain contexts. This should be expected to fail with shcomp, as the file is parsed entirely before executing. src/cmd/ksh93/tests/shtests: - Like pty.sh, do not run locale.sh under shcomp, unless -c or --compile is explicitly specified. --- src/cmd/ksh93/tests/shtests | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cmd/ksh93/tests/shtests b/src/cmd/ksh93/tests/shtests index 1ed797132fff..942a026022be 100755 --- a/src/cmd/ksh93/tests/shtests +++ b/src/cmd/ksh93/tests/shtests @@ -8,20 +8,17 @@ valgrindflags='--xml=yes --log-file=/dev/null --track-origins=yes --read-var-inf USAGE=$' [-s8? -@(#)$Id: shtests (ksh 93u+m) 2024-07-27 $ +@(#)$Id: shtests (ksh 93u+m) 2024-12-28 $ ] [-author?David Korn ] [-author?Glenn Fowler ] [-author?Contributors to https://github.com/ksh93/ksh] [-copyright?(c) 2000-2012 AT&T Intellectual Property] -[-copyright?(c) 2020-2023 Contributors to ksh 93u+m] +[-copyright?(c) 2020-2024 Contributors to ksh 93u+m] [-license?https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html] [+NAME?shtests - ksh regression test harness] [+DESCRIPTION?\bshtests\b is the \bksh\b(1) regression test harness for - \b$SHELL\b or \bksh\b if \bSHELL\b is not defined and exported. If - none of the \b--posix\b \b--utf8\b \b--compile\b options are specified then - all three are enabled for most tests, whereas only \b--posix\b \b--utf8\b - are enabled for the \bpty\b tests for the interactive shell.] + \b$SHELL\b (or \bksh\b if \bSHELL\b is not defined and exported).] [+INPUT FILES?\bshtests\b regression test files are shell scripts that run in an environment controlled by \bshtests\b. An identification message is printed before and after each test on the standard output. @@ -46,6 +43,9 @@ USAGE=$' \bvalgrind\b(1) on \bksh\b. If \b$SHELL-g\b exists and is executable, then it is used instead of \b$SHELL\b.] [x:trace?Enable script execution trace.] +[+?If none of the \b--posix\b \b--utf8\b \b--compile\b options are specified, + then all three are enabled for most tests, whereas only \b--posix\b + \b--utf8\b are enabled for the \blocale.sh\b and \bpty.sh\b tests.] [ test.sh ... ] [ name=value ... ] @@ -410,8 +410,8 @@ do [[ $i == *.sh ]] || i+='.sh' esac done fi - # Skip pty tests for shcomp, unless -c was explicitly specified (compile==2) - if [[ compile -gt 0 && ! ($u == pty && compile -lt 2) ]] + # Skip certain tests for shcomp, unless -c was explicitly specified (compile==2) + if [[ compile -gt 0 && ! (compile -lt 2 && ($u == 'locale' || $u == 'pty')) ]] then c=$tmp/shcomp-$u.ksh o="$u(shcomp)" echo test $o begins ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"}