clean up OS exclusions somewhat: have Perl substitute the UTF-8 locale

This commit is contained in:
tg 2017-04-29 15:18:25 +00:00
parent a6686cfec5
commit bcf3130230
2 changed files with 16 additions and 45 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.pl,v 1.43 2017/04/20 21:43:43 tg Exp $
# $MirOS: src/bin/mksh/check.pl,v 1.44 2017/04/29 15:18:25 tg Exp $
# $OpenBSD: th,v 1.1 2013/12/02 20:39:44 millert Exp $
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011,
@ -80,6 +80,7 @@
# ENV is set to /nonexistant.
# __progname is set to the -p argument.
# __perlname is set to $^X (perlexe).
# @utflocale@ is substituted from -U.
# file-setup mps Used to create files, directories
# and symlinks. First word is either
# file, dir or symlink; second word is
@ -179,7 +180,7 @@ $os = defined $^O ? $^O : 'unknown';
$Usage = <<EOF ;
Usage: $prog [-Pv] [-C cat] [-e e=v] [-p prog] [-s fn] [-T dir] \
[-t tmo] name ...
[-t tmo] [-U lcl] name ...
-C c Specify the comma separated list of categories the program
belongs to (see category field).
-e e=v Set the environment variable e to v for all tests
@ -192,6 +193,7 @@ Usage: $prog [-Pv] [-C cat] [-e e=v] [-p prog] [-s fn] [-T dir] \
scaned for test files (which end in .t).
-T dir Use dir instead of /tmp to hold temporary files
-t t Use t as default time limit for tests (default is unlimited)
-U lcl Use lcl as UTF-8 locale (e.g. C.UTF-8) instead of the default
-v Verbose mode: print reason test failed.
name specifies the name of the test(s) to run; if none are
specified, all tests are run.
@ -240,7 +242,7 @@ $nxpassed = 0;
%known_tests = ();
if (!getopts('C:e:Pp:s:T:t:v')) {
if (!getopts('C:e:Pp:s:T:t:U:v')) {
print STDERR $Usage;
exit 1;
}
@ -251,6 +253,7 @@ $test_prog = $opt_p;
$verbose = defined $opt_v && $opt_v;
$test_set = $opt_s;
$temp_base = $opt_T || "/tmp";
$utflocale = $opt_U || (($os eq "hpux") ? "en_US.utf8" : "en_US.UTF-8");
if (defined $opt_t) {
die "$prog: bad -t argument (should be number > 0): $opt_t\n"
if $opt_t !~ /^\d+$/ || $opt_t <= 0;
@ -1157,6 +1160,8 @@ read_test
print STDERR "$prog:$test{':long-name'}: env-setup field doesn't start and end with the same character\n";
return undef;
}
$test{'env-setup'} =~ s/\@utflocale\@/$utflocale/g;
}
if (defined $test{'expected-exit'}) {
local($val) = $test{'expected-exit'};

50
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.784 2017/04/29 14:36:13 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.785 2017/04/29 15:18:25 tg Exp $
# -*- mode: sh -*-
#-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -1355,7 +1355,7 @@ need-pass: no
# the mv command fails on Cygwin
# Hurd aborts the testsuite (permission denied)
# QNX does not find subdir to cd into
category: !os:cygwin,!os:gnu,!os:msys,!os:nto,!os:os390,!nosymlink
category: !os:cygwin,!os:gnu,!os:msys,!os:nto,!nosymlink
file-setup: file 644 "x"
mkdir noread noread/target noread/target/subdir
ln -s noread link
@ -2438,7 +2438,7 @@ description:
# breaks on Mac OSX (HFS+ non-standard Unicode canonical decomposition)
# breaks on Cygwin 1.7 (files are now UTF-16 or something)
# breaks on QNX 6.4.1 (says RT)
category: !os:cygwin,!os:darwin,!os:msys,!os:nto,!os:os2
category: !os:cygwin,!os:darwin,!os:msys,!os:nto,!os:os2,!os:os390
need-pass: no
file-setup: file 644 "aÂc"
stdin:
@ -8340,11 +8340,10 @@ expected-stdout:
expected-stderr-pattern:
/(Unrecognized character .... ignored at \..t4 line 1)*/
---
name: utf8opt-1a
name: utf8opt-1
description:
Check that the utf8-mode flag is not set at non-interactive startup
category: !os:hpux
env-setup: !PS1=!PS2=!LC_CTYPE=en_US.UTF-8!
env-setup: !PS1=!PS2=!LC_CTYPE=@utflocale@!
stdin:
if [[ $- = *U* ]]; then
echo is set
@ -8354,48 +8353,15 @@ stdin:
expected-stdout:
is not set
---
name: utf8opt-1b
description:
Check that the utf8-mode flag is not set at non-interactive startup
category: os:hpux
env-setup: !PS1=!PS2=!LC_CTYPE=en_US.utf8!
stdin:
if [[ $- = *U* ]]; then
echo is set
else
echo is not set
fi
expected-stdout:
is not set
---
name: utf8opt-2a
name: utf8opt-2
description:
Check that the utf8-mode flag is set at interactive startup.
If your OS is old, try passing HAVE_SETLOCALE_CTYPE=0 to Build.sh
need-pass: no
category: !os:hpux,!noutf8
category: !noutf8
need-ctty: yes
arguments: !-i!
env-setup: !PS1=!PS2=!LC_CTYPE=en_US.UTF-8!
stdin:
if [[ $- = *U* ]]; then
echo is set
else
echo is not set
fi
expected-stdout:
is set
expected-stderr-pattern:
/(# )*/
---
name: utf8opt-2b
description:
Check that the utf8-mode flag is set at interactive startup
Expected failure if -DMKSH_ASSUME_UTF8=0
category: os:hpux
need-ctty: yes
arguments: !-i!
env-setup: !PS1=!PS2=!LC_CTYPE=en_US.utf8!
env-setup: !PS1=!PS2=!LC_CTYPE=@utflocale@!
stdin:
if [[ $- = *U* ]]; then
echo is set