diff options
19 files changed, 126 insertions, 28 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4b3ca396ea5..8ecd101dca3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2005-05-06 Mark Mitchell <mark@codesourcery.com> + + * lib/target-supports-dg.exp (dg-require-fork): New function. + (dg-require-mkfifo): Likewise. + * lib/target-supports.exp (check_function_available): New + function. + (check_fork_available): Likewise. + (check_mkfifo_available): Likewise. + 2005-05-06 Jeff Law <law@redhat.com> * gcc.c-torture/compile/pr21380.c: New test. diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp index 33c574ac34c..1e112185041 100644 --- a/gcc/testsuite/lib/scanasm.exp +++ b/gcc/testsuite/lib/scanasm.exp @@ -118,7 +118,7 @@ proc scan-not-hidden { args } { set output_file "[file rootname [file tail $testcase]].s" set symbol [lindex $args 0] - set hidden_scan [hidden-scan-for symbol] + set hidden_scan [hidden-scan-for $symbol] set args [lreplace $args 0 0 "$hidden_scan"] diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index 1f2242fdc5d..899473f8736 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -122,6 +122,24 @@ proc dg-require-effective-target { args } { } } +# If this target does not have fork, skip this test. + +proc dg-require-fork { args } { + if { ![check_fork_available] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } +} + +# If this target does not have mkfifo, skip this test. + +proc dg-require-mkfifo { args } { + if { ![check_mkfifo_available] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } +} + # Check the flags with which the test will be run against options in # a test directive that will skip or xfail that test. The DejaGnu proc # check_conditional_xfail will look at the options in compiler_flags, so diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 6d47ece07f0..90139ff8395 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -601,6 +601,53 @@ proc check_alpha_max_hw_available { } { return $alpha_max_hw_available_saved } +# Returns true iff the FUNCTION is available on the target system. +# (This is essentially a Tcl implementation of Autoconf's +# AC_CHECK_FUNC.) + +proc check_function_available { function } { + set var "${function}_available_saved" + global $var + global tool + + if {![info exists $var]} { + # Assume it exists. + set $var 1 + # Check to make sure. + set src "function[pid].c" + set exe "function[pid].exe" + + set f [open $src "w"] + puts $f "int main () { $function (); }" + close $f + + set lines [${tool}_target_compile $src $exe executable ""] + file delete $src + file delete $exe + + if {![string match "" $lines]} then { + set $var 0 + verbose -log "$function is not available" + } else { + verbose -log "$function is available" + } + } + + eval return \$$var +} + +# Returns ture iff "fork" is available on the target system. + +proc check_fork_available {} { + return [check_function_available "fork"] +} + +# Returns ture iff "mkfifo" is available on the target system. + +proc check_mkfifo_available {} { + return [check_function_available "mkfifo"] +} + # Return 1 if we're generating 32-bit code using default options, 0 # otherwise. # diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc index 96033e5a658..a7d0c5ced06 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -46,7 +49,7 @@ test_04() signal(SIGPIPE, SIG_IGN); unlink(name); - if (0 != try_mkfifo(name, S_IRWXU)) + if (0 != mkfifo(name, S_IRWXU)) { std::cerr << "failed to create fifo" << std::endl; exit(-1); diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc index d46184a705c..6be75113327 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -44,7 +47,7 @@ void test_07() signal(SIGPIPE, SIG_IGN); unlink(name); - try_mkfifo(name, S_IRWXU); + mkfifo(name, S_IRWXU); int child = fork(); VERIFY( child != -1 ); diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc index e62ed05b5e0..ec7be498274 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // Copyright (C) 2003, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -38,7 +41,7 @@ void test01() const char* name = "tmp_fifo_13171-2"; unlink(name); - try_mkfifo(name, S_IRWXU); + mkfifo(name, S_IRWXU); semaphore s1, s2; int child = fork(); diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13582-2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13582-2.cc index 79cd00a15b2..6a7376df18f 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13582-2.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13582-2.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // 2004-01-11 Petur Runolfsson <peturr02@ru.is> // Copyright (C) 2004, 2005 Free Software Foundation, Inc. @@ -41,7 +44,7 @@ void test01() const char* name = "tmp_fifo_13582-2"; unlink(name); - try_mkfifo(name, S_IRWXU); + mkfifo(name, S_IRWXU); int child = fork(); if (child == 0) diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/13582-2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/13582-2.cc index 7491f8c3a31..80fd8e92f91 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/13582-2.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/13582-2.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // 2004-01-11 Petur Runolfsson <peturr02@ru.is> // Copyright (C) 2004 Free Software Foundation, Inc. @@ -41,7 +44,7 @@ void test01() const char* name = "tmp_fifo_13582-2"; unlink(name); - try_mkfifo(name, S_IRWXU); + mkfifo(name, S_IRWXU); int child = fork(); if (child == 0) diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc index 2e6f9ec4149..d65b8d09f70 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // 2004-04-16 Petur Runolfsson <peturr02@ru.is> // Copyright (C) 2004, 2005 Free Software Foundation, Inc. @@ -41,7 +44,7 @@ void test01() signal(SIGPIPE, SIG_IGN); unlink(name); - try_mkfifo(name, S_IRWXU); + mkfifo(name, S_IRWXU); semaphore s1; int child = fork(); diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc index 792aeb5a310..8035a7b3009 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc @@ -1,3 +1,5 @@ +// { dg-require-mkfifo "" } + // Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -41,7 +43,7 @@ void test_06() signal(SIGPIPE, SIG_IGN); unlink(name); - try_mkfifo(name, S_IRWXU); + mkfifo(name, S_IRWXU); std::filebuf fbuf; // The use of ios_base::ate implies an attempt to seek on the file diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc index 19f0fcee20c..f5126e41df2 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // Copyright (C) 2003 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -39,7 +42,7 @@ void test_01() signal(SIGPIPE, SIG_IGN); unlink(name); - if (0 != try_mkfifo(name, S_IRWXU)) + if (0 != mkfifo(name, S_IRWXU)) { VERIFY( false ); } diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc index 88ba371d1d9..1113f84435f 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // 2001-05-21 Benjamin Kosnik <bkoz@redhat.com> // Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. @@ -53,7 +56,7 @@ void test16() signal(SIGPIPE, SIG_IGN); unlink(name); - if (0 != try_mkfifo(name, S_IRWXU)) + if (0 != mkfifo(name, S_IRWXU)) { VERIFY( false ); } diff --git a/libstdc++-v3/testsuite/27_io/objects/char/7.cc b/libstdc++-v3/testsuite/27_io/objects/char/7.cc index 9650f7b26df..b1b078120c1 100644 --- a/libstdc++-v3/testsuite/27_io/objects/char/7.cc +++ b/libstdc++-v3/testsuite/27_io/objects/char/7.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // 2003-04-26 Petur Runolfsson <peturr02@ru.is> // Copyright (C) 2003, 2005 Free Software Foundation, Inc. @@ -41,7 +44,7 @@ void test07() signal(SIGPIPE, SIG_IGN); unlink(name); - try_mkfifo(name, S_IRWXU); + mkfifo(name, S_IRWXU); semaphore s1; int child = fork(); diff --git a/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc b/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc index 51f2de1402d..778490896f9 100644 --- a/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc +++ b/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // 2003-04-30 Petur Runolfsson <peturr02@ru.is> // Copyright (C) 2003, 2005 Free Software Foundation, Inc. @@ -42,7 +45,7 @@ void test01() signal(SIGPIPE, SIG_IGN); unlink(name); - try_mkfifo(name, S_IRWXU); + mkfifo(name, S_IRWXU); semaphore s1, s2; int child = fork(); diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc index f51b3de8d57..9351ca48324 100644 --- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc +++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // 2003-05-01 Petur Runolfsson <peturr02@ru.is> // Copyright (C) 2003, 2005 Free Software Foundation, Inc. @@ -41,7 +44,7 @@ void test07() signal(SIGPIPE, SIG_IGN); unlink(name); - try_mkfifo(name, S_IRWXU); + mkfifo(name, S_IRWXU); semaphore s1; int child = fork(); diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc index c9e848aaf61..42b167b052a 100644 --- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc +++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc @@ -1,3 +1,6 @@ +// { dg-require-fork "" } +// { dg-require-mkfifo "" } + // 2003-04-30 Petur Runolfsson <peturr02@ru.is> // Copyright (C) 2003, 2005 Free Software Foundation, Inc. @@ -42,7 +45,7 @@ void test01() signal(SIGPIPE, SIG_IGN); unlink(name); - try_mkfifo(name, S_IRWXU); + mkfifo(name, S_IRWXU); semaphore s1, s2; int child = fork(); diff --git a/libstdc++-v3/testsuite/testsuite_hooks.cc b/libstdc++-v3/testsuite/testsuite_hooks.cc index e8618fb71df..a5f1b26e8cc 100644 --- a/libstdc++-v3/testsuite/testsuite_hooks.cc +++ b/libstdc++-v3/testsuite/testsuite_hooks.cc @@ -233,17 +233,6 @@ namespace __gnu_test #endif } - int - try_mkfifo (const char* filename, mode_t mode) - { -#if defined (_NEWLIB_VERSION) || defined (__MINGW32_VERSION) - /* Newlib and MinGW32 do not have mkfifo. */ - exit(0); -#else - return mkfifo(filename, mode); -#endif - } - counter::size_type counter::count = 0; unsigned int copy_constructor::count_ = 0; unsigned int copy_constructor::throw_on_ = 0; diff --git a/libstdc++-v3/testsuite/testsuite_hooks.h b/libstdc++-v3/testsuite/testsuite_hooks.h index 635ee1cce4a..8b8222316e6 100644 --- a/libstdc++-v3/testsuite/testsuite_hooks.h +++ b/libstdc++-v3/testsuite/testsuite_hooks.h @@ -164,9 +164,6 @@ namespace __gnu_test std::locale try_named_locale(const char* name); - int - try_mkfifo (const char* filename, mode_t mode); - // Counting. struct counter |