stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r660776 [2/2] - in /stdcxx/trunk: bin/ etc/config/ etc/config/src/ examples/manual/ examples/manual/in/ examples/manual/out/ include/loc/ include/rw/ src/ tests/include/ tests/iostream/ tests/localization/ tests/numerics/ tests/regress/ tes...
Date Wed, 28 May 2008 01:48:21 GMT
Modified: stdcxx/trunk/tests/localization/22.locale.moneypunct.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.moneypunct.mt.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.moneypunct.mt.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.moneypunct.mt.cpp Tue May 27 18:48:19 2008
@@ -43,14 +43,17 @@
 
 // default number of threads (will be adjusted to the number
 // of processors/cores later)
-int rw_opt_nthreads = 1;
+int opt_nthreads = 1;
 
 // the default number of times for each thread to iterate
 #define DFLT_LOOPS   10000
 
 // the number of times each thread should iterate (will be set to
 // DFLT_LOOPS unless explicitly specified on the command line)
-int rw_opt_nloops = -1;
+int opt_nloops = -1;
+
+// default timeout used by each threaded section of this test
+int opt_timeout = 60;
 
 /**************************************************************************/
 
@@ -240,7 +243,10 @@
 static void*
 thread_func (void*)
 {
-    for (int i = 0; i != rw_opt_nloops; ++i) {
+    for (int i = 0; i != opt_nloops; ++i) {
+
+        if (rw_thread_pool_timeout_expired ())
+            break;
 
         thread_loop_body (std::size_t (i));
     }
@@ -388,13 +394,13 @@
     // unless the number of iterations was explicitly specified
     // on the command line, decrease the number to equal the number
     // of excericsed locales when only one thread is being tested
-    if (1 == rw_opt_nthreads && rw_opt_nloops < 0)
-        rw_opt_nloops = int (nlocales);
+    if (1 == opt_nthreads && opt_nloops < 0)
+        opt_nloops = int (nlocales);
 
     // when the number of iterations wasn't explicitly specified
     // on the command line set it to the default value
-    if (rw_opt_nloops < 0)
-        rw_opt_nloops = DFLT_LOOPS;
+    if (opt_nloops < 0)
+        opt_nloops = DFLT_LOOPS;
 
     rw_fatal (0 < nlocales, 0, __LINE__,
               "must have at least one valid locale to test");
@@ -402,8 +408,8 @@
     rw_info (0, 0, 0,
              "testing std::moneypunct<charT> with %d thread%{?}s%{;}, "
              "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
-             rw_opt_nthreads, 1 != rw_opt_nthreads,
-             rw_opt_nloops, 1 != rw_opt_nloops,
+             opt_nthreads, 1 != opt_nthreads,
+             opt_nloops, 1 != opt_nloops,
              nlocales, int (nlocales), "%#s", locales);
 
     rw_info (0, 0, 0, "exercising std::moneypunct<char>");
@@ -413,11 +419,12 @@
 
     // create and start a pool of threads and wait for them to finish
     int result =
-        rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
-              rw_opt_nthreads, thread_func);
+              opt_nthreads, thread_func);
 
 #ifndef _RWSTD_NO_WCHAR_T
 
@@ -429,11 +436,12 @@
     // start a pool of threads to exercise the thread safety
     // of the wchar_t specialization
     result =
-        rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
-              rw_opt_nthreads, thread_func);
+              opt_nthreads, thread_func);
 
     // exercise both the char and the wchar_t specializations
     // at the same time
@@ -447,11 +455,12 @@
 
     // start a pool of threads to exercise wstring thread safety
     result =
-        rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
-              rw_opt_nthreads, thread_func);
+              opt_nthreads, thread_func);
 
 #endif   // _RWSTD_NO_WCHAR_T
 
@@ -466,20 +475,22 @@
 
     // set nthreads to the greater of the number of processors
     // and 2 (for uniprocessor systems) by default
-    rw_opt_nthreads = rw_get_cpus ();
-    if (rw_opt_nthreads < 2)
-        rw_opt_nthreads = 2;
+    opt_nthreads = rw_get_cpus ();
+    if (opt_nthreads < 2)
+        opt_nthreads = 2;
 
 #endif   // _RWSTD_REENTRANT
 
     return rw_test (argc, argv, __FILE__,
                     "lib.locale.moneypunct",
                     "thread safety", run_test,
+                    "|-soft-timeout#0 "  // must be non-negative
                     "|-nloops#0 "       // must be non-negative
                     "|-nthreads#0-* "   // must be in [0, MAX_THREADS]
                     "|-locales=",       // must be provided
-                    &rw_opt_nloops,
+                    &opt_timeout,
+                    &opt_nloops,
                     int (MAX_THREADS),
-                    &rw_opt_nthreads,
+                    &opt_nthreads,
                     &rw_opt_setlocales);
 }

Modified: stdcxx/trunk/tests/localization/22.locale.num.get.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.num.get.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.num.get.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.num.get.cpp Tue May 27 18:48:19 2008
@@ -235,6 +235,13 @@
 
 /**************************************************************************/
 
+// if non-zero expected to point to a maximum valid value
+// of type T that's being tested below (used for floating
+// point ranges)
+// on function return, the pointed to value is overwritten
+// with the actual extracted value
+void *pmax = 0;
+
 
 enum IterType { iter_pointer, iter_istreambuf, iter_input };
 
@@ -244,7 +251,6 @@
              const char *cname,           // name of character type
              IterType    itype,           // type of input iterator
              const char *iname,           // name of input iterator
-             void       *pmax,
              nativeT     val,             // value expected to be extracted
              const char *str,             // input sequence
              int         eat_expect = -1, // number of consumed characters
@@ -438,7 +444,6 @@
              const char *cname,           // name of character type
              IterType    itype,           // iterator type
              const char *iname,           // name of iterator type
-             void       *pmax,
              nativeT     val,             // value expected to be extracted
              const char *str,             // input sequence
              int         eat_expect = -1, // number of consumed characters
@@ -449,15 +454,15 @@
     switch (ctype) {
     case narrow_char:
         return do_test (lineno, (char*)0, cname, itype, iname,
-                        pmax, val, str, eat_expect, flags, err_expect, grouping);
+                        val, str, eat_expect, flags, err_expect, grouping);
     case wide_char:
         return do_test (lineno, (wchar_t*)0, cname, itype, iname,
-                        pmax, val, str, eat_expect, flags, err_expect, grouping);
+                        val, str, eat_expect, flags, err_expect, grouping);
     case user_char:
         break;
 #if 0   // disabled
         return do_test (lineno, (UserChar*)0, cname, itype, iname,
-                        pmax, val, str, eat_expect, flags, err_expect, grouping);
+                        val, str, eat_expect, flags, err_expect, grouping);
 #endif   // disabled
     }
 
@@ -497,8 +502,7 @@
 /*************************************************************************/
 
 #define TEST   do_test
-#define T      __LINE__, ctype, cname, itype, iname, 0
-#define T_MAX  __LINE__, ctype, cname, itype, iname, &val
+#define T      __LINE__, ctype, cname, itype, iname
 
 
 template <class numT>
@@ -2441,7 +2445,8 @@
              cname, iname);
 
     // exercise bahvior on underflow
-    float val = 0;
+    static float val = 0;
+    pmax = &val;
 
     // on underflow, get() follows C99 requirements on strtof()
     // i.e., it stores a value in the range [0, +/-FLT_MIN]
@@ -2452,34 +2457,35 @@
     //     normalized positive number in the return type; whether
     //     errno acquires the value ERANGE is implementation-defined.
 
-    TEST (T_MAX, (val = FLT_MIN, 0.0f), "1.111111e-9999", 14, 0, Eof);
+    TEST (T, (val = FLT_MIN, 0.0f), "1.111111e-9999", 14, 0, Eof);
     rw_assert (!(val < 0.0), 0, __LINE__,
                "correct sign after positive underflow");
 
-    TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.111111e-9999", 15, 0, Eof);
+    TEST (T, (val = 0.0f, -FLT_MIN), "-1.111111e-9999", 15, 0, Eof);
     rw_assert (!(val > 0.0), 0, __LINE__,
                "correct sign after negative underflow");
 
     if (1.234567e-39 < FLT_MIN) {
-        TEST (T_MAX, (val = FLT_MIN, 0.0f),   "1.234567e-39", 12, 0, Eof);
-        TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.234567e-39", 13, 0, Eof);
+        TEST (T, (val = FLT_MIN, 0.0f),   "1.234567e-39", 12, 0, Eof);
+        TEST (T, (val = 0.0f, -FLT_MIN), "-1.234567e-39", 13, 0, Eof);
     }
 
     if (1.234567e-49 < FLT_MIN) {
-        TEST (T_MAX, (val = FLT_MIN, 0.0f),   "1.234567e-49", 12, 0, Eof);
-        TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.234567e-49", 13, 0, Eof);
+        TEST (T, (val = FLT_MIN, 0.0f),   "1.234567e-49", 12, 0, Eof);
+        TEST (T, (val = 0.0f, -FLT_MIN), "-1.234567e-49", 13, 0, Eof);
     }
 
     if (1.234567e-99 < FLT_MIN) {
-        TEST (T_MAX, (val = FLT_MIN, 0.0f),   "1.234567e-99", 12, 0, Eof);
-        TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.234567e-99", 13, 0, Eof);
+        TEST (T, (val = FLT_MIN, 0.0f),   "1.234567e-99", 12, 0, Eof);
+        TEST (T, (val = 0.0f, -FLT_MIN), "-1.234567e-99", 13, 0, Eof);
     }
 
     // exercise facet's behavior on underflow:
     //   parsing succeeds (fail is clear), +/-min is stored
-    TEST (T_MAX,  FLT_MIN, _RWSTD_STRSTR ( _RWSTD_DBL_MIN), -1, 0, Eof);
-    TEST (T_MAX, -FLT_MIN, _RWSTD_STRSTR (-_RWSTD_DBL_MIN), -1, 0, Eof);
+    TEST (T,  FLT_MIN, _RWSTD_STRSTR ( _RWSTD_DBL_MIN), -1, 0, Eof);
+    TEST (T, -FLT_MIN, _RWSTD_STRSTR (-_RWSTD_DBL_MIN), -1, 0, Eof);
 
+    pmax = 0;   // reset before next test
 
 
     rw_info (0, 0, 0, "std::num_get<%s, %s>::get (..., float&) on overflow",
@@ -2610,7 +2616,8 @@
              cname, iname);
 
     // exercise bahvior on underflow
-    double val = DBL_MIN;
+    static double val = DBL_MIN;
+    pmax = &val;
 
     // on underflow, get() follows C99 requirements on strtod()
     // i.e., it stores a value in the range [0, +/-DBL_MIN]
@@ -2621,24 +2628,25 @@
     //     normalized positive number in the return type; whether
     //     errno acquires the value ERANGE is implementation-defined.
 
-    TEST (T_MAX, (val = DBL_MIN, 0.0),   "1.111111e-9999", 14, 0, Eof);
-    TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.111111e-9999", 15, 0, Eof);
+    TEST (T, (val = DBL_MIN, 0.0),   "1.111111e-9999", 14, 0, Eof);
+    TEST (T, (val = 0.0, -DBL_MIN), "-1.111111e-9999", 15, 0, Eof);
 
     if (1.23456789e-309L < DBL_MIN) {
-        TEST (T_MAX, (val = DBL_MIN, 0.0),   "1.23456789e-309", 15, 0, Eof);
-        TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.23456789e-309", 16, 0, Eof);
+        TEST (T, (val = DBL_MIN, 0.0),   "1.23456789e-309", 15, 0, Eof);
+        TEST (T, (val = 0.0, -DBL_MIN), "-1.23456789e-309", 16, 0, Eof);
     }
 
     if (1.234567e-409L < DBL_MIN) {
-        TEST (T_MAX, (val = DBL_MIN, 0.0),   "1.23456789e-409", 15, 0, Eof);
-        TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.23456789e-409", 16, 0, Eof);
+        TEST (T, (val = DBL_MIN, 0.0),   "1.23456789e-409", 15, 0, Eof);
+        TEST (T, (val = 0.0, -DBL_MIN), "-1.23456789e-409", 16, 0, Eof);
     }
 
     if (1.234567e-999L < DBL_MIN) {
-        TEST (T_MAX, (val = DBL_MIN, 0.0),   "1.23456789e-999", 15, 0, Eof);
-        TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.23456789e-999", 16, 0, Eof);
+        TEST (T, (val = DBL_MIN, 0.0),   "1.23456789e-999", 15, 0, Eof);
+        TEST (T, (val = 0.0, -DBL_MIN), "-1.23456789e-999", 16, 0, Eof);
     }
 
+    pmax = 0;   // reset before next test
 
 
 #  ifdef _RWSTD_LDBL_MAX
@@ -2731,7 +2739,8 @@
              cname, iname);
 
     // exercise bahvior on underflow
-    long double val = LDBL_MIN;
+    static long double val = LDBL_MIN;
+    pmax = &val;
 
     // on underflow, get() follows C99 requirements on strtold()
     // i.e., it stores a value in the range [0, +/-LDBL__MIN]
@@ -2742,22 +2751,23 @@
     //     normalized positive number in the return type; whether
     //     errno acquires the value ERANGE is implementation-defined.
 
-    TEST (T_MAX, (val = LDBL_MIN, 0.0L),   "1.987654321e-99999", 18, 0, Eof);
-    TEST (T_MAX, (val = 0.0L, -LDBL_MIN), "-1.987654321e-99999", 19, 0, Eof);
+    TEST (T, (val = LDBL_MIN, 0.0L),   "1.987654321e-99999", 18, 0, Eof);
+    TEST (T, (val = 0.0L, -LDBL_MIN), "-1.987654321e-99999", 19, 0, Eof);
 
     const char fmt[] = "%Lg";
 
     long double ld = 0.0;
     if (1 == std::sscanf ("3.456789e-4932", fmt, &ld) && ld < LDBL_MIN) {
-        TEST (T_MAX, (val = LDBL_MIN, 0.0L),   "3.456789e-4932", 14, 0, Eof);
-        TEST (T_MAX, (val = 0.0L, -LDBL_MIN), "-3.456789e-4932", 15, 0, Eof);
+        TEST (T, (val = LDBL_MIN, 0.0L),   "3.456789e-4932", 14, 0, Eof);
+        TEST (T, (val = 0.0L, -LDBL_MIN), "-3.456789e-4932", 15, 0, Eof);
     }
 
     if (1 == std::sscanf ("3.456789e-9999", fmt, &ld) && ld < LDBL_MIN) {
-        TEST (T_MAX, (val = LDBL_MIN, 0.0L),   "3.456789e-9999", 14, 0, Eof);
-        TEST (T_MAX, (val = 0.0L, -LDBL_MIN), "-3.456789e-9999", 15, 0, Eof);
+        TEST (T, (val = LDBL_MIN, 0.0L),   "3.456789e-9999", 14, 0, Eof);
+        TEST (T, (val = 0.0L, -LDBL_MIN), "-3.456789e-9999", 15, 0, Eof);
     }
 
+    pmax = 0;   // reset before next test
 
 
 #  ifdef _RWSTD_LDBL_MAX

Modified: stdcxx/trunk/tests/localization/22.locale.num.get.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.num.get.mt.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.num.get.mt.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.num.get.mt.cpp Tue May 27 18:48:19 2008
@@ -42,10 +42,10 @@
 
 // default number of threads (will be adjusted to the number
 // of processors/cores later)
-int rw_opt_nthreads = 1;
+int opt_nthreads = 1;
 
 // the number of times each thread should iterate
-int rw_opt_nloops = MAX_LOOPS;
+int opt_nloops = MAX_LOOPS;
 
 #if !defined (_RWSTD_OS_HP_UX) || defined (_ILP32)
 
@@ -62,7 +62,10 @@
 
 // should all threads share the same set of locale objects instead
 // of creating their own?
-int rw_opt_shared_locale;
+int opt_shared_locale;
+
+// default timeout used by each threaded section of this test
+int opt_timeout = 60;
 
 /**************************************************************************/
 
@@ -117,11 +120,13 @@
 
     // holds the narrow/wide character representation of value_ and
     // the number of used 'charT' in each buffer.
-    char    ncs_ [BufferSize];
+    char        ncs_ [BufferSize];
+    std::size_t nlen_;   // number of valid characters in buffer
 
 #ifndef _RWSTD_NO_WCHAR_T
 
-    wchar_t wcs_ [BufferSize];
+    wchar_t     wcs_ [BufferSize];
+    std::size_t wlen_;   // number of valid characters in buffer
 
 #endif  // _RWSTD_NO_WCHAR_T
 
@@ -338,7 +343,10 @@
     wio.rdbuf (&wsb);
 #endif // _RWSTD_NO_WCHAR_T
 
-    for (int i = 0; i != rw_opt_nloops; ++i) {
+    for (int i = 0; i != opt_nloops; ++i) {
+
+        if (rw_thread_pool_timeout_expired ())
+            break;
 
         // fill in the value and results for this locale
         const MyNumData& data = my_num_data [i % nlocales];
@@ -346,8 +354,8 @@
         // construct a named locale and imbue it in the ios object
         // so that the locale is used not only by the num_put facet
         const std::locale loc =
-            rw_opt_shared_locale ? data.locale_
-                                 : std::locale (data.locale_name_);
+            opt_shared_locale ? data.locale_
+                              : std::locale (data.locale_name_);
 
         if (test_char) {
             // exercise the narrow char specialization of the facet
@@ -356,7 +364,7 @@
                 std::use_facet<std::num_get<char> >(loc);
 
             nio.imbue (loc);
-            nsb.pubsetg (data.ncs_, Traits::length (data.ncs_));
+            nsb.pubsetg (data.ncs_, data.nlen_);
 
             test_get_data (data, ng,
                            std::istreambuf_iterator<char>(&nsb),
@@ -377,7 +385,7 @@
                 std::use_facet<std::num_get<wchar_t> >(loc);
 
             wio.imbue (loc);
-            wsb.pubsetg (data.wcs_, WTraits::length (data.wcs_));
+            wsb.pubsetg (data.wcs_, data.wlen_);
 
             test_get_data (data, wp,
                            std::istreambuf_iterator<wchar_t>(&wsb),
@@ -445,6 +453,8 @@
             test_put_data (data, np, std::ostreambuf_iterator<char>(&nsb),
                            nio, ' ', '\0');
 
+            data.nlen_ = std::char_traits<char>::length (data.ncs_);
+
             rw_fatal (!nio.fail (), __FILE__, __LINE__,
                       "num_put<char>::put(...) failed for locale(%#s)",
                       data.locale_name_);
@@ -460,13 +470,15 @@
             test_put_data (data, wp, std::ostreambuf_iterator<wchar_t>(&wsb),
                            wio, L' ', L'\0');
 
+            data.wlen_ = std::char_traits<wchar_t>::length (data.wcs_);
+
             rw_fatal (!wio.fail (), __FILE__, __LINE__,
                       "num_put<wchar_t>::put(...) failed for locale(%#s)",
                       data.locale_name_);
 
 #endif // _RWSTD_NO_WCHAR_T
 
-            if (rw_opt_shared_locale)
+            if (opt_shared_locale)
                 data.locale_ = loc;
 
             nlocales += 1;
@@ -487,8 +499,8 @@
     rw_info (0, 0, 0,
              "testing std::num_get<charT> with %d thread%{?}s%{;}, "
              "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
-             rw_opt_nthreads, 1 != rw_opt_nthreads,
-             rw_opt_nloops, 1 != rw_opt_nloops,
+             opt_nthreads, 1 != opt_nthreads,
+             opt_nloops, 1 != opt_nloops,
              nlocales, int (nlocales), "%#s", locales);
 
     rw_info (0, 0, 0, "exercising std::num_get<char>");
@@ -498,11 +510,12 @@
 
     // create and start a pool of threads and wait for them to finish
     int result =
-        rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
-              rw_opt_nthreads, thread_func);
+              opt_nthreads, thread_func);
 
 #ifndef _RWSTD_NO_WCHAR_T
 
@@ -513,11 +526,12 @@
 
     // start a pool of threads to exercise wstring thread safety
     result =
-        rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
-              rw_opt_nthreads, thread_func);
+              opt_nthreads, thread_func);
 
     // exercise both the char and the wchar_t specializations
     // at the same time
@@ -530,11 +544,12 @@
 
     // start a pool of threads to exercise wstring thread safety
     result =
-        rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
-              rw_opt_nthreads, thread_func);
+              opt_nthreads, thread_func);
 
 #endif   // _RWSTD_NO_WCHAR_T
 
@@ -549,24 +564,26 @@
 
     // set nthreads to the greater of the number of processors
     // and 2 (for uniprocessor systems) by default
-    rw_opt_nthreads = rw_get_cpus ();
-    if (rw_opt_nthreads < 2)
-        rw_opt_nthreads = 2;
+    opt_nthreads = rw_get_cpus ();
+    if (opt_nthreads < 2)
+        opt_nthreads = 2;
 
 #endif   // _RWSTD_REENTRANT
 
     return rw_test (argc, argv, __FILE__,
                     "lib.locale.num.get",
                     "thread safety", run_test,
+                    "|-soft-timeout#0 "  // must be non-negative
                     "|-nloops#0 "       // must be non-negative
                     "|-nthreads#0-* "   // must be in [0, MAX_THREADS]
                     "|-nlocales#0 "     // arg must be non-negative
                     "|-locales= "       // must be provided
                     "|-shared-locale# ",
-                    &rw_opt_nloops,
+                    &opt_timeout,
+                    &opt_nloops,
                     int (MAX_THREADS),
-                    &rw_opt_nthreads,
+                    &opt_nthreads,
                     &opt_nlocales,
                     &rw_opt_setlocales,
-                    &rw_opt_shared_locale);
+                    &opt_shared_locale);
 }

Modified: stdcxx/trunk/tests/localization/22.locale.num.put.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.num.put.mt.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.num.put.mt.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.num.put.mt.cpp Tue May 27 18:48:19 2008
@@ -64,6 +64,9 @@
 // of creating their own?
 int opt_shared_locale;
 
+// default timeout used by each threaded section of this test
+int opt_timeout = 60;
+
 /**************************************************************************/
 
 // array of locale names to use for testing
@@ -238,6 +241,9 @@
 
     for (int i = 0; i != opt_nloops; ++i) {
 
+        if (rw_thread_pool_timeout_expired ())
+            break;
+
         // fill in the value and results for this locale
         const MyNumData& data = my_num_data [i % nlocales];
 
@@ -245,7 +251,7 @@
         // so that the locale is used not only by the num_put facet
         const std::locale loc =
             opt_shared_locale ? data.locale_
-                                 : std::locale (data.locale_name_);
+                              : std::locale (data.locale_name_);
 
         if (test_char) {
             // exercise the narrow char specialization of the facet
@@ -394,7 +400,8 @@
 
     // create and start a pool of threads and wait for them to finish
     int result =
-        rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
@@ -409,7 +416,8 @@
 
     // start a pool of threads to exercise wstring thread safety
     result =
-        rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
@@ -426,7 +434,8 @@
 
     // start a pool of threads to exercise wstring thread safety
     result =
-        rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
@@ -454,11 +463,13 @@
     return rw_test (argc, argv, __FILE__,
                     "lib.locale.num.put",
                     "thread safety", run_test,
+                    "|-soft-timeout#0 "  // must be non-negative
                     "|-nloops#0 "       // must be non-negative
                     "|-nthreads#0-* "   // must be in [0, MAX_THREADS]
                     "|-nlocales#0 "     // arg must be non-negative
                     "|-locales= "       // must be provided
                     "|-shared-locale# ",
+                    &opt_timeout,
                     &opt_nloops,
                     int (MAX_THREADS),
                     &opt_nthreads,

Modified: stdcxx/trunk/tests/localization/22.locale.numpunct.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.numpunct.mt.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.numpunct.mt.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.numpunct.mt.cpp Tue May 27 18:48:19 2008
@@ -47,7 +47,7 @@
 
 // the number of times each thread should iterate (unless specified
 // otherwise on the command line)
-int rw_opt_nloops = 200000;
+int opt_nloops = 200000;
 
 #if !defined (_RWSTD_OS_HP_UX) || defined (_ILP32)
 
@@ -66,6 +66,9 @@
 // of creating their own?
 int opt_shared_locale;
 
+// default timeout used by each threaded section of this test
+int opt_timeout = 60;
+
 /**************************************************************************/
 
 // array of locale names to use for testing
@@ -111,7 +114,10 @@
 static void*
 thread_func (void*)
 {
-    for (int i = 0; i != rw_opt_nloops; ++i) {
+    for (int i = 0; i != opt_nloops; ++i) {
+
+        if (rw_thread_pool_timeout_expired ())
+            break;
 
         const std::size_t inx = std::size_t (i) % nlocales;
 
@@ -120,7 +126,7 @@
         // construct a named locale
         const std::locale loc =
             opt_shared_locale ? data.locale_
-                                 : std::locale (data.locale_name_);
+                              : std::locale (data.locale_name_);
 
         if (test_char) {
             // exercise the narrow char specialization of the facet
@@ -250,7 +256,7 @@
              "testing std::numpunct<charT> with %d thread%{?}s%{;}, "
              "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
              opt_nthreads, 1 != opt_nthreads,
-             rw_opt_nloops, 1 != rw_opt_nloops,
+             opt_nloops, 1 != opt_nloops,
              nlocales, int (nlocales), "%#s", locales);
 
     rw_info (0, 0, 0, "exercising std::numpunct<char>");
@@ -260,7 +266,8 @@
 
     // create and start a pool of threads and wait for them to finish
     int result =
-        rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
@@ -276,7 +283,8 @@
     // start a pool of threads to exercise the thread safety
     // of the wchar_t specialization
     result =
-        rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
@@ -293,7 +301,8 @@
 
     // start a pool of threads to exercise wstring thread safety
     result =
-        rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
@@ -321,12 +330,14 @@
     return rw_test (argc, argv, __FILE__,
                     "lib.locale.numpunct",
                     "thread safety", run_test,
+                    "|-soft-timeout#0 "  // must be non-negative
                     "|-nloops#0 "       // must be non-negative
                     "|-nthreads#0-* "   // must be in [0, MAX_THREADS]
                     "|-nlocales#0 "     // arg must be non-negative
                     "|-locales= "       // must be provided
                     "|-shared-locale# ",
-                    &rw_opt_nloops,
+                    &opt_timeout,
+                    &opt_nloops,
                     int (MAX_THREADS),
                     &opt_nthreads,
                     &opt_nlocales,

Modified: stdcxx/trunk/tests/localization/22.locale.statics.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.statics.mt.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.statics.mt.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.statics.mt.cpp Tue May 27 18:48:19 2008
@@ -50,6 +50,9 @@
 int opt_classic;
 int opt_global;
 
+// default timeout used by each threaded section of this test
+int opt_timeout = 60;
+
 /**************************************************************************/
 
 // array of locale objects to use for testing
@@ -92,6 +95,9 @@
 {
     for (std::size_t i = 0; i != opt_nloops; ++i) {
 
+        if (rw_thread_pool_timeout_expired ())
+            break;
+
         const std::size_t inx = i % nlocales;
 
         const std::locale last (std::locale::global (locales [inx]));
@@ -125,7 +131,7 @@
 
         // 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_classic, 0);
+                                 test_classic, 0, std::size_t (opt_timeout));
     }
 
     if (rw_note (0 <= opt_global, 0, __LINE__,
@@ -161,7 +167,7 @@
 
         // 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_global, 0);
+                                 test_global, 0, std::size_t (opt_timeout));
     }
 
     return result;
@@ -187,11 +193,13 @@
                     run_test,
                     "|-classic~ "
                     "|-global~ "
+                    "|-soft-timeout#0 "  // must be non-negative
                     "|-nloops#0 "        // arg must be non-negative
                     "|-nthreads#0-* "    // arg must be in [0, MAX_THREADS]
                     "|-locales= ",       // argument must be provided
                     &opt_classic,
                     &opt_global,
+                    &opt_timeout,
                     &opt_nloops,
                     int (MAX_THREADS),
                     &opt_nthreads,

Modified: stdcxx/trunk/tests/localization/22.locale.time.get.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.time.get.mt.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.time.get.mt.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.time.get.mt.cpp Tue May 27 18:48:19 2008
@@ -43,17 +43,20 @@
 
 // default number of threads (will be adjusted to the number
 // of processors/cores later)
-int rw_opt_nthreads = 1;
+int opt_nthreads = 1;
 
 // the number of times each thread should iterate
-int rw_opt_nloops = 50000;
+int opt_nloops = 50000;
 
 // number of locales to use
-int rw_opt_nlocales = MAX_THREADS;
+int opt_nlocales = MAX_THREADS;
 
 // should all threads share the same set of locale objects instead
 // of creating their own?
-int rw_opt_shared_locale;
+int opt_shared_locale;
+
+// default timeout used by each threaded section of this test
+int opt_timeout = 60;
 
 /**************************************************************************/
 
@@ -162,7 +165,10 @@
     std::ios_base::iostate state = std::ios_base::goodbit;
 
     std::tm local;
-    for (int i = 0; i != rw_opt_nloops; ++i) {
+    for (int i = 0; i != opt_nloops; ++i) {
+
+        if (rw_thread_pool_timeout_expired ())
+            break;
 
         // save the name of the locale
         const MyTimeData& data = my_time_data [i % nlocales];
@@ -171,8 +177,8 @@
         // facet from it and use it to format a random time value
         // using a random conversion specifier
         const std::locale loc =
-            rw_opt_shared_locale ? data.locale_
-                                 : std::locale (data.locale_name_);
+            opt_shared_locale ? data.locale_
+                              : std::locale (data.locale_name_);
 
         if (test_char) {
             // exercise the narrow char specialization of the facet
@@ -420,7 +426,7 @@
 
 #endif // _RWSTD_NO_WCHAR_T
 
-            if (rw_opt_shared_locale)
+            if (opt_shared_locale)
                 data.locale_ = loc;
 
             nlocales += 1;
@@ -431,7 +437,7 @@
                      "failed to create locale(%#s)", name);
         }
 
-        if (nlocales == maxinx || nlocales == std::size_t (rw_opt_nlocales))
+        if (nlocales == maxinx || nlocales == std::size_t (opt_nlocales))
             break;
     }
 
@@ -442,8 +448,8 @@
     rw_info (0, 0, 0,
              "testing std::time_get<charT> with %d thread%{?}s%{;}, "
              "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
-             rw_opt_nthreads, 1 != rw_opt_nthreads,
-             rw_opt_nloops, 1 != rw_opt_nloops,
+             opt_nthreads, 1 != opt_nthreads,
+             opt_nloops, 1 != opt_nloops,
              nlocales, int (nlocales), "%#s", locales);
 
     rw_info (0, 0, 0, "exercising std::time_get<char>");
@@ -453,11 +459,12 @@
 
     // create and start a pool of threads and wait for them to finish
     int result =
-        rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
-              rw_opt_nthreads, thread_func);
+              opt_nthreads, thread_func);
 
 #ifndef _RWSTD_NO_WCHAR_T
 
@@ -468,11 +475,12 @@
 
     // start a pool of threads to exercise wstring thread safety
     result =
-        rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
-              rw_opt_nthreads, thread_func);
+              opt_nthreads, thread_func);
 
     // exercise both the char and the wchar_t specializations
     // at the same time
@@ -485,11 +493,12 @@
 
     // start a pool of threads to exercise wstring thread safety
     result =
-        rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
-              rw_opt_nthreads, thread_func);
+              opt_nthreads, thread_func);
 
 #endif   // _RWSTD_NO_WCHAR_T
 
@@ -504,24 +513,26 @@
 
     // set nthreads to the greater of the number of processors
     // and 2 (for uniprocessor systems) by default
-    rw_opt_nthreads = rw_get_cpus ();
-    if (rw_opt_nthreads < 2)
-        rw_opt_nthreads = 2;
+    opt_nthreads = rw_get_cpus ();
+    if (opt_nthreads < 2)
+        opt_nthreads = 2;
 
 #endif   // _RWSTD_REENTRANT
 
     return rw_test (argc, argv, __FILE__,
                     "lib.locale.time.get",
                     "thread safety", run_test,
+                    "|-soft-timeout#0 "  // must be non-negative
                     "|-nloops#0 "       // must be non-negative
                     "|-nthreads#0-* "   // must be in [0, MAX_THREADS]
                     "|-nlocales#0 "     // arg must be non-negative
                     "|-locales= "       // must be provided
                     "|-shared-locale# ",
-                    &rw_opt_nloops,
+                    &opt_timeout,
+                    &opt_nloops,
                     int (MAX_THREADS),
-                    &rw_opt_nthreads,
-                    &rw_opt_nlocales,
+                    &opt_nthreads,
+                    &opt_nlocales,
                     &rw_opt_setlocales,
-                    &rw_opt_shared_locale);
+                    &opt_shared_locale);
 }

Modified: stdcxx/trunk/tests/localization/22.locale.time.put.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.time.put.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.time.put.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.time.put.cpp Tue May 27 18:48:19 2008
@@ -405,10 +405,15 @@
 
     std::ostreambuf_iterator<charT> it (&sb);
 
+    // convert the narrow fill character to the generic charT
+    // being careful to avoid (potential) sign extension
+    typedef unsigned char UChar;
+    const charT wfill = charT (UChar (fill));
+
     if (patend - pat == 2 && '%' == pat [0]) {
 
         // format character, no modifier
-        *tp.put (it, ios, fill, tmb, char (wpat [1])) = charT ();
+        *tp.put (it, ios, wfill, tmb, char (wpat [1])) = charT ();
 
         const bool success = 0 == rw_strncmp (buf, result);
 
@@ -425,7 +430,7 @@
     else if (patend - pat == 3 && '%' == pat [0]) {
 
         // format character preceded by a format modifier
-        *tp.put (it, ios, fill, tmb, char (wpat [2]), char (wpat [1])) =
+        *tp.put (it, ios, wfill, tmb, char (wpat [2]), char (wpat [1])) =
             charT ();
 
         const bool success = 0 == rw_strncmp (buf, result);
@@ -442,7 +447,7 @@
     sb.pubsetp (buf, buf + sizeof buf / sizeof *buf);
 
     // format string
-    *tp.put (it, ios, fill, tmb, wpat, wpat + (patend - pat)) = charT ();
+    *tp.put (it, ios, wfill, tmb, wpat, wpat + (patend - pat)) = charT ();
 
     const bool success = 0 == rw_strncmp (buf, result);
 
@@ -507,6 +512,8 @@
         return 0;
 
     std::FILE *fout = std::fopen (srcfname, "w");
+    if (0 == fout)
+        return 0;
 
     std::fprintf (fout, "LC_TIME\n");
 
@@ -643,6 +650,9 @@
         return 0;
 
     fout = std::fopen (cmfname, "w");
+    if (0 == fout)
+        return 0;
+
     pcs_write (fout, 0);
 
     std::fclose (fout);

Modified: stdcxx/trunk/tests/localization/22.locale.time.put.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.time.put.mt.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.time.put.mt.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.time.put.mt.cpp Tue May 27 18:48:19 2008
@@ -67,6 +67,9 @@
 // of creating their own?
 int opt_shared_locale;
 
+// default timeout used by each threaded section of this test
+int opt_timeout = 60;
+
 /**************************************************************************/
 
 // array of locale names to use for testing
@@ -157,6 +160,9 @@
 
     for (int i = 0; i != opt_nloops; ++i) {
 
+        if (rw_thread_pool_timeout_expired ())
+            break;
+
         // save the name of the locale
         const MyTimeData& data = my_time_data [i % nlocales];
 
@@ -165,7 +171,7 @@
         // using a random conversion specifier
         const std::locale loc =
             opt_shared_locale ? data.locale_
-                                 : std::locale (data.locale_name_);
+                              : std::locale (data.locale_name_);
 
         if (test_char) {
             // exercise the narrow char specialization of the facet
@@ -331,7 +337,8 @@
 
     // create and start a pool of threads and wait for them to finish
     int result =
-        rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
@@ -346,7 +353,8 @@
 
     // start a pool of threads to exercise wstring thread safety
     result =
-        rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
@@ -363,7 +371,8 @@
 
     // start a pool of threads to exercise wstring thread safety
     result =
-        rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
+        rw_thread_pool (0, std::size_t (opt_nthreads), 0,
+                        thread_func, 0, std::size_t (opt_timeout));
 
     rw_error (result == 0, 0, __LINE__,
               "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
@@ -391,11 +400,13 @@
     return rw_test (argc, argv, __FILE__,
                     "lib.locale.time.put",
                     "thread safety", run_test,
+                    "|-soft-timeout#0 "  // must be non-negative
                     "|-nloops#0 "       // must be non-negative
                     "|-nthreads#0-* "   // must be in [0, MAX_THREADS]
                     "|-nlocales#0 "     // arg must be non-negative
                     "|-locales= "       // must be provided
                     "|-shared-locale# ",
+                    &opt_timeout,
                     &opt_nloops,
                     int (MAX_THREADS),
                     &opt_nthreads,

Modified: stdcxx/trunk/tests/numerics/26.valarray.cassign.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/numerics/26.valarray.cassign.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/numerics/26.valarray.cassign.cpp (original)
+++ stdcxx/trunk/tests/numerics/26.valarray.cassign.cpp Tue May 27 18:48:19 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright (C) 2007 Rogue Wave Software, Inc.
+ * Copyright (C) 2007-2008 Rogue Wave Software, Inc.
  *
  **************************************************************************/
 
@@ -805,15 +805,15 @@
     TEST (int);
     TEST (double);
 
-#if 0x04020000 >= _RWSTD_VER
+#if 0x04020100 >= _RWSTD_VER
 
-    // test fails to compile with stdcxx 4.2.0 and prior due to
+    // test fails to compile with stdcxx 4.2.1 and prior due to
     // STDCXX-512: http://issues.apache.org/jira/browse/STDCXX-512
     rw_warn (0, 0, __LINE__,
              "test of UserClass disabled in stdcxx 4.2.0 and prior "
              "due to STDCXX-512");
 
-#else   // stdcxx > 4.2.0
+#else   // stdcxx >= 4.2.1
 
     TEST (UserClass);
 

Modified: stdcxx/trunk/tests/src/alarm.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/alarm.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/src/alarm.cpp (original)
+++ stdcxx/trunk/tests/src/alarm.cpp Tue May 27 18:48:19 2008
@@ -44,16 +44,16 @@
 // exported/imported
 
 /* extern _TEST_EXPORT */ rw_signal_handler_t* const
-rw_sig_dfl = (rw_signal_handler_t*)-1;
+rw_sig_dfl = (rw_signal_handler_t*)0;
 
 /* extern _TEST_EXPORT */ rw_signal_handler_t* const
-rw_sig_ign = (rw_signal_handler_t*)-2;
+rw_sig_ign = (rw_signal_handler_t*)1;
 
 /* extern _TEST_EXPORT */ rw_signal_handler_t* const
-rw_sig_hold = (rw_signal_handler_t*)-3;
+rw_sig_hold = (rw_signal_handler_t*)2;
 
 /* extern _TEST_EXPORT */ rw_signal_handler_t* const
-rw_sig_restore = (rw_signal_handler_t*)-4;
+rw_sig_restore = (rw_signal_handler_t*)3;
 
 
 // may point to a user-defined handler for the alarm
@@ -133,7 +133,7 @@
 #  endif
 
 #  ifndef SIG_DFL
-#    define SIG_IGN (rw_signal_handler_t*)0
+#    define SIG_DFL (rw_signal_handler_t*)0
 #  endif   // SIG_DFL
 
 #  ifndef SIG_IGN

Modified: stdcxx/trunk/tests/src/cmdopt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/cmdopt.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/src/cmdopt.cpp (original)
+++ stdcxx/trunk/tests/src/cmdopt.cpp Tue May 27 18:48:19 2008
@@ -20,7 +20,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2005-2006 Rogue Wave Software.
+ * Copyright 2005-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -518,6 +518,8 @@
                 lopt = lastopt->loptbuf_;
             else {
                 lopt = (char*)malloc (optlen + 1);
+                if (0 == lopt)
+                    return -1;   // error
                 lastopt->lopt_ = lopt;
             }
 
@@ -534,6 +536,8 @@
 
         int arg_is_callback = true;
 
+        RW_ASSERT (0 != next);
+
         if ('#' == *next) {
             // examples of option specification:
             //   --foo#     option takes an optional numeric argument

Modified: stdcxx/trunk/tests/src/locale.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/locale.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/src/locale.cpp (original)
+++ stdcxx/trunk/tests/src/locale.cpp Tue May 27 18:48:19 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2007 Rogue Wave Software, Inc.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -215,8 +215,22 @@
 
     // otherwise, try to create the locale database
 
+    // fallback for when TOPDIR is unset or empty
+    char topdir_path_buf [] = __FILE__;
+
     // use TOPDIR to determine the root of the source tree
-    const char* const topdir = getenv (TOPDIR);
+    const char* topdir = getenv (TOPDIR);
+    if (!topdir || !*topdir) {
+
+        // try to get TOPDIR from __FILE__
+        char* const slash = strrchr (topdir_path_buf, _RWSTD_PATH_SEP);
+
+        if (slash) {
+            slash [-1] = '\0';
+            topdir     = topdir_path_buf;
+        }
+    }
+
     if (!topdir || !*topdir) {
         rw_error (0, __FILE__, __LINE__,
                   "the environment variable %s is %s",
@@ -1097,8 +1111,22 @@
         _rw_lookup_table_t countries_map;
         _rw_lookup_table_t encodings_map;
 
+        // fallback for when TOPDIR is unset or empty
+        char topdir_path_buf [] = __FILE__;
+
         // use TOPDIR to determine the root of the source tree
-        const char* const topdir = getenv (TOPDIR);
+        const char* topdir = getenv (TOPDIR);
+        if (!topdir || !*topdir) {
+
+            // try to get TOPDIR from __FILE__
+            char* const slash = strrchr (topdir_path_buf, _RWSTD_PATH_SEP);
+
+            if (slash) {
+                slash [-1] = '\0';
+                topdir     = topdir_path_buf;
+            }
+        }
+
         if (!topdir || !*topdir) {
             rw_error (0, __FILE__, __LINE__,
                       "the environment variable %s is %s",

Modified: stdcxx/trunk/tests/src/opt_diags.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/opt_diags.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/src/opt_diags.cpp (original)
+++ stdcxx/trunk/tests/src/opt_diags.cpp Tue May 27 18:48:19 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -282,6 +282,8 @@
             break;
         }
 
+        RW_ASSERT (0 != end);
+
         if (':' == *end || '\0' == *end) {
             parg = end + (0 != *end);
             end  = strpbrk (parg, ":,");
@@ -299,6 +301,8 @@
                 break;
             }
 
+            RW_ASSERT (0 != end);
+
             if (':' == *end || '\0' == *end) {
                 parg = end + ('\0' != *end);
                 end  = strpbrk (parg, ":,");
@@ -317,6 +321,8 @@
                     break;
                 }
 
+                RW_ASSERT (0 != end);
+
                 if (':' == *end || '\0' == *end) {
                     parg = end + (0 != *end);
                     end  = strpbrk (parg, ":,");

Modified: stdcxx/trunk/tests/src/printf.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/printf.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/src/printf.cpp (original)
+++ stdcxx/trunk/tests/src/printf.cpp Tue May 27 18:48:19 2008
@@ -1424,13 +1424,6 @@
     if (spec.fl_zero)
         *pf++ = '0';
 
-    if (spec.mod != spec.mod_ext_A && 0 <= spec.width) {
-        pf += sprintf (pf, "%i", spec.width);
-    }
-
-    if (0 <= spec.prec)
-        pf += sprintf (pf, ".%i", spec.prec);
-
     if (spec.mod == spec.mod_h)
         *pf++ = 'h';
     else if (spec.mod == spec.mod_hh) {
@@ -1458,6 +1451,13 @@
         pf += strlen (pf);
     }
 
+    if (spec.mod != spec.mod_ext_A && 0 <= spec.width) {
+        pf += sprintf (pf, "%i", spec.width);
+    }
+
+    if (0 <= spec.prec)
+        pf += sprintf (pf, ".%i", spec.prec);
+
     *pf++ = char (spec.cvtspec);
     *pf   = '\0';
 
@@ -1499,7 +1499,6 @@
             buffer [len - 3] = buffer [len - 2];
             buffer [len - 2] = buffer [len - 1];
             buffer [len - 1] = buffer [len];
-            --len;
         }
     }
 

Modified: stdcxx/trunk/tests/src/thread.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/thread.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/src/thread.cpp (original)
+++ stdcxx/trunk/tests/src/thread.cpp Tue May 27 18:48:19 2008
@@ -30,6 +30,7 @@
 #define _RWSTD_TEST_SRC
 
 #include <rw_thread.h>
+#include <rw_alarm.h>   // for rw_alarm()
 #include <stddef.h>     // for size_t
 #include <string.h>     // for memset()
 
@@ -52,16 +53,41 @@
 
 static long maxthreads;
 
+/************************************************************************/
 
-#if defined (_RWSTD_POSIX_THREADS)
-#  include <pthread.h>
+static volatile int
+_rw_timeout_expired = 0;
+
+/************************************************************************/
+
+_TEST_EXPORT int
+rw_thread_pool_timeout_expired ()
+{
+    return _rw_timeout_expired != 0;
+}
+
+/************************************************************************/
 
 extern "C" {
 
+static void
+_rw_timeout_handler (int)
+{
+    _rw_timeout_expired = 1;
+}
+
+}    // extern "C"
+
+/************************************************************************/
+
+
+#if defined (_RWSTD_POSIX_THREADS)
+#  include <pthread.h>
+
 _TEST_EXPORT int
 rw_thread_create (rw_thread_t *thr_id,
                   rw_thread_attr_t*,
-                  void* (*thr_proc)(void*),
+                  rw_thread_proc *thr_proc,
                   void *thr_arg)
 {
 #ifdef _RWSTD_OS_SUNOS
@@ -109,19 +135,15 @@
     return result;
 }
 
-}   // extern "C"
-
 /**************************************************************************/
 
 #elif defined (_RWSTD_SOLARIS_THREADS)
 #  include <thread.h>
 
-extern "C" {
-
 _TEST_EXPORT int
 rw_thread_create (rw_thread_t *thr_id,
                   rw_thread_attr_t*,
-                  void* (*thr_proc)(void*),
+                  rw_thread_proc *thr_proc,
                   void *thr_arg)
 {
     static int concurrency_set;
@@ -170,8 +192,6 @@
     return result;
 }
 
-}   // extern "C"
-
 /**************************************************************************/
 
 #elif defined (_RWSTD_DEC_THREADS)
@@ -179,13 +199,10 @@
 #  include <setjmp.h>
 #  include <cma.h>
 
-
-extern "C" {
-
 _TEST_EXPORT int
 rw_thread_create (rw_thread_t *thr_id,
                   rw_thread_attr_t*,
-                  void* (*thr_proc)(void*),
+                  rw_thread_proc *thr_proc,
                   void *thr_arg)
 {
     rw_thread_t tmpid;
@@ -244,19 +261,15 @@
     return status;
 }
 
-}   // extern "C"
-
 /**************************************************************************/
 
 #elif defined (_WIN32) && defined (_MT)
 #  include <process.h>    // for _beginthreadex()
 
-extern "C" {
-
 _TEST_EXPORT int
 rw_thread_create (rw_thread_t *thr_id,
                   rw_thread_attr_t*,
-                  void* (*thr_proc)(void*),
+                  rw_thread_proc *thr_proc,
                   void *thr_arg)
 {
     int result = 0;
@@ -324,8 +337,6 @@
     return result;
 }
 
-}   // extern "C"
-
 /**************************************************************************/
 
 #else   // unknown/missing threads environment
@@ -352,12 +363,10 @@
 #    endif
 #  endif   // ENOTSUP
 
-extern "C" {
-
 _TEST_EXPORT int
 rw_thread_create (rw_thread_t*,
                   rw_thread_attr_t*,
-                  void* (*)(void*),
+                  rw_thread_proc*,
                   void*)
 {
     _RWSTD_UNUSED (maxthreads);
@@ -372,8 +381,6 @@
     return ENOTSUP;
 }
 
-}   // extern "C"
-
 #endif   // threads environment
 
 /**************************************************************************/
@@ -471,16 +478,20 @@
 
 /**************************************************************************/
 
-extern "C" {
-
-
 _TEST_EXPORT int
 rw_thread_pool (rw_thread_t        *thr_id,
                 size_t              nthrs,
                 rw_thread_attr_t*,
-                void*             (*thr_proc)(void*),
-                void*              *thr_arg)
-{
+                rw_thread_proc     *thr_proc,
+                void*              *thr_arg,
+                size_t              timeout)
+{
+    // apply timeout if one was specified
+    if (0 != timeout) {
+        _rw_timeout_expired = 0;
+        rw_alarm (timeout, _rw_timeout_handler);
+    }
+
     // small buffer for thread ids when invoked with (thr_id == 0)
     rw_thread_t id_buf [16];
 
@@ -575,5 +586,3 @@
 
     return 0;
 }
-
-}   // extern "C"

Modified: stdcxx/trunk/tests/strings/21.cwctype.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/strings/21.cwctype.cpp?rev=660776&r1=660775&r2=660776&view=diff
==============================================================================
--- stdcxx/trunk/tests/strings/21.cwctype.cpp (original)
+++ stdcxx/trunk/tests/strings/21.cwctype.cpp Tue May 27 18:48:19 2008
@@ -82,7 +82,6 @@
     "iswlower",
 #else
     "",
-#endif
 
 #ifdef iswprint
 #  undef iswprint
@@ -119,6 +118,8 @@
     "",
 #endif
 
+#endif
+
 #ifdef tolower
 #  undef tolower
     "tolower",



Mime
View raw message