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: Fix spurious HP-UX V3 testsuite failures


HP-UX 11.2[23] do not permit you to open a FIFO with O_WRONLY|O_TRUNC
if the FIFO lives on an NFS partition mounted from a GNU/Linux server.
I don't know whether this is an HP-UX kernel bug, a HP-UX NFS client
bug, or a GNU/Linux NFS server bug -- but neither do I care, since the
point of the tests has nothing to do with the exact file open mode.

This patch makes four of the tests in the V3 testsuite more portable
by using "ios_base::in|ios_base::out" or "r+" to open FIFOs for
writing, rather than "ios_base::out" or "w".

Tested on ia64-hp-hpux11.23, installed on the mainline and on the 3.4
branch.

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

2004-02-20  Mark Mitchell  <mark@codesourcery.com>

	* testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc: Open
	FIFO for writing with ios_base::in|ios_base::out.
	* 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: Open FIFO for writing
	with "r+".

Index: 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.4
diff -c -5 -p -r1.4 9533-1.cc
*** 27_io/basic_filebuf/showmanyc/char/9533-1.cc	12 Jan 2004 08:11:07 -0000	1.4
--- 27_io/basic_filebuf/showmanyc/char/9533-1.cc	20 Feb 2004 23:44:37 -0000
*************** void test_01()
*** 51,61 ****
        VERIFY( false );
      }
    else if (fval == 0)
      {
        filebuf ofbuf;
!       ofbuf.open(name, ios_base::out);
        VERIFY( ofbuf.is_open() );
        sleep(1);
  
        for (int i = 0; i < count; ++i)
  	ofbuf.sputc(i % 100);
--- 51,61 ----
        VERIFY( false );
      }
    else if (fval == 0)
      {
        filebuf ofbuf;
!       ofbuf.open(name, ios_base::in|ios_base::out);
        VERIFY( ofbuf.is_open() );
        sleep(1);
  
        for (int i = 0; i < count; ++i)
  	ofbuf.sputc(i % 100);
Index: 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.4
diff -c -5 -p -r1.4 10097.cc
*** 27_io/basic_filebuf/underflow/char/10097.cc	12 Jan 2004 08:11:07 -0000	1.4
--- 27_io/basic_filebuf/underflow/char/10097.cc	20 Feb 2004 23:44:38 -0000
*************** void test16()
*** 65,75 ****
        VERIFY( false );
      }
    else if (fval == 0)
      {
        filebuf fbout;
!       fbout.open(name, ios_base::out);
        fbout.sputn("0123456789", 10);
        fbout.pubsync();
        sleep(2);
        fbout.close();
        exit(0);
--- 65,76 ----
        VERIFY( false );
      }
    else if (fval == 0)
      {
        filebuf fbout;
!       fbout.open(name, ios_base::in|ios_base::out);
!       VERIFY ( fbout.is_open() );
        fbout.sputn("0123456789", 10);
        fbout.pubsync();
        sleep(2);
        fbout.close();
        exit(0);
Index: 27_io/objects/char/7.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/objects/char/7.cc,v
retrieving revision 1.4
diff -c -5 -p -r1.4 7.cc
*** 27_io/objects/char/7.cc	12 Jan 2004 08:11:07 -0000	1.4
--- 27_io/objects/char/7.cc	20 Feb 2004 23:44:39 -0000
*************** void test07()
*** 48,58 ****
  
    if (child == 0)
      {
        filebuf fbout;
        sleep(1);
!       fbout.open(name, ios_base::out);
        cout.rdbuf(&fbout);
        fbout.sputc('a');
        sleep(2);
        // NB: fbout is *not* destroyed here!
        exit(0);
--- 48,59 ----
  
    if (child == 0)
      {
        filebuf fbout;
        sleep(1);
!       fbout.open(name, ios_base::in|ios_base::out);
!       VERIFY ( fbout.is_open() );
        cout.rdbuf(&fbout);
        fbout.sputc('a');
        sleep(2);
        // NB: fbout is *not* destroyed here!
        exit(0);
Index: 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.4
diff -c -5 -p -r1.4 9661-1.cc
*** 27_io/objects/char/9661-1.cc	12 Jan 2004 08:11:07 -0000	1.4
--- 27_io/objects/char/9661-1.cc	20 Feb 2004 23:44:39 -0000
*************** void test01()
*** 48,58 ****
    VERIFY( child != -1 );
  
    if (child == 0)
      {
        sleep(1);
!       FILE* file = fopen(name, "w");
        fputs("Whatever\n", file);
        fflush(file);
        sleep(2);
        fclose(file);
        exit(0);
--- 48,59 ----
    VERIFY( child != -1 );
  
    if (child == 0)
      {
        sleep(1);
!       FILE* file = fopen(name, "r+");
!       VERIFY (file != NULL);
        fputs("Whatever\n", file);
        fflush(file);
        sleep(2);
        fclose(file);
        exit(0);


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