On Oct 31 2014, Janne Blomqvist wrote:
what would be the best way to test stuff like two binaries communicating via a pipe, FIFO or such with DejaGNU? The gfortran testsuite has by now quite extensive coverage of all the weird and quirky corner cases of Fortran I/O behavior, but practically all these tests are done using regular files. Over the years we've had some embarrassing bugs in handling non-seekable files like terminals, FIFO's, and pipes. I believe these would have been quickly caught if only we had testing coverage.
It's worse. It's much, much worse :-( When the original f77 was perpetrated, er, written, it chose a bizarre unformatted format to make BACKSPACE efficient. Inter alia, this made it hard for implementations to support things like sockets (and magnetic tape!) for unformatted files. Previously, virtually every system supported such things. BACKSPACE has been a known abomination since the 1960s, and has caused and still causes a LOT of trouble over the years, but I failed to get it even deprecated. So the first question is to decide the priority of I/O variations, including types of file and permitted operations for each connection mode. The key characteristics (in OPEN) are ACCESS, FORM and ACTION. In particular, there is disagreement on WG5 exactly what constitutes a 'file' - I have been told that magnetic tape files and sockets are not files by someone who ought to have known better. For example, does gfortran intend to support the piping of unformatted files? Not all compilers do. My apologies if gfortran/DejaGNU has already done this, but I am pretty sure not. If anyone has, please could they point me to a reference?
(Something which works only on x86_64-unknown-linux-gnu and perhaps a few other "mainstream" targets where we can expect the presence of a "normal" shell environment etc., while not optimal, is certainly a lot better than what we have now.)
You can do a LOT better than THAT! It would be trivial to write something that would work on any reasonably Unix-like system (including anything that supports base POSIX 1996). I have done that for system scripts and still do that for my course tests, though I no longer have access to weird and wonderful Unices to test them. You are quite right that you need to assume a reasonable shell, though you can write such tests that will work on pretty well any modern Bourne, Korn or POSIX shell, and any version of bash. The original Bourne shell was beyond redemption, but I believe that it is now completely dead. That is from experience in writing portable system scripts a decade or so back, but I am pretty sure it still holds. Regards, Nick Maclaren.