You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Martin Sebor <se...@roguewave.com> on 2008/01/02 18:00:38 UTC

Re: low hanging fruit while cleaning up test failures

Travis Vitek wrote:
> 
> 
> Martin Sebor wrote:
>> I added a new function, rw_fnmatch(), to the test driver. It behaves just
>> like the POSIX fnmatch() (the FNM_XXX constants aren't implemented
>> yet). While the main purpose behind the new function is to support
>> STDCXX-683 it should make it easier to also implement a scheme like
>> the one outlined below.
>>
>> Travis, feel free to experiment/prototype a solution :)
>>
>> Martin
>>
> 
> What expression should be used to get an appropriate set of locales for a
> given platform? I can't really expect a filter for all UTF-8 locales to work
> on all platforms as some don't have those encodings available at all. If I
> filter by language, then I may be limiting the testing to some always
> correct subset. Is that acceptable for the MT tests?

I think the MT ctype tests just need to exercise a representative
sample of multi-byte encodings (i.e., MB_CUR_MAX between 1 and
MB_LEN_MAX). There already is some code in the test suite to find
locales that use these encodings, although it could be made more
efficient. I don't know how useful rw_fnmatch() will turn out to
be in finding these codesets since their names don't matter.

Martin

> 
> Travis


Re: low hanging fruit while cleaning up test failures

Posted by Martin Sebor <se...@roguewave.com>.
Martin Sebor wrote:
> [forwarding back to the list]
> 
> Travis Vitek wrote:
>  > Martin,
>  >
>  > Not all supported platforms have the GB18030 encoding [HP, Compaq and
>  > IRIX don't], and of those that do, they use different names [gb18030 vs
>  > GB18030]. Same with UTF-8 [utf8, UTF8 or UTF-8].
> 
> I realize that. That's the reason why I mentioned the (currently quite
> inefficient) find_mb_locale() in 22.locale.codecvt.out.cpp: it looks
> for any multibyte locale with MB_CUR_MAX of some value.

[Warning: completely unbaked brainstorming follows...]

Btw., it might help to think of this not in terms of locales or code
sets or the names of such things but rather in terms of the parameters
that they have in common or that distinguish them, and that our tests
are trying to exploit. The names are just handles, or shortcuts, that
let us refer to these sets of attributes. Maybe the right interface
is some kind of SQL-like language that lets us refer to the attributes
individually or in Boolean expressions.

Each codeset has three fundamental attributes:

   <code_set_name>
   <mb_cur_max>
   <mb_cur_min>

Since code_set_name is platform-specific, we could add another called
<std_name> for standard name assigned by IANA:
   http://www.iana.org/assignments/character-sets

There might be others (e.g., the highest wchar_t value).

So maybe the ideal interface we're looking for is simply a function
that takes a query, like this:

   const char* find_codeset(const char *query);

with query being an expression that lets us refer to the attributes.
For instance, find_codeset("std_name == GB18030") would return the
platform-specific name of the codeset corresponding to GB18030, and
find_codeset("mb_cur_max >= 2") would return a string of names of
all platform-specific codeset names with MB_CUR_MAX >= 2 holds.
Names would be able to use fnmatch()-style regular expressions.
The query string could contain printf-like directives to make it
easy to compose expressions parametrized on run-time values.

Would this interface make the locale tests easier to write? Would
the expression parser/evaluator be fairly easy to implement?

Martin

> 
>  > On top of that, Windows
>  > uses code page numbers instead of encodings. Now I can easily convert
>  > names to uppercase and strip out non alphanumeric characters. I might
>  > even be able to do something with windows. That isn't the problem.
>  >
>  > The problem is that I don't seem to have a clear understanding of what
>  > exactly you want from this. The original proposal was to be able to
>  > filter locales by name or encoding, like so...
>  >
>  >     char* locales = rw_locales (_RWSTD_LC_ALL, "en_US de", 0, true);
>  >     // would retrieve C en_US and all German locales
>  >
>  >     char* locales = rw_locales (_RWSTD_LC_ALL, 0, "UTF-8", true);
>  >     // would retrieve all UTF-8 locales [those that end in .utf8, .UTF-8
>  > or .UTF8]
>  >
>  > So I wrote that. Unfortunately, as mentioned above, it has limitations.
> 
> Right. It wasn't a thought out proposal. I was just brainstorming :)
> We may not be able to use any of it to fix the hanging tests.
> 
>  > What I really need is some actual requirements so that I can write some
>  > code and get this bug closed.
> 
> My only requirement is to get those tests to pass in a reasonable
> amount of time (i.e., without timing out), and without compromising
> their effectiveness.
> 
>  >
>  > It seems that you want to guarantee that we test multibyte locales.
> 
> It seems important to exercise ctype::do_narrow() in this case but
> I haven't looked at the code very carefully. It could be that the
> code path in the multibyte case isn't any different from the single
> byte case.
> 
>  > Do
>  > we want to give up on the locale name matching, or do we want to include
>  > zh_CN in the list of locales to test? What about matching the encoding?
>  > Should we ignore all of this and just find one locale for each value of
>  > MB_CUR_MAX from 1 to MB_LEN_MAX and run the test on them?
> 
> Maybe. I'll let you propose what makes the most sense to you :)
> 
> Martin
> 
>  >
>  > Travis
>  >
>  >
>  >
>  >
>  >> -----Original Message-----
>  >> From: Martin Sebor [mailto:msebor@gmail.com] On Behalf Of Martin Sebor
>  >> Sent: Wednesday, January 02, 2008 1:41 PM
>  >> To: stdcxx-dev@incubator.apache.org
>  >> Subject: Re: low hanging fruit while cleaning up test failures
>  >>
>  >> Travis Vitek wrote:
>  >>>
>  >>> Martin Sebor wrote:
>  >>>> Travis Vitek wrote:
>  >>>>> Martin Sebor wrote:
>  >>>>>> Travis Vitek wrote:
>  >>>>>>> Martin Sebor wrote:
>  >>>>>>>> I added a new function, rw_fnmatch(), to the test
>  >> driver. It behaves
>  >>>>>>>> just
>  >>>>>>>> like the POSIX fnmatch() (the FNM_XXX constants aren't
>  >> implemented
>  >>>>>>>> yet). While the main purpose behind the new function is
>  >> to support
>  >>>>>>>> STDCXX-683 it should make it easier to also implement a
>  >> scheme like
>  >>>>>>>> the one outlined below.
>  >>>>>>>>
>  >>>>>>>> Travis, feel free to experiment/prototype a solution :)
>  >>>>>>>>
>  >>>>>>>> Martin
>  >>>>>>>>
>  >>>>>>> What expression should be used to get an appropriate set
>  >> of locales for
>  >>>>>>> a
>  >>>>>>> given platform? I can't really expect a filter for all
>  >> UTF-8 locales to
>  >>>>>>> work
>  >>>>>>> on all platforms as some don't have those encodings
>  >> available at all.
>  >>>>>>> If
>  >>>>>>> I
>  >>>>>>> filter by language, then I may be limiting the testing
>  >> to some always
>  >>>>>>> correct subset. Is that acceptable for the MT tests?
>  >>>>>> I think the MT ctype tests just need to exercise a representative
>  >>>>>> sample of multi-byte encodings (i.e., MB_CUR_MAX between 1 and
>  >>>>>> MB_LEN_MAX). There already is some code in the test suite to find
>  >>>>>> locales that use these encodings, although it could be made more
>  >>>>>> efficient. I don't know how useful rw_fnmatch() will turn out to
>  >>>>>> be in finding these codesets since their names don't matter.
>  >>>>>>
>  >>>>>> Martin
>  >>>>>>
>  >>>>>>> Travis
>  >>>>> Actually, I think I meant to say single threaded tests.
>  >> Those are the
>  >>>>> ones
>  >>>>> that currently test every locale. The multi-threadede
>  >> tests already test
>  >>>>> a
>  >>>>> subset of locales, though the method for selecting those
>  >> locales may vary
>  >>>>> between tests.
>  >>>>>
>  >>>>> I don't think it is right to test a fixed set of locales based on
>  >>>>> language,
>  >>>>> country, or encoding. If you agree, then we probably agree that the
>  >>>>> proposed
>  >>>>> enhancement doesn't actually do anything useful [and I've
>  >> wasted a bunch
>  >>>>> of
>  >>>>> time]. If this is the case, then we need to propose
>  >> another solution for
>  >>>>> selecting locales.
>  >>>> I think testing a small subset of installed locales should
>  >> be enough.
>  >>>> In fact, for white box testing of the ctype facets, exercising three
>  >>>> locales, "C" and two named ones, should be sufficient.
>  >>>>
>  >>>>> If I am wrong, and it is useful for testing [and more
>  >> specifically how it
>  >>>>> would be useful for fixing STDCXX-608], then I'd like to hear how.
>  >>>> What do you propose?
>  >>>>
>  >>>> Martin
>  >>>>
>  >>>>
>  >>> Okay. I can live with that. Then the issue now becomes deciding which
>  >>> additional locales to test. How about just testing all
>  >> Spanish and German
>  >>> locales?
>  >> I'd make sure at least one of them uses a multibyte encoding. Maybe
>  >> zh_CN.GB18030? (with MB_CUR_MAX of 4)?
>  >>
>  >> Martin
>  >>
>  >
> 
> 
> 


RE: low hanging fruit while cleaning up test failures

Posted by Farid Zaripov <Fa...@epam.com>.
> -----Original Message-----
> From: Travis Vitek [mailto:vitek@roguewave.com] 
> Sent: Thursday, January 24, 2008 2:16 AM
> To: dev@stdcxx.apache.org
> Subject: Re: low hanging fruit while cleaning up test failures
> 
> 
> 
> Okay, I think I've finally got something that will be useful 
> to someone. I'm attaching the patch to STDCXX-608 
> [https://issues.apache.org/jira/browse/STDCXX-608] for review.
> 
> There is a lot of code, and the feature is not 100% complete 
> yet. I need to create a test, deprecate the old rw_locales() 
> function, and come up with a way to locate the input files 
> without actually requiring that the environment variable 
> TOPDIR be defined.

  I've applied the patch and tested it on Windows.

  And I suppose that _rw_lookup_comparator() is intended to compare the
keys, but not the values.

  Personally I like the query syntax, proposed by Martin. Although we
would lose the ability to
select priority of the fields in query, this query syntax is more
intuitive. In tests we need to
obtain the list of the some subset of installed locales in any order.

Farid.

Re: low hanging fruit while cleaning up test failures

Posted by Martin Sebor <se...@roguewave.com>.
Travis Vitek wrote:
[...]
>> FYI, the setlocale() names can be really long on some platforms (e.g.,
>> on HP-UX, they always take the form:
>> /<category>/<category>/<category>/<category>/<category>/<category>
>> so 64 characters may not be enough for all locales).
> 
> I thought this was only the case when using setlocale (LC_ALL, ...)

Definitely for LC_ALL.

> because the OS needs to return a string that indicates which locales are
> used for each category so that the return of setlocale (LC_ALL, 0) can
> be used to restore the locale to a previous state. I believe that this
> is the way that it works on HP and AIX.

Looks like you're right (at least on HP-UX where I confirmed it).

> 
> So here is the thing that I am concerned about. The previous code
> allowed you to specify which locale facet you wanted to get locales for.

You mean category (the LC_XXX thing).

> I didn't understand how or why this was useful. I believe that I do now.
> Say a call to setlocale (LC_ALL, "X") returns the string "/A/B/C/D/E/F".
> If I just capture the result of setlocale (LC_CTYPE, 0), I'm not going
> to see that the other facets are set differently. I need to store the
> result of locale -a, or the names of the locales used by each of the
> components.

I'm not sure there are any tests that use the category argument but
I think the main point was to eliminate locales that seem to work
but some of whose categories don't. E.g., setlocale(LC_ALL, "zh_CN")
might return non-NULL but setlocale(LC_MESSAGES, "zh_CN") returns
NULL. I think we've had this happen.

> 
[...]
> 
> This is similar to what I started out with. The only disadvantage is
> that it doesn't allow you to prioritize one attribute over another.
> Nobody ever said we cared about order, but I assumed that we would.

As we discussed (and so just for the record), the "prioritization"
within, say, the MB_CUR_MAX field would be useful, but within the
locale name probably less so.

> 
[...]
>> Internally it would translate into multiple grep-like expressions
>> (i.e., arguments to the -e grep option) looking like this:
>>
>>   *_JP.* 3\n
>>   *_JP.* 4\n
>>   *_CN.* 3\n
>>   *_CN.* 4\n
>>
> 
> Yes, this would work fine provided that you didn't ever want to get all
> 4 byte encodings before the 3 byte encodings. I like the syntax much
> better though.

It would be nice to be able to specify the ordering somehow. Again,
for the record, the approach we discussed was to specify the order
using a second argument, say something like this:

     rw_locale_query("*_{JP,CN}.* {3,4}", "2d");

where the "2d" means: order the second bracket field in a descending
order, i.e., 4 before 3. The first field isn't specified, so the
function would internally expand the query into one of the following
grep-like expressions:

     "*_JP.* 4\n*_CN.* 4\n*_JP.* 3\n*_CN.* 3\n"
     "*_CN.* 4\n*_JP.* 4\n*_JP.* 3\n*_CN.* 3\n"
     "*_JP.* 4\n*_CN.* 4\n*_CN.* 3\n*_JP.* 3\n"
     "*_CN.* 4\n*_JP.* 4\n*_JP.* 3\n*_CN.* 3\n"

> 
>> with the whole thing basically being a simplified grep pattern that
>> could be used to search in a plain text file in this format:
>>
>>   <locale> <mb-cur-max> <alias-list>
>>
> 
> BTW, I never did find a way to get an alias for a locale. If I have the
> name of a locale, how can I find the list of aliases?

I don't know of any programmatic way to get the list of known aliases
but searching the filesystem for symlinks to locale database should
work. The aliases for our own locales and codesets are also listed
in the source files.

Martin


RE: low hanging fruit while cleaning up test failures

Posted by Travis Vitek <Tr...@roguewave.com>.
 

>Martin Sebor wrote:
>
>Travis Vitek wrote:
>> 
>> Okay, I think I've finally got something that will be useful 
>to someone. I'm
>> attaching the patch to STDCXX-608
>> [https://issues.apache.org/jira/browse/STDCXX-608] for review.
>> 
>> There is a lot of code, and the feature is not 100% complete 
>> yet. I need to create a test, deprecate the old rw_locales()
>> function, and come up with a way to locate the input files
>> without actually requiring that the environment variable TOPDIR
>> be defined.
>> 
>> The system is fairly simple from the public interface. A new 
>> public type rw_locale_entry_t
>
>What's the advantage of returning a list instead of just a character
>string like rw_locales() does? (Wouldn't it be simpler to just stick
>with the same interface?)
>

The advantage was not having to duplicate the data. I already have the
locale name in each of the rw_locale_entry_t objects and didn't see any
reason to duplicate the data in that list.

That said, I believe that I can easily write that on top of the
framework that I have now. That would minimize the impact on the
existing tests, which would be an advantage.

>
>I assume the rw_locale_entry_t members language, country, and encodings
>are populated with our canonical names for each, correct?
>

Yes. All members are canonical except for the `name' field.

>Is the rw_locale_entry_t::name member populated with a string specific
>to each operating system? If so, which of the two forms does it use:
>the one returned by locale -a or the one returned by setlocale()?
>

The name member holds the result of the call to setlocale (LC_CTYPE,
name), which should just be a single name. This is something that I
wasn't absolutely sure about. See below...

>FYI, the setlocale() names can be really long on some platforms (e.g.,
>on HP-UX, they always take the form:
>/<category>/<category>/<category>/<category>/<category>/<category>
>so 64 characters may not be enough for all locales).

I thought this was only the case when using setlocale (LC_ALL, ...)
because the OS needs to return a string that indicates which locales are
used for each category so that the return of setlocale (LC_ALL, 0) can
be used to restore the locale to a previous state. I believe that this
is the way that it works on HP and AIX.

So here is the thing that I am concerned about. The previous code
allowed you to specify which locale facet you wanted to get locales for.
I didn't understand how or why this was useful. I believe that I do now.
Say a call to setlocale (LC_ALL, "X") returns the string "/A/B/C/D/E/F".
If I just capture the result of setlocale (LC_CTYPE, 0), I'm not going
to see that the other facets are set differently. I need to store the
result of locale -a, or the names of the locales used by each of the
components.

>
>> has been added. It represents is a link in a linked list
>> of installed locales. The new function rw_all_locales() 
>> gives you a pointer to the first item in a sorted list of
>> installed locales. Another new function rw_locale_query()
>> takes a query string and a count, and it returns a pointer
>> to the first entry in a linked list of locale entries that
>> match the provided query string. The count parameter is
>> used to limit the number of locales in the linked list.
>
>Is the user responsible for freeing the linked list? If so, how?
>

No. It is 'memory in use at program termination', just like the locale
name buffer in the original rw_locales() function.

=========|=========|=========|=========|=========|=========|=========|==
===|

>> As an example, imagine that I want to find up to 10 locales 
>> for Japan or China that have MB_CUR_LEN of 4 or 3. You could
>> get that list of locales
>> with the following query...
>> 
>>   const rw_locale_entry_t* e = rw_locale_query ("C=JP|CN M=4|3", 10);
>
>I assume the AND operator is implicit between the subexpressions?
>I.e., the query is equivalent to
>
>   (C == "JP" OR C == "CN") && (MB_CUR_LEN == 3 || MB_CUR_LEN == 4)
>
>I'd like to make a simplifying suggestion regarding the query syntax
>[ducks] ;-) First, I'd like to suggest to drop the attributes C, E,
>and L, and instead assume the standard canonical locale name in the
>form <language>_<country>.<encoding>. Second, since we already have
>simple pattern matching in the form of rw_fnmatch() and since at at
>some point we'll need to add shell brace expansion (e.g., for the
>expected failures project), I'd like to propose that rather than
>using our own special syntax here and pattern matching and brace
>expansion elsewhere, we start with both here as well.

This is similar to what I started out with. The only disadvantage is
that it doesn't allow you to prioritize one attribute over another.
Nobody ever said we cared about order, but I assumed that we would.

>
>With that, the first part of the query string above would look like
>this: "*_{JP,CN}.*"
>
>The shell brace expansion syntax looks something like this:
>
>   string     ::= <brace-expr> | [ <chars> ]
>   brace-expr ::= <string> '{' <brace-list> '}' <string> | <string>
>   brace-list ::= <string> ',' <brace-list> | <string>
>   chars      ::= <pcs-char> <string> | <pcs-char>
>   pcs-char   ::= character in the Portable Character Set
>
>For the rest of the query I wonder if we could come up with a more
>conventional (and possibly more expressive) syntax that could use
>in other areas as well. I'm thinking something loosely based on
>grep might work, with multiple lines representing a disjunction of
>the expressions on each line, and with subexpressions on the same
>line being representing a conjunction of the subexpressions.
>
>So the query string from your example above would look like this:
>
>   *_{JP,CN}.* {3,4}
>
>Internally it would translate into multiple grep-like expressions
>(i.e., arguments to the -e grep option) looking like this:
>
>   *_JP.* 3\n
>   *_JP.* 4\n
>   *_CN.* 3\n
>   *_CN.* 4\n
>

Yes, this would work fine provided that you didn't ever want to get all
4 byte encodings before the 3 byte encodings. I like the syntax much
better though.

>with the whole thing basically being a simplified grep pattern that
>could be used to search in a plain text file in this format:
>
>   <locale> <mb-cur-max> <alias-list>
>

BTW, I never did find a way to get an alias for a locale. If I have the
name of a locale, how can I find the list of aliases?

>If we also wanted to include, say, an English locale in UTF, we
>would write:
>
>   *_{JP,CN}.*  *{3,4}\n
>   en_*.UTF-8
>
>I realize this is a little different from what I outlined earlier
>but after protyping the "expected failures" solution I think the
>bracket expression will be a very handy tool to add to the driver,
>and since we already have pattern matching in rw_fnmatch() we might
>as well put it to good use.
>

No problem. I'm getting used to doing it the wrong way once or twice
before producing something that is usable. :P

>Martin
>
>

Re: low hanging fruit while cleaning up test failures

Posted by Martin Sebor <se...@roguewave.com>.
Travis Vitek wrote:
> 
> Okay, I think I've finally got something that will be useful to someone. I'm
> attaching the patch to STDCXX-608
> [https://issues.apache.org/jira/browse/STDCXX-608] for review.
> 
> There is a lot of code, and the feature is not 100% complete yet. I need to
> create a test, deprecate the old rw_locales() function, and come up with a
> way to locate the input files without actually requiring that the
> environment variable TOPDIR be defined.
> 
> The system is fairly simple from the public interface. A new public type
> rw_locale_entry_t

What's the advantage of returning a list instead of just a character
string like rw_locales() does? (Wouldn't it be simpler to just stick
with the same interface?)

I assume the rw_locale_entry_t members language, country, and encodings
are populated with our canonical names for each, correct?

Is the rw_locale_entry_t::name member populated with a string specific
to each operating system? If so, which of the two forms does it use:
the one returned by locale -a or the one returned by setlocale()?

FYI, the setlocale() names can be really long on some platforms (e.g.,
on HP-UX, they always take the form:
/<category>/<category>/<category>/<category>/<category>/<category>
so 64 characters may not be enough for all locales).

> has been added. It represents is a link in a linked list
> of installed locales. The new function rw_all_locales() gives you a pointer
> to the first item in a sorted list of installed locales. Another new
> function rw_locale_query() takes a query string and a count, and it returns
> a pointer to the first entry in a linked list of locale entries that match
> the provided query string. The count parameter is used to limit the number
> of locales in the linked list.

Is the user responsible for freeing the linked list? If so, how?

> 
> The query string allows you to specify what attributes you want to query,
> what values you want those attributes to have, and what priority to give
> thos attributes relative to others. The supported attributes are language
> [L], country [C], encoding [E], and mb_cur_len [M]. Multiple values for the
> same attribute can be specified by seperating them with a | character. You
> can use a * as a match anything wildcard expression. I just realized that it
> might be useful to omit certain attribute values. If someone thinks this
> might be useful, we could do that with a ! or ^.

I suppose it could potentially be a useful extension, although off
hand I can't come up with a use case.

> 
> As an example, imagine that I want to find up to 10 locales for Japan or
> China that have MB_CUR_LEN of 4 or 3. You could get that list of locales
> with the following query...
> 
>   const rw_locale_entry_t* e = rw_locale_query ("C=JP|CN M=4|3", 10);

I assume the AND operator is implicit between the subexpressions?
I.e., the query is equivalent to

   (C == "JP" OR C == "CN") && (MB_CUR_LEN == 3 || MB_CUR_LEN == 4)

I'd like to make a simplifying suggestion regarding the query syntax
[ducks] ;-) First, I'd like to suggest to drop the attributes C, E,
and L, and instead assume the standard canonical locale name in the
form <language>_<country>.<encoding>. Second, since we already have
simple pattern matching in the form of rw_fnmatch() and since at at
some point we'll need to add shell brace expansion (e.g., for the
expected failures project), I'd like to propose that rather than
using our own special syntax here and pattern matching and brace
expansion elsewhere, we start with both here as well.

With that, the first part of the query string above would look like
this: "*_{JP,CN}.*"

The shell brace expansion syntax looks something like this:

   string     ::= <brace-expr> | [ <chars> ]
   brace-expr ::= <string> '{' <brace-list> '}' <string> | <string>
   brace-list ::= <string> ',' <brace-list> | <string>
   chars      ::= <pcs-char> <string> | <pcs-char>
   pcs-char   ::= character in the Portable Character Set

For the rest of the query I wonder if we could come up with a more
conventional (and possibly more expressive) syntax that could use
in other areas as well. I'm thinking something loosely based on
grep might work, with multiple lines representing a disjunction of
the expressions on each line, and with subexpressions on the same
line being representing a conjunction of the subexpressions.

So the query string from your example above would look like this:

   *_{JP,CN}.* {3,4}

Internally it would translate into multiple grep-like expressions
(i.e., arguments to the -e grep option) looking like this:

   *_JP.* 3\n
   *_JP.* 4\n
   *_CN.* 3\n
   *_CN.* 4\n

with the whole thing basically being a simplified grep pattern that
could be used to search in a plain text file in this format:

   <locale> <mb-cur-max> <alias-list>

If we also wanted to include, say, an English locale in UTF, we
would write:

   *_{JP,CN}.*  *{3,4}\n
   en_*.UTF-8

I realize this is a little different from what I outlined earlier
but after protyping the "expected failures" solution I think the
bracket expression will be a very handy tool to add to the driver,
and since we already have pattern matching in rw_fnmatch() we might
as well put it to good use.

Martin


Re: low hanging fruit while cleaning up test failures

Posted by Travis Vitek <vi...@roguewave.com>.

Okay, I think I've finally got something that will be useful to someone. I'm
attaching the patch to STDCXX-608
[https://issues.apache.org/jira/browse/STDCXX-608] for review.

There is a lot of code, and the feature is not 100% complete yet. I need to
create a test, deprecate the old rw_locales() function, and come up with a
way to locate the input files without actually requiring that the
environment variable TOPDIR be defined.

The system is fairly simple from the public interface. A new public type
rw_locale_entry_t has been added. It represents is a link in a linked list
of installed locales. The new function rw_all_locales() gives you a pointer
to the first item in a sorted list of installed locales. Another new
function rw_locale_query() takes a query string and a count, and it returns
a pointer to the first entry in a linked list of locale entries that match
the provided query string. The count parameter is used to limit the number
of locales in the linked list.

The query string allows you to specify what attributes you want to query,
what values you want those attributes to have, and what priority to give
thos attributes relative to others. The supported attributes are language
[L], country [C], encoding [E], and mb_cur_len [M]. Multiple values for the
same attribute can be specified by seperating them with a | character. You
can use a * as a match anything wildcard expression. I just realized that it
might be useful to omit certain attribute values. If someone thinks this
might be useful, we could do that with a ! or ^.

As an example, imagine that I want to find up to 10 locales for Japan or
China that have MB_CUR_LEN of 4 or 3. You could get that list of locales
with the following query...

  const rw_locale_entry_t* e = rw_locale_query ("C=JP|CN M=4|3", 10);

That query will give you results in the order you ask for them. In this
example, all locales for Japan would be prioritized before those for China,
regardless of MB_CUR_LEN. They would also be sorted so that the 4 byte
encodings for each language would come before the 3 byte encodings. On AIX
the returned list of locales should be something like...

  JA_JP            [4]
  JA_JP.UTF-8      [4]
  ja_JP            [3]
  ja_JP.IBM-eucJP  [3]
  ZH_CN            [4]
  Zh_CN            [4]
  Zh_CN.GB18030    [4]
  ZH_CN.UTF-8      [4]

If we switched the query to 

  const rw_locale_entry_t* e = rw_locale_query ("M=4|3 C=JP|CN", 10);

the results would be prioritized such that all 4 byte encodings for Japan
would be first, then all 4 byte encodings for China, followed by 3 byte
encodings for for each...

  JA_JP            [4]
  JA_JP.UTF-8      [4]
  ZH_CN            [4]
  Zh_CN            [4]
  Zh_CN.GB18030    [4]
  ZH_CN.UTF-8      [4]
  ja_JP            [3]
  ja_JP.IBM-eucJP  [3]

So I hope that is enough to get us started and that I haven't been wandering
down the wrong road for days. Please post feedback so I know how everyone
feels about this. Evan a 'do not care' post is better than nothing.

Travis
-- 
View this message in context: http://www.nabble.com/low-hanging-fruit-while-cleaning-up-test-failures-tp13634803p15056065.html
Sent from the stdcxx-dev mailing list archive at Nabble.com.


Re: low hanging fruit while cleaning up test failures

Posted by Martin Sebor <se...@roguewave.com>.
Travis Vitek wrote:
> 
> 
> Travis Vitek wrote:
>>
>>
>> Martin Sebor wrote:
>>> My only requirement is to get those tests to pass in a reasonable
>>> amount of time (i.e., without timing out), and without compromising
>>> their effectiveness.
>>>
>>>  > Do
>>>  > we want to give up on the locale name matching, or do we want to
>>> include
>>>  > zh_CN in the list of locales to test? What about matching the
>>> encoding?
>>>  > Should we ignore all of this and just find one locale for each value
>>> of
>>>  > MB_CUR_MAX from 1 to MB_LEN_MAX and run the test on them?
>>>
>>> Maybe. I'll let you propose what makes the most sense to you :)
>>>
>>> Martin
>>>
>> Well, the AIX I'm testing on has 683 installed locale files. Of those,
>> many are links to locales with different names. For example, we have
>>
>>     $ locale -a | grep "_CN" | grep -v "\."
>>     ZH_CN
>>     Zh_CN
>>     zh_CN
>>     $ ls -l /usr/lib/nls/loc/ZH_CN
>>     lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
>> /usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/ZH_CN.UTF-8
>>     $ ls -l /usr/lib/nls/loc/Zh_CN
>>     lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
>> /usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/Zh_CN.GB18030
>>     $ ls -l /usr/lib/nls/loc/zh_CN
>>     lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
>> /usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/zh_CN.IBM-eucCN
>>
>> The locales that are mapped to [ZH_CN.UTF-8, Zh_CN.GB18030,
>> zh_CN.IBM-eucCN] also appear in the locale list, so we have many
>> duplicated locales. So, for an immediate reduction in the number of tested
>> locales, we could eliminate these duplicates. How to tell if a locale is a
>> duplicate? I'm not sure.
>>
>> Another option would be to ignore all locales that don't match the regular
>> expression "[a-z][a-z]_[A-Z][A-Z](\.[^@]*)?$" or the fnmatch expressions
>> "[a-z][a-z]_[A-Z][A-Z]" and "[a-z][a-z]_[A-Z][A-Z].[!@]*". The C/POSIX
>> locales don't match this, but we can explicitly allow them.
>>
>> This alone cuts the number of locales down significantly, though it does
>> affect other platforms. Here is a small table showing the total number of
>> locales, and the number of locales that match the above regular
>> expression.
>>
>>         Okay Total
>> AIX      226   603
>> Compaq    33    40
>> HP-UX    142   160
>> Irix      39    60
>> Linux    479   582
>> Solaris  223   331
>>
>> Another option is to build up a list of all installed locales [their names
>> and other properties], and then provide a mechanism to search through, or
>> iterate over that list. If you want to run a test on all locales that have
>> a name matching some expression, you write a function or function object
>> to return true on match. You pass that to the rw_locales_match() routine,
>> and it gives you the first match. Call again to get the next match or
>> null.
>>
>>     for (const rw_locale_entry* e = rw_locales_match(0, fun);
>>          e; e = rw_locales_match(e, fun))
>>     {
>>     }
>>
>> If you want to select only locales with mb_cur_max of 4, you either write
>> a filter, or you explicitly iterate over the list. If we really decide
>> that it is necessary to write up a SQL type language for selecting
>> locales, then that system can be implemented on top of this.
>>
>> Travis
>>
> 
> Ah, my primitive scheme above isn't quite good enough. The time to run the
> 22.locale.ctype.is test was 28m35s, and I've reduced it down to 6m28s with
> an 11s build on AIX. The test would have timed out at 5 minutes.

Because we're still testing far too many locales...

> 
> Now that I've seen that, it makes me wonder about the other proposal and the
> SQL-like query string idea. If we get a locale from the system, we don't
> have access to the original data that was in the ASCII source file. We just
> get the data presented from the C/C++ locale. This means that we have to
> discover information about the locale [like the mb_cur_max value]. This may
> take considerable time.

Maybe we should start by putting together a comprehensive list
of locales installed on all our systems and their properties:

   std-country, std-lang, std-codeset, native-name, aliases, MB_CUR_MAX,
   ...(anything else of interest)...

std-country (ISO-3166):
   http://www.iso.org/iso/english_country_names_and_code_elements

std-lang (ISO-639):
   http://www.loc.gov/standards/iso639-2/php/English_list.php

std-codeset:
   http://www.iana.org/assignments/character-sets

We could then create a database mapping each of the set of standard
names to the platform-specific names on every supported OS. We'd
also need the ability to ask for one out of a set of options (i.e.,
give me a locale that corresponds to en_US.UTF-8 if it exist, or
else en_US.ISO-8859-1, or an en_US locale in any encoding, or if
even that's not available, anything you've got in English ;-)

Martin

Re: low hanging fruit while cleaning up test failures

Posted by Travis Vitek <vi...@roguewave.com>.


Travis Vitek wrote:
> 
> 
> 
> Martin Sebor wrote:
>> 
>> My only requirement is to get those tests to pass in a reasonable
>> amount of time (i.e., without timing out), and without compromising
>> their effectiveness.
>> 
>>  > Do
>>  > we want to give up on the locale name matching, or do we want to
>> include
>>  > zh_CN in the list of locales to test? What about matching the
>> encoding?
>>  > Should we ignore all of this and just find one locale for each value
>> of
>>  > MB_CUR_MAX from 1 to MB_LEN_MAX and run the test on them?
>> 
>> Maybe. I'll let you propose what makes the most sense to you :)
>> 
>> Martin
>> 
> 
> Well, the AIX I'm testing on has 683 installed locale files. Of those,
> many are links to locales with different names. For example, we have
> 
>     $ locale -a | grep "_CN" | grep -v "\."
>     ZH_CN
>     Zh_CN
>     zh_CN
>     $ ls -l /usr/lib/nls/loc/ZH_CN
>     lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
> /usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/ZH_CN.UTF-8
>     $ ls -l /usr/lib/nls/loc/Zh_CN
>     lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
> /usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/Zh_CN.GB18030
>     $ ls -l /usr/lib/nls/loc/zh_CN
>     lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
> /usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/zh_CN.IBM-eucCN
> 
> The locales that are mapped to [ZH_CN.UTF-8, Zh_CN.GB18030,
> zh_CN.IBM-eucCN] also appear in the locale list, so we have many
> duplicated locales. So, for an immediate reduction in the number of tested
> locales, we could eliminate these duplicates. How to tell if a locale is a
> duplicate? I'm not sure.
> 
> Another option would be to ignore all locales that don't match the regular
> expression "[a-z][a-z]_[A-Z][A-Z](\.[^@]*)?$" or the fnmatch expressions
> "[a-z][a-z]_[A-Z][A-Z]" and "[a-z][a-z]_[A-Z][A-Z].[!@]*". The C/POSIX
> locales don't match this, but we can explicitly allow them.
> 
> This alone cuts the number of locales down significantly, though it does
> affect other platforms. Here is a small table showing the total number of
> locales, and the number of locales that match the above regular
> expression.
> 
>         Okay Total
> AIX      226   603
> Compaq    33    40
> HP-UX    142   160
> Irix      39    60
> Linux    479   582
> Solaris  223   331
> 
> Another option is to build up a list of all installed locales [their names
> and other properties], and then provide a mechanism to search through, or
> iterate over that list. If you want to run a test on all locales that have
> a name matching some expression, you write a function or function object
> to return true on match. You pass that to the rw_locales_match() routine,
> and it gives you the first match. Call again to get the next match or
> null.
> 
>     for (const rw_locale_entry* e = rw_locales_match(0, fun);
>          e; e = rw_locales_match(e, fun))
>     {
>     }
> 
> If you want to select only locales with mb_cur_max of 4, you either write
> a filter, or you explicitly iterate over the list. If we really decide
> that it is necessary to write up a SQL type language for selecting
> locales, then that system can be implemented on top of this.
> 
> Travis
> 

Ah, my primitive scheme above isn't quite good enough. The time to run the
22.locale.ctype.is test was 28m35s, and I've reduced it down to 6m28s with
an 11s build on AIX. The test would have timed out at 5 minutes.

Now that I've seen that, it makes me wonder about the other proposal and the
SQL-like query string idea. If we get a locale from the system, we don't
have access to the original data that was in the ASCII source file. We just
get the data presented from the C/C++ locale. This means that we have to
discover information about the locale [like the mb_cur_max value]. This may
take considerable time.

Travis

-- 
View this message in context: http://www.nabble.com/low-hanging-fruit-while-cleaning-up-test-failures-tp13634803p14821525.html
Sent from the stdcxx-dev mailing list archive at Nabble.com.


Re: low hanging fruit while cleaning up test failures

Posted by Martin Sebor <se...@roguewave.com>.
Travis Vitek wrote:
> 
> 
> Martin Sebor wrote:
>> My only requirement is to get those tests to pass in a reasonable
>> amount of time (i.e., without timing out), and without compromising
>> their effectiveness.
>>
>>  > Do
>>  > we want to give up on the locale name matching, or do we want to
>> include
>>  > zh_CN in the list of locales to test? What about matching the encoding?
>>  > Should we ignore all of this and just find one locale for each value of
>>  > MB_CUR_MAX from 1 to MB_LEN_MAX and run the test on them?
>>
>> Maybe. I'll let you propose what makes the most sense to you :)
>>
>> Martin
>>
> 
> Well, the AIX I'm testing on has 683 installed locale files. Of those, many
> are links to locales with different names. For example, we have
> 
>     $ locale -a | grep "_CN" | grep -v "\."
>     ZH_CN
>     Zh_CN
>     zh_CN
>     $ ls -l /usr/lib/nls/loc/ZH_CN
>     lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
> /usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/ZH_CN.UTF-8
>     $ ls -l /usr/lib/nls/loc/Zh_CN
>     lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
> /usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/Zh_CN.GB18030
>     $ ls -l /usr/lib/nls/loc/zh_CN
>     lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
> /usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/zh_CN.IBM-eucCN
> 
> The locales that are mapped to [ZH_CN.UTF-8, Zh_CN.GB18030, zh_CN.IBM-eucCN]
> also appear in the locale list, so we have many duplicated locales. So, for
> an immediate reduction in the number of tested locales, we could eliminate
> these duplicates. How to tell if a locale is a duplicate? I'm not sure.

Test the result of setlocale(LC_ALL, name) for equality?

> 
> Another option would be to ignore all locales that don't match the regular
> expression "[a-z][a-z]_[A-Z][A-Z](\.[^@]*)?$" or the fnmatch expressions
> "[a-z][a-z]_[A-Z][A-Z]" and "[a-z][a-z]_[A-Z][A-Z].[!@]*". The C/POSIX
> locales don't match this, but we can explicitly allow them.

I suspect this kind of matching isn't going to be robust enough.

> 
> This alone cuts the number of locales down significantly, though it does
> affect other platforms. Here is a small table showing the total number of
> locales, and the number of locales that match the above regular expression.
> 
>         Okay Total
> AIX      226   603
> Compaq    33    40
> HP-UX    142   160
> Irix      39    60
> Linux    479   582
> Solaris  223   331
> 
> Another option is to build up a list of all installed locales [their names
> and other properties], and then provide a mechanism to search through, or
> iterate over that list.

This would work.

> If you want to run a test on all locales that have a
> name matching some expression, you write a function or function object to
> return true on match. You pass that to the rw_locales_match() routine, and
> it gives you the first match. Call again to get the next match or null.
> 
>     for (const rw_locale_entry* e = rw_locales_match(0, fun);
>          e; e = rw_locales_match(e, fun))
>     {
>     }
> 
> If you want to select only locales with mb_cur_max of 4, you either write a
> filter, or you explicitly iterate over the list. If we really decide that it
> is necessary to write up a SQL type language for selecting locales, then
> that system can be implemented on top of this.

I like it!

Martin

Re: low hanging fruit while cleaning up test failures

Posted by Travis Vitek <vi...@roguewave.com>.


Martin Sebor wrote:
> 
> My only requirement is to get those tests to pass in a reasonable
> amount of time (i.e., without timing out), and without compromising
> their effectiveness.
> 
>  > Do
>  > we want to give up on the locale name matching, or do we want to
> include
>  > zh_CN in the list of locales to test? What about matching the encoding?
>  > Should we ignore all of this and just find one locale for each value of
>  > MB_CUR_MAX from 1 to MB_LEN_MAX and run the test on them?
> 
> Maybe. I'll let you propose what makes the most sense to you :)
> 
> Martin
> 

Well, the AIX I'm testing on has 683 installed locale files. Of those, many
are links to locales with different names. For example, we have

    $ locale -a | grep "_CN" | grep -v "\."
    ZH_CN
    Zh_CN
    zh_CN
    $ ls -l /usr/lib/nls/loc/ZH_CN
    lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
/usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/ZH_CN.UTF-8
    $ ls -l /usr/lib/nls/loc/Zh_CN
    lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
/usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/Zh_CN.GB18030
    $ ls -l /usr/lib/nls/loc/zh_CN
    lrwxrwxrwx   1 bin    bin      bin              28 Feb  8 2008 
/usr/lib/nls/loc/ZH_CN -> /usr/lib/nls/loc/zh_CN.IBM-eucCN

The locales that are mapped to [ZH_CN.UTF-8, Zh_CN.GB18030, zh_CN.IBM-eucCN]
also appear in the locale list, so we have many duplicated locales. So, for
an immediate reduction in the number of tested locales, we could eliminate
these duplicates. How to tell if a locale is a duplicate? I'm not sure.

Another option would be to ignore all locales that don't match the regular
expression "[a-z][a-z]_[A-Z][A-Z](\.[^@]*)?$" or the fnmatch expressions
"[a-z][a-z]_[A-Z][A-Z]" and "[a-z][a-z]_[A-Z][A-Z].[!@]*". The C/POSIX
locales don't match this, but we can explicitly allow them.

This alone cuts the number of locales down significantly, though it does
affect other platforms. Here is a small table showing the total number of
locales, and the number of locales that match the above regular expression.

        Okay Total
AIX      226   603
Compaq    33    40
HP-UX    142   160
Irix      39    60
Linux    479   582
Solaris  223   331

Another option is to build up a list of all installed locales [their names
and other properties], and then provide a mechanism to search through, or
iterate over that list. If you want to run a test on all locales that have a
name matching some expression, you write a function or function object to
return true on match. You pass that to the rw_locales_match() routine, and
it gives you the first match. Call again to get the next match or null.

    for (const rw_locale_entry* e = rw_locales_match(0, fun);
         e; e = rw_locales_match(e, fun))
    {
    }

If you want to select only locales with mb_cur_max of 4, you either write a
filter, or you explicitly iterate over the list. If we really decide that it
is necessary to write up a SQL type language for selecting locales, then
that system can be implemented on top of this.

Travis
-- 
View this message in context: http://www.nabble.com/low-hanging-fruit-while-cleaning-up-test-failures-tp13634803p14818795.html
Sent from the stdcxx-dev mailing list archive at Nabble.com.


Re: low hanging fruit while cleaning up test failures

Posted by Martin Sebor <se...@roguewave.com>.
[forwarding back to the list]

Travis Vitek wrote:
 > Martin,
 >
 > Not all supported platforms have the GB18030 encoding [HP, Compaq and
 > IRIX don't], and of those that do, they use different names [gb18030 vs
 > GB18030]. Same with UTF-8 [utf8, UTF8 or UTF-8].

I realize that. That's the reason why I mentioned the (currently quite
inefficient) find_mb_locale() in 22.locale.codecvt.out.cpp: it looks
for any multibyte locale with MB_CUR_MAX of some value.

 > On top of that, Windows
 > uses code page numbers instead of encodings. Now I can easily convert
 > names to uppercase and strip out non alphanumeric characters. I might
 > even be able to do something with windows. That isn't the problem.
 >
 > The problem is that I don't seem to have a clear understanding of what
 > exactly you want from this. The original proposal was to be able to
 > filter locales by name or encoding, like so...
 >
 >     char* locales = rw_locales (_RWSTD_LC_ALL, "en_US de", 0, true);
 >     // would retrieve C en_US and all German locales
 >
 >     char* locales = rw_locales (_RWSTD_LC_ALL, 0, "UTF-8", true);
 >     // would retrieve all UTF-8 locales [those that end in .utf8, .UTF-8
 > or .UTF8]
 >
 > So I wrote that. Unfortunately, as mentioned above, it has limitations.

Right. It wasn't a thought out proposal. I was just brainstorming :)
We may not be able to use any of it to fix the hanging tests.

 > What I really need is some actual requirements so that I can write some
 > code and get this bug closed.

My only requirement is to get those tests to pass in a reasonable
amount of time (i.e., without timing out), and without compromising
their effectiveness.

 >
 > It seems that you want to guarantee that we test multibyte locales.

It seems important to exercise ctype::do_narrow() in this case but
I haven't looked at the code very carefully. It could be that the
code path in the multibyte case isn't any different from the single
byte case.

 > Do
 > we want to give up on the locale name matching, or do we want to include
 > zh_CN in the list of locales to test? What about matching the encoding?
 > Should we ignore all of this and just find one locale for each value of
 > MB_CUR_MAX from 1 to MB_LEN_MAX and run the test on them?

Maybe. I'll let you propose what makes the most sense to you :)

Martin

 >
 > Travis
 >
 >
 >
 >
 >> -----Original Message-----
 >> From: Martin Sebor [mailto:msebor@gmail.com] On Behalf Of Martin Sebor
 >> Sent: Wednesday, January 02, 2008 1:41 PM
 >> To: stdcxx-dev@incubator.apache.org
 >> Subject: Re: low hanging fruit while cleaning up test failures
 >>
 >> Travis Vitek wrote:
 >>>
 >>> Martin Sebor wrote:
 >>>> Travis Vitek wrote:
 >>>>> Martin Sebor wrote:
 >>>>>> Travis Vitek wrote:
 >>>>>>> Martin Sebor wrote:
 >>>>>>>> I added a new function, rw_fnmatch(), to the test
 >> driver. It behaves
 >>>>>>>> just
 >>>>>>>> like the POSIX fnmatch() (the FNM_XXX constants aren't
 >> implemented
 >>>>>>>> yet). While the main purpose behind the new function is
 >> to support
 >>>>>>>> STDCXX-683 it should make it easier to also implement a
 >> scheme like
 >>>>>>>> the one outlined below.
 >>>>>>>>
 >>>>>>>> Travis, feel free to experiment/prototype a solution :)
 >>>>>>>>
 >>>>>>>> Martin
 >>>>>>>>
 >>>>>>> What expression should be used to get an appropriate set
 >> of locales for
 >>>>>>> a
 >>>>>>> given platform? I can't really expect a filter for all
 >> UTF-8 locales to
 >>>>>>> work
 >>>>>>> on all platforms as some don't have those encodings
 >> available at all.
 >>>>>>> If
 >>>>>>> I
 >>>>>>> filter by language, then I may be limiting the testing
 >> to some always
 >>>>>>> correct subset. Is that acceptable for the MT tests?
 >>>>>> I think the MT ctype tests just need to exercise a representative
 >>>>>> sample of multi-byte encodings (i.e., MB_CUR_MAX between 1 and
 >>>>>> MB_LEN_MAX). There already is some code in the test suite to find
 >>>>>> locales that use these encodings, although it could be made more
 >>>>>> efficient. I don't know how useful rw_fnmatch() will turn out to
 >>>>>> be in finding these codesets since their names don't matter.
 >>>>>>
 >>>>>> Martin
 >>>>>>
 >>>>>>> Travis
 >>>>> Actually, I think I meant to say single threaded tests.
 >> Those are the
 >>>>> ones
 >>>>> that currently test every locale. The multi-threadede
 >> tests already test
 >>>>> a
 >>>>> subset of locales, though the method for selecting those
 >> locales may vary
 >>>>> between tests.
 >>>>>
 >>>>> I don't think it is right to test a fixed set of locales based on
 >>>>> language,
 >>>>> country, or encoding. If you agree, then we probably agree that the
 >>>>> proposed
 >>>>> enhancement doesn't actually do anything useful [and I've
 >> wasted a bunch
 >>>>> of
 >>>>> time]. If this is the case, then we need to propose
 >> another solution for
 >>>>> selecting locales.
 >>>> I think testing a small subset of installed locales should
 >> be enough.
 >>>> In fact, for white box testing of the ctype facets, exercising three
 >>>> locales, "C" and two named ones, should be sufficient.
 >>>>
 >>>>> If I am wrong, and it is useful for testing [and more
 >> specifically how it
 >>>>> would be useful for fixing STDCXX-608], then I'd like to hear how.
 >>>> What do you propose?
 >>>>
 >>>> Martin
 >>>>
 >>>>
 >>> Okay. I can live with that. Then the issue now becomes deciding which
 >>> additional locales to test. How about just testing all
 >> Spanish and German
 >>> locales?
 >> I'd make sure at least one of them uses a multibyte encoding. Maybe
 >> zh_CN.GB18030? (with MB_CUR_MAX of 4)?
 >>
 >> Martin
 >>
 >



Re: low hanging fruit while cleaning up test failures

Posted by Martin Sebor <se...@roguewave.com>.
Travis Vitek wrote:
> 
> 
> Martin Sebor wrote:
>> Travis Vitek wrote:
>>>
>>> Martin Sebor wrote:
>>>> Travis Vitek wrote:
>>>>> Martin Sebor wrote:
>>>>>> I added a new function, rw_fnmatch(), to the test driver. It behaves
>>>>>> just
>>>>>> like the POSIX fnmatch() (the FNM_XXX constants aren't implemented
>>>>>> yet). While the main purpose behind the new function is to support
>>>>>> STDCXX-683 it should make it easier to also implement a scheme like
>>>>>> the one outlined below.
>>>>>>
>>>>>> Travis, feel free to experiment/prototype a solution :)
>>>>>>
>>>>>> Martin
>>>>>>
>>>>> What expression should be used to get an appropriate set of locales for
>>>>> a
>>>>> given platform? I can't really expect a filter for all UTF-8 locales to
>>>>> work
>>>>> on all platforms as some don't have those encodings available at all.
>>>>> If
>>>>> I
>>>>> filter by language, then I may be limiting the testing to some always
>>>>> correct subset. Is that acceptable for the MT tests?
>>>> I think the MT ctype tests just need to exercise a representative
>>>> sample of multi-byte encodings (i.e., MB_CUR_MAX between 1 and
>>>> MB_LEN_MAX). There already is some code in the test suite to find
>>>> locales that use these encodings, although it could be made more
>>>> efficient. I don't know how useful rw_fnmatch() will turn out to
>>>> be in finding these codesets since their names don't matter.
>>>>
>>>> Martin
>>>>
>>>>> Travis
>>>
>>> Actually, I think I meant to say single threaded tests. Those are the
>>> ones
>>> that currently test every locale. The multi-threadede tests already test
>>> a
>>> subset of locales, though the method for selecting those locales may vary
>>> between tests.
>>>
>>> I don't think it is right to test a fixed set of locales based on
>>> language,
>>> country, or encoding. If you agree, then we probably agree that the
>>> proposed
>>> enhancement doesn't actually do anything useful [and I've wasted a bunch
>>> of
>>> time]. If this is the case, then we need to propose another solution for
>>> selecting locales.
>> I think testing a small subset of installed locales should be enough.
>> In fact, for white box testing of the ctype facets, exercising three
>> locales, "C" and two named ones, should be sufficient.
>>
>>> If I am wrong, and it is useful for testing [and more specifically how it
>>> would be useful for fixing STDCXX-608], then I'd like to hear how.
>> What do you propose?
>>
>> Martin
>>
>>
> 
> Okay. I can live with that. Then the issue now becomes deciding which
> additional locales to test. How about just testing all Spanish and German
> locales?

I'd make sure at least one of them uses a multibyte encoding. Maybe
zh_CN.GB18030? (with MB_CUR_MAX of 4)?

Martin

Re: low hanging fruit while cleaning up test failures

Posted by Travis Vitek <vi...@roguewave.com>.


Martin Sebor wrote:
> 
> Travis Vitek wrote:
>> 
>> 
>> Martin Sebor wrote:
>>> Travis Vitek wrote:
>>>>
>>>> Martin Sebor wrote:
>>>>> I added a new function, rw_fnmatch(), to the test driver. It behaves
>>>>> just
>>>>> like the POSIX fnmatch() (the FNM_XXX constants aren't implemented
>>>>> yet). While the main purpose behind the new function is to support
>>>>> STDCXX-683 it should make it easier to also implement a scheme like
>>>>> the one outlined below.
>>>>>
>>>>> Travis, feel free to experiment/prototype a solution :)
>>>>>
>>>>> Martin
>>>>>
>>>> What expression should be used to get an appropriate set of locales for
>>>> a
>>>> given platform? I can't really expect a filter for all UTF-8 locales to
>>>> work
>>>> on all platforms as some don't have those encodings available at all.
>>>> If
>>>> I
>>>> filter by language, then I may be limiting the testing to some always
>>>> correct subset. Is that acceptable for the MT tests?
>>> I think the MT ctype tests just need to exercise a representative
>>> sample of multi-byte encodings (i.e., MB_CUR_MAX between 1 and
>>> MB_LEN_MAX). There already is some code in the test suite to find
>>> locales that use these encodings, although it could be made more
>>> efficient. I don't know how useful rw_fnmatch() will turn out to
>>> be in finding these codesets since their names don't matter.
>>>
>>> Martin
>>>
>>>> Travis
>> 
>> 
>> Actually, I think I meant to say single threaded tests. Those are the
>> ones
>> that currently test every locale. The multi-threadede tests already test
>> a
>> subset of locales, though the method for selecting those locales may vary
>> between tests.
>> 
>> I don't think it is right to test a fixed set of locales based on
>> language,
>> country, or encoding. If you agree, then we probably agree that the
>> proposed
>> enhancement doesn't actually do anything useful [and I've wasted a bunch
>> of
>> time]. If this is the case, then we need to propose another solution for
>> selecting locales.
> 
> I think testing a small subset of installed locales should be enough.
> In fact, for white box testing of the ctype facets, exercising three
> locales, "C" and two named ones, should be sufficient.
> 
>> 
>> If I am wrong, and it is useful for testing [and more specifically how it
>> would be useful for fixing STDCXX-608], then I'd like to hear how.
> 
> What do you propose?
> 
> Martin
> 
> 

Okay. I can live with that. Then the issue now becomes deciding which
additional locales to test. How about just testing all Spanish and German
locales?

Travis
-- 
View this message in context: http://www.nabble.com/low-hanging-fruit-while-cleaning-up-test-failures-tp13634803p14585914.html
Sent from the stdcxx-dev mailing list archive at Nabble.com.


Re: low hanging fruit while cleaning up test failures

Posted by Martin Sebor <se...@roguewave.com>.
Travis Vitek wrote:
> 
> 
> Martin Sebor wrote:
>> Travis Vitek wrote:
>>>
>>> Martin Sebor wrote:
>>>> I added a new function, rw_fnmatch(), to the test driver. It behaves
>>>> just
>>>> like the POSIX fnmatch() (the FNM_XXX constants aren't implemented
>>>> yet). While the main purpose behind the new function is to support
>>>> STDCXX-683 it should make it easier to also implement a scheme like
>>>> the one outlined below.
>>>>
>>>> Travis, feel free to experiment/prototype a solution :)
>>>>
>>>> Martin
>>>>
>>> What expression should be used to get an appropriate set of locales for a
>>> given platform? I can't really expect a filter for all UTF-8 locales to
>>> work
>>> on all platforms as some don't have those encodings available at all. If
>>> I
>>> filter by language, then I may be limiting the testing to some always
>>> correct subset. Is that acceptable for the MT tests?
>> I think the MT ctype tests just need to exercise a representative
>> sample of multi-byte encodings (i.e., MB_CUR_MAX between 1 and
>> MB_LEN_MAX). There already is some code in the test suite to find
>> locales that use these encodings, although it could be made more
>> efficient. I don't know how useful rw_fnmatch() will turn out to
>> be in finding these codesets since their names don't matter.
>>
>> Martin
>>
>>> Travis
> 
> 
> Actually, I think I meant to say single threaded tests. Those are the ones
> that currently test every locale. The multi-threadede tests already test a
> subset of locales, though the method for selecting those locales may vary
> between tests.
> 
> I don't think it is right to test a fixed set of locales based on language,
> country, or encoding. If you agree, then we probably agree that the proposed
> enhancement doesn't actually do anything useful [and I've wasted a bunch of
> time]. If this is the case, then we need to propose another solution for
> selecting locales.

I think testing a small subset of installed locales should be enough.
In fact, for white box testing of the ctype facets, exercising three
locales, "C" and two named ones, should be sufficient.

> 
> If I am wrong, and it is useful for testing [and more specifically how it
> would be useful for fixing STDCXX-608], then I'd like to hear how.

What do you propose?

Martin

Re: low hanging fruit while cleaning up test failures

Posted by Travis Vitek <vi...@roguewave.com>.


Martin Sebor wrote:
> 
> Travis Vitek wrote:
>> 
>> 
>> Martin Sebor wrote:
>>> I added a new function, rw_fnmatch(), to the test driver. It behaves
>>> just
>>> like the POSIX fnmatch() (the FNM_XXX constants aren't implemented
>>> yet). While the main purpose behind the new function is to support
>>> STDCXX-683 it should make it easier to also implement a scheme like
>>> the one outlined below.
>>>
>>> Travis, feel free to experiment/prototype a solution :)
>>>
>>> Martin
>>>
>> 
>> What expression should be used to get an appropriate set of locales for a
>> given platform? I can't really expect a filter for all UTF-8 locales to
>> work
>> on all platforms as some don't have those encodings available at all. If
>> I
>> filter by language, then I may be limiting the testing to some always
>> correct subset. Is that acceptable for the MT tests?
> 
> I think the MT ctype tests just need to exercise a representative
> sample of multi-byte encodings (i.e., MB_CUR_MAX between 1 and
> MB_LEN_MAX). There already is some code in the test suite to find
> locales that use these encodings, although it could be made more
> efficient. I don't know how useful rw_fnmatch() will turn out to
> be in finding these codesets since their names don't matter.
> 
> Martin
> 
>> 
>> Travis
> 


Actually, I think I meant to say single threaded tests. Those are the ones
that currently test every locale. The multi-threadede tests already test a
subset of locales, though the method for selecting those locales may vary
between tests.

I don't think it is right to test a fixed set of locales based on language,
country, or encoding. If you agree, then we probably agree that the proposed
enhancement doesn't actually do anything useful [and I've wasted a bunch of
time]. If this is the case, then we need to propose another solution for
selecting locales.

If I am wrong, and it is useful for testing [and more specifically how it
would be useful for fixing STDCXX-608], then I'd like to hear how.

Travis
-- 
View this message in context: http://www.nabble.com/low-hanging-fruit-while-cleaning-up-test-failures-tp13634803p14584842.html
Sent from the stdcxx-dev mailing list archive at Nabble.com.