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