1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

Fix github test run (re: 064baa37); clean up more build sys cruft

The change in .github/workflows/ci.yml (use 'bin/package test' to
run the iffe regression tests as well) caused the GitHub workflow
to fail immediately with a syntax error. This is because iffe.tst
is a ksh93 script, but the runner does not have a ksh93 installed
as a system package.

As of e08ca80d, package prefers a known-good system shell over the
newly compiled shell to stop builds from failing when I break ksh,
making it convenient to fix it. But that change should not apply to
the regression tests; they should use the newly compiled shell.

src/cmd/INIT/package.sh, bin/package:
- Set KEEP_SHELL to 2 when given a SHELL=* argument.
- Before running the regression tests, override the known-good
  shell with the compiled one if $KEEP_SHELL < 2, ensuring that all
  tests, including the iffe ones, are run with the compiled shell.
  This allows 'bin/package test' to run if the known-good shell is
  not a ksh93, while testing that the compiled shell successfully
  runs iffe. (re: e08ca80d)
- Standardise 'test' command use: -a and -o are deprecated.
- Remove some more unused cruft. (re: 6137b99a)

src/cmd/ksh93/Mamfile:
- Do not override SHELL when running shtests; this is now set
  correctly in 'bin/package test'.

src/cmd/INIT/rt.sh:
- Removed. This regression test output filter was only used with
  nmake, which we deleted. (re: 2940b3f5, 6cc2f6a0, aa601a39)
This commit is contained in:
Martijn Dekker 2022-07-14 15:45:53 +02:00
parent ad229fd5ee
commit b991987642
5 changed files with 85 additions and 651 deletions

View file

@ -109,7 +109,7 @@ command=${0##*/}
case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in
0123) USAGE=$'
[-?
@(#)$Id: '$command$' (ksh 93u+m) 2022-06-12 $
@(#)$Id: '$command$' (ksh 93u+m) 2022-07-22 $
]
[-author?Glenn Fowler <gsf@research.att.com>]
[-author?Contributors to https://github.com/ksh93/ksh]
@ -608,7 +608,7 @@ case $_PACKAGE_HOSTTYPE_ in
;;
esac
KEEP_PACKAGEROOT=0
KEEP_SHELL=0
KEEP_SHELL=0 # set to 1 if SHELL is a known-good system shell, 2 if SHELL supplied by user
USER_VPATH=
args=
assign=
@ -646,7 +646,7 @@ do case $i in
;;
SHELL=*)eval $n='$'v
case $SHELL in
?*) KEEP_SHELL=1 ;;
?*) KEEP_SHELL=2 ;;
esac
;;
VPATH=*)eval USER_$n='$'v
@ -721,7 +721,7 @@ use) case $1 in
$exec export VPATH=$A:$P
$exec export nativepp=/usr/lib
if test '' != "$INSTALLROOT" -a -d $INSTALLROOT/include/ast
if test -n "$INSTALLROOT" && test -d "$INSTALLROOT/include/ast"
then $exec export PACKAGE_ast=$INSTALLROOT
elif test -d ${PWD%/*}/ast/arch/$HOSTTYPE
then $exec export PACKAGE_ast=${PWD%/*}/ast/arch/$HOSTTYPE
@ -750,7 +750,7 @@ esac
packageroot() # dir
{
test -d $1/lib/$command -o -x $1/bin/$command
test -d "$1/lib/$command" || test -x "$1/bin/$command"
}
# true if arg is executable
@ -758,8 +758,8 @@ packageroot() # dir
executable() # [!] command
{
case $1 in
'!') test ! -x "$2" -a ! -x "$2.exe"; return ;;
*) test -x "$1" -o -x "$1.exe"; return ;;
'!') test ! -x "$2" && test ! -x "$2.exe" ;;
*) test -x "$1" || test -x "$1.exe" ;;
esac
}
@ -1460,7 +1460,7 @@ int main()
type=unixware
;;
UTS*|uts*)
if test -x /bin/u370 -o -x /bin/u390
if test -x /bin/u370 || test -x /bin/u390
then type=uts.390
else case $arch in
'') arch=$mach ;;
@ -1846,12 +1846,6 @@ esac
run=-
case $x in
1) : accept the current package use environment
OK=ok
KSH=$EXECROOT/bin/ksh
MAKE=mamake
SUM=$EXECROOT/bin/sum
TEE=$EXECROOT/bin/tee
INITROOT=$PACKAGEROOT/src/cmd/INIT
checkcc
;;
@ -2261,17 +2255,8 @@ cat $INITROOT/$i.sh
$show export EXECROOT
export EXECROOT
# use these if possible
OK=ok
KSH=$EXECROOT/bin/ksh
MAKE=mamake
SUM=$EXECROOT/bin/sum
TEE=$EXECROOT/bin/tee
# grab a decent default shell
checksh "$SHELL" || KEEP_SHELL=0
case $KEEP_SHELL in
0) save_PATH=$PATH
if PATH=$(getconf PATH 2>/dev/null)
@ -2506,7 +2491,7 @@ checkaout() # cmd ...
'') _PACKAGE_cc=0
;;
*) _PACKAGE_cc=1
test -f $INITROOT/hello.c -a -f $INITROOT/p.c || {
test -f "$INITROOT/hello.c" && test -f "$INITROOT/p.c" || {
note "$INITROOT: INIT package source not found"
return 1
}
@ -2656,7 +2641,7 @@ capture() # file command ...
cmd='case $error_status in 0) r=done;; *) r=failed;; esac;'
cmd=$cmd' echo "$command: $action $r at $(date) in $INSTALLROOT"'
case $quiet in
0) cmd="$cmd 2>&1 | \$TEE -a $o" ;;
0) cmd="$cmd 2>&1 | tee -a $o" ;;
*) cmd="$cmd >> $o" ;;
esac
trap "$cmd" 0
@ -2665,10 +2650,7 @@ capture() # file command ...
;;
esac
case $quiet in
0) if executable ! $TEE
then TEE=tee
fi
# Connect 'tee' to a FIFO instead of a pipe, so that we can obtain
0) # Connect 'tee' to a FIFO instead of a pipe, so that we can obtain
# the build's exit status and use it for $error_status
rm -f $o.fifo
mkfifo -m 600 $o.fifo || exit
@ -2677,7 +2659,7 @@ capture() # file command ...
# unlink early
exec rm $o.fifo
) &
$TEE -a $o < $o.fifo &
tee -a $o < $o.fifo &
tee_pid=$!
o=$o.fifo
;;
@ -2852,7 +2834,7 @@ make|view)
for i in arch arch/$HOSTTYPE
do test -d $PACKAGEROOT/$i || $exec mkdir $PACKAGEROOT/$i || exit
done
for i in bin bin/$OK bin/$OK/lib fun include lib lib/package lib/package/gen src man man/man1 man/man3 man/man8
for i in bin bin/ok bin/ok/lib fun include lib lib/package lib/package/gen src man man/man1 man/man3 man/man8
do test -d $INSTALLROOT/$i || $exec mkdir $INSTALLROOT/$i || exit
done
make_recurse src
@ -3054,7 +3036,7 @@ make|view)
k=$INITROOT/make.probe
case $(ls -t $i $j $k 2>/dev/null) in
$i*) ;;
*) if test -f $j -a -f $k
*) if test -f "$j" && test -f "$k"
then note "update $i"
shellmagic
case $exec in
@ -3087,19 +3069,19 @@ cat $j $k
then execrate=execrate
$make cd $INSTALLROOT/bin
for i in chmod chgrp cmp cp ln mv rm
do if test ! -x $OK/$i -a -x /bin/$i.exe
do if test ! -x "ok/$i" && test -x "/bin/$i.exe"
then shellmagic
case $exec in
'') echo "$SHELLMAGIC"'execrate /bin/'$i' "$@"' > $OK/$i
chmod +x $OK/$i
'') echo "$SHELLMAGIC"'execrate /bin/'$i' "$@"' > ok/$i
chmod +x ok/$i
;;
*) $exec echo \'"$SHELLMAGIC"'execrate /bin/'$i' "$@"'\'' >' $OK/$i
$exec chmod +x $OK/$i
*) $exec echo \'"$SHELLMAGIC"'execrate /bin/'$i' "$@"'\'' >' ok/$i
$exec chmod +x ok/$i
;;
esac
fi
done
PATH=$INSTALLROOT/bin/$OK:$PATH
PATH=$INSTALLROOT/bin/ok:$PATH
export PATH
else execrate=
fi
@ -3172,7 +3154,7 @@ cat $j $k
# mamprobe data should have been generated by this point
case $exec in
'') if test ! -f $INSTALLROOT/bin/.paths -o -w $INSTALLROOT/bin/.paths
'') if test ! -f "$INSTALLROOT/bin/.paths" || test -w "$INSTALLROOT/bin/.paths"
then N='
'
b= f= h= n= p= u= B= L=
@ -3264,32 +3246,29 @@ cat $j $k
ksh tee cp ln mv rm \
*ast*.dll *cmd*.dll *dll*.dll *shell*.dll
do executable $i && {
cmp -s $i $OK/$i 2>/dev/null || {
test -f $OK/$i &&
$exec $execrate $rm $OK/$i </dev/null
test -f $OK/$i &&
$exec $execrate $mv $OK/$i $OK/$i.old </dev/null
test -f $OK/$i &&
cmp -s $i ok/$i 2>/dev/null || {
test -f ok/$i &&
$exec $execrate $rm ok/$i </dev/null
test -f ok/$i &&
$exec $execrate $mv ok/$i ok/$i.old </dev/null
test -f ok/$i &&
case $exec:$i in
:ksh)
err_out "$OK/$i: cannot update [may be in use by a running process] remove manually and try again"
err_out "ok/$i: cannot update [may be in use by a running process] remove manually and try again"
;;
esac
$exec $execrate $cp $i $OK/$i
$exec $execrate $cp $i ok/$i
}
}
done
if executable $OK/tee
then TEE=$INSTALLROOT/bin/$OK/tee
fi
if test "$KEEP_SHELL" != 1 && executable $OK/ksh
then SHELL=$INSTALLROOT/bin/$OK/ksh
if test "$KEEP_SHELL" -eq 0 && executable ok/ksh
then SHELL=$INSTALLROOT/bin/ok/ksh
export SHELL
fi
case :$PATH: in
*:$INSTALLROOT/bin/$OK:*)
*:$INSTALLROOT/bin/ok:*)
;;
*) PATH=$INSTALLROOT/bin/$OK:$PATH
*) PATH=$INSTALLROOT/bin/ok:$PATH
export PATH
;;
esac
@ -3371,10 +3350,6 @@ results)set '' $target
;;
make|test|view)
def=$1
case $filter:$1:$SHELL in
errors:*:*) ;;
*:test:*/ksh*) filter=rt ;;
esac
;;
old) suf=old
;;
@ -3391,7 +3366,6 @@ results)set '' $target
path) path=1
;;
test) def=test
filter=rt
;;
*) break
;;
@ -3444,8 +3418,6 @@ results)set '' $target
;;
errors) $exec egrep -i '\*\*\*|FAIL[ES]|^TEST.* [123456789][0123456789]* error|core.*dump' $j | sed -e '/^TEST.\//s,/[^ ]*/,,'
;;
rt) $exec $KSH rt - $j
;;
*) $exec egrep -i '^TEST|FAIL' $j
;;
esac
@ -3489,8 +3461,14 @@ results)set '' $target
esac
;;
test) # run all available default regression tests
test) # run all available default regression tests, using our newly compiled shell unless overridden
cd "$INSTALLROOT" || err_out "run '$0 make' first"
if test "$KEEP_SHELL" -lt 2
then executable bin/ksh || err_out "build ksh first, or supply a SHELL=/path/to/ksh argument"
SHELL=$INSTALLROOT/bin/ksh
fi
export SHELL
set -f
set -- ${args:-src}
cd "$1" || exit

View file

@ -159,42 +159,6 @@ make install
exec - esac
exec - test -w regress -a -x regress || chmod u+w,+x regress
done regress generated
make rt
make rt.sh
done rt.sh
prev rt.sh
exec - case static,port:$OPTIND:$RANDOM in
exec - ?*:*:*|*::*|*:*:$RANDOM)
exec - ;;
exec - *) if ENV= LC_ALL=C x= $SHELL -nc '[[ a || b ]] && : ${list[level]} !(pattern)' 2>/dev/null
exec - then if grep '### .*archaic.* ###' >/dev/null
exec - then : rt contains archaic constructs :
exec - else ENV= LC_ALL=C $SHELL -n rt.sh
exec - fi
exec - fi
exec - ;;
exec - esac
exec - case '${mam_cc_SHELLMAGIC}' in
exec - "") case 184 in
exec - 0) cp rt.sh rt
exec - ;;
exec - *) {
exec - i=`(read x; echo $x) < rt.sh`
exec - case $i in
exec - '#!'*|*'||'*|':'*|'":"'*|"':'"*) echo "$i" ;;
exec - esac
exec - cat rt.sh
exec - } > rt
exec - ;;
exec - esac
exec - ;;
exec - *) cat - rt.sh > rt <<'!'
exec - ${mam_cc_SHELLMAGIC}
exec - !
exec - ;;
exec - esac
exec - test -w rt -a -x rt || chmod u+w,+x rt
done rt generated
make crossexec
make crossexec.sh
done crossexec.sh
@ -498,10 +462,6 @@ make install
prev regress
exec - test '' = 'regress' || ${STDCMP} 2>/dev/null -s regress ${INSTALLROOT}/bin/regress || { ${STDMV} ${INSTALLROOT}/bin/regress ${INSTALLROOT}/bin/regress.old 2>/dev/null || true; ${STDCP} regress ${INSTALLROOT}/bin/regress ;}
done ${INSTALLROOT}/bin/regress generated
make ${INSTALLROOT}/bin/rt
prev rt
exec - test '' = 'rt' || ${STDCMP} 2>/dev/null -s rt ${INSTALLROOT}/bin/rt || { ${STDMV} ${INSTALLROOT}/bin/rt ${INSTALLROOT}/bin/rt.old 2>/dev/null || true; ${STDCP} rt ${INSTALLROOT}/bin/rt ;}
done ${INSTALLROOT}/bin/rt generated
make ${PACKAGEROOT}/bin
exec - if test ! -d ${PACKAGEROOT}/bin
exec - then mkdir -p ${PACKAGEROOT}/bin
@ -1095,16 +1055,16 @@ make test
make test.iffe
make iffe.tst
done iffe.tst
exec - regress iffe.tst iffe
exec - exec "$SHELL" "$INSTALLROOT/bin/regress" iffe.tst iffe
done test.iffe virtual
make test.mamake
make mamake.tst
make mamake.rt
done mamake.rt
exec - if [[ "1" || "mamake.rt" -nt "mamake.tst" ]]
exec - then mktest --style=regress mamake.rt > mamake.tst
exec - if test mamake.rt -nt mamake.tst
exec - then "$SHELL" "$INSTALLROOT/bin/mktest" --style=regress mamake.rt > mamake.tst
exec - fi
done mamake.tst generated
exec - regress mamake.tst mamake
exec - exec "$SHELL" "$INSTALLROOT/bin/regress" mamake.tst mamake
done test.mamake virtual
done test dontcare virtual

View file

@ -109,7 +109,7 @@ command=${0##*/}
case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in
0123) USAGE=$'
[-?
@(#)$Id: '$command$' (ksh 93u+m) 2022-06-12 $
@(#)$Id: '$command$' (ksh 93u+m) 2022-07-22 $
]
[-author?Glenn Fowler <gsf@research.att.com>]
[-author?Contributors to https://github.com/ksh93/ksh]
@ -608,7 +608,7 @@ case $_PACKAGE_HOSTTYPE_ in
;;
esac
KEEP_PACKAGEROOT=0
KEEP_SHELL=0
KEEP_SHELL=0 # set to 1 if SHELL is a known-good system shell, 2 if SHELL supplied by user
USER_VPATH=
args=
assign=
@ -646,7 +646,7 @@ do case $i in
;;
SHELL=*)eval $n='$'v
case $SHELL in
?*) KEEP_SHELL=1 ;;
?*) KEEP_SHELL=2 ;;
esac
;;
VPATH=*)eval USER_$n='$'v
@ -721,7 +721,7 @@ use) case $1 in
$exec export VPATH=$A:$P
$exec export nativepp=/usr/lib
if test '' != "$INSTALLROOT" -a -d $INSTALLROOT/include/ast
if test -n "$INSTALLROOT" && test -d "$INSTALLROOT/include/ast"
then $exec export PACKAGE_ast=$INSTALLROOT
elif test -d ${PWD%/*}/ast/arch/$HOSTTYPE
then $exec export PACKAGE_ast=${PWD%/*}/ast/arch/$HOSTTYPE
@ -750,7 +750,7 @@ esac
packageroot() # dir
{
test -d $1/lib/$command -o -x $1/bin/$command
test -d "$1/lib/$command" || test -x "$1/bin/$command"
}
# true if arg is executable
@ -758,8 +758,8 @@ packageroot() # dir
executable() # [!] command
{
case $1 in
'!') test ! -x "$2" -a ! -x "$2.exe"; return ;;
*) test -x "$1" -o -x "$1.exe"; return ;;
'!') test ! -x "$2" && test ! -x "$2.exe" ;;
*) test -x "$1" || test -x "$1.exe" ;;
esac
}
@ -1460,7 +1460,7 @@ int main()
type=unixware
;;
UTS*|uts*)
if test -x /bin/u370 -o -x /bin/u390
if test -x /bin/u370 || test -x /bin/u390
then type=uts.390
else case $arch in
'') arch=$mach ;;
@ -1846,12 +1846,6 @@ esac
run=-
case $x in
1) : accept the current package use environment
OK=ok
KSH=$EXECROOT/bin/ksh
MAKE=mamake
SUM=$EXECROOT/bin/sum
TEE=$EXECROOT/bin/tee
INITROOT=$PACKAGEROOT/src/cmd/INIT
checkcc
;;
@ -2261,17 +2255,8 @@ cat $INITROOT/$i.sh
$show export EXECROOT
export EXECROOT
# use these if possible
OK=ok
KSH=$EXECROOT/bin/ksh
MAKE=mamake
SUM=$EXECROOT/bin/sum
TEE=$EXECROOT/bin/tee
# grab a decent default shell
checksh "$SHELL" || KEEP_SHELL=0
case $KEEP_SHELL in
0) save_PATH=$PATH
if PATH=$(getconf PATH 2>/dev/null)
@ -2506,7 +2491,7 @@ checkaout() # cmd ...
'') _PACKAGE_cc=0
;;
*) _PACKAGE_cc=1
test -f $INITROOT/hello.c -a -f $INITROOT/p.c || {
test -f "$INITROOT/hello.c" && test -f "$INITROOT/p.c" || {
note "$INITROOT: INIT package source not found"
return 1
}
@ -2656,7 +2641,7 @@ capture() # file command ...
cmd='case $error_status in 0) r=done;; *) r=failed;; esac;'
cmd=$cmd' echo "$command: $action $r at $(date) in $INSTALLROOT"'
case $quiet in
0) cmd="$cmd 2>&1 | \$TEE -a $o" ;;
0) cmd="$cmd 2>&1 | tee -a $o" ;;
*) cmd="$cmd >> $o" ;;
esac
trap "$cmd" 0
@ -2665,10 +2650,7 @@ capture() # file command ...
;;
esac
case $quiet in
0) if executable ! $TEE
then TEE=tee
fi
# Connect 'tee' to a FIFO instead of a pipe, so that we can obtain
0) # Connect 'tee' to a FIFO instead of a pipe, so that we can obtain
# the build's exit status and use it for $error_status
rm -f $o.fifo
mkfifo -m 600 $o.fifo || exit
@ -2677,7 +2659,7 @@ capture() # file command ...
# unlink early
exec rm $o.fifo
) &
$TEE -a $o < $o.fifo &
tee -a $o < $o.fifo &
tee_pid=$!
o=$o.fifo
;;
@ -2852,7 +2834,7 @@ make|view)
for i in arch arch/$HOSTTYPE
do test -d $PACKAGEROOT/$i || $exec mkdir $PACKAGEROOT/$i || exit
done
for i in bin bin/$OK bin/$OK/lib fun include lib lib/package lib/package/gen src man man/man1 man/man3 man/man8
for i in bin bin/ok bin/ok/lib fun include lib lib/package lib/package/gen src man man/man1 man/man3 man/man8
do test -d $INSTALLROOT/$i || $exec mkdir $INSTALLROOT/$i || exit
done
make_recurse src
@ -3054,7 +3036,7 @@ make|view)
k=$INITROOT/make.probe
case $(ls -t $i $j $k 2>/dev/null) in
$i*) ;;
*) if test -f $j -a -f $k
*) if test -f "$j" && test -f "$k"
then note "update $i"
shellmagic
case $exec in
@ -3087,19 +3069,19 @@ cat $j $k
then execrate=execrate
$make cd $INSTALLROOT/bin
for i in chmod chgrp cmp cp ln mv rm
do if test ! -x $OK/$i -a -x /bin/$i.exe
do if test ! -x "ok/$i" && test -x "/bin/$i.exe"
then shellmagic
case $exec in
'') echo "$SHELLMAGIC"'execrate /bin/'$i' "$@"' > $OK/$i
chmod +x $OK/$i
'') echo "$SHELLMAGIC"'execrate /bin/'$i' "$@"' > ok/$i
chmod +x ok/$i
;;
*) $exec echo \'"$SHELLMAGIC"'execrate /bin/'$i' "$@"'\'' >' $OK/$i
$exec chmod +x $OK/$i
*) $exec echo \'"$SHELLMAGIC"'execrate /bin/'$i' "$@"'\'' >' ok/$i
$exec chmod +x ok/$i
;;
esac
fi
done
PATH=$INSTALLROOT/bin/$OK:$PATH
PATH=$INSTALLROOT/bin/ok:$PATH
export PATH
else execrate=
fi
@ -3172,7 +3154,7 @@ cat $j $k
# mamprobe data should have been generated by this point
case $exec in
'') if test ! -f $INSTALLROOT/bin/.paths -o -w $INSTALLROOT/bin/.paths
'') if test ! -f "$INSTALLROOT/bin/.paths" || test -w "$INSTALLROOT/bin/.paths"
then N='
'
b= f= h= n= p= u= B= L=
@ -3264,32 +3246,29 @@ cat $j $k
ksh tee cp ln mv rm \
*ast*.dll *cmd*.dll *dll*.dll *shell*.dll
do executable $i && {
cmp -s $i $OK/$i 2>/dev/null || {
test -f $OK/$i &&
$exec $execrate $rm $OK/$i </dev/null
test -f $OK/$i &&
$exec $execrate $mv $OK/$i $OK/$i.old </dev/null
test -f $OK/$i &&
cmp -s $i ok/$i 2>/dev/null || {
test -f ok/$i &&
$exec $execrate $rm ok/$i </dev/null
test -f ok/$i &&
$exec $execrate $mv ok/$i ok/$i.old </dev/null
test -f ok/$i &&
case $exec:$i in
:ksh)
err_out "$OK/$i: cannot update [may be in use by a running process] remove manually and try again"
err_out "ok/$i: cannot update [may be in use by a running process] remove manually and try again"
;;
esac
$exec $execrate $cp $i $OK/$i
$exec $execrate $cp $i ok/$i
}
}
done
if executable $OK/tee
then TEE=$INSTALLROOT/bin/$OK/tee
fi
if test "$KEEP_SHELL" != 1 && executable $OK/ksh
then SHELL=$INSTALLROOT/bin/$OK/ksh
if test "$KEEP_SHELL" -eq 0 && executable ok/ksh
then SHELL=$INSTALLROOT/bin/ok/ksh
export SHELL
fi
case :$PATH: in
*:$INSTALLROOT/bin/$OK:*)
*:$INSTALLROOT/bin/ok:*)
;;
*) PATH=$INSTALLROOT/bin/$OK:$PATH
*) PATH=$INSTALLROOT/bin/ok:$PATH
export PATH
;;
esac
@ -3371,10 +3350,6 @@ results)set '' $target
;;
make|test|view)
def=$1
case $filter:$1:$SHELL in
errors:*:*) ;;
*:test:*/ksh*) filter=rt ;;
esac
;;
old) suf=old
;;
@ -3391,7 +3366,6 @@ results)set '' $target
path) path=1
;;
test) def=test
filter=rt
;;
*) break
;;
@ -3444,8 +3418,6 @@ results)set '' $target
;;
errors) $exec egrep -i '\*\*\*|FAIL[ES]|^TEST.* [123456789][0123456789]* error|core.*dump' $j | sed -e '/^TEST.\//s,/[^ ]*/,,'
;;
rt) $exec $KSH rt - $j
;;
*) $exec egrep -i '^TEST|FAIL' $j
;;
esac
@ -3489,8 +3461,14 @@ results)set '' $target
esac
;;
test) # run all available default regression tests
test) # run all available default regression tests, using our newly compiled shell unless overridden
cd "$INSTALLROOT" || err_out "run '$0 make' first"
if test "$KEEP_SHELL" -lt 2
then executable bin/ksh || err_out "build ksh first, or supply a SHELL=/path/to/ksh argument"
SHELL=$INSTALLROOT/bin/ksh
fi
export SHELL
set -f
set -- ${args:-src}
cd "$1" || exit

View file

@ -1,482 +0,0 @@
########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1994-2011 AT&T Intellectual Property #
# Copyright (c) 2020-2021 Contributors to ksh 93u+m #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# http://www.eclipse.org/org/documents/epl-v10.html #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
: rt - nmake test output filter
command=rt
flags='--silent --keepgoing'
failed=0
heading=1
verbose=0
case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
0123) ARGV0="-a $command"
USAGE=$'
[-?
@(#)$Id: rt (AT&T Research) 2010-07-27 $
]
[-author?Glenn Fowler <gsf@research.att.com>]
[-copyright?Copyright (c) 2005-2012 AT&T Intellectual Property]
[-license?http://www.eclipse.org/org/documents/epl-v10.html]
[+NAME?rt - run "nmake test" and filter output]
[+DESCRIPTION?\brt\b runs \bnmake test\b and filters the regression
test output to contain only test summary lines. If no \atest\a
operands are specified then \btest\b is assumed. If \b-\b is
specified then the \afile\a operands, or the standard input
if no \afile\a operands are specified, are filtered instead
of the output from \bnmake\b.]
[f:failed?Only list failed test results.]
[h!:heading?Enable per-file heading when more than one \afile\a operand
follows \b-\b.]
[v:verbose?Run with \bREGRESSFLAGS=-v\b.]
[ test ... | - [ file ... ] ]
[+SEE ALSO?\bnmake\b(1), \bregress\b(1)]
[+CAVEATS?\brt\b guesses the regression test output style. Garbled
output indicates a bad guess.]
'
;;
*) ARGV0=""
USAGE="fhv"
;;
esac
function usage
{
OPTIND=0
getopts $ARGV0 "$USAGE" OPT '-?'
exit 2
}
while getopts $ARGV0 "$USAGE" OPT
do case $OPT in
f) failed=1 ;;
h) heading=0 ;;
v) (( verbose=$OPTARG )) && flags="$flags REGRESSFLAGS=-v" ;;
esac
done
shift `expr $OPTIND - 1`
ifs=${IFS:-$' \t\n'}
set -o noglob
component=
dots='............................................'
bad=' ***'
style=unknown
integer tests errors signals lineno=0 skip=0
typeset -l lower
function results # tests errors signals
{
integer t=$1 e=$2 s=$3
typeset label note
if [[ $style != unknown ]] && (( errors >= 0 ))
then style=unknown
if (( !failed || errors ))
then if (( failed ))
then print -r -n -- "$unit"
fi
if (( t >= 0 ))
then if (( t == 1))
then label="test "
else label=tests
fi
printf $'%s%5d %s' "$prefix" "$t" "$label"
prefix=
else prefix="$prefix..........."
fi
if (( s ))
then label=signal
(( e=s ))
else label=error
fi
if (( e != 1))
then label=${label}s
fi
if (( e == 1 ))
then note=" $bad"
elif (( e > 1 ))
then note=$bad
fi
printf $'%s%5d %s%s\n' "$prefix" "$e" "$label" "$note"
fi
fi
}
function unit
{
typeset x
if [[ $component ]]
then x=${component##*/}
if [[ " $x " != *' '$unit' '* && " $unit " != *' '$x' '* ]]
then if [[ $component == cmd/?*lib/* ]]
then unit="$unit $x"
else unit="$x $unit"
fi
fi
fi
unit="$unit ${dots:1:${#dots}-${#unit}}"
if [[ $1 ]]
then unit="$unit..........."
fi
if (( ! failed ))
then print -r -n -- "$unit"
fi
}
if [[ $1 == - ]]
then shift
if (( $# <= 1 ))
then heading=0
fi
if (( heading ))
then for i
do print test heading $i
cat -- "$i"
done
else cat "$@"
fi
else if [[ $1 == *=* ]]
then set test "$@"
elif (( ! $# ))
then set test
fi
nmake "$@" $flags 2>&1
fi |
while read -r line
do set '' $line
shift
case $line in
TEST[' ']*', '*' error'*)
IFS=${IFS}","
set '' $line
IFS=$ifs
set '' $*
while :
do case $2 in
'') break
;;
error|errors)
errors=$1
break
;;
test|tests)
tests=$1
;;
esac
shift
done
results $tests $errors
continue
;;
TEST[' ']*)
results $tests $errors
IFS=${IFS}","
set '' $line
IFS=$ifs
set '' $*
unit=${3##*/}
case $4 in
[a-zA-Z]*) unit="$unit $4" ;;
esac
unit
prefix=
errors=0
signals=0
style=regress
continue
;;
'pathname and options of item under test')
read -r line || break
results $tests $errors $signals
set '' $line
unit=${2##*/}
unit
tests=0
errors=0
signals=0
style=script
continue
;;
'test heading '*)
if (( heading ))
then if (( heading > 1 ))
then print
else heading=2
fi
set '' $line
shift 3
print -r -- "==> $* <=="
fi
continue
;;
'test '*' begins at '????-??-??+??:??:??|'test '*' begins at '*' '*' '*' '*' '*)
results $tests $errors $signals
unit=${2##*/}
unit=${unit%.sh}
unit
prefix=
tests=-1
errors=0
signals=0
style=shell
continue
;;
'test '*' at '????-??-??+??:??:??' [ '*' ]'|'test '*' at '*' '*' '*' '*' '*)
case $line in
*' [ '*test*error*' ]')
while :
do case $1 in
'[') tests=$2
errors=$4
if (( errors > 256 ))
then (( signals++ ))
fi
break
;;
esac
shift
done
;;
*' [ '*test*signal*' ]')
while :
do case $1 in
'[') tests=$2
signals=$4
if (( signals ))
then (( errors++ ))
fi
break
;;
esac
shift
done
;;
*) if [[ $3 != passed ]]
then (( errors )) || (( errors++ ))
fi
;;
esac
results $tests $errors $signals
continue
;;
'## ---'*(-)'--- ##')
(( ++lineno > skip )) || continue
read -r line || break
lower=$line
set '' $lower
case $lower in
'##'*'test suite:'*'##')
results $tests $errors $signals
set -- ${lower//*suite:}
set -- ${*//[.#]/}
unit=$*
if [[ $unit == *' tests' ]]
then unit=${unit/' tests'/}
fi
main=$unit
prefix=
tests=0
errors=0
signals=0
category=
style=autotest
(( skip = lineno + 1 ))
unit
continue
;;
esac
;;
+(-)) case $style in
regress) continue ;;
esac
(( ++lineno > skip )) || continue
read -r line || break
set '' $line
case $line in
'Running tests for '*)
results $tests $errors $signals
shift 4
unit=
while (( $# ))
do if [[ $1 == on ]]
then break
fi
if [[ $unit ]]
then unit="$unit "
fi
unit=$unit${1##*/}
shift
done
main=$unit
prefix=
tests=-1
errors=-1
category=
style=perl
(( skip = lineno + 1 ))
continue
;;
*' : '*)results $tests $errors $signals
unit=${2##*/}
unit=${unit%.sh}
unit
prefix=
tests=0
errors=0
signals=0
style=timing
(( skip = lineno + 1 ))
continue
;;
esac
;;
+([0-9])*([a-zA-Z0-9])' '*)
case $style in
script) case $line in
*FAILED*|*failed*)
(( errors++ ))
;;
*) (( tests++ ))
;;
esac
;;
esac
;;
make:*|'make ['*']:'*)
case $line in
*': warning:'*|*'making test'*|*'action'?(s)' failed'*|*': *** '*)
;;
*) results $tests $errors $signals
print -r -u2 -- "$line"
;;
esac
continue
;;
+([/a-zA-Z_0-9]):)
component=${line%:}
;;
'') continue
;;
esac
case $style in
autotest)
case $line in
+([0-9]):*ok)
(( tests++ ))
;;
+([0-9]):*FAILED*)
(( tests++ ))
(( errors++ ))
if (( $verbose ))
then if [[ ! $prefix ]]
then prefix=$unit
print
fi
print -r -- " ${line//*'FAILED '/}"
fi
;;
esac
continue
;;
perl) case $line in
*'........ '*)
if [[ $1 == */* ]]
then cat=${1%%/*}
if [[ $cat != $category ]]
then results $tests $errors $signals
category=$cat
unit="$main $category"
unit
prefix=
tests=0
errors=0
signals=0
fi
(( tests++ ))
case $line in
*' ok') ;;
*) (( errors++ ))
if (( $verbose ))
then if [[ ! $prefix ]]
then prefix=$unit
print
fi
print -r -- "$line"
fi
;;
esac
else results $tests $errors $signals
case $line in
*' ok') errors=0 ;;
*) errors=1 ;;
esac
unit="$main $1"
unit
if (( $verbose && errors ))
then prefix=$unit
print
shift 2
print -r -- "$@"
else prefix=
fi
results $tests $errors $signals
tests=-1
errors=-1
category=
fi
style=perl
;;
esac
continue
;;
esac
case $line in
*FAILED*|*failed*)
(( errors++ ))
;;
*) case $style in
regress)case $line in
['<>']*);;
*) continue ;;
esac
;;
script) continue
;;
shell) ((errors++ ))
;;
timing) (( tests++ ))
continue
;;
unknown)continue
;;
esac
;;
esac
if (( $verbose ))
then if [[ ! $prefix ]]
then prefix=$unit
print
fi
print -r -- "$line"
fi
done
results $tests $errors $signals

View file

@ -1467,6 +1467,6 @@ make test
make tests/shtests
done tests/shtests
exec - cd "$PACKAGEROOT/src/cmd/ksh93/tests"
exec - SHELL=$INSTALLROOT/bin/ksh "$INSTALLROOT/bin/ksh" ./shtests
exec - exec "$SHELL" shtests
done test.ksh virtual
done test dontcare virtual