This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[RFTesters] Make portable sgetn/1-in and 1-io tests
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: libstdc++ at gcc dot gnu dot org
- Cc: pinskia at physics dot uc dot edu, dje at watson dot ibm dot com, ljrittle at FreeBSD dot org
- Date: Mon, 16 Jun 2003 19:45:38 +0200
- Subject: [RFTesters] Make portable sgetn/1-in and 1-io tests
Hi everyone,
perhaps I have nailed down the reason underlying the
failure on *many* platforms of 27_io/basic_filebuf/sgetn/char/1-in.cc
and 1-io.cc: seems due to the value of BUFSIZ not being
8192 everywhere.
If my hypothesis is correct the below should fix it.
Many thanks in advance,
Paolo.
/////////
diff -urN libstdc++-v3-orig/testsuite/27_io/basic_filebuf/sgetn/char/1-in.cc libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/1-in.cc
--- libstdc++-v3-orig/testsuite/27_io/basic_filebuf/sgetn/char/1-in.cc 2003-06-06 02:19:16.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/1-in.cc 2003-06-16 19:33:49.000000000 +0200
@@ -37,12 +37,12 @@
typedef filebuf::int_type int_type;
typedef filebuf::traits_type traits_type;
- bool test = true;
+ bool test = true;
streamsize strmsz_1, strmsz_2, strmsz_3;
- int i = 0, j = 0, k = 0;
char carray1[13] = "";
char carray2[8192] = "";
+ char buffer[8192] = "";
int_type c1, c2, c3, c4;
// streamsize sgetn(char_type *s, streamsize n)
@@ -52,7 +52,10 @@
// in
{
- constraint_filebuf fb_01;
+ constraint_filebuf fb_01;
+ // Need this since BUFSIZ is only guaranteed >= 255 and we want
+ // to trigger the same underflow situation everywhere.
+ fb_01.pubsetbuf(buffer, 8192);
fb_01.open(name_01, ios_base::in);
VERIFY( !fb_01.write_position() );
strmsz_1 = fb_01.in_avail(); // 8261
diff -urN libstdc++-v3-orig/testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc
--- libstdc++-v3-orig/testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc 2003-06-06 02:19:16.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc 2003-06-16 19:35:07.000000000 +0200
@@ -38,12 +38,12 @@
typedef filebuf::int_type int_type;
typedef filebuf::traits_type traits_type;
- bool test = true;
+ bool test = true;
streamsize strmsz_1, strmsz_2, strmsz_3;
- int i = 0, j = 0, k = 0;
char carray1[13] = "";
char carray2[8192] = "";
+ char buffer[8192] = "";
int_type c1, c2, c3, c4;
// streamsize sgetn(char_type *s, streamsize n)
@@ -65,7 +65,10 @@
// in | out 2
{
- constraint_filebuf fb_01;
+ constraint_filebuf fb_01;
+ // Need this since BUFSIZ is only guaranteed >= 255 and we want
+ // to trigger the same underflow situation everywhere.
+ fb_01.pubsetbuf(buffer, 8192);
fb_01.open(name_01, ios_base::in | ios_base::out);
VERIFY( fb_01.write_position() );
strmsz_1 = fb_01.in_avail();