This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Disable some libstdc++ tests for Windows text-mode I/O


Several libstdc++ testcases fail for MinGW because of text-mode I/O
issues.  In particular, showmanyc cannot determine how many characters
are available to read for text input, and it may also be
unpredicatable whether the sequences of bytes in the test data files
are using \n or \r\n line endings, depending on how the files ended up
on the Windows target.

This patch adds dg-require-binary-io to disable those tests if
_GLIBCXX_HAVE_DOS_BASED_FILESYSTEM (the relevant condition used in
showmanyc).  Tested with cross to i686-mingw32.  OK to commit?

2009-09-17  Joseph Myers  <joseph@codesourcery.com>

	* testsuite/lib/libstdc++.exp (check_v3_target_binary_io): New.
	* testsuite/lib/dg-options.exp (dg-require-binary-io): New.
	* testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc,
	testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc,
	testsuite/27_io/basic_filebuf/sgetn/char/1-in.cc,
	testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc,
	testsuite/27_io/basic_filebuf/sgetn/char/2-in.cc,
	testsuite/27_io/basic_filebuf/sgetn/char/2-io.cc,
	testsuite/27_io/basic_filebuf/underflow/wchar_t/11603.cc,
	testsuite/27_io/basic_istream/readsome/char/6746-2.cc,
	testsuite/27_io/basic_istream/readsome/wchar_t/6746-2.cc,
	testsuite/27_io/objects/char/10.cc: Use dg-require-binary-io.

Index: testsuite/27_io/objects/char/10.cc
===================================================================
--- testsuite/27_io/objects/char/10.cc	(revision 151770)
+++ testsuite/27_io/objects/char/10.cc	(working copy)
@@ -18,6 +18,7 @@
 // <http://www.gnu.org/licenses/>.
  
 // { dg-require-fileio "" }
+// { dg-require-binary-io "" }
 
 #include <iostream>
 #include <cstdio>
Index: testsuite/27_io/basic_istream/readsome/wchar_t/6746-2.cc
===================================================================
--- testsuite/27_io/basic_istream/readsome/wchar_t/6746-2.cc	(revision 151770)
+++ testsuite/27_io/basic_istream/readsome/wchar_t/6746-2.cc	(working copy)
@@ -19,6 +19,8 @@
 // causes "in_avail" to return an incorrect value.
 // { dg-do run { xfail arm*-*-elf arm*-*-eabi } }
 
+// { dg-require-binary-io "" }
+
 // 27.6.1.3 unformatted input functions
 // @require@ %-*.tst %-*.txt
 // @diff@ %-*.tst %-*.txt
Index: testsuite/27_io/basic_istream/readsome/char/6746-2.cc
===================================================================
--- testsuite/27_io/basic_istream/readsome/char/6746-2.cc	(revision 151770)
+++ testsuite/27_io/basic_istream/readsome/char/6746-2.cc	(working copy)
@@ -26,6 +26,7 @@
 // @diff@ %-*.tst %-*.txt
 
 // { dg-require-fileio "" }
+// { dg-require-binary-io "" }
 
 #include <istream>
 #include <fstream>
Index: testsuite/27_io/basic_filebuf/sgetn/char/1-in.cc
===================================================================
--- testsuite/27_io/basic_filebuf/sgetn/char/1-in.cc	(revision 151770)
+++ testsuite/27_io/basic_filebuf/sgetn/char/1-in.cc	(working copy)
@@ -24,6 +24,7 @@
 // 27.8.1.4 Overridden virtual functions
 
 // { dg-require-fileio "" }
+// { dg-require-binary-io "" }
 
 #include <fstream>
 #include <testsuite_hooks.h>
Index: testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc
===================================================================
--- testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc	(revision 151770)
+++ testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc	(working copy)
@@ -24,6 +24,7 @@
 // 27.8.1.4 Overridden virtual functions
 
 // { dg-require-fileio "" }
+// { dg-require-binary-io "" }
 
 #include <fstream>
 #include <testsuite_hooks.h>
Index: testsuite/27_io/basic_filebuf/sgetn/char/2-in.cc
===================================================================
--- testsuite/27_io/basic_filebuf/sgetn/char/2-in.cc	(revision 151770)
+++ testsuite/27_io/basic_filebuf/sgetn/char/2-in.cc	(working copy)
@@ -24,6 +24,7 @@
 // 27.8.1.4 Overridden virtual functions
 
 // { dg-require-fileio "" }
+// { dg-require-binary-io "" }
 
 #include <fstream>
 #include <testsuite_hooks.h>
Index: testsuite/27_io/basic_filebuf/sgetn/char/2-io.cc
===================================================================
--- testsuite/27_io/basic_filebuf/sgetn/char/2-io.cc	(revision 151770)
+++ testsuite/27_io/basic_filebuf/sgetn/char/2-io.cc	(working copy)
@@ -24,6 +24,7 @@
 // 27.8.1.4 Overridden virtual functions
 
 // { dg-require-fileio "" }
+// { dg-require-binary-io "" }
 
 #include <fstream>
 #include <testsuite_hooks.h>
Index: testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc
===================================================================
--- testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc	(revision 151770)
+++ testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc	(working copy)
@@ -20,6 +20,7 @@
 // 27.8.1.4 Overridden virtual functions
 
 // { dg-require-fileio "" }
+// { dg-require-binary-io "" }
 
 #include <fstream>
 #include <testsuite_hooks.h>
Index: testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc
===================================================================
--- testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc	(revision 151770)
+++ testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc	(working copy)
@@ -20,6 +20,7 @@
 // 27.8.1.4 Overridden virtual functions
 
 // { dg-require-fileio "" }
+// { dg-require-binary-io "" }
 
 #include <fstream>
 #include <testsuite_hooks.h>
Index: testsuite/27_io/basic_filebuf/underflow/wchar_t/11603.cc
===================================================================
--- testsuite/27_io/basic_filebuf/underflow/wchar_t/11603.cc	(revision 151770)
+++ testsuite/27_io/basic_filebuf/underflow/wchar_t/11603.cc	(working copy)
@@ -17,6 +17,8 @@
 
 // 27.8.1.4 Overridden virtual functions
 
+// { dg-require-binary-io "" }
+
 #include <fstream>
 #include <locale>
 #include <testsuite_hooks.h>
Index: testsuite/lib/libstdc++.exp
===================================================================
--- testsuite/lib/libstdc++.exp	(revision 151770)
+++ testsuite/lib/libstdc++.exp	(working copy)
@@ -1441,3 +1441,61 @@
     verbose "check_v3_target_swprintf: $et_swprintf" 2
     return $et_swprintf
 }
+
+proc check_v3_target_binary_io { } {
+    global cxxflags
+    global DEFAULT_CXXFLAGS
+    global et_binary_io
+
+    global tool
+
+    if { ![info exists et_binary_io_target_name] } {
+        set et_binary_io_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_binary_io_target_name } {
+        verbose "check_v3_target_binary_io: `$et_binary_io_target_name'" 2
+        set et_binary_io_target_name $current_target
+        if [info exists et_binary_io] {
+            verbose "check_v3_target_binary_io: removing cached result" 2
+            unset et_binary_io
+        }
+    }
+
+    if [info exists et_binary_io] {
+        verbose "check_v3_target_binary_io: using cached result" 2
+    } else {
+        set et_binary_io 0
+	
+	# Set up and compile a C++0x test program that depends
+        # on text and binary I/O being the same.
+        set src binary_io[pid].cc
+        set exe binary_io[pid].exe
+
+        set f [open $src "w"]
+        puts $f "#include <bits/c++config.h>"
+        puts $f "int main()"
+        puts $f "#if !defined(_GLIBCXX_HAVE_DOS_BASED_FILESYSTEM)"
+        puts $f "{ return 0; }"
+        puts $f "#endif"
+        close $f
+
+        set cxxflags_saved $cxxflags
+        set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+        set lines [v3_target_compile $src $exe executable ""]
+        set cxxflags $cxxflags_saved
+        file delete $src
+
+        if [string match "" $lines] {
+            # No error message, compilation succeeded.
+            set et_binary_io 1
+        } else {
+            verbose "check_v3_target_binary_io: compilation failed" 2
+        }
+    }
+    verbose "check_v3_target_binary_io: $et_binary_io" 2
+    return $et_binary_io
+}
Index: testsuite/lib/dg-options.exp
===================================================================
--- testsuite/lib/dg-options.exp	(revision 151770)
+++ testsuite/lib/dg-options.exp	(working copy)
@@ -151,3 +151,12 @@
     }
     return
 }
+
+proc dg-require-binary-io { args } {
+    if { ![ check_v3_target_binary_io ] } {
+        upvar dg-do-what dg-do-what
+        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+        return
+    }
+    return
+}

-- 
Joseph S. Myers
joseph@codesourcery.com


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