You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Farid Zaripov <Fa...@kyiv.vdiweb.com> on 2006/08/17 17:07:18 UTC
run_locale_utils.sh
I can't understand what does the line "test -z "`echo $it | grep .cm`"
;" in function below?
check_locale_m()
{
printf "Checking \"locale -m\" output..." >$dbgout
loc_m_out=`${locale} -m`
for it in $loc_m_out; do
assertions=`expr $assertions + 1`
if test -z "`echo $it | grep .cm`" ; then
echo " incorrect." >$dbgout
echo "ERROR: \"locale -m\" failed." >$dbgout
echo >$dbgout
failedassertions=`expr $failedassertions + 1`
fi;
done;
echo " correct." >$dbgout
}
I suppose that in command 'grep .cm' ".cm" is a regular expression and
grep utility should print lines that contains <anychar>cm?
On my machine on Windows locale -m produces:
ANSI_X3.110-1983
ANSI_X3.4-1968
ASMO_449
BIG5
BIG5-HKSCS
BS_4730
BS_VIEWDATA
CP10007
CP1250
CP1251
CP1252
CP1253
CP1254
CP1255
CP1256
CP1257
CP1258
CP437
CP737
CP775
CP949
...
I not see the lines that matches to the ".cm" regexp. And because of
this
the sanity check fails.
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights r
Checking "locale --help" output... correct.
Checking "locale -a" output...check completed.
Checking "locale -m" output... incorrect.
ERROR: "locale -m" failed.
Checking "locale -k LC_ALL" output... correct.
Checking "localedef --help" output... correct.
# +-----------------------+--------+--------+--------+
# | DIAGNOSTIC | ACTIVE | TOTAL |INACTIVE|
# +-----------------------+--------+--------+--------+
# | (S7) ASSERTION | 1 | 49 | 98% |
# +-----------------------+--------+--------+--------+
## Assertions = 49
## FailedAssertions = 1
Where I wrong?
Farid.
Re: run_locale_utils.sh
Posted by Andrew Black <ab...@roguewave.com>.
I am also unclear as to what this test is supposed to accomplish.
The -z test returns true if the string is an empty string. The string
will be empty if $it doesn't contain the string literal '.cm'.
When I run the (system) locale utility on my (Linux) machine, I receive
output similar in nature to what you observed. However, when I run the
stdcxx locale utility, I receive blank (no) output. This likely is
because there are no files in the nls subdirectory of my build directory
at this time. I have a total of 46 assertions, compared to your 49. I
suspect the difference in assertion counts is related to the contents of
the this directory. I wonder if the output you listed is from the
system locale utility rather than the stdcxx locale utility. (Try
'which locale' to check if you are invoking the one you wanted to. You
may need to invoke the utility as './locale', depending on your $PATH
variable.)
--Andrew Black
Farid Zaripov wrote:
> I can't understand what does the line "test -z "`echo $it | grep .cm`"
> ;" in function below?
>
> check_locale_m()
> {
> printf "Checking \"locale -m\" output..." >$dbgout
> loc_m_out=`${locale} -m`
> for it in $loc_m_out; do
> assertions=`expr $assertions + 1`
> if test -z "`echo $it | grep .cm`" ; then
> echo " incorrect." >$dbgout
> echo "ERROR: \"locale -m\" failed." >$dbgout
> echo >$dbgout
> failedassertions=`expr $failedassertions + 1`
> fi;
> done;
> echo " correct." >$dbgout
> }
>
> I suppose that in command 'grep .cm' ".cm" is a regular expression and
> grep utility should print lines that contains <anychar>cm?
>
> On my machine on Windows locale -m produces:
> ANSI_X3.110-1983
> ANSI_X3.4-1968
> ASMO_449
> BIG5
> BIG5-HKSCS
> BS_4730
> BS_VIEWDATA
> CP10007
> CP1250
> CP1251
> CP1252
> CP1253
> CP1254
> CP1255
> CP1256
> CP1257
> CP1258
> CP437
> CP737
> CP775
> CP949
> ...
>
> I not see the lines that matches to the ".cm" regexp. And because of
> this
> the sanity check fails.
>
> Microsoft (R) Windows Script Host Version 5.6
> Copyright (C) Microsoft Corporation 1996-2001. All rights r
>
> Checking "locale --help" output... correct.
> Checking "locale -a" output...check completed.
> Checking "locale -m" output... incorrect.
> ERROR: "locale -m" failed.
> Checking "locale -k LC_ALL" output... correct.
> Checking "localedef --help" output... correct.
> # +-----------------------+--------+--------+--------+
> # | DIAGNOSTIC | ACTIVE | TOTAL |INACTIVE|
> # +-----------------------+--------+--------+--------+
> # | (S7) ASSERTION | 1 | 49 | 98% |
> # +-----------------------+--------+--------+--------+
>
> ## Assertions = 49
> ## FailedAssertions = 1
>
>
> Where I wrong?
>
>
> Farid.
Re: run_locale_utils.sh
Posted by Martin Sebor <se...@roguewave.com>.
Martin Sebor wrote:
> Farid Zaripov wrote:
>
>> I can't understand what does the line "test -z "`echo $it | grep .cm`"
>> ;" in function below?
>>
>> check_locale_m()
>> {
>> printf "Checking \"locale -m\" output..." >$dbgout
>> loc_m_out=`${locale} -m`
>> for it in $loc_m_out; do
>> assertions=`expr $assertions + 1`
>> if test -z "`echo $it | grep .cm`" ; then
>> echo " incorrect." >$dbgout
>> echo "ERROR: \"locale -m\" failed." >$dbgout
>> echo >$dbgout
>> failedassertions=`expr $failedassertions + 1`
>> fi;
>> done;
>> echo " correct." >$dbgout
>> }
>>
>> I suppose that in command 'grep .cm' ".cm" is a regular expression and
>> grep utility should print lines that contains <anychar>cm?
>
>
> My guess is that whoever wrote it (cough, Liviu, cough) meant
> a literal period, not just any character (i.e., grep "\.cm")
> and the expression was supposed to look for the .cm file suffix
> (where .cm presumably stands for Character Map).
>
> If that's correct the regular expression should look for ".cm"
> at the end each string, i.e., "\.c
Looks like the end of the expression got stripped. Let's try
again: "\.c$"
I.e., <backslash><period><C><dollar> (in case it happens again).
>
>>
>> On my machine on Windows locale -m produces:
>> ANSI_X3.110-1983
>> ...
>
> [...]
>
>>
>> I not see the lines that matches to the ".cm" regexp. And because of
>> this
>> the sanity check fails.
>
>
> I don't know why. We'd have to ask the original author if he
> still remembers -- Liviu?
>
> Martin
Re: run_locale_utils.sh
Posted by Martin Sebor <se...@roguewave.com>.
Liviu Nicoara wrote:
> Martin Sebor wrote:
>
>>Farid Zaripov wrote:
>>
>>> I can't understand what does the line "test -z "`echo $it | grep .cm`"
>>>;" in function below?
>>>
>>>check_locale_m()
>>
>>My guess is that whoever wrote it (cough, Liviu, cough) meant
>>a literal period [...]
>
>
> I can only assume that in some incarnation, a certain locale utility,
> outputs *.cm filenames when invoked with -m. GNU's doesn't, and it looks
> like neither does MS'.
Tru64 locale does that:
$ uname -sr && locale -m
OSF1 V5.1
ascii.cm
But I'm not sure it matters. AFAICT, locale -m outputs the names
of the installed charmaps which are usually the same as the names
of the character description files (our locale utility behaves
that way). Only one of our character description files has a .cm
suffix (ascii.cm, formerly called posix_pcs.cm). We never had any
other .cm files, so I also have no idea why the test is looking
for .cm. It also seems that the test should do more than just
look for the .cm extension in the output. If the -m option isn't
recognized by the utility and produces an error message on stderr
(and even causes the utility to exit with a non-zero status), the
test will pass. That's definitely not what we want.
I think we should get rid of this script and replace it with
a regular test written in C that fully exercises the behavior of
the utility. That way we'll have to maintain just one version of
the test across all platforms instead of two (one for UNIX and
one for Windows). What do you think, Farid?
Martin
Re: run_locale_utils.sh
Posted by Liviu Nicoara <ni...@roguewave.com>.
Martin Sebor wrote:
> Farid Zaripov wrote:
>> I can't understand what does the line "test -z "`echo $it | grep .cm`"
>> ;" in function below?
>>
>> check_locale_m()
>
> My guess is that whoever wrote it (cough, Liviu, cough) meant
> a literal period [...]
I can only assume that in some incarnation, a certain locale utility,
outputs *.cm filenames when invoked with -m. GNU's doesn't, and it looks
like neither does MS'.
I believe your guess is true. But it all happened too far back for me to
have any useful recollection of it.
- L
Re: run_locale_utils.sh
Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
> I can't understand what does the line "test -z "`echo $it | grep .cm`"
> ;" in function below?
>
> check_locale_m()
> {
> printf "Checking \"locale -m\" output..." >$dbgout
> loc_m_out=`${locale} -m`
> for it in $loc_m_out; do
> assertions=`expr $assertions + 1`
> if test -z "`echo $it | grep .cm`" ; then
> echo " incorrect." >$dbgout
> echo "ERROR: \"locale -m\" failed." >$dbgout
> echo >$dbgout
> failedassertions=`expr $failedassertions + 1`
> fi;
> done;
> echo " correct." >$dbgout
> }
>
> I suppose that in command 'grep .cm' ".cm" is a regular expression and
> grep utility should print lines that contains <anychar>cm?
My guess is that whoever wrote it (cough, Liviu, cough) meant
a literal period, not just any character (i.e., grep "\.cm")
and the expression was supposed to look for the .cm file suffix
(where .cm presumably stands for Character Map).
If that's correct the regular expression should look for ".cm"
at the end each string, i.e., "\.c
>
> On my machine on Windows locale -m produces:
> ANSI_X3.110-1983
> ...
[...]
>
> I not see the lines that matches to the ".cm" regexp. And because of
> this
> the sanity check fails.
I don't know why. We'd have to ask the original author if he
still remembers -- Liviu?
Martin