Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 97065 invoked from network); 29 Jun 2007 23:40:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Jun 2007 23:40:05 -0000 Received: (qmail 59620 invoked by uid 500); 29 Jun 2007 23:40:09 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 59596 invoked by uid 500); 29 Jun 2007 23:40:09 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 59585 invoked by uid 99); 29 Jun 2007 23:40:08 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jun 2007 16:40:08 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jun 2007 16:40:04 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 7BF691A981A; Fri, 29 Jun 2007 16:39:44 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r552061 - in /incubator/stdcxx/trunk/tests/localization: 22.locale.cons.mt.cpp 22.locale.globals.mt.cpp Date: Fri, 29 Jun 2007 23:39:44 -0000 To: stdcxx-commits@incubator.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070629233944.7BF691A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebor Date: Fri Jun 29 16:39:43 2007 New Revision: 552061 URL: http://svn.apache.org/viewvc?view=rev&rev=552061 Log: 2007-06-28 Martin Sebor * 22.locale.cons.mt.cpp: New test exercising the thread safety of locale ctors. * 22.locale.globals.mt.cpp: New test exercising the thread safety of therequired specializations of the std::has_facet and std::use_facet function templates. Added: incubator/stdcxx/trunk/tests/localization/22.locale.cons.mt.cpp (with props) incubator/stdcxx/trunk/tests/localization/22.locale.globals.mt.cpp (with props) Added: incubator/stdcxx/trunk/tests/localization/22.locale.cons.mt.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/localization/22.locale.cons.mt.cpp?view=auto&rev=552061 ============================================================================== --- incubator/stdcxx/trunk/tests/localization/22.locale.cons.mt.cpp (added) +++ incubator/stdcxx/trunk/tests/localization/22.locale.cons.mt.cpp Fri Jun 29 16:39:43 2007 @@ -0,0 +1,211 @@ +/************************************************************************ + * + * 22.locale.cons.mt.cpp + * + * test exercising the thread safety of locale ctors + * + * $Id$ + * + *************************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + **************************************************************************/ + +#include // for locale + +#include // for strlen() + +#include +#include // for rw_get_processors (), rw_thread_pool() +#include + + +// maximum number of threads allowed by the command line interface +#define MAX_THREADS 32 + +// default number of threads (will be adjusted to the number +// of processors/cores later) +int opt_nthreads = 1; + +// the number of times each thread should iterate (unless specified +// otherwise on the command line) +int opt_nloops = 20000; + +// tristate flag set in response to the --no-combine/--enable-combine +// command line option +int opt_combine; + +/**************************************************************************/ + +// array of locale names to use for testing +static const char* +locales [MAX_THREADS]; + +// number of locale names in the array +static std::size_t +nlocales; + +/**************************************************************************/ + +extern "C" { + +static void* +test_ctors (void*) +{ + static const std::locale::category cats[] = { + std::locale::all, + std::locale::collate, + std::locale::ctype, + std::locale::messages, + std::locale::monetary, + std::locale::numeric, + std::locale::time, + std::locale::none + }; + + static const std::size_t ncats = sizeof cats / sizeof *cats; + + // the next locale "advanced" in each iteration of the loop + std::locale next (locales [0]); + + for (int i = 0; i != opt_nloops; ++i) { + + // compute an index into the array of locales + const std::size_t linx = i % nlocales; + + // create two locale objects from the same name and verify + // they are equal + const std::locale first (next.name ().c_str ()); + const std::locale second (next.name ().c_str ()); + + RW_ASSERT (first == second); + + // create another locale object as a copy of one of the two + // above and verify it's equal to the other + const std::locale third (first); + + RW_ASSERT (second == third); + + // compute the next index into the array of locales + const std::size_t ninx = (i + 1) % nlocales; + const char* const next_name = locales [ninx]; + + // create the next locale from a name + next = std::locale (next_name); + + if (0 <= opt_combine) { + // compute an index into the array of categories + const std::size_t cinx = i % ncats; + const std::locale::category cat = cats [cinx]; + + // create a locale from another object and the name of yet + // another locale, combining some (none, one, or all) of their + // categories + const std::locale combined (first, next_name, cat); + + // verify that the locales were created correctly + if (std::locale::none == cat || first == next) + RW_ASSERT (combined == first); + else if (std::locale::all == cat) + RW_ASSERT (combined == next); + else + RW_ASSERT (combined != first && combined != next); + + // repeat the step above but with a locale object + const std::locale combined_2 (first, next, cat); + + if (std::locale::none == cat || first == next) + RW_ASSERT (combined_2 == first); + else if (std::locale::all == cat) + RW_ASSERT (combined_2 == next); + else + RW_ASSERT (combined_2 != first && combined_2 != next); + } + } + + return 0; +} + +} // extern "C" + +/**************************************************************************/ + +static int +run_test (int, char**) +{ + // find all installed locales for which setlocale(LC_ALL) succeeds + const char* const locale_list = + rw_opt_locales ? rw_opt_locales : rw_locales (_RWSTD_LC_ALL); + + const std::size_t maxinx = sizeof locales / sizeof *locales; + + for (const char *name = locale_list; *name; name += std::strlen (name) +1) { + + locales [nlocales++] = name; + + if (nlocales == maxinx) + break; + } + + int result; + + rw_info (0, 0, 0, + "testing std::locale ctors with %d thread%{?}s%{;}, " + "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }", + opt_nthreads, 1 != opt_nthreads, + opt_nloops, 1 != opt_nloops, + nlocales, int (nlocales), "%#s", locales); + + // create and start a pool of threads and wait for them to finish + result = rw_thread_pool (0, std::size_t (opt_nthreads), 0, + test_ctors, 0); + + rw_error (result == 0, 0, __LINE__, + "rw_thread_pool(0, %d, 0, %{#f}, 0) failed", + opt_nthreads, test_ctors); + + return result; +} + +/**************************************************************************/ + +int main (int argc, char *argv[]) +{ +#ifdef _RWSTD_REENTRANT + + // set nthreads to the greater of the number of processors + // and 2 (for uniprocessor systems) by default + opt_nthreads = rw_get_cpus (); + if (opt_nthreads < 2) + opt_nthreads = 2; + +#endif // _RWSTD_REENTRANT + + return rw_test (argc, argv, __FILE__, + "lib.locale.cons", + "thread safety", run_test, + "|-combine~ " + "|-nloops#0 " // must be non-negative + "|-nthreads#0-* " // must be in [0, MAX_THREADS] + "|-locales=", // must be provided + &opt_combine, + &opt_nloops, + int (MAX_THREADS), + &opt_nthreads, + &rw_opt_setlocales); +} Propchange: incubator/stdcxx/trunk/tests/localization/22.locale.cons.mt.cpp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/stdcxx/trunk/tests/localization/22.locale.cons.mt.cpp ------------------------------------------------------------------------------ svn:keywords = Id Added: incubator/stdcxx/trunk/tests/localization/22.locale.globals.mt.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/localization/22.locale.globals.mt.cpp?view=auto&rev=552061 ============================================================================== --- incubator/stdcxx/trunk/tests/localization/22.locale.globals.mt.cpp (added) +++ incubator/stdcxx/trunk/tests/localization/22.locale.globals.mt.cpp Fri Jun 29 16:39:43 2007 @@ -0,0 +1,474 @@ +/************************************************************************ + * + * 22.locale.globals.mt.cpp + * + * test exercising the thread safety of [locale.global.templates] + * + * $Id$ + * + *************************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + **************************************************************************/ + +#include // for locale + +#include // for strlen() + +#include +#include // for rw_get_processors (), rw_thread_pool() +#include + + +// maximum number of threads allowed by the command line interface +#define MAX_THREADS 16 + +// default number of threads (will be adjusted to the number +// of processors/cores later) +int opt_nthreads = 1; + +// the number of times each thread should iterate (unless specified +// otherwise on the command line) +int opt_nloops = 20000; + +/**************************************************************************/ + +// array of locale names to use for testing +static const char* +locales [MAX_THREADS]; + +// number of locale names in the array +static std::size_t +nlocales; + +/**************************************************************************/ + +// convenience typedefs for all required specializations of standard facets +typedef std::collate Collate; +typedef std::ctype Ctype; +typedef std::codecvt Codecvt; +typedef std::messages Messages; +typedef std::moneypunct Moneypunct0; +typedef std::moneypunct Moneypunct1; +typedef std::numpunct Numpunct; +typedef std::money_get MoneyGet; +typedef std::money_put MoneyPut; +typedef std::num_get NumGet; +typedef std::num_put NumPut; +typedef std::time_get TimeGet; +typedef std::time_put TimePut; + +typedef std::collate_byname CollateByname; +typedef std::ctype_byname CtypeByname; +typedef std::codecvt_byname CodecvtByname; +typedef std::messages_byname MessagesByname; +typedef std::moneypunct_byname Moneypunct0Byname; +typedef std::moneypunct_byname Moneypunct1Byname; +typedef std::numpunct_byname NumpunctByname; +typedef std::time_get_byname TimeGetByname; +typedef std::time_put_byname TimePutByname; + + +#ifndef _RWSTD_NO_WCHAR_T + +typedef std::collate WCollate; +typedef std::ctype WCtype; +typedef std::codecvt WCodecvt; +typedef std::messages WMessages; +typedef std::moneypunct WMoneypunct0; +typedef std::moneypunct WMoneypunct1; +typedef std::numpunct WNumpunct; +typedef std::money_get WMoneyGet; +typedef std::money_put WMoneyPut; +typedef std::num_get WNumGet; +typedef std::num_put WNumPut; +typedef std::time_get WTimeGet; +typedef std::time_put WTimePut; + +typedef std::collate_byname WCollateByname; +typedef std::ctype_byname WCtypeByname; +typedef std::codecvt_byname WCodecvtByname; +typedef std::messages_byname WMessagesByname; +typedef std::moneypunct_byname WMoneypunct0Byname; +typedef std::moneypunct_byname WMoneypunct1Byname; +typedef std::numpunct_byname WNumpunctByname; +typedef std::time_get_byname WTimeGetByname; +typedef std::time_put_byname WTimePutByname; + +#endif // _RWSTD_NO_WCHAR_T + + +extern "C" { + +static void* +test_has_facet (void*) +{ + const std::locale classic (std::locale::classic ()); + + for (int i = 0; i != opt_nloops; ++i) { + + // save the name of the locale + const char* const locale_name = locales [i % nlocales]; + + // construct a named locale and imbue it in the ios object + // so that the locale is used not only by the num_put facet + // but also by the numpunct facet + const std::locale loc (locale_name); + + const bool byname = loc != classic; + + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + +#ifndef _RWSTD_NO_WCHAR_T + + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + RW_ASSERT (std::has_facet(loc)); + + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + RW_ASSERT (byname == std::has_facet(loc)); + +#endif // _RWSTD_NO_WCHAR_T + + } + + return 0; +} + + +static void* +test_use_facet (void*) +{ + const std::locale classic (std::locale::classic ()); + + for (int i = 0; i != opt_nloops; ++i) { + + // save the name of the locale + const char* const locale_name = locales [i % nlocales]; + + // construct a named locale and imbue it in the ios object + // so that the locale is used not only by the num_put facet + // but also by the numpunct facet + const std::locale loc (locale_name); + + const bool byname = loc != classic; + + { + // get references to the char specializations of facets + const Collate &f0 = std::use_facet(loc); + const Ctype &f1 = std::use_facet(loc); + const Codecvt &f2 = std::use_facet(loc); + const Messages &f3 = std::use_facet(loc); + const Moneypunct0 &f4 = std::use_facet(loc); + const Moneypunct1 &f5 = std::use_facet(loc); + const MoneyGet &f6 = std::use_facet(loc); + const MoneyPut &f7 = std::use_facet(loc); + const Numpunct &f8 = std::use_facet(loc); + const NumGet &f9 = std::use_facet(loc); + const NumPut &f10 = std::use_facet(loc); + const TimeGet &f11 = std::use_facet(loc); + const TimePut &f12 = std::use_facet(loc); + + if (byname) { + // get references to the char specializations + // of byname facets + const CollateByname &f0n = + std::use_facet(loc); + const CtypeByname &f1n = + std::use_facet(loc); + const CodecvtByname &f2n = + std::use_facet(loc); + const MessagesByname &f3n = + std::use_facet(loc); + const Moneypunct0Byname &f4n = + std::use_facet(loc); + const Moneypunct1Byname &f5n = + std::use_facet(loc); + const NumpunctByname &f8n = + std::use_facet(loc); + const TimeGetByname &f11n = + std::use_facet(loc); + const TimePutByname &f12n = + std::use_facet(loc); + + RW_ASSERT (byname == (&f0 == &f0n)); + RW_ASSERT (byname == (&f1 == &f1n)); + RW_ASSERT (byname == (&f2 == &f2n)); + RW_ASSERT (byname == (&f3 == &f3n)); + RW_ASSERT (byname == (&f4 == &f4n)); + RW_ASSERT (byname == (&f5 == &f5n)); + RW_ASSERT (byname == (&f8 == &f8n)); + RW_ASSERT (byname == (&f11 == &f11n)); + RW_ASSERT (byname == (&f12 == &f12n)); + } + else { + +#ifndef _RWSTD_NO_THREAD_SAFE_EXCEPTIONS + + bool threw; + +#define TEST_USE_FACET(Facet, loc) \ + try { threw = false; std::use_facet(loc); } \ + catch (...) { threw = true; } \ + RW_ASSERT (threw) + + TEST_USE_FACET (CollateByname, loc); + TEST_USE_FACET (CtypeByname, loc); + TEST_USE_FACET (CodecvtByname, loc); + TEST_USE_FACET (MessagesByname, loc); + TEST_USE_FACET (Moneypunct0Byname, loc); + TEST_USE_FACET (Moneypunct1Byname, loc); + TEST_USE_FACET (NumpunctByname, loc); + TEST_USE_FACET (TimeGetByname, loc); + TEST_USE_FACET (TimePutByname, loc); + +#endif // _RWSTD_NO_THREAD_SAFE_EXCEPTIONS + + } + } + +#ifndef _RWSTD_NO_WCHAR_T + + { + const WCollate &f0 = std::use_facet(loc); + const WCtype &f1 = std::use_facet(loc); + const WCodecvt &f2 = std::use_facet(loc); + const WMessages &f3 = std::use_facet(loc); + const WMoneypunct0 &f4 = std::use_facet(loc); + const WMoneypunct1 &f5 = std::use_facet(loc); + const WMoneyGet &f6 = std::use_facet(loc); + const WMoneyPut &f7 = std::use_facet(loc); + const WNumpunct &f8 = std::use_facet(loc); + const WNumGet &f9 = std::use_facet(loc); + const WNumPut &f10 = std::use_facet(loc); + const WTimeGet &f11 = std::use_facet(loc); + const WTimePut &f12 = std::use_facet(loc); + + if (byname) { + const WCollateByname &f0n = + std::use_facet(loc); + const WCtypeByname &f1n = + std::use_facet(loc); + const WCodecvtByname &f2n = + std::use_facet(loc); + const WMessagesByname &f3n = + std::use_facet(loc); + const WMoneypunct0Byname &f4n = + std::use_facet(loc); + const WMoneypunct1Byname &f5n = + std::use_facet(loc); + const WTimeGetByname &f11n = + std::use_facet(loc); + const WTimePutByname &f12n = + std::use_facet(loc); + + RW_ASSERT (byname == (&f0 == &f0n)); + RW_ASSERT (byname == (&f1 == &f1n)); + RW_ASSERT (byname == (&f2 == &f2n)); + RW_ASSERT (byname == (&f3 == &f3n)); + RW_ASSERT (byname == (&f4 == &f4n)); + RW_ASSERT (byname == (&f5 == &f5n)); + RW_ASSERT (byname == (&f11 == &f11n)); + RW_ASSERT (byname == (&f12 == &f12n)); + } + else { + +#ifndef _RWSTD_NO_THREAD_SAFE_EXCEPTIONS + + bool threw; + +#define TEST_USE_FACET(Facet, loc) \ + try { threw = false; std::use_facet(loc); } \ + catch (...) { threw = true; } \ + RW_ASSERT (threw) + + TEST_USE_FACET (WCollateByname, loc); + TEST_USE_FACET (WCtypeByname, loc); + TEST_USE_FACET (WCodecvtByname, loc); + TEST_USE_FACET (WMessagesByname, loc); + TEST_USE_FACET (WMoneypunct0Byname, loc); + TEST_USE_FACET (WMoneypunct1Byname, loc); + TEST_USE_FACET (WNumpunctByname, loc); + TEST_USE_FACET (WTimeGetByname, loc); + TEST_USE_FACET (WTimePutByname, loc); + +#endif // _RWSTD_NO_THREAD_SAFE_EXCEPTIONS + + } + } + +#endif // _RWSTD_NO_WCHAR_T + + } + + return 0; +} + + +} // extern "C" + +/**************************************************************************/ + +int opt_has_facet; // exercise std::has_facet? +int opt_use_facet; // exercise std::use_facet? + + +static int +run_test (int, char**) +{ + // find all installed locales for which setlocale(LC_ALL) succeeds + const char* const locale_list = + rw_opt_locales ? rw_opt_locales : rw_locales (_RWSTD_LC_ALL); + + const std::size_t maxinx = sizeof locales / sizeof *locales; + + // set to true if the classic "C" locale is on the lost + bool has_classic = false; + + for (const char *name = locale_list; *name; name += std::strlen (name) +1) { + + locales [nlocales++] = name; + + if (!has_classic && 0 == std::strcmp ("C", name)) + has_classic = true; + + if (nlocales == maxinx) + break; + } + + // when the classic "C" locale isn't on the list put it there + // unless the list was explicitly specified on the command line + if (1 < nlocales && !has_classic && 0 == rw_opt_locales) + locales [0] = "C"; + + int result; + + rw_info (0, 0, 0, + "testing std::locale globals with %d thread%{?}s%{;}, " + "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }", + opt_nthreads, 1 != opt_nthreads, + opt_nloops, 1 != opt_nloops, + nlocales, int (nlocales), "%#s", locales); + + if (opt_has_facet >= 0) { + rw_info (0, 0, 0, + "template bool std::has_facet (const locale&)"); + + // create and start a pool of threads and wait for them to finish + result = rw_thread_pool (0, std::size_t (opt_nthreads), 0, + test_has_facet, 0); + + rw_error (result == 0, 0, __LINE__, + "rw_thread_pool(0, %d, 0, %{#f}, 0) failed", + opt_nthreads, test_has_facet); + } + else { + rw_note (0, 0, 0, "std::has_facet test disabled"); + } + + if (opt_use_facet >= 0) { + rw_info (0, 0, 0, + "template const T& std::use_facet (const locale&)"); + +#ifdef _RWSTD_NO_THREAD_SAFE_EXCEPTIONS + + rw_warning (0, 0, 0, + "exceptions not thread safe, skipping that part of test") + +#endif // _RWSTD_NO_THREAD_SAFE_EXCEPTIONS + + + // create and start a pool of threads and wait for them to finish + result = rw_thread_pool (0, std::size_t (opt_nthreads), 0, + test_use_facet, 0); + + rw_error (result == 0, 0, __LINE__, + "rw_thread_pool(0, %d, 0, %{#f}, 0) failed", + opt_nthreads, test_use_facet); + } + else { + rw_note (0, 0, 0, "std::use_facet test disabled"); + } + + return result; +} + +/**************************************************************************/ + +int main (int argc, char *argv[]) +{ +#ifdef _RWSTD_REENTRANT + + // set nthreads to the greater of the number of processors + // and 2 (for uniprocessor systems) by default + opt_nthreads = rw_get_cpus (); + if (opt_nthreads < 2) + opt_nthreads = 2; + +#endif // _RWSTD_REENTRANT + + return rw_test (argc, argv, __FILE__, + "lib.locale.global.templates", + "thread safety", run_test, + "|-has_facet~ " + "|-use_facet~ " + "|-nloops#0 " // must be non-negative + "|-nthreads#0-* " // must be in [0, MAX_THREADS] + "|-locales=", // must be provided + &opt_has_facet, + &opt_use_facet, + &opt_nloops, + int (MAX_THREADS), + &opt_nthreads, + &rw_opt_setlocales); +} Propchange: incubator/stdcxx/trunk/tests/localization/22.locale.globals.mt.cpp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/stdcxx/trunk/tests/localization/22.locale.globals.mt.cpp ------------------------------------------------------------------------------ svn:keywords = Id