This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: dg-require-{fork,mkfifo} for V3 testsuite


This patch adds dg-require-fork and dg-require-mkfifo to the generic
GCC test infrastructure, and then uses it in the V3 testsuite, instead
of using "try_mkfifo" and blindly calling "fork", even on systems that
don't support it.

OK to commit V3 bits?  Janis, any objections to GCC bits?

Once this goes on mainline, I will backport to 3.4/4.0.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-05-05  Mark Mitchell  <mark@codesourcery.com>

	* testsuite/testsuite_hooks.cc (try_mkfifo): Remove.
	* testsuite/testsuite_hooks.h (try_mkfifo): Likewise.
	* testsuite/27_io/basic_filebuf/close/char/4879.cc: Use
	dg-require-fork and dg-require-mkfifo.  Replace try_mkfifo with
	mkfifo.
	* testsuite/27_io/basic_filebuf/close/char/9964.cc: Likewise.
	* testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc: Likewise.
	* testsuite/27_io/basic_filebuf/imbue/char/13582-2.cc: Likewise.
	* testsuite/27_io/basic_filebuf/imbue/wchar_t/13582-2.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/open/char/9507.cc: Likewise.
	* testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/underflow/char/10097.cc: Likewise.
	* testsuite/27_io/objects/char/7.cc: Likewise.
	* testsuite/27_io/objects/char/9661-1.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/7.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/9661-1.cc: Likewise.

2005-05-05  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.

Index: libstdc++-v3/testsuite/testsuite_hooks.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/testsuite_hooks.cc,v
retrieving revision 1.28
diff -c -5 -p -r1.28 testsuite_hooks.cc
*** libstdc++-v3/testsuite/testsuite_hooks.cc	7 Apr 2005 04:16:16 -0000	1.28
--- libstdc++-v3/testsuite/testsuite_hooks.cc	5 May 2005 22:25:52 -0000
*************** namespace __gnu_test
*** 231,251 ****
  	  throw;
        }
  #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;
    unsigned int assignment_operator::count_ = 0;
    unsigned int assignment_operator::throw_on_ = 0;
--- 231,240 ----
Index: libstdc++-v3/testsuite/testsuite_hooks.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/testsuite_hooks.h,v
retrieving revision 1.34
diff -c -5 -p -r1.34 testsuite_hooks.h
*** libstdc++-v3/testsuite/testsuite_hooks.h	7 Apr 2005 04:16:16 -0000	1.34
--- libstdc++-v3/testsuite/testsuite_hooks.h	5 May 2005 22:25:52 -0000
*************** namespace __gnu_test
*** 162,174 ****
  
    // Try to create a locale with the given name. If it fails, bail.
    std::locale
    try_named_locale(const char* name);
  
-   int
-   try_mkfifo (const char* filename, mode_t mode);
- 
  
    // Counting.
    struct counter
    {
      // Specifically and glaringly-obviously marked 'signed' so that when
--- 162,171 ----
Index: libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc,v
retrieving revision 1.6
diff -c -5 -p -r1.6 4879.cc
*** libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc	4 Jan 2005 00:17:12 -0000	1.6
--- libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc	5 May 2005 22:25:53 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { 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
  // software; you can redistribute it and/or modify it under the
  // terms of the GNU General Public License as published by the
*************** test_04()
*** 44,54 ****
    semaphore s1, s2;
  
    signal(SIGPIPE, SIG_IGN);
    
    unlink(name);
!   if (0 != try_mkfifo(name, S_IRWXU))
      {
        std::cerr << "failed to create fifo" << std::endl;
        exit(-1);
      }
    
--- 47,57 ----
    semaphore s1, s2;
  
    signal(SIGPIPE, SIG_IGN);
    
    unlink(name);
!   if (0 != mkfifo(name, S_IRWXU))
      {
        std::cerr << "failed to create fifo" << std::endl;
        exit(-1);
      }
    
Index: libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc,v
retrieving revision 1.8
diff -c -5 -p -r1.8 9964.cc
*** libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc	4 Jan 2005 00:17:12 -0000	1.8
--- libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc	5 May 2005 22:25:53 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { 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
  // software; you can redistribute it and/or modify it under the
  // terms of the GNU General Public License as published by the
*************** void test_07()
*** 42,52 ****
    const char* name = "tmp_fifo3";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   try_mkfifo(name, S_IRWXU);
    
    int child = fork();
    VERIFY( child != -1 );
  
    if (child == 0)
--- 45,55 ----
    const char* name = "tmp_fifo3";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   mkfifo(name, S_IRWXU);
    
    int child = fork();
    VERIFY( child != -1 );
  
    if (child == 0)
Index: libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc,v
retrieving revision 1.5
diff -c -5 -p -r1.5 13171-2.cc
*** libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc	4 Jan 2005 00:17:13 -0000	1.5
--- libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc	5 May 2005 22:25:53 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { 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
  // software; you can redistribute it and/or modify it under the
  // terms of the GNU General Public License as published by the
*************** void test01()
*** 36,46 ****
    locale loc_fr(__gnu_test::try_named_locale("fr_FR"));
    locale loc_en(__gnu_test::try_named_locale("en_US"));
  
    const char* name = "tmp_fifo_13171-2";
    unlink(name);
!   try_mkfifo(name, S_IRWXU);
    semaphore s1, s2;
    
    int child = fork();
    if (child == 0)
      {
--- 39,49 ----
    locale loc_fr(__gnu_test::try_named_locale("fr_FR"));
    locale loc_en(__gnu_test::try_named_locale("en_US"));
  
    const char* name = "tmp_fifo_13171-2";
    unlink(name);
!   mkfifo(name, S_IRWXU);
    semaphore s1, s2;
    
    int child = fork();
    if (child == 0)
      {
Index: libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13582-2.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13582-2.cc,v
retrieving revision 1.4
diff -c -5 -p -r1.4 13582-2.cc
*** libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13582-2.cc	4 Jan 2005 00:17:13 -0000	1.4
--- libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13582-2.cc	5 May 2005 22:25:53 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { dg-require-fork "" }
+ // { dg-require-mkfifo "" }
+ 
  // 2004-01-11  Petur Runolfsson  <peturr02@ru.is>
  
  // Copyright (C) 2004, 2005 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
*************** void test01()
*** 39,49 ****
    locale loc_en(__gnu_test::try_named_locale("en_US"));
    locale loc_fr(__gnu_test::try_named_locale("fr_FR"));
  
    const char* name = "tmp_fifo_13582-2";
    unlink(name);
!   try_mkfifo(name, S_IRWXU);
  
    int child = fork();
    if (child == 0)
      {
        filebuf fbout;
--- 42,52 ----
    locale loc_en(__gnu_test::try_named_locale("en_US"));
    locale loc_fr(__gnu_test::try_named_locale("fr_FR"));
  
    const char* name = "tmp_fifo_13582-2";
    unlink(name);
!   mkfifo(name, S_IRWXU);
  
    int child = fork();
    if (child == 0)
      {
        filebuf fbout;
Index: libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/13582-2.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/13582-2.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 13582-2.cc
*** libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/13582-2.cc	12 Jan 2004 17:25:25 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/13582-2.cc	5 May 2005 22:25:53 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { dg-require-fork "" }
+ // { dg-require-mkfifo "" }
+ 
  // 2004-01-11  Petur Runolfsson  <peturr02@ru.is>
  
  // Copyright (C) 2004 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
*************** void test01()
*** 39,49 ****
    locale loc_en(__gnu_test::try_named_locale("en_US"));
    locale loc_fr(__gnu_test::try_named_locale("fr_FR"));
  
    const char* name = "tmp_fifo_13582-2";
    unlink(name);
!   try_mkfifo(name, S_IRWXU);
    
    int child = fork();
    if (child == 0)
      {
        filebuf fbout;
--- 42,52 ----
    locale loc_en(__gnu_test::try_named_locale("en_US"));
    locale loc_fr(__gnu_test::try_named_locale("fr_FR"));
  
    const char* name = "tmp_fifo_13582-2";
    unlink(name);
!   mkfifo(name, S_IRWXU);
    
    int child = fork();
    if (child == 0)
      {
        filebuf fbout;
Index: libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc,v
retrieving revision 1.3
diff -c -5 -p -r1.3 14975-2.cc
*** libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc	4 Jan 2005 00:17:14 -0000	1.3
--- libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/14975-2.cc	5 May 2005 22:25:53 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { dg-require-fork "" }
+ // { dg-require-mkfifo "" }
+ 
  // 2004-04-16  Petur Runolfsson  <peturr02@ru.is>
  
  // Copyright (C) 2004, 2005 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
*************** void test01()
*** 39,49 ****
    const char* name = "tmp_14975-2";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   try_mkfifo(name, S_IRWXU);
    semaphore s1;
  
    int child = fork();
    VERIFY( child != -1 );
  
--- 42,52 ----
    const char* name = "tmp_14975-2";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   mkfifo(name, S_IRWXU);
    semaphore s1;
  
    int child = fork();
    VERIFY( child != -1 );
  
Index: libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc,v
retrieving revision 1.10
diff -c -5 -p -r1.10 9507.cc
*** libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc	21 Jan 2005 01:37:09 -0000	1.10
--- libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc	5 May 2005 22:25:53 -0000
***************
*** 1,5 ****
--- 1,7 ----
+ // { 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
  // software; you can redistribute it and/or modify it under the
  // terms of the GNU General Public License as published by the
*************** void test_06()
*** 39,49 ****
    const char* name = "tmp_fifo2";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);
!   try_mkfifo(name, S_IRWXU);
    
    std::filebuf fbuf;
    // The use of ios_base::ate implies an attempt to seek on the file
    // descriptor.  The seek will fail.  Thus, at the OS level, this
    // call to "fbuf.open" will result in a call to "open" (which will
--- 41,51 ----
    const char* name = "tmp_fifo2";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);
!   mkfifo(name, S_IRWXU);
    
    std::filebuf fbuf;
    // The use of ios_base::ate implies an attempt to seek on the file
    // descriptor.  The seek will fail.  Thus, at the OS level, this
    // call to "fbuf.open" will result in a call to "open" (which will
Index: libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc,v
retrieving revision 1.5
diff -c -5 -p -r1.5 9533-1.cc
*** libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc	20 Feb 2004 23:51:06 -0000	1.5
--- libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc	5 May 2005 22:25:53 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { 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
  // software; you can redistribute it and/or modify it under the
  // terms of the GNU General Public License as published by the
*************** void test_01()
*** 37,47 ****
    const int count = 10000;
  
    signal(SIGPIPE, SIG_IGN);
    unlink(name);
    
!   if (0 != try_mkfifo(name, S_IRWXU))
      {
        VERIFY( false );
      }
    
    int fval = fork();
--- 40,50 ----
    const int count = 10000;
  
    signal(SIGPIPE, SIG_IGN);
    unlink(name);
    
!   if (0 != mkfifo(name, S_IRWXU))
      {
        VERIFY( false );
      }
    
    int fval = fork();
Index: libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc,v
retrieving revision 1.7
diff -c -5 -p -r1.7 10097.cc
*** libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc	4 Jan 2005 00:17:15 -0000	1.7
--- libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc	5 May 2005 22:25:53 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { dg-require-fork "" }
+ // { dg-require-mkfifo "" }
+ 
  // 2001-05-21 Benjamin Kosnik  <bkoz@redhat.com>
  
  // Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
*************** void test16()
*** 51,61 ****
    const char* name = "tmp_fifo1";
    
    signal(SIGPIPE, SIG_IGN);
    unlink(name);
    
!   if (0 != try_mkfifo(name, S_IRWXU))
      {
        VERIFY( false );
      }
    
    semaphore s1;
--- 54,64 ----
    const char* name = "tmp_fifo1";
    
    signal(SIGPIPE, SIG_IGN);
    unlink(name);
    
!   if (0 != mkfifo(name, S_IRWXU))
      {
        VERIFY( false );
      }
    
    semaphore s1;
Index: libstdc++-v3/testsuite/27_io/objects/char/7.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/objects/char/7.cc,v
retrieving revision 1.7
diff -c -5 -p -r1.7 7.cc
*** libstdc++-v3/testsuite/27_io/objects/char/7.cc	4 Jan 2005 00:17:15 -0000	1.7
--- libstdc++-v3/testsuite/27_io/objects/char/7.cc	5 May 2005 22:26:05 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { dg-require-fork "" }
+ // { dg-require-mkfifo "" }
+ 
  // 2003-04-26 Petur Runolfsson  <peturr02@ru.is>
  
  // Copyright (C) 2003, 2005 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
*************** void test07()
*** 39,49 ****
    const char* name = "tmp_fifo4";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   try_mkfifo(name, S_IRWXU);
    semaphore s1;
  
    int child = fork();
    VERIFY( child != -1 );
  
--- 42,52 ----
    const char* name = "tmp_fifo4";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   mkfifo(name, S_IRWXU);
    semaphore s1;
  
    int child = fork();
    VERIFY( child != -1 );
  
Index: libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc,v
retrieving revision 1.7
diff -c -5 -p -r1.7 9661-1.cc
*** libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc	4 Jan 2005 00:17:16 -0000	1.7
--- libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc	5 May 2005 22:26:05 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { dg-require-fork "" }
+ // { dg-require-mkfifo "" }
+ 
  // 2003-04-30  Petur Runolfsson <peturr02@ru.is>
  
  // Copyright (C) 2003, 2005 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
*************** void test01()
*** 40,50 ****
    const char* name = "tmp_fifo5";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   try_mkfifo(name, S_IRWXU);
    semaphore s1, s2;
    
    int child = fork();
    VERIFY( child != -1 );
  
--- 43,53 ----
    const char* name = "tmp_fifo5";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   mkfifo(name, S_IRWXU);
    semaphore s1, s2;
    
    int child = fork();
    VERIFY( child != -1 );
  
Index: libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc,v
retrieving revision 1.5
diff -c -5 -p -r1.5 7.cc
*** libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc	4 Jan 2005 00:17:16 -0000	1.5
--- libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc	5 May 2005 22:26:05 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { dg-require-fork "" }
+ // { dg-require-mkfifo "" }
+ 
  // 2003-05-01 Petur Runolfsson  <peturr02@ru.is>
  
  // Copyright (C) 2003, 2005 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
*************** void test07()
*** 39,49 ****
    const char* name = "tmp_fifo4";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   try_mkfifo(name, S_IRWXU);
    semaphore s1;
    
    int child = fork();
    VERIFY( child != -1 );
  
--- 42,52 ----
    const char* name = "tmp_fifo4";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   mkfifo(name, S_IRWXU);
    semaphore s1;
    
    int child = fork();
    VERIFY( child != -1 );
  
Index: libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc,v
retrieving revision 1.5
diff -c -5 -p -r1.5 9661-1.cc
*** libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc	4 Jan 2005 00:17:16 -0000	1.5
--- libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc	5 May 2005 22:26:05 -0000
***************
*** 1,5 ****
--- 1,8 ----
+ // { dg-require-fork "" }
+ // { dg-require-mkfifo "" }
+ 
  // 2003-04-30  Petur Runolfsson <peturr02@ru.is>
  
  // Copyright (C) 2003, 2005 Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
*************** void test01()
*** 40,50 ****
    const char* name = "tmp_fifo5";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   try_mkfifo(name, S_IRWXU);
    semaphore s1, s2;
  
    int child = fork();
    VERIFY( child != -1 );
  
--- 43,53 ----
    const char* name = "tmp_fifo5";
  
    signal(SIGPIPE, SIG_IGN);
  
    unlink(name);  
!   mkfifo(name, S_IRWXU);
    semaphore s1, s2;
  
    int child = fork();
    VERIFY( child != -1 );
  
Index: gcc/testsuite/lib/target-supports-dg.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/target-supports-dg.exp,v
retrieving revision 1.2
diff -c -5 -p -r1.2 target-supports-dg.exp
*** gcc/testsuite/lib/target-supports-dg.exp	25 Mar 2005 02:21:01 -0000	1.2
--- gcc/testsuite/lib/target-supports-dg.exp	5 May 2005 22:26:06 -0000
*************** proc dg-require-effective-target { args 
*** 120,129 ****
--- 120,147 ----
  	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 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
  # set that up for this test based on flags we know about.
  
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/target-supports.exp,v
retrieving revision 1.54
diff -c -5 -p -r1.54 target-supports.exp
*** gcc/testsuite/lib/target-supports.exp	29 Apr 2005 00:06:26 -0000	1.54
--- gcc/testsuite/lib/target-supports.exp	5 May 2005 22:26:06 -0000
*************** proc check_alpha_max_hw_available { } {
*** 599,608 ****
--- 599,655 ----
      }
  
      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.
  #
  # When the target name changes, replace the cached result.
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]