xref: /csrg-svn/usr.bin/f77/tests/testf77 (revision 47959)
1*47959Sbostic#!/bin/sh -
2*47959Sbostic#
3*47959Sbostic# Copyright (c) 1980 The Regents of the University of California.
4*47959Sbostic# All rights reserved.
5*47959Sbostic#
6*47959Sbostic# %sccs.include.proprietary.sh%
7*47959Sbostic#
8*47959Sbostic#	@(#)testf77	5.2 (Berkeley) 04/12/91
9*47959Sbostic#
1043133Sbostic
1143133Sbostic# This script will compile and test all of the f77 certification
1243133Sbostic# tests in then given fcvs directories
1343133Sbostic
1443133Sbostic: ${FC=f77}
1543133Sbostic: ${FFLAGS=-Ns500}
1643133Sbosticexport FC
1743133Sbosticexport FFLAGS
1843133Sbostic
1943133Sbostic   cd tests
2043133Sbostic
2143133Sbostic   # Cleanup unnecessary files
2243133Sbostic   rm -f *.o *.out
2343133Sbostic
2443133Sbostic   ls f* | sort +0.2 | awk '
2543133Sbostic   # This awk program will create a script that will compile and run
2643133Sbostic   # each fm program. Input will be in the order of number (???) then by:
2743133Sbostic   #         data if any  fd???
2843133Sbostic   #         main program fm???.f
2943133Sbostic   #         subroutines  fs???.f ...
3043133Sbostic   BEGIN {
3143133Sbostic      last = -1
3243133Sbostic      input = -1
3343133Sbostic      working = "false"
3443133Sbostic      print "# Trap any signals causing termination of execution"
3543133Sbostic      print "trap \""
3643133Sbostic      print "   echo @@@@@@@@@@@@@@@@@@@@@@"
3743133Sbostic      print "   echo @@                  @@"
3843133Sbostic      print "   echo @@ Execution failed @@"
3943133Sbostic      print "   echo @@                  @@"
4043133Sbostic      print "   echo @@@@@@@@@@@@@@@@@@@@@@"
4143133Sbostic      print "   \" 3 4 5 6 7 8 10 12 13 14 15 16"
4243133Sbostic      print " "
4343133Sbostic	  print "# Trap user interrupt"
4443133Sbostic	  print "trap \""
4543133Sbostic      print "   echo @@@@@@@@@@@@@@@@"
4643133Sbostic      print "   echo @@            @@"
4743133Sbostic      print "   echo @@ INTERRUPT  @@"
4843133Sbostic      print "   echo @@            @@"
4943133Sbostic      print "   echo @@@@@@@@@@@@@@@@"
5043133Sbostic      print "   \" 1 2"
5143133Sbostic      }
5243133Sbostic
5343133Sbostic   /f[dm]/ && working == "true" {
5443133Sbostic      printf "-o %s \n", runfile
5543133Sbostic      printf "%s ", runfile
5643133Sbostic      if (substr (input, 3, 3) == substr (runfile, 3, 3))
5743133Sbostic         printf "< %s ", input
5843133Sbostic      print " "
5943133Sbostic      print "case $? in"
6043133Sbostic      print "   0) echo " runfile " completed successfully.;;"
6143133Sbostic      print "   *) echo " runfile " had a return code of $?.;;"
6243133Sbostic      print "esac"
6343133Sbostic      print "rm -f *.o *.out"
6443133Sbostic      working = "false"
6543133Sbostic      }
6643133Sbostic
6743133Sbostic   /fd/ {
6843133Sbostic      input = $1
6943133Sbostic      }
7043133Sbostic
7143133Sbostic   /fm/ {
7243133Sbostic      print " "
7343133Sbostic      print "echo -page-"
7443133Sbostic      printf "echo ===== Testing %s =====\n", $1
7543133Sbostic      printf "${FC} ${FFLAGS} %s ", $1
7643133Sbostic      working = "true"
7743133Sbostic      runfile = sprintf ("%s.out", substr ($1, 1, 5))
7843133Sbostic      }
7943133Sbostic   /fs/ {
8043133Sbostic      printf "%s ", $1
8143133Sbostic      }
8243133Sbostic
8343133Sbostic   END {
8443133Sbostic      printf "-o %s \n", runfile
8543133Sbostic      printf "%s ", runfile
8643133Sbostic      if (substr (input, 3, 3) == substr (runfile, 3, 3))
8743133Sbostic         printf "< %s ", input
8843133Sbostic      print " "
8943133Sbostic      print "case $? in"
9043133Sbostic      print "   0) echo " runfile " completed successfully.;;"
9143133Sbostic      print "   *) echo " runfile " had a return code of $?.;;"
9243133Sbostic      print "esac"
9343133Sbostic      print "rm -f *.o *.out"
9443133Sbostic      print "\n# Script is complete."
9543133Sbostic      }
9643133Sbostic   ' > tst$$
9743133Sbostic
9843133Sbostic   # Now execute the script we created.
9943133Sbostic   sh tst$$ 2>&1
10043133Sbostic   rm tst$$
10143133Sbostic   echo ===== test is complete =====
102