1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Fix xtrace (shtests -x) for the regression tests

src/cmd/ksh93/tests/{shtests,_common}:
- When xtrace is active, set SECONDS to the float type so that
  the $SECONDS expansion in $PS4 shows fractional seconds.

src/cmd/ksh93/tests/*.sh:
- Various fixes to avoid command substitutions incorporating xtrace
  output into their results. Sometimes this is done by avoiding a
  preceding assignment on a command that redirects 2>&1 (as that
  will also redirect the preceding assignment and its xtrace,
  causing the command substitution to capture the xtrace); other
  times it was easiest to just turn off xtrace outright within the
  command substitution.

src/cmd/ksh93/tests/math.sh:
- Remove an obsolete 'fixme' note.
This commit is contained in:
Martijn Dekker 2021-05-14 19:38:20 +02:00
parent 16080141c5
commit c59d888394
11 changed files with 38 additions and 21 deletions

View file

@ -722,6 +722,7 @@ read baz <<< 'foo\\\\bar'
# ======
# Check that I/O errors are detected <https://github.com/att/ast/issues/1093>
actual=$(
set +x
{
(
trap "" PIPE
@ -1239,10 +1240,10 @@ then exp=' version cat (*) ????-??-??'
got=$(PATH=/opt/ast/bin:$PATH; "${ whence -p cat; }" --version 2>&1)
[[ $got == $exp ]] || err_exit "path-bound builtin not executable by canonical path resulting from expansion" \
"(expected match of $(printf %q "$exp"), got $(printf %q "$got"))"
got=$(PATH=/opt/ast/bin:$PATH "$SHELL" -o restricted -c 'cat --version' 2>&1)
got=$(PATH=/opt/ast/bin:$PATH; "$SHELL" -o restricted -c 'cat --version' 2>&1)
[[ $got == $exp ]] || err_exit "restricted shells do not recognize path-bound builtins" \
"(expected match of $(printf %q "$exp"), got $(printf %q "$got"))"
got=$(PATH=/opt/ast/bin cat --version 2>&1)
got=$(set +x; PATH=/opt/ast/bin cat --version 2>&1)
[[ $got == $exp ]] || err_exit "path-bound builtin not found on PATH in preceding assignment" \
"(expected match of $(printf %q "$exp"), got $(printf %q "$got"))"
else warning 'skipping path-bound builtin tests: builtin /opt/ast/bin/cat not found'