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