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

Backport ksh93v- regression tests and fix various regression test bugs (#472)

- tests/*.sh: Backported many additional regression tests and test
  fixes from the alpha and beta releases of ksh93v-.

- tests/alias.sh: Avoid trying to add vi to the hash table, as some
  platforms do not provide a vi(1) implementation installed as part
  of the default system. This fixes a regression test failure I was
  getting in one of my Linux virtual machines.

- tests/builtins.sh: Fixed a bug in one of the regression tests that
  caused an incorrect total error count if any of the tests failed.

- tests/sh_match.sh: Fixed a regression test failure on DragonFly
  BSD caused by the diff command printing an extra 'No differences
  encountered' line.
This commit is contained in:
Johnothan King 2022-02-23 21:01:44 -08:00 committed by Martijn Dekker
parent bb3527aea5
commit dccf6b5ea8
25 changed files with 313 additions and 32 deletions

View file

@ -2,7 +2,7 @@
# #
# This software is part of the ast package #
# Copyright (c) 1982-2012 AT&T Intellectual Property #
# Copyright (c) 2020-2021 Contributors to ksh 93u+m #
# Copyright (c) 2020-2022 Contributors to ksh 93u+m #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
@ -573,5 +573,37 @@ got=$("$SHELL" -o pipefail -c 'trap "print ERR\ trap" ERR; true | exit 3 | false
let "(e=$?)==1" && [[ $got == 'ERR trap' ]] || err_exit 'ERR trap + pipefail failed' \
"(expected status 1, 'ERR trap'; got status $e, $(printf %q "$got"))"
# ======
# Basic test for 'ksh -v' backported from ksh93v- 2013-09-13
exp=:
got=$("$SHELL" -vc : 2>&1)
[[ $exp == $got ]] || err_exit 'incorrect output with ksh -v' \
"(expected $(printf %q "$exp"), got $(printf %q "$got"))"
# ======
# Tests that set -m puts background jobs in a separate process group.
LINENO=$LINENO "$SHELL" -m <<- \EOF
. "${SHTESTS_COMMON:-${0%/*}/_common}"
[[ $- == *m* ]] || err_exit '$- does not contain m when monitor mode specified'
float t=SECONDS
sleep 2 & pid=$!
kill -KILL -$pid 2> /dev/null || err_exit 'kill to background group failed'
wait 2> /dev/null
(( (SECONDS-t) > 1 )) && err_exit 'kill did not kill background sleep'
exit $Errors
EOF
((Errors+=$?))
# ======
# Test for 'set -u' from ksh93v- 2013-04-09
"$SHELL" 2> /dev/null <<- \EOF && err_exit 'unset variable with set -u on does not terminate script'
set -e -u -o pipefail
ls | while read file
do
files[${#files[*]}]=$fil
done
exit
EOF
# ======
exit $((Errors<125?Errors:125))