# # 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 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # # # 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. # # - "io.sh" may fail due a subtle bug in ksh93 or the test suite which # only happens when ksh93 is NOT called "ksh"; to work around the # problem the test sequence currently uses $(SRC)/cmd/ksh/$(CMDTRANSMACH)/ksh # instead of $(SRC)/cmd/ksh/$(CMDTRANSMACH)/$(PROG) until we+upstream figure # out what exactly is going wrong in this case. # -- snip -- # ./close0[2]: ./close1: cannot execute [Exec format error] # io.sh[81]: picked up file descriptor zero for opening script file # -- snip -- # # - These tests need a working system clock, otherwise they'll bite you. # # - The test frontend in this Makefile should be rewritten in ksh93 # instead of the current /usr/bin/ksh (=ksh88i). This would be far less # complicated. # # - 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 associate/compound variables (this may require a flag # day... ;-( ). # The current list was mainly composed to cover various encodings and # all important markets based on suggestions by Sun's i18n team. # # - Due to the timing sensitivity of some of the tests, these tests should # be run on a quiet system with no other activity. # TESTSRC= $(LIBSHELLSRC)/../tests # ON_KSH_TEST_LOCALES can be overridden via # $ export ON_KSH_TEST_LOCALES= # before $ make install # ON_KSH_TEST_LOCALES = \ C \ en_US en_US.UTF-8 \ he_IL.UTF-8 \ hi_IN.UTF-8 \ ja_JP.PCK ja_JP.UTF-8 ja_JP.eucJP \ ko_KR.EUC \ th_TH.TIS620 \ zh_CN.EUC zh_CN.GBK zh_CN.GB18030 zh_CN.UTF-8 \ 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= # before $ make install # ON_KSH_TEST_LIST = $(TESTSRC)/*.sh # 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) @ \ print '# NOTE: Make sure your binaries in ROOT match your kernel!' ; \ ( \ set +o errexit ; \ export PATH="$(SRC)/cmd/ksh/$(CMDTRANSMACH):/bin:/usr/bin" ; \ printf "# which ksh='%s', ksh93='%s'\n" \ "$$(which ksh)" "$$(which ksh93)" ; \ ) ; \ if [[ "$$(isalist | fgrep "$(CMDTRANSMACH)")" = "" ]] ; then \ printf \ "# ISA='%s' not available on this system, skipping tests...\n" \ "$(CMDTRANSMACH)" ; \ exit 0 ; \ fi ; \ exec 2>&1 ; \ (supported_locales="$$(/usr/bin/locale -a)" ; \ for test_lang in $(ON_KSH_TEST_LOCALES) ; do \ if [[ "$$(print "$${supported_locales}" | \ egrep "^$${test_lang}\$$")" = "" ]] ; 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)/options.sh" ]] || \ $(ON_KSH_TEST_IGNORE_TESTFAILURE) && \ set +o errexit ; \ printf \ "## Running %s test: LANG='%s' script='%s'\n" \ "$(CMDTRANSMACH)/ksh" \ "$${test_lang}" \ "$$(basename "$${test_item}")"; \ ( \ test_output="$$( ( \ export \ SHELL="$(SRC)/cmd/ksh/$(CMDTRANSMACH)/ksh" \ LD_LIBRARY_PATH_64="$(ROOTLIB64)/" \ LD_LIBRARY_PATH_32="$(ROOTLIB)/" ; \ LD_LIBRARY_PATH="$(ROOTLIB64)/:$(ROOTLIB)/" ; \ "$${SHELL}" "$(TESTSRC)/shtests" -t \ 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}" \ "$${test_item}" \ ) 2>&1 | while read ; do \ printf "#\t%s\n" "$${REPLY}" ; \ done | tee /dev/stderr)" ; \ [[ "$$(print "$${test_output}" | \ egrep 'passed \[ .* tests 0 errors \]')" != "" ]] || \ (print "##> test failed" ; exit 1) \ ) ; \ set -o errexit ; \ done) ; \ done)