Skip to content

Commit

Permalink
MBCS testcases may not work as expected if LC_ALL is defined or fallb…
Browse files Browse the repository at this point in the history
…ack encoding is UTF-8 (#3716)
  • Loading branch information
takiguc authored Jun 7, 2022
1 parent d5b12f0 commit 36d32af
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 9 deletions.
12 changes: 10 additions & 2 deletions functional/MBCS_Tests/StAX/resultCheck.pl
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@

$OS=$^O; #OS name
chomp($OS);
$SYSENC=`locale charmap`;
undef $ENV{'LC_ALL'};
$SYSENC=`locale charmap 2>&1`;
$lang = $ENV{'LANG'};
if (index($SYSENC," ") > -1) {
for($i = 0; $i < 4; $i+=1) {
ok(1 == 1,"skip");
}
print "SKIPPED! $lang is not supported.\n";
exit(0);
}
chomp($SYSENC);
$lang = $ENV{LANG};
$lang =~ s/\..*$//;
$FULLLANG = $OS."_".$lang.".".$SYSENC;
undef %LOC;
Expand Down
12 changes: 10 additions & 2 deletions functional/MBCS_Tests/i18n/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@

$OS=$^O; #OS name
chomp($OS);
$SYSENC=`locale charmap`;
undef $ENV{'LC_ALL'};
$SYSENC=`locale charmap 2>&1`;
$lang = $ENV{'LANG'};
if (index($SYSENC," ") > -1) {
for($i = 0; $i < 3; $i+=1) {
ok(1 == 1,"skip");
}
print "SKIPPED! $lang is not supported.\n";
exit(0);
}
chomp($SYSENC);
$lang = $ENV{LANG};
$i = index($lang,".");
if ($i == -1) {
$i = length($lang);
Expand Down
12 changes: 10 additions & 2 deletions functional/MBCS_Tests/locale_matching/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@

$OS=$^O; #OS name
chomp($OS);
$SYSENC=`locale charmap`;
undef $ENV{'LC_ALL'};
$SYSENC=`locale charmap 2>&1`;
$lang = $ENV{'LANG'};
if (index($SYSENC," ") > -1) {
for($i = 0; $i < 5; $i+=1) {
ok(1 == 1,"skip");
}
print "SKIPPED! $lang is not supported.\n";
exit(0);
}
chomp($SYSENC);
$lang = $ENV{LANG};
$i = index($lang,".");
if ($i == -1) {
$i = length($lang);
Expand Down
4 changes: 1 addition & 3 deletions functional/MBCS_Tests/nio/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ FULLLANG=${OS}_${LANG%.*}.${LOC}

BASE=`dirname $0`
export CLASSPATH=${BASE}/nio.jar
CHARMAP=${FULLLANG}
SOURCE="${CHARMAP}.txt"
. ${BASE}/check_env_unix.sh

if [ "$FULLLANG" = "AIX_Zh_TW.big5" ]; then
LOC="IBM-950";
Expand All @@ -30,7 +29,6 @@ fi

echo "system code page is " ${LOC}

. ${BASE}/check_env_unix.sh
echo "invoking ReadWriteTest..."
${JAVA_BIN}/java ReadWriteTest ${BASE}/expected_${FULLLANG}.txt ${LOC} converted.txt ${LOC} > log 2>&1
diff ${BASE}/expected_${FULLLANG}.txt ./converted.txt > diff.txt 2>&1
Expand Down
9 changes: 9 additions & 0 deletions functional/MBCS_Tests/tools/check_env_unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ if [ "x$JAVA_BIN" = "x" ]; then
fi
fi

unset LC_ALL
OS=`uname`
LOC=`locale charmap 2>&1`
if [ "${LOC}" != "${LOC%% *}" ]; then
FULLLANG=${LANG}
showMessage
fi
FULLLANG=${OS}_${LANG%.*}.${LOC}

case "${FULLLANG}" in
"AIX_Ja_JP.IBM-943"|\
"AIX_ja_JP.IBM-eucJP"|\
Expand Down

0 comments on commit 36d32af

Please sign in to comment.