This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Libstdc++ newlib testsuite updates + PR 31884
- From: Daniel Jacobowitz <drow at false dot org>
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Wed, 15 Aug 2007 15:57:04 -0400
- Subject: Libstdc++ newlib testsuite updates + PR 31884
This patch fixes two problems. Apologies for combining them, but I
tested them together (and they're trivially separable).
David Edelsohn noticed ages ago that the priority_queue_dijkstra.cc
test was failing (on AIX I believe). Joern also reported this in
PR 31884. I've implemented Joern's suggested fix; it's not pretty,
but I couldn't come up with any other way to do it. The test is
definitely accessing freed memory, and using newlib's malloc this
leads to a crash. Valgrind is also unhappy with the test on x86_64,
and happy with it after the patch.
Also, a lot of new tests have sprouted that use either file I/O or
std::time. The powerpc-eabi board I was testing on does not currently
offer either, so the time tests failed to link and the file I/O tests
all failed at execution time. There's already appropriate dg-require
directives for both of these.
Some of the std::time references are unfortunate: they come from the
random seed in ext/throw_allocator.h, so this header is not usable
without it.
Some of the tests put dg directives before the copyright notice,
others after it, or after the #include's, or after the test, or...
I picked right after the header comment but I can change that if
requested.
Is this patch OK to commit? Tested on powerpc-eabi, where it fixes
priority_queue_dijkstra.cc and correctly turns a number of FAILs to
UNSUPPORTEDs.
--
Daniel Jacobowitz
CodeSourcery
2007-08-03 Daniel Jacobowitz <dan@codesourcery.com>
PR testsuite/31884
* testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc (main): Do
not access deleted nodes.
* testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc,
testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc,
testsuite/27_io/basic_filebuf/open/char/4.cc,
testsuite/27_io/objects/char/9.cc: Use dg-require-fileio.
* testsuite/ext/forced_exception_error/cons_virtual_derivation.cc,
testsuite/ext/pb_ds/regression/hash_data_map_rand.cc,
testsuite/ext/pb_ds/regression/trie_data_map_rand.cc,
testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc,
testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc,
testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc,
testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc,
testsuite/ext/pb_ds/regression/priority_queue_rand.cc,
testsuite/ext/pb_ds/regression/tree_data_map_rand.cc,
testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc,
testsuite/ext/throw_allocator/deallocate_global.cc,
testsuite/ext/throw_allocator/check_delete.cc,
testsuite/ext/throw_allocator/check_allocate_max_size.cc,
testsuite/ext/throw_allocator/check_deallocate_null.cc,
testsuite/ext/throw_allocator/check_new.cc,
testsuite/ext/throw_allocator/deallocate_local.cc,
testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc,
testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc,
testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc,
testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc,
testsuite/23_containers/list/modifiers/insert/25288.cc: Use
dg-require-time.
Index: libstdc++-v3/testsuite/27_io/objects/char/9.cc
===================================================================
--- libstdc++-v3/testsuite/27_io/objects/char/9.cc (revision 127482)
+++ libstdc++-v3/testsuite/27_io/objects/char/9.cc (working copy)
@@ -17,6 +17,8 @@
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
+
+// { dg-require-fileio "" }
#include <iostream>
#include <cstdio>
Index: libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/4.cc
===================================================================
--- libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/4.cc (revision 127482)
+++ libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/4.cc (working copy)
@@ -18,6 +18,8 @@
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
+// { dg-require-fileio "" }
+
#include <fstream>
#include <testsuite_hooks.h>
Index: libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc
===================================================================
--- libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc (revision 127482)
+++ libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc (working copy)
@@ -24,6 +24,8 @@
#include <cstring>
#include <testsuite_hooks.h>
+// { dg-require-fileio "" }
+
// In the occasion of libstdc++/25482
void test01()
{
Index: libstdc++-v3/testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc
===================================================================
--- libstdc++-v3/testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc (revision 127482)
+++ libstdc++-v3/testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc (working copy)
@@ -23,6 +23,8 @@
#include <algorithm>
#include <testsuite_hooks.h>
+// { dg-require-fileio "" }
+
// In the occasion of libstdc++/25482
void test01()
{
Index: libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc
===================================================================
--- libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc (working copy)
@@ -45,6 +45,8 @@
* Contains a random-operation test for maps and sets.
*/
+// { dg-require-time "" }
+
#include <regression/rand/assoc/rand_regression_test.hpp>
#include <regression/assoc/common_type.hpp>
Index: libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc
===================================================================
--- libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc (working copy)
@@ -45,6 +45,8 @@
* Contains a random-operation test for maps and sets.
*/
+// { dg-require-time "" }
+
#include <regression/rand/assoc/rand_regression_test.hpp>
#include <regression/assoc/common_type.hpp>
Index: libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc
===================================================================
--- libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc (working copy)
@@ -45,6 +45,8 @@
* Contains a random-operation test for maps and sets.
*/
+// { dg-require-time "" }
+
#include <regression/rand/assoc/rand_regression_test.hpp>
#include <regression/assoc/common_type.hpp>
Index: libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc
===================================================================
--- libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc (working copy)
@@ -45,6 +45,8 @@
* Contains a random-operation test for maps and sets.
*/
+// { dg-require-time "" }
+
#include <regression/rand/assoc/rand_regression_test.hpp>
#include <regression/assoc/common_type.hpp>
Index: libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc
===================================================================
--- libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc (working copy)
@@ -45,6 +45,8 @@
* Contains a random-operation test for maps and sets.
*/
+// { dg-require-time "" }
+
#include <regression/rand/assoc/rand_regression_test.hpp>
#include <regression/assoc/common_type.hpp>
Index: libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc
===================================================================
--- libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc (working copy)
@@ -45,6 +45,8 @@
* Contains a random-operation test for maps and sets.
*/
+// { dg-require-time "" }
+
#include <regression/rand/assoc/rand_regression_test.hpp>
#include <regression/assoc/common_type.hpp>
Index: libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc
===================================================================
--- libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc (working copy)
@@ -45,6 +45,8 @@
* Contains a random-operation test for priority queues.
*/
+// { dg-require-time "" }
+
#include <regression/rand/priority_queue/rand_regression_test.hpp>
#include <regression/priority_queue/common_type.hpp>
Index: libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc
===================================================================
--- libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc (working copy)
@@ -45,6 +45,8 @@
* Contains a random-operation test for maps and sets.
*/
+// { dg-require-time "" }
+
#include <regression/rand/assoc/rand_regression_test.hpp>
#include <regression/assoc/common_type.hpp>
Index: libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc
===================================================================
--- libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc (working copy)
@@ -45,6 +45,8 @@
* Contains a random-operation test for maps and sets.
*/
+// { dg-require-time "" }
+
#include <regression/rand/assoc/rand_regression_test.hpp>
#include <regression/assoc/common_type.hpp>
Index: libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc
===================================================================
--- libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc (working copy)
@@ -151,12 +151,16 @@ int main()
// node to the neighbor.
const size_t pot_dist = dist + a_a_edge_legnth[node_id][neighbor_i];
+ if (a_it[neighbor_i] == a_it[0])
+ continue;
+
// "Relax" the distance (if appropriate) through modify.
if (pot_dist < a_it[neighbor_i]->second)
p.modify(a_it[neighbor_i], pq_value(neighbor_i, pot_dist));
}
// Done with the node, so we pop it.
+ a_it[node_id] = a_it[0];
p.pop();
}
Index: libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc
===================================================================
--- libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc (working copy)
@@ -19,6 +19,8 @@
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
+// { dg-require-time "" }
+
#include <ext/throw_allocator.h>
#include <testsuite_api.h>
Index: libstdc++-v3/testsuite/ext/throw_allocator/deallocate_global.cc
===================================================================
--- libstdc++-v3/testsuite/ext/throw_allocator/deallocate_global.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/throw_allocator/deallocate_global.cc (working copy)
@@ -17,6 +17,8 @@
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
+// { dg-require-time "" }
+
#include <string>
#include <stdexcept>
#include <ext/throw_allocator.h>
Index: libstdc++-v3/testsuite/ext/throw_allocator/check_delete.cc
===================================================================
--- libstdc++-v3/testsuite/ext/throw_allocator/check_delete.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/throw_allocator/check_delete.cc (working copy)
@@ -17,6 +17,8 @@
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
+// { dg-require-time "" }
+
#include <cstdlib>
#include <ext/throw_allocator.h>
#include <testsuite_hooks.h>
Index: libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc
===================================================================
--- libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc (working copy)
@@ -17,6 +17,8 @@
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
+// { dg-require-time "" }
+
#include <ext/throw_allocator.h>
#include <testsuite_allocator.h>
Index: libstdc++-v3/testsuite/ext/throw_allocator/check_deallocate_null.cc
===================================================================
--- libstdc++-v3/testsuite/ext/throw_allocator/check_deallocate_null.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/throw_allocator/check_deallocate_null.cc (working copy)
@@ -17,6 +17,8 @@
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
+// { dg-require-time "" }
+
#include <ext/throw_allocator.h>
#include <testsuite_allocator.h>
Index: libstdc++-v3/testsuite/ext/throw_allocator/check_new.cc
===================================================================
--- libstdc++-v3/testsuite/ext/throw_allocator/check_new.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/throw_allocator/check_new.cc (working copy)
@@ -17,6 +17,8 @@
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
+// { dg-require-time "" }
+
#include <cstdlib>
#include <ext/throw_allocator.h>
#include <testsuite_hooks.h>
Index: libstdc++-v3/testsuite/ext/throw_allocator/deallocate_local.cc
===================================================================
--- libstdc++-v3/testsuite/ext/throw_allocator/deallocate_local.cc (revision 127482)
+++ libstdc++-v3/testsuite/ext/throw_allocator/deallocate_local.cc (working copy)
@@ -17,6 +17,8 @@
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
+// { dg-require-time "" }
+
#include <string>
#include <ext/throw_allocator.h>
#include <testsuite_hooks.h>
Index: libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc
===================================================================
--- libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc (revision 127482)
+++ libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc (working copy)
@@ -21,6 +21,8 @@
// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub]
// 5.1.1 Table 16 line 3 Gen ctor
+// { dg-require-time "" }
+
#include <ctime>
#include <tr1/random>
#include <testsuite_hooks.h>
Index: libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc
===================================================================
--- libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc (revision 127482)
+++ libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc (working copy)
@@ -21,6 +21,8 @@
// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1]
// 5.1.1 Table 16 line 3 Gen ctor
+// { dg-require-time "" }
+
#include <ctime>
#include <tr1/random>
#include <testsuite_hooks.h>
Index: libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc
===================================================================
--- libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc (revision 127482)
+++ libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc (working copy)
@@ -21,6 +21,8 @@
// 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong]
// 5.1.1 Table 16 line 3 template ctor(gen)
+// { dg-require-time "" }
+
#include <ctime>
#include <tr1/random>
#include <testsuite_hooks.h>
Index: libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc
===================================================================
--- libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc (revision 127482)
+++ libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc (working copy)
@@ -21,6 +21,8 @@
// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers]
// 5.1.1 Table 16 line 3 Gen ctor
+// { dg-require-time "" }
+
#include <ctime>
#include <tr1/random>
#include <testsuite_hooks.h>
Index: libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc
===================================================================
--- libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc (revision 127482)
+++ libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc (working copy)
@@ -18,6 +18,8 @@
// 23.2.2.3 list modifiers [lib.list.modifiers]
+// { dg-require-time "" }
+
#include <list>
#include <testsuite_hooks.h>
#include <ext/throw_allocator.h>