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]

RFA: Tweak test for fileio support


Many of the libstdc++ file I/O tests fail for mips-sim-idt{32,64}.
The IDT monitor apparently provides callbacks for open and close,
which the gdb simulator emulates as full semihosted calls.  This is
enough to pass the open ("." ...) test in check_v3_target_fileio.
However, the monitor doesn't provide callbacks for lseek or *stat,
so libgloss provides dummy implementations that cause most real file
I/O tests fail.

It'd probably be a good idea to add a new libgloss and gdb simulator
skin that supports full semihosting, but (a) that'd require testers to
update three packages: newlib/libgloss, gdb and dejagnu (to get the new
baseboard) and (b) it wouldn't help users testing on real hardware.
So I think it's worth trying to skip the failing tests for existing
MIPS simulator targets.

Also, because more than one function is missing, I didn't think it was
worth trying to subdivide the fileio tests.  It seems simpler just to
declare file I/O to be broken on the affected targets.

The patch below therefore adds a simple lseek test to
check_v3_target_fileio.  I think we already require all targets to
support lseek (config/io/basic_file_stdio.cc always uses either lseek
or lseek64) and the call is a no-op that all real implementations
should handle.

Bootstrapped & regression-tested on x86_64-linux-gnu, which runs the
same tests as before.  Also tested on mipsisa64-elf, where it fixes
all hard-float libstdc++ failures and all but 2 soft-float failures
(both timeouts).  OK to install?

Richard


libstdc++-v3/
	* testsuite/lib/libstdc++.exp (check_v3_target_fileio): Test lseek.

Index: libstdc++-v3/testsuite/lib/libstdc++.exp
===================================================================
--- libstdc++-v3/testsuite/lib/libstdc++.exp	2007-09-24 10:41:29.000000000 +0100
+++ libstdc++-v3/testsuite/lib/libstdc++.exp	2007-09-24 10:44:36.000000000 +0100
@@ -599,15 +599,20 @@ proc check_v3_target_fileio { } {
 	puts $f "int main ()"
 	puts $f "{"
 	puts $f "  int fd  = open (\".\", O_RDONLY);"
+	puts $f "  int ret = 0;"
 	puts $f "  if (fd == -1)"
 	puts $f "  {"
 	puts $f "    int err = errno;"
 	puts $f "    if (err == EIO || err == ENOSYS)"
-	puts $f "      return 1;"
+	puts $f "      ret = 1;"
 	puts $f "  }"
 	puts $f "  else"
+	puts $f "  {"
+	puts $f "    if (lseek (fd, 0, SEEK_CUR) == -1)"
+	puts $f "      ret = 1;"
 	puts $f "    close (fd);"
-	puts $f "  return 0;"
+	puts $f "  }"
+	puts $f "  return ret;"
 	puts $f "}" 
 	close $f
 


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