patch test.sh to support check.t split into multiple chunks

which is apparently needed on Coherent due to OS limits

inspired by a patched test.sh from RT, except I require a
dot before the sequence number for easier globbing, made
the splitting use -S, and the errorlevel is more correct
This commit is contained in:
tg 2012-05-04 21:28:06 +00:00
parent 2d31aca859
commit 2d0ca10629

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.553 2012/05/04 20:49:00 tg Exp $' srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.554 2012/05/04 21:28:06 tg Exp $'
#- #-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 # 2011, 2012
@ -1398,7 +1398,7 @@ else
#define EXTERN #define EXTERN
#define MKSH_INCLUDES_ONLY #define MKSH_INCLUDES_ONLY
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.553 2012/05/04 20:49:00 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.554 2012/05/04 21:28:06 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (0); } int main(void) { printf("Hello, World!\n"); return (0); }
EOF EOF
case $cm in case $cm in
@ -1852,13 +1852,14 @@ cat >test.sh <<-EOF
set -A check_categories -- $check_categories set -A check_categories -- $check_categories
pflag='$curdir/$mkshexe' pflag='$curdir/$mkshexe'
sflag='$srcdir/check.t' sflag='$srcdir/check.t'
usee=0 Pflag=0 uset=0 vflag=0 xflag=0 usee=0 Pflag=0 Sflag=0 uset=0 vflag=0 xflag=0
while getopts "C:e:fPp:s:t:v" ch; do case \$ch { while getopts "C:e:fPp:Ss:t:v" ch; do case \$ch {
(C) check_categories[\${#check_categories[*]}]=\$OPTARG ;; (C) check_categories[\${#check_categories[*]}]=\$OPTARG ;;
(e) usee=1; eflag=\$OPTARG ;; (e) usee=1; eflag=\$OPTARG ;;
(f) check_categories[\${#check_categories[*]}]=fastbox ;; (f) check_categories[\${#check_categories[*]}]=fastbox ;;
(P) Pflag=1 ;; (P) Pflag=1 ;;
(p) pflag=\$OPTARG ;; (p) pflag=\$OPTARG ;;
(S) Sflag=1 ;;
(s) sflag=\$OPTARG ;; (s) sflag=\$OPTARG ;;
(t) uset=1; tflag=\$OPTARG ;; (t) uset=1; tflag=\$OPTARG ;;
(v) vflag=1 ;; (v) vflag=1 ;;
@ -1866,7 +1867,7 @@ cat >test.sh <<-EOF
} }
done done
shift \$((OPTIND - 1)) shift \$((OPTIND - 1))
set -A args -- '$srcdir/check.pl' -p "\$pflag" -s "\$sflag" set -A args -- '$srcdir/check.pl' -p "\$pflag"
x= x=
for y in "\${check_categories[@]}"; do for y in "\${check_categories[@]}"; do
x=\$x,\$y x=\$x,\$y
@ -1887,8 +1888,7 @@ cat >test.sh <<-EOF
(( vflag )) && args[\${#args[*]}]=-v (( vflag )) && args[\${#args[*]}]=-v
(( xflag )) && args[\${#args[*]}]=-x # force usage by synerr (( xflag )) && args[\${#args[*]}]=-x # force usage by synerr
print Testing mksh for conformance: print Testing mksh for conformance:
fgrep MirOS: '$srcdir/check.t' fgrep -e MirOS: -e MIRBSD "\$sflag"
fgrep MIRBSD '$srcdir/check.t'
print "This shell is actually:\\n\\t\$KSH_VERSION" print "This shell is actually:\\n\\t\$KSH_VERSION"
print 'test.sh built for mksh $dstversion' print 'test.sh built for mksh $dstversion'
cstr='\$os = defined \$^O ? \$^O : "unknown";' cstr='\$os = defined \$^O ? \$^O : "unknown";'
@ -1911,7 +1911,15 @@ cat >test.sh <<-EOF
break break
fi fi
done done
exec \$perli "\${args[@]}" "\$@"$tsts (( Sflag )) || exec \$perli "\${args[@]}" -s "\$sflag" "\$@"$tsts
# use of the -S option for check.t split into multiple chunks
rv=0
for s in "\$sflag".*; do
\$perli "\${args[@]}" -s "\$s" "\$@"$tsts
rc=\$?
(( rv = rv ? rv : rc ))
done
exit \$rv
EOF EOF
chmod 755 test.sh chmod 755 test.sh
if test $cm = llvm; then if test $cm = llvm; then