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