/* Copyright (C) 1990, Digital Equipment Corporation.         */
/* All rights reserved.                                       */
/* See the file COPYRIGHT for a full description.             */

/* Last modified on Mon Nov  2 16:29:38 PST 1992 by kalsow    */
/*      modified on Tue Mar 12 22:05:06 1991 by muller        */

#ifdef LOCAL_M3
M3 = m3 -Y0@/udir/kalsow/pkgs/compiler/mips/m3compiler@
#endif

M3FLAGS = 
COMPILE = $(M3) -g -w1 -D../.. -o a.out ../libtest.a

all::       /* run all tests */
new_base::  /* run all tests & capture their output as the new base case */
tidy::      /* remove the trash */
scratch::   /* remove all derived files */

/* build the "standard" test library */
libtest.a: ../Test.i3 ../Test.m3 ; $(M3) -a libtest.a ../Test.i3 ../Test.m3
scratch:: ; -rm -f libtest.a libtest.ax Test.io Test.mo

#define testdir(d,comment)                                                  @@\
                                                                            @@\
all:: d##_X                                                                 @@\
new_base:: d##_base                                                         @@\
scratch:: ; -rm -fr d##_X                                                   @@\
d:: d##_X                                                                   @@\
d##_base:: d##_X ; @mv d##_X/stdout d##_X/stderr d                          @@\
d##_X:: libtest.a FRC ;\                                                    @@\
-@ echo --- d --- comment  ;\                                               @@\
   rm -fr d##_X ;\                                                          @@\
   mkdir d##_X ;\                                                           @@\
   (cd d##_X ;\                                                             @@\
     $(COMPILE) ../d >stdout ;\                                             @@\
     a.out >>stdout ) 2>d##_X/stderr ;\                                     @@\
   if test -r d/stdout;\                                                    @@\
     then diff d/stdout d##_X/stdout;\                                      @@\
     else cat d##_X/stdout;\                                                @@\
   fi;\                                                                     @@\
   if test -r d/stderr;\                                                    @@\
     then diff d/stderr d##_X/stderr;\                                      @@\
     else cat d##_X/stderr;\                                                @@\
   fi;\                                                                     @@\
   rm -f d##_X/a.out d##_X/core

testdir (r001, "unhandled exception")
testdir (r002, "stack overflow in the main thread")
testdir (r003, "b3tests/b002 - improper size for an open array parameter")
testdir (r004, "negative size for an open array")
testdir (r005, "unhandled exception in nested procedure")
testdir (r006, "range check of INC(char)")
testdir (r007, "hijacked exception isn't propagated !!BUG!!")
testdir (r008, "negative count on NEW of open array")
testdir (r009, "overflow on NUMBER")
