8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libshell / misc / buildksh93.sh
blobd89941d278d86796af40def432196c4ff23a156d
1 #!/bin/ksh -p
2 # (note we use "/bin/ksh -p" for Linux/pdksh support in this script)
5 # CDDL HEADER START
7 # The contents of this file are subject to the terms of the
8 # Common Development and Distribution License (the "License").
9 # You may not use this file except in compliance with the License.
11 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
12 # or http://www.opensolaris.org/os/licensing.
13 # See the License for the specific language governing permissions
14 # and limitations under the License.
16 # When distributing Covered Code, include this CDDL HEADER in each
17 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
18 # If applicable, add the following below this CDDL HEADER, with the
19 # fields enclosed by brackets "[]" replaced with your own identifying
20 # information: Portions Copyright [yyyy] [name of copyright owner]
22 # CDDL HEADER END
26 # Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
30 # buildksh93.sh - ast-ksh standalone build script for the
31 # OpenSolaris ksh93-integration project
34 # ksh93t sources can be downloaded like this from the AT&T site:
35 # wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/~gsf/download/tgz/INIT.2010-03-09.tgz'
36 # wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/~gsf/download/tgz/ast-ksh.2010-03-09.tgz'
38 function fatal_error
40 print -u2 "${progname}: $*"
41 exit 1
44 set -o errexit
45 set -o xtrace
47 typeset progname="$(basename "${0}")"
48 typeset buildmode="$1"
50 if [[ "${buildmode}" == "" ]] ; then
51 fatal_error "buildmode required."
54 # Make sure we use the C locale during building to avoid any unintended
55 # side-effects
56 export LANG=C
57 export LC_ALL=$LANG LC_MONETARY=$LANG LC_NUMERIC=$LANG LC_MESSAGES=$LANG LC_COLLATE=$LANG LC_CTYPE=$LANG
58 # Make sure the POSIX/XPG6 tools are in front of /usr/bin (/bin is needed for Linux after /usr/bin)
59 export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/bin:/opt/SUNWspro/bin
61 # Make sure the POSIX/XPG6 packages are installed (mandatory for building
62 # our version of ksh93 correctly).
63 if [[ "$(uname -s)" == "SunOS" ]] ; then
64 if [[ ! -x "/usr/xpg6/bin/tr" ]] ; then
65 fatal_error "XPG6/4 packages (SUNWxcu6,SUNWxcu4) not installed."
69 function print_solaris_builtin_header
71 # Make sure to use \\ instead of \ for continuations
72 cat <<ENDOFTEXT
74 * CDDL HEADER START
76 * The contents of this file are subject to the terms of the
77 * Common Development and Distribution License (the "License").
78 * You may not use this file except in compliance with the License.
80 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
81 * or http://www.opensolaris.org/os/licensing.
82 * See the License for the specific language governing permissions
83 * and limitations under the License.
85 * When distributing Covered Code, include this CDDL HEADER in each
86 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
87 * If applicable, add the following below this CDDL HEADER, with the
88 * fields enclosed by brackets "[]" replaced with your own identifying
89 * information: Portions Copyright [yyyy] [name of copyright owner]
91 * CDDL HEADER END
95 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
98 #ifndef _SOLARIS_KSH_CMDLIST_H
99 #define _SOLARIS_KSH_CMDLIST_H
101 #ifdef __cplusplus
102 extern "C" {
103 #endif
106 * List builtins for Solaris.
107 * The list here is partially autogenerated and partially hand-picked
108 * based on compatibility with the native Solaris versions of these
109 * tools
113 * Commands which are 100% compatible with native Solaris versions (/bin is
114 * a softlink to ./usr/bin, ksh93 takes care about the lookup)
116 #define BINCMDLIST(f) \\
117 { "/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
118 #define USRBINCMDLIST(f) \\
119 { "/usr/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
120 #define SBINCMDLIST(f) \\
121 { "/sbin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
122 #define SUSRBINCMDLIST(f) \\
123 { "/usr/sbin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
124 /* POSIX compatible commands */
125 #define XPG6CMDLIST(f) \\
126 { "/usr/xpg6/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
127 #define XPG4CMDLIST(f) \\
128 { "/usr/xpg4/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
129 #ifdef SHOPT_USR_GNU_BIN_BUILTINS
130 /* GNU coreutils compatible commands */
131 #define GNUCMDLIST(f) \\
132 { "/usr/gnu/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
133 #else
134 #define GNUCMDLIST(f)
135 #endif
137 * Make all ksh93 builtins accessible when /usr/ast/bin was added to
138 * /usr/xpg6/bin:/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/bin:/opt/SUNWspro/bin
140 #define ASTCMDLIST(f) \\
141 { "/usr/ast/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
143 /* undo ast_map.h #defines to avoid collision */
144 #undef basename
145 #undef dirname
146 #undef mktemp
148 /* Generated data, do not edit. */
149 ASTCMDLIST(basename)
150 GNUCMDLIST(basename)
151 XPG4CMDLIST(basename)
152 ASTCMDLIST(cat)
153 BINCMDLIST(cat)
154 ASTCMDLIST(chgrp)
155 // XPG4CMDLIST(chgrp)
156 ASTCMDLIST(chmod)
157 ASTCMDLIST(chown)
158 // XPG4CMDLIST(chown)
159 BINCMDLIST(chown)
160 ASTCMDLIST(cksum)
161 BINCMDLIST(cksum)
162 GNUCMDLIST(cksum)
163 ASTCMDLIST(cmp)
164 BINCMDLIST(cmp)
165 ASTCMDLIST(comm)
166 BINCMDLIST(comm)
167 GNUCMDLIST(comm)
168 ASTCMDLIST(cp)
169 // XPG4CMDLIST(cp)
170 ASTCMDLIST(cut)
171 BINCMDLIST(cut)
172 GNUCMDLIST(cut)
173 ASTCMDLIST(date)
174 // XPG4CMDLIST(date)
175 ASTCMDLIST(dirname)
176 BINCMDLIST(dirname)
177 GNUCMDLIST(dirname)
178 // ASTCMDLIST(egrep)
179 // XPG4CMDLIST(egrep)
180 ASTCMDLIST(expr)
181 GNUCMDLIST(expr)
182 XPG6CMDLIST(expr)
183 ASTCMDLIST(fds)
184 // ASTCMDLIST(fgrep)
185 // XPG4CMDLIST(fgrep)
186 ASTCMDLIST(fmt)
187 ASTCMDLIST(fold)
188 BINCMDLIST(fold)
189 GNUCMDLIST(fold)
190 // ASTCMDLIST(grep)
191 // XPG4CMDLIST(grep)
192 ASTCMDLIST(head)
193 BINCMDLIST(head)
194 ASTCMDLIST(id)
195 XPG4CMDLIST(id)
196 ASTCMDLIST(join)
197 BINCMDLIST(join)
198 GNUCMDLIST(join)
199 ASTCMDLIST(ln)
200 // XPG4CMDLIST(ln)
201 ASTCMDLIST(logname)
202 BINCMDLIST(logname)
203 GNUCMDLIST(logname)
204 ASTCMDLIST(md5sum)
205 ASTCMDLIST(mkdir)
206 BINCMDLIST(mkdir)
207 GNUCMDLIST(mkdir)
208 ASTCMDLIST(mkfifo)
209 BINCMDLIST(mkfifo)
210 GNUCMDLIST(mkfifo)
211 ASTCMDLIST(mktemp)
212 BINCMDLIST(mktemp)
213 GNUCMDLIST(mktemp)
214 ASTCMDLIST(mv)
215 // XPG4CMDLIST(mv)
216 ASTCMDLIST(paste)
217 BINCMDLIST(paste)
218 GNUCMDLIST(paste)
219 ASTCMDLIST(pathchk)
220 BINCMDLIST(pathchk)
221 GNUCMDLIST(pathchk)
222 // ASTCMDLIST(readlink)
223 ASTCMDLIST(rev)
224 BINCMDLIST(rev)
225 ASTCMDLIST(rm)
226 XPG4CMDLIST(rm)
227 ASTCMDLIST(rmdir)
228 BINCMDLIST(rmdir)
229 GNUCMDLIST(rmdir)
230 GNUCMDLIST(sleep)
231 ASTCMDLIST(stty)
232 // XPG4CMDLIST(stty)
233 ASTCMDLIST(sum)
234 BINCMDLIST(sum)
235 ASTCMDLIST(sync)
236 BINCMDLIST(sync)
237 GNUCMDLIST(sync)
238 SBINCMDLIST(sync)
239 SUSRBINCMDLIST(sync)
240 ASTCMDLIST(tail)
241 BINCMDLIST(tail)
242 XPG4CMDLIST(tail)
243 ASTCMDLIST(tee)
244 BINCMDLIST(tee)
245 GNUCMDLIST(tee)
246 ASTCMDLIST(tty)
247 BINCMDLIST(tty)
248 GNUCMDLIST(tty)
249 ASTCMDLIST(uname)
250 ASTCMDLIST(uniq)
251 BINCMDLIST(uniq)
252 GNUCMDLIST(uniq)
253 ASTCMDLIST(wc)
254 BINCMDLIST(wc)
255 GNUCMDLIST(wc)
256 // ASTCMDLIST(xgrep)
257 // BINCMDLIST(xgrep)
259 /* Mandatory for ksh93 test suite and AST scripts */
260 BINCMDLIST(getconf)
262 #ifdef __cplusplus
264 #endif
265 #endif /* !_SOLARIS_KSH_CMDLIST_H */
267 ENDOFTEXT
270 function build_shell
272 set -o errexit
273 set -o xtrace
275 # OS.cputype.XXbit.compiler
276 case "${buildmode}" in
277 *.linux.*)
278 # ksh93+AST config flags
279 bast_flags="-DSHOPT_CMDLIB_BLTIN=0 -DSH_CMDLIB_DIR=\\\"/usr/ast/bin\\\" -DSHOPT_SYSRC -D_map_libc=1"
281 # gcc flags
282 bgcc99="gcc -std=gnu99 "
283 bgcc_ccflags="${bon_flags} ${bast_flags} -g"
285 case "${buildmode}" in
286 # Linux i386
287 *.i386.32bit.gcc*) HOSTTYPE="linux.i386" CC="${bgcc99} -fPIC" cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}"
290 fatal_error "build_shell: Illegal Linux type/compiler build mode \"${buildmode}\"."
292 esac
294 *.solaris.*)
295 # Notes:
296 # 1. Do not remove/modify these flags or their order before either
297 # asking the project leads at
298 # http://www.opensolaris.org/os/project/ksh93-integration/
299 # These flags all have a purpose, even if they look
300 # weird/redundant/etc. at the first look.
302 # 2. We use -KPIC here since -Kpic is too small on 64bit sparc and
303 # on 32bit it's close to the barrier so we use it for both 32bit and
304 # 64bit to avoid later suprises when people update libast in the
305 # future
307 # 3. "-D_map_libc=1" is needed to force map.c to add a "_ast_" prefix to all
308 # AST symbol names which may otherwise collide with Solaris/Linux libc
310 # 4. "-DSHOPT_SYSRC" enables /etc/ksh.kshrc support (AST default is currently
311 # to enable it if /etc/ksh.kshrc or /etc/bash.bashrc are available on the
312 # build machine).
314 # 5. -D_lib_socket=1 -lsocket -lnsl" was added to make sure ksh93 is compiled
315 # with networking support enabled, the current AST build infratructure has
316 # problems with detecting networking support in Solaris.
318 # 6. "-xc99=%all -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1" is used to force
319 # the compiler into C99 mode. Otherwise ksh93 will be much slower and lacks
320 # lots of arithmethic functions.
322 # 7. "-D_TS_ERRNO -D_REENTRANT" are flags taken from the default OS/Net
323 # build system.
325 # 8. "-xpagesize_stack=64K is used on SPARC to enhance the performace
327 # 9. -DSHOPT_CMDLIB_BLTIN=0 -DSH_CMDLIB_DIR=\\\"/usr/ast/bin\\\" -DSHOPT_CMDLIB_HDR=\\\"/home/test001/ksh93/ast_ksh_20070322/solaris_cmdlist.h\\\"
328 # is used to bind all ksh93 builtins to a "virtual" directory
329 # called "/usr/ast/bin/" and to adjust the list of builtins
330 # enabled by default to those defined by PSARC 2006/550
332 solaris_builtin_header="${PWD}/tmp_solaris_builtin_header.h"
333 print_solaris_builtin_header >"${solaris_builtin_header}"
335 # OS/Net build flags
336 bon_flags="-D_TS_ERRNO -D_REENTRANT"
338 # ksh93+AST config flags
339 bast_flags="-DSHOPT_CMDLIB_BLTIN=0 -DSH_CMDLIB_DIR=\\\"/usr/ast/bin\\\" -DSHOPT_CMDLIB_HDR=\\\"${solaris_builtin_header}\\\" -DSHOPT_SYSRC -D_map_libc=1"
341 # Sun Studio flags
342 bsunc99="/opt/SUNWspro/bin/cc -xc99=%all -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1"
343 bsuncc_app_ccflags_sparc="-xpagesize_stack=64K" # use bsuncc_app_ccflags_sparc only for final executables
344 bsuncc_ccflags="${bon_flags} -KPIC -g -xs -xspace -Xa -xstrconst -z combreloc -xildoff -xcsi -errtags=yes ${bast_flags} -D_lib_socket=1 -lsocket -lnsl"
346 # gcc flags
347 bgcc99="/usr/sfw/bin/gcc -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1"
348 bgcc_warnflags="-Wall -Wextra -Wno-unknown-pragmas -Wno-missing-braces -Wno-sign-compare -Wno-parentheses -Wno-uninitialized -Wno-implicit-function-declaration -Wno-unused -Wno-trigraphs -Wno-char-subscripts -Wno-switch"
349 bgcc_ccflags="${bon_flags} ${bgcc_warnflags} ${bast_flags} -D_lib_socket=1 -lsocket -lnsl"
351 case "${buildmode}" in
352 # for -m32/-m64 flags see usr/src/Makefile.master, makefile symbols *_XARCH/co.
353 *.i386.32bit.suncc*) HOSTTYPE="sol11.i386" CC="${bsunc99} -m32" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" ;;
354 *.i386.64bit.suncc*) HOSTTYPE="sol11.i386" CC="${bsunc99} -m64 -KPIC" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" ;;
355 *.sparc.32bit.suncc*) HOSTTYPE="sol11.sun4" CC="${bsunc99} -m32" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" bsuncc_app_ccflags="${bsuncc_app_ccflags_sparc}" ;;
356 *.sparc.64bit.suncc*) HOSTTYPE="sol11.sun4" CC="${bsunc99} -m64 -dalign -KPIC" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" bsuncc_app_ccflags="${bsuncc_app_ccflags_sparc}" ;;
358 *.i386.32bit.gcc*) HOSTTYPE="sol11.i386" CC="${bgcc99} -fPIC" cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}" ;;
359 *.i386.64bit.gcc*) HOSTTYPE="sol11.i386" CC="${bgcc99} -m64 -mtune=opteron -Ui386 -U__i386 -fPIC" cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}" ;;
360 *.sparc.32bit.gcc*) HOSTTYPE="sol11.sun4" CC="${bgcc99} -m32 -mcpu=v8 -fPIC" cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}" ;;
361 *.sparc.64bit.gcc*) HOSTTYPE="sol11.sun4" CC="${bgcc99} -m64 -mcpu=v9 -fPIC" cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}" ;;
362 *.s390.32bit.gcc*) HOSTTYPE="sol11.s390" CC="${bgcc99} -m32 -fPIC" cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}" ;;
363 *.s390.64bit.gcc*) HOSTTYPE="sol11.s390" CC="${bgcc99} -m64 -fPIC" cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}" ;;
366 fatal_error "build_shell: Illegal Solaris type/compiler build mode \"${buildmode}\"."
368 esac
371 fatal_error "Illegal OS build mode \"${buildmode}\"."
373 esac
375 # some prechecks
376 [[ -z "${CCFLAGS}" ]] && fatal_error "build_shell: CCFLAGS is empty."
377 [[ -z "${CC}" ]] && fatal_error "build_shell: CC is empty."
378 [[ -z "${HOSTTYPE}" ]] && fatal_error "build_shell: HOSTTYPE is empty."
379 [[ ! -f "bin/package" ]] && fatal_error "build_shell: bin/package missing."
380 [[ ! -x "bin/package" ]] && fatal_error "build_shell: bin/package not executable."
382 export CCFLAGS CC HOSTTYPE
384 # build ksh93
385 bin/package make CCFLAGS="${CCFLAGS}" CC="${CC}" HOSTTYPE="${HOSTTYPE}"
387 root="${PWD}/arch/${HOSTTYPE}"
388 [[ -d "$root" ]] || fatal_error "build_shell: directory ${root} not found."
389 log="${root}/lib/package/gen/make.out"
391 [[ -s $log ]] || fatal_error "build_shell: no make.out log found."
393 if [[ -f ${root}/lib/libast-g.a ]] then link_libast="ast-g" ; else link_libast="ast" ; fi
394 if [[ -f ${root}/lib/libdll-g.a ]] then link_libdll="dll-g" ; else link_libdll="dll" ; fi
395 if [[ -f ${root}/lib/libsum-g.a ]] then link_libsum="sum-g" ; else link_libsum="sum" ; fi
396 if [[ -f ${root}/lib/libcmd-g.a ]] then link_libcmd="cmd-g" ; else link_libcmd="cmd" ; fi
397 if [[ -f ${root}/lib/libshell-g.a ]] then link_libshell="shell-g" ; else link_libshell="shell" ; fi
399 if [[ "${buildmode}" != *.staticshell* ]] ; then
400 # libcmd causes some trouble since there is a squatter in solaris
401 # This has been fixed in Solaris 11/B48 but may require adjustments
402 # for older Solaris releases
403 for lib in libast libdll libsum libcmd libshell ; do
404 case "$lib" in
405 libshell)
406 base="src/cmd/ksh93/"
407 vers=1
408 link="-L${root}/lib/ -l${link_libcmd} -l${link_libsum} -l${link_libdll} -l${link_libast} -lm"
410 libdll)
411 base="src/lib/${lib}"
412 vers=1
413 link="-ldl"
415 libast)
416 base="src/lib/${lib}"
417 vers=1
418 link="-lm"
421 base="src/lib/${lib}"
422 vers=1
423 link="-L${root}/lib/ -l${link_libast} -lm"
425 esac
428 cd "${root}/${base}"
430 if [[ -f ${lib}-g.a ]] ; then lib_a="${lib}-g.a" ; else lib_a="${lib}.a" ; fi
432 if [[ "${buildmode}" == *solaris* ]] ; then
433 ${CC} ${cc_sharedlib} ${CCFLAGS} -Bdirect -Wl,-zallextract -Wl,-zmuldefs -o "${root}/lib/${lib}.so.${vers}" "${lib_a}" $link
434 else
435 ${CC} ${cc_sharedlib} ${CCFLAGS} -Wl,--whole-archive -Wl,-zmuldefs "${lib_a}" -Wl,--no-whole-archive -o "${root}/lib/${lib}.so.${vers}" $link
438 #rm ${lib}.a
439 mv "${lib_a}" "disabled_${lib_a}_"
441 cd "${root}/lib"
442 ln -sf "${lib}.so.${vers}" "${lib}.so"
444 done
447 base=src/cmd/ksh93
448 cd "${root}/${base}"
449 rm -f \
450 "${root}/lib/libshell.a" "${root}/lib/libshell-g.a" \
451 "${root}/lib/libsum.a" "${root}/lib/libsum-g.a" \
452 "${root}/lib/libdll.a" "${root}/lib/libdll-g.a" \
453 "${root}/lib/libast.a" "${root}/lib/libast-g.a"
455 if [[ "${buildmode}" == *solaris* ]] ; then
456 ${CC} ${CCFLAGS} ${bsuncc_app_ccflags} -L${root}/lib/ -Bdirect -o ksh pmain.o -lshell -Bstatic -l${link_libcmd} -Bdynamic -lsum -ldll -last -lm -lmd -lsecdb
457 else
458 ${CC} ${CCFLAGS} ${bsuncc_app_ccflags} -L${root}/lib/ -o ksh pmain.o -lshell -lcmd -lsum -ldll -last -lm
461 file ksh
462 file shcomp
464 export LD_LIBRARY_PATH="${root}/lib:${LD_LIBRARY_PATH}"
465 export LD_LIBRARY_PATH_32="${root}/lib:${LD_LIBRARY_PATH_32}"
466 export LD_LIBRARY_PATH_64="${root}/lib:${LD_LIBRARY_PATH_64}"
467 ldd ksh
472 function test_builtin_getconf
475 print "# testing getconf builtin..."
476 set +o errexit
477 export PATH=/bin:/usr/bin
478 for lang in ${TEST_LANG} ; do
480 printf "## testing LANG=%s\n" "${lang}"
481 export LC_ALL="${lang}" LANG="${lang}"
482 ${SHELL} -c '/usr/bin/getconf -a |
483 while read i ; do
484 t="${i%:*}" ; a="$(getconf "$t" 2>/dev/null)" ;
485 b="$(/usr/bin/getconf "$t" 2>/dev/null)" ; [ "$a" != "$b" ] && print "# |$t|:|$a| != |$b|" ;
486 done'
488 done
489 print "# testing getconf done."
493 function test_shell
495 set -o errexit
496 set -o xtrace
498 ulimit -s 65536 # need larger stack on 64bit SPARC to pass all tests
500 export SHELL="$(ls -1 $PWD/arch/*/src/cmd/ksh93/ksh)"
501 export LD_LIBRARY_PATH="$(ls -1ad $PWD/arch/*/lib):${LD_LIBRARY_PATH}"
502 export LD_LIBRARY_PATH_32="$(ls -1ad $PWD/arch/*/lib):${LD_LIBRARY_PATH_32}"
503 export LD_LIBRARY_PATH_64="$(ls -1ad $PWD/arch/*/lib):${LD_LIBRARY_PATH_64}"
504 printf "## SHELL is |%s|\n" "${SHELL}"
505 printf "## LD_LIBRARY_PATH is |%s|\n" "${LD_LIBRARY_PATH}"
507 [[ ! -f "${SHELL}" ]] && fatal_error "test_shell: |${SHELL}| is not a file."
508 [[ ! -x "${SHELL}" ]] && fatal_error "test_shell: |${SHELL}| is not executable."
510 [[ "${TEST_LANG}" == "" ]] && TEST_LANG="C zh_CN.GB18030 en_US.UTF-8"
512 case "${buildmode}" in
513 testshell.bcheck*)
514 for lang in ${TEST_LANG} ; do
516 export LC_ALL="${lang}" LANG="${lang}"
517 for i in ./src/cmd/ksh93/tests/*.sh ; do
518 bc_logfile="$(basename "$i").$$.bcheck"
519 rm -f "${bc_logfile}"
520 /opt/SUNWspro/bin/bcheck -q -access -o "${bc_logfile}" ${SHELL} ./src/cmd/ksh93/tests/shtests \
521 LD_LIBRARY_PATH_64="$LD_LIBRARY_PATH_64" \
522 LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
523 LD_LIBRARY_PATH_32="$LD_LIBRARY_PATH_32"\
524 LC_ALL="${lang}" LANG="${lang}" \
525 VMALLOC_OPTIONS=abort \
526 "$i"
527 cat "${bc_logfile}"
528 done
530 done
532 testshell.builtin.getconf)
533 test_builtin_getconf
535 testshell)
536 for lang in ${TEST_LANG} ; do
538 export LC_ALL="${lang}" LANG="${lang}"
539 for i in ./src/cmd/ksh93/tests/*.sh ; do
540 ${SHELL} ./src/cmd/ksh93/tests/shtests -a \
541 LD_LIBRARY_PATH_64="$LD_LIBRARY_PATH_64" \
542 LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
543 LD_LIBRARY_PATH_32="$LD_LIBRARY_PATH_32" \
544 LC_ALL="${lang}" LANG="${lang}" \
545 VMALLOC_OPTIONS=abort \
546 SHCOMP=$PWD/arch/*/bin/shcomp \
547 "$i"
548 done
550 done
551 test_builtin_getconf
553 esac
556 # main
557 case "${buildmode}" in
558 build.*) build_shell ;;
559 testshell*) test_shell ;;
560 *) fatal_error "Illegal build mode \"${buildmode}\"." ;;
561 esac
562 # EOF.