From mjc@abstract-hardware-ltd.co.uk Thu Oct 31 09:17:21 1991
Return-Path: <alice!brunel.ac.uk!abstract-hardware-ltd.co.uk!mjc>
From: Mike Crawley <mjc@abstract-hardware-ltd.co.uk>
Date: Wed, 30 Oct 91 09:39:03 GMT
To: jhr@research.att.com
Subject: Re: compiling test cases
Cc: dbm@research.att.com


> By the way, we are planning to make available a large collection of
> test cases (400 files) together with some regression testing scripts.
> Any interest in sharing test cases?

Yes I would like to share test cases. I have been trying to get
my test cases into a form where they can be used by Poly/ML and SML/NJ
without change. The method I came up with was to write a small
prologue file for each system that deals with any system dependancies,
like different names for certain system functions, and prepend that
file onto the front of the test cases in the following way.

% cat poly.prologue  test.case.1 | polyML
% cat smlnj.prologue test.case.1 | smlNJ

This is when I found that SML/NJ has a problem recovering from errors.
If the test case is long enough (needs to be more than 4096 bytes long)
then 

% cat test.case | smlNJ
Standard ML of New Jersey, Version 0.73, 10 September 1991
Arrays have changed; see doc/NEWS
val it = () : unit
- std_in:11.29-11.49 Error: duplicate specifications for structure A in signature
- std_in:1.2 Error: syntax error found at END
- std_in:1.9 Error: syntax error found at SIG
- std_in:1.27 Error: unmatched close comment
std_in:2.1 Error: syntax error found at SIGNATURE
- std_in:1.4 Error: syntax error found at END
- std_in:2.15 Error: syntax error found at END
- std_in:1.13 Error: syntax error found at SIG
- std_in:1.14 Error: unmatched close comment
std_in:2.1 Error: syntax error found at SIGNATURE
%

But if I redirect the file instead of using a pipe.

% smlNJ < test.case
Standard ML of New Jersey, Version 0.73, 10 September 1991
Arrays have changed; see doc/NEWS
val it = () : unit
- std_in:11.29-11.49 Error: duplicate specifications for structure A in signature
- % 

it drops out at the first error like 'use' does.
It is doing something different when the pipe is used.
I think it is flushing all characters that are already available
on the input stream, then waiting for input again.
When a file is used the flush operation gets rid of all the characters
since they may have been loaded into one big buffer, and the next
read operation returns EOF.
When the pipe is used it breaks the input up into 4096 byte chunks
so the flush operation throws aways several thousand characters, but the
next read gets the next 4096 bytes down the pipe.
This is my theory anyway.

> One thing is that is_term_in(std_in) is false if std_in is from a
> pipe.  You might try putting "set_term_in(std_in,true);" at the
> beginning of the file.

This had no effect.

You can make big enough 'test.case' by simply repeating the following
bit of ML several hundred times.

(* Assorted tests for ML modules in no particular order and with tests of
   differing importance.  Contains quite a lot of tests that deliberately fail
   to check the error detection of the compiler. *)

(* This must be fed in as the standard input because it includes
   tests that deliberately fail. use will drop out at the first error. *)

(* Check on repeated definitions. *)
signature S = sig structure A: sig type t end
                  structure A: sig val x: int end
              end;



