Skip to content

Commit

Permalink
shtests: do not run locale.sh with shcomp(1) by default
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
McDutchie committed Dec 28, 2024
1 parent 0510264 commit 64050f7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/cmd/ksh93/tests/shtests
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>]
[-author?Glenn Fowler <[email protected]>]
[-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.
Expand All @@ -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 ... ]

Expand Down Expand Up @@ -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)"}
Expand Down

0 comments on commit 64050f7

Please sign in to comment.