4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
27 # Run the ksh93 minimum set of tests
32 # - "builtins.sh" may fail in some locales like this:
34 # ## Running ksh test: LANG='zh_TW.EUC' script='builtins.sh'
35 # builtins.sh[274]: printf "%T" now
38 # - "options.sh" may currently fail in some locales with:
40 # options.sh[145]: -G ** failed -- expected 'bam.c bar bar.c bar/bam.c bar/foo.c foo foo/bam.c', got 'bam.c bar bar/bam.c bar.c bar/foo.c foo foo/bam.c'
41 # options.sh[149]: -G **/*.c failed -- expected 'bam.c bar.c bar/bam.c bar/foo.c foo/bam.c', got 'bam.c bar/bam.c bar.c bar/foo.c foo/bam.c'
43 # This may be simply a different sort order or a bug in the test suite.
44 # Currently under investigation.
46 # - "glob.sh" may currently fail in some locales (e.g. en_US.UTF-8) with:
48 # glob.sh[157] glob -- expected '<d> <dd> <de> <Beware>', got '<Beware> <d> <dd> <de>'
49 # glob.sh[277] glob -- expected '<abc> <abe> <bdir> <ca> <de> <man> <Beware>', got '<abc> <abe> <bdir> <Beware> <ca> <de> <man>'
51 # This may be simply a different sort order or a bug in the test suite.
52 # Currently under investigation.
54 # - These tests need a working system clock, otherwise they'll bite you.
56 # - The current list of locales was mainly composed to cover various encodings
57 # and all important markets based on suggestions by Sun's i18n team.
59 # - More locales should be tested here (via ON_KSH_TEST_LOCALES below).
60 # Locales like "ru_RU.KOI8-R","de_DE.UTF-8", "is_IS.ISO8859-1",
61 # "is_IS.UTF-8" and "nl_BE.ISO8859-15" are on our wishlist - but
62 # that is getting little bit more compliciated because these locales use
63 # ',' as decimal delimter. The best solution may be to wait for ksh93
64 # being integrated into OS/Net and then change the test sequence to
65 # use ksh93's associative/compound variables (this may require a flag
68 # - Due to the timing sensitivity of some of the tests, these tests should
69 # be run on a quiet system with no other activity.
72 TESTSRC= $(LIBSHELLBASE)/common/tests
74 # ON_KSH_TEST_LOCALES can be overridden via
75 # $ export ON_KSH_TEST_LOCALES=<value> # before $ make install #
76 ON_KSH_TEST_LOCALES = \
78 en_US.UTF-8 en_US en_US.ISO8859-15@euro \
81 ja ja_JP.PCK ja_JP.UTF-8 ja_JP.eucJP \
82 ko_KR.UTF-8 ko_KR.EUC \
85 zh_CN.GB18030 zh_CN.GB18030@pinyin zh_CN.GB18030@radical zh_CN.GB18030@stroke \
86 zh_CN.UTF-8 zh_CN.UTF-8@pinyin zh_CN.UTF-8@radical zh_CN.UTF-8@stroke \
88 zh_TW.BIG5 zh_TW.EUC zh_TW.UTF-8
90 # ON_KSH_TEST_LIST can be overridden via
91 # $ export ON_KSH_TEST_LIST=<value> # before $ make install #
92 ON_KSH_TEST_LIST = $(TESTSRC)/*.sh
94 # Boolean (true/false) flag to control whether we should make test
96 ON_KSH_TEST_IGNORE_TESTFAILURE=false
98 # We must wait for other things in this subdir to finish before running
99 # the test suite, otherwise we may run into trouble that this activity
100 # may disturb the test suite run (resulting in weird "heisenbug"-like
105 print '# NOTE: Make sure your binaries in ROOT match your kernel!' ; \
108 export PATH="$(SRC)/cmd/ksh/$(LIBSHELLMACH):/bin:/usr/bin" ; \
109 printf "# which ksh='%s', ksh93='%s'\n" \
110 "$$(which ksh)" "$$(which ksh93)" ; \
112 if [[ "$$(isalist)" != ~(F)$(LIBSHELLMACH) ]] ; then \
114 "# ISA='%s' not available on this system, skipping tests...\n" \
115 "$(LIBSHELLMACH)" ; \
118 print "# Libraries used:" ; \
119 LD_LIBRARY_PATH_64="$(ROOTLIB64)/" \
120 LD_LIBRARY_PATH_32="$(ROOTLIB)/" \
121 LD_LIBRARY_PATH="$(ROOTLIB64)/:$(ROOTLIB)/" \
122 /usr/bin/ldd "$(SRC)/cmd/ksh/$(LIBSHELLMACH)/ksh" ; \
123 print "# Running tests:" ; \
125 (supported_locales="$$(/usr/bin/locale -a)" ; \
126 for test_lang in $(ON_KSH_TEST_LOCALES) ; do \
127 if [[ "$$(egrep "^$${test_lang}\$$" <<< "$${supported_locales}")" == "" ]] ; then \
129 "# Locale '%s' not supported, skipping tests...\n" \
133 (for test_item in $(ON_KSH_TEST_LIST) ; do \
134 [[ "$${test_item}" == "$(TESTSRC)/builtins.sh" || \
135 "$${test_item}" == "$(TESTSRC)/glob.sh" || \
136 "$${test_item}" == "$(TESTSRC)/options.sh" ]] || \
137 $(ON_KSH_TEST_IGNORE_TESTFAILURE) && \
139 for mode in 'plain_script:-s' 'compiled_script:-c' ; do \
141 "## Running %s test: LANG='%s' script='%s', mode='%s'\n" \
142 "$(LIBSHELLMACH)/ksh" \
144 "$$(basename "$${test_item}")" \
150 SHELL="$(SRC)/cmd/ksh/$(LIBSHELLMACH)/ksh" \
151 LD_LIBRARY_PATH_64="$(ROOTLIB64)/" \
152 LD_LIBRARY_PATH_32="$(ROOTLIB)/" \
153 LD_LIBRARY_PATH="$(ROOTLIB64)/:$(ROOTLIB)/" ; \
154 "$${SHELL}" "$(TESTSRC)/shtests" -t "$${mode#*:}" \
155 LD_LIBRARY_PATH_64="$${LD_LIBRARY_PATH_64}" \
156 LD_LIBRARY_PATH_32="$${LD_LIBRARY_PATH_32}" \
157 LD_LIBRARY_PATH="$${LD_LIBRARY_PATH}" \
159 LANG="$${test_lang}" \
160 LC_ALL="$${test_lang}" \
161 VMALLOC_OPTIONS=abort \
162 SHCOMP="$(ROOTBIN)/shcomp" \
164 ) 2>&1 | while read ; do \
165 printf "#\t%s\n" "$${REPLY}" ; \
166 done | tee /dev/stderr)" ; \
167 [[ "$${test_output}" == ~(E)test.*passed\ \[\ [[:digit:]]*\ test.*\ 0\ errors\ \] ]] || \
168 (print "##--------> test failed" ; exit 1) \