xref: /original-bsd/usr.bin/f77/tests/testf77 (revision 1897046e)
1#!/bin/sh -
2#
3# Copyright (c) 1980 The Regents of the University of California.
4# All rights reserved.
5#
6# %sccs.include.proprietary.sh%
7#
8#	@(#)testf77	5.2 (Berkeley) 04/12/91
9#
10
11# This script will compile and test all of the f77 certification
12# tests in then given fcvs directories
13
14: ${FC=f77}
15: ${FFLAGS=-Ns500}
16export FC
17export FFLAGS
18
19   cd tests
20
21   # Cleanup unnecessary files
22   rm -f *.o *.out
23
24   ls f* | sort +0.2 | awk '
25   # This awk program will create a script that will compile and run
26   # each fm program. Input will be in the order of number (???) then by:
27   #         data if any  fd???
28   #         main program fm???.f
29   #         subroutines  fs???.f ...
30   BEGIN {
31      last = -1
32      input = -1
33      working = "false"
34      print "# Trap any signals causing termination of execution"
35      print "trap \""
36      print "   echo @@@@@@@@@@@@@@@@@@@@@@"
37      print "   echo @@                  @@"
38      print "   echo @@ Execution failed @@"
39      print "   echo @@                  @@"
40      print "   echo @@@@@@@@@@@@@@@@@@@@@@"
41      print "   \" 3 4 5 6 7 8 10 12 13 14 15 16"
42      print " "
43	  print "# Trap user interrupt"
44	  print "trap \""
45      print "   echo @@@@@@@@@@@@@@@@"
46      print "   echo @@            @@"
47      print "   echo @@ INTERRUPT  @@"
48      print "   echo @@            @@"
49      print "   echo @@@@@@@@@@@@@@@@"
50      print "   \" 1 2"
51      }
52
53   /f[dm]/ && working == "true" {
54      printf "-o %s \n", runfile
55      printf "%s ", runfile
56      if (substr (input, 3, 3) == substr (runfile, 3, 3))
57         printf "< %s ", input
58      print " "
59      print "case $? in"
60      print "   0) echo " runfile " completed successfully.;;"
61      print "   *) echo " runfile " had a return code of $?.;;"
62      print "esac"
63      print "rm -f *.o *.out"
64      working = "false"
65      }
66
67   /fd/ {
68      input = $1
69      }
70
71   /fm/ {
72      print " "
73      print "echo -page-"
74      printf "echo ===== Testing %s =====\n", $1
75      printf "${FC} ${FFLAGS} %s ", $1
76      working = "true"
77      runfile = sprintf ("%s.out", substr ($1, 1, 5))
78      }
79   /fs/ {
80      printf "%s ", $1
81      }
82
83   END {
84      printf "-o %s \n", runfile
85      printf "%s ", runfile
86      if (substr (input, 3, 3) == substr (runfile, 3, 3))
87         printf "< %s ", input
88      print " "
89      print "case $? in"
90      print "   0) echo " runfile " completed successfully.;;"
91      print "   *) echo " runfile " had a return code of $?.;;"
92      print "esac"
93      print "rm -f *.o *.out"
94      print "\n# Script is complete."
95      }
96   ' > tst$$
97
98   # Now execute the script we created.
99   sh tst$$ 2>&1
100   rm tst$$
101   echo ===== test is complete =====
102