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