file.write("stuff",n) failing under CTest on mips*

"Rebecca N. Palmer" <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <[email protected]>
The simgear package recently added a test ( 
http://sources.debian.net/src/simgear/3.0.0~git20140204%2Bc99ea4-1/simgear/misc/sgstream_test.cxx 
) that uses binary-mode file.write("line1\n" "line2\r" ... ,1024) to 
create a test file (which it then uses to test the package's file input 
functions).

On mips and sometimes mipsel, the write() fails, with 
file.rdstate()==std::ios_base::badbit ( 
https://buildd.debian.org/status/fetch.php?pkg=simgear&arch=mips&ver=3.0.0~git20140204%2Bc99ea4-1&stamp=1391888133 
, search for "9: Unable to run test due to I/O error 1").

Testing under qemu-system-mips found that this problem only happens 
under CTest (cmake's test runner, which redirects stdout/stderr), not 
when the test is run directly, and that it leaves the test file existing 
but empty.  Adding a file.flush() doesn't help, but reading 
file.rdstate() sometimes (not always) avoids the problem.

We are currently working around this problem by not treating this as a 
test failure (since it's nothing to do with what is being tested), but 
I'd like to know what's actually wrong here.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.