This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
PATCH (mainline & 3.3): testsuite/27_io/filebuf_members.cc (test_07)
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- To: libstdc++ at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org, peturr02 at ru dot is
- Date: Tue, 22 Apr 2003 04:33:53 -0500 (CDT)
- Subject: PATCH (mainline & 3.3): testsuite/27_io/filebuf_members.cc (test_07)
- Reply-to: rittle at labs dot mot dot com
Various platforms that implement fork() differently than some other
platforms have been seeing a race with this code. I don't claim this
is any better but it should reduce the possibility of a race in
practice. The result was a hung process since dejagnu only knows how
to kill the process it started to end a test...
I believe this test, as modified, still has the original intent of the
PR. Could Petur Runolfsson please ACK that my patch doesn't subvert
his test? I'll commit them after the ACK. Otherwise, please propose
alternate to address race. Thanks, Loren
mainline:
* testsuite/27_io/basic_filebuf/close/char/9964.cc (test_07):
Adjust timing.
3.3 branch:
* testsuite/27_io/filebuf_members.cc (test_07): Adjust timing.
Index: filebuf_members.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/Attic/filebuf_members.cc,v
retrieving revision 1.16.20.3
diff -c -r1.16.20.3 filebuf_members.cc
*** filebuf_members.cc 25 Mar 2003 19:53:18 -0000 1.16.20.3
--- filebuf_members.cc 22 Apr 2003 08:17:44 -0000
***************
*** 242,258 ****
{
filebuf fbin;
fbin.open(name, ios_base::in);
! sleep(1);
fbin.close();
exit(0);
}
filebuf fb;
filebuf* ret = fb.open(name, ios_base::out | ios_base::trunc);
VERIFY( ret != NULL );
VERIFY( fb.is_open() );
! sleep(2);
fb.sputc('a');
ret = fb.close();
--- 242,259 ----
{
filebuf fbin;
fbin.open(name, ios_base::in);
! sleep(2);
fbin.close();
exit(0);
}
filebuf fb;
+ sleep(1);
filebuf* ret = fb.open(name, ios_base::out | ios_base::trunc);
VERIFY( ret != NULL );
VERIFY( fb.is_open() );
! sleep(3);
fb.sputc('a');
ret = fb.close();