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