Travis Vitek wrote:

[...]
[...]
+ // avoid divide by zero in thread if there are no
locales to test
+    if (nlocales < 1) {
+        rw_fatal(nlocales != 0, 0, __LINE__,
+                 "failed to create one or more usable locales");
There are systems with no locales installed. I think we just want
rw_warn() here, not something as severe as rw_fatal(). (And we
want a space before the open paren :)


Not exactly sure what you want here. I can put an rw_warn() followed
immediately by a return, or I can have each thread test the number of
locales again and bail early. If the threads are allowed to run, they
will all fail with a div-by-zero when they try to mod by 'nlocales'.

A test failure should indicate that there is a problem with the library,
not that the environment system is not equipped to exercise it. When
there's only one locale installed on a system (the "C" locale must
always be present) that's not a problem we can do much about. All it
means is that we can't tell if the library would work correctly if
there were more than one locale. So I think in this case the test
should just run all threads in the "C" locale. It won't be a very
useful test but it'll be better than nothing, don't you agree?

Btw., the locale thread safety tests currently only exercise the
implementation when using the native (libc) locales. There's a big
chunk of code that deals with our own locales that's not being
tested. At some point we'll need to enhance the tests to exercise
this functionality as well.

Martin

Reply via email to