Blame tests/run_make_tests.com

Packit 26a39e
$! Test_make.com
Packit 26a39e
$!
Packit 26a39e
$! This is a wrapper for the GNU make perl test programs on VMS.
Packit 26a39e
$!
Packit 26a39e
$! Parameter "-help" for description on how to use described below.
Packit 26a39e
$!
Packit 26a39e
$! Copyright (C) 2014-2016 Free Software Foundation, Inc.
Packit 26a39e
$! This file is part of GNU Make.
Packit 26a39e
$!
Packit 26a39e
$! GNU Make is free software; you can redistribute it and/or modify it under
Packit 26a39e
$! the terms of the GNU General Public License as published by the Free Software
Packit 26a39e
$! Foundation; either version 3 of the License, or (at your option) any later
Packit 26a39e
$! version.
Packit 26a39e
$!
Packit 26a39e
$! GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
Packit 26a39e
$! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
Packit 26a39e
$! FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
Packit 26a39e
$! details.
Packit 26a39e
$!
Packit 26a39e
$! You should have received a copy of the GNU General Public License along with
Packit 26a39e
$! this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 26a39e
$!
Packit 26a39e
$!
Packit 26a39e
$! Allow more than 8 paramters with using commas as a delimiter.
Packit 26a39e
$!
Packit 26a39e
$ params = "''p1',''p2',''p3',''p4',''p5',''p6',''p7',''p8'"
Packit 26a39e
$!
Packit 26a39e
$ test_flags = ",verbose,detail,keep,usage,help,debug,"
Packit 26a39e
$ test_flags_len = f$length(test_flags)
Packit 26a39e
$ verbose_flag = ""
Packit 26a39e
$ detail_flag = ""
Packit 26a39e
$ keep_flag = ""
Packit 26a39e
$ usage_flag = ""
Packit 26a39e
$ help_flag = ""
Packit 26a39e
$ debug_flag = ""
Packit 26a39e
$!
Packit 26a39e
$ ignored_options = "profile,make,srcdir,valgrind,memcheck,massif,"
Packit 26a39e
$ ignored_option_len = f$length(ignored_options)
Packit 26a39e
$!
Packit 26a39e
$ testname = ""
Packit 26a39e
$ make :== $bin:make.exe"
Packit 26a39e
$!
Packit 26a39e
$ i = 0
Packit 26a39e
$param_loop:
Packit 26a39e
$ param = f$element(i, ",", params)
Packit 26a39e
$ i = i + 1
Packit 26a39e
$ if param .eqs. "" then goto param_loop
Packit 26a39e
$ if param .eqs. "," then goto param_loop_end
Packit 26a39e
$ param_len = f$length(param)
Packit 26a39e
$ if f$locate("/", param) .lt. param_len
Packit 26a39e
$ then
Packit 26a39e
$   if testname .nes. ""
Packit 26a39e
$   then
Packit 26a39e
$       write sys$output "Only the last test name specified will be run!"
Packit 26a39e
$   endif
Packit 26a39e
$   testname = param
Packit 26a39e
$   goto param_loop
Packit 26a39e
$ endif
Packit 26a39e
$ lc_param = f$edit(param,"LOWERCASE") - "-"
Packit 26a39e
$ if f$locate(",''lc_param',", ignored_options) .lt. ignored_option_len
Packit 26a39e
$ then
Packit 26a39e
$   write sys$output "parameter ''param' is ignored on VMS for now."
Packit 26a39e
$   goto param_loop
Packit 26a39e
$ endif
Packit 26a39e
$ if f$locate(",''lc_param',", test_flags) .lt. test_flags_len
Packit 26a39e
$ then
Packit 26a39e
$   'lc_param'_flag = "-" + lc_param
Packit 26a39e
$   goto param_loop
Packit 26a39e
$ endif
Packit 26a39e
$   write sys$output "parameter ''param' is not known to VMS."
Packit 26a39e
$ goto param_loop
Packit 26a39e
$!
Packit 26a39e
$param_loop_end:
Packit 26a39e
$!
Packit 26a39e
$no_gnv = 1
Packit 26a39e
$no_perl = 1
Packit 26a39e
$!
Packit 26a39e
$!  Find GNV 2.1.3 + manditory updates
Packit 26a39e
$!  If properly updated, the GNV$GNU logical name is present.
Packit 26a39e
$!  Updated GNV utilities have a gnv$ prefix on them.
Packit 26a39e
$   gnv_root = f$trnlnm("GNV$GNU", "LNM$SYSTEM_TABLE")
Packit 26a39e
$   if gnv_root .nes. ""
Packit 26a39e
$   then
Packit 26a39e
$       no_gnv = 0
Packit 26a39e
$       ! Check for update ar utility.
Packit 26a39e
$       new_ar = "gnv$gnu:[usr.bin]gnv$ar.exe"
Packit 26a39e
$       if f$search(new_ar) .nes. ""
Packit 26a39e
$       then
Packit 26a39e
$           ! See if a new port of ar exists.
Packit 26a39e
$           ar :== $'new_ar'
Packit 26a39e
$       else
Packit 26a39e
$           ! Fall back to legacy GNV AR wrapper.
Packit 26a39e
$           old_ar = "gnv$gnu:[bin]ar.exe"
Packit 26a39e
$           if f$search(old_ar) .nes. ""
Packit 26a39e
$           then
Packit 26a39e
$               ar :== $'old_ar'
Packit 26a39e
$           else
Packit 26a39e
$               no_gnv = 1
Packit 26a39e
$           endif
Packit 26a39e
$       endif
Packit 26a39e
$       ! Check for updated bash
Packit 26a39e
$       if no_gnv .eq. 0
Packit 26a39e
$       then
Packit 26a39e
$           new_bash = "gnv$gnu:[bin]gnv$bash.exe"
Packit 26a39e
$           if f$search(new_bash) .nes. ""
Packit 26a39e
$           then
Packit 26a39e
$               bash :== $'new_bash'
Packit 26a39e
$               sh :== $'new_bash'
Packit 26a39e
$           else
Packit 26a39e
$               no_gnv = 1
Packit 26a39e
$           endif
Packit 26a39e
$       endif
Packit 26a39e
$       ! Check for updated coreutils
Packit 26a39e
$       if no_gnv .eq. 0
Packit 26a39e
$       then
Packit 26a39e
$           new_cat = "gnv$gnu:[bin]gnv$cat.exe"
Packit 26a39e
$           if f$search(new_cat) .nes. ""
Packit 26a39e
$           then
Packit 26a39e
$               cat :== $'new_cat'
Packit 26a39e
$               cp :== $gnv$gnu:[bin]gnv$cp.exe
Packit 26a39e
$               echo :== $gnv$gnu:[bin]gnv$echo.exe
Packit 26a39e
$               false :== $gnv$gnu:[bin]gnv$false.exe
Packit 26a39e
$               true :== $gnv$gnu:[bin]gnv$true.exe
Packit 26a39e
$               touch :== $gnv$gnu:[bin]gnv$touch.exe
Packit 26a39e
$               mkdir :== $gnv$gnu:[bin]gnv$mkdir.exe
Packit 26a39e
$               rm :== $gnv$gnu:[bin]gnv$rm.exe
Packit 26a39e
$               sleep :== $gnv$gnu:[bin]gnv$sleep.exe
Packit 26a39e
$           else
Packit 26a39e
$               no_gnv = 1
Packit 26a39e
$           endif
Packit 26a39e
$       endif
Packit 26a39e
$       ! Check for updated diff utility.
Packit 26a39e
$       if no_gnv .eq. 0
Packit 26a39e
$       then
Packit 26a39e
$           new_diff = "gnv$gnu:[usr.bin]gnv$diff.exe"
Packit 26a39e
$           if f$search(new_diff) .nes. ""
Packit 26a39e
$           then
Packit 26a39e
$               ! See if a new port of diff exists.
Packit 26a39e
$               diff :== $'new_diff'
Packit 26a39e
$           else
Packit 26a39e
$               ! Fall back to legacy GNV diff
Packit 26a39e
$               old_diff = "gnv$gnu:[bin]diff.exe"
Packit 26a39e
$               if f$search(old_diff) .nes. ""
Packit 26a39e
$               then
Packit 26a39e
$                   diff :== $'old_diff'
Packit 26a39e
$               else
Packit 26a39e
$                   no_gnv = 1
Packit 26a39e
$               endif
Packit 26a39e
$           endif
Packit 26a39e
$       endif
Packit 26a39e
$   endif
Packit 26a39e
$!
Packit 26a39e
$if no_gnv
Packit 26a39e
$then
Packit 26a39e
$   write sys$output "Could not find an up to date GNV installed!"
Packit 26a39e
$   help_flag = 1
Packit 26a39e
$endif
Packit 26a39e
$!
Packit 26a39e
$! Find perl 5.18.1 or later.
Packit 26a39e
$!
Packit 26a39e
$! look in perl_root:[000000]perl_setup.com
Packit 26a39e
$ perl_root = f$trnlnm("perl_root")
Packit 26a39e
$ ! This works with known perl installed from PCSI kits.
Packit 26a39e
$ if perl_root .nes. ""
Packit 26a39e
$ then
Packit 26a39e
$   perl_ver = f$element(1, ".", perl_root)
Packit 26a39e
$   if f$locate("-", perl_ver) .lt. f$length(perl_ver)
Packit 26a39e
$   then
Packit 26a39e
$       no_perl = 0
Packit 26a39e
$   endif
Packit 26a39e
$ endif
Packit 26a39e
$ if no_perl
Packit 26a39e
$ then
Packit 26a39e
$!  look for sys$common:[perl-*]perl_setup.com
Packit 26a39e
$   perl_setup = f$search("sys$common:[perl-*]perl_setup.com")
Packit 26a39e
$   if perl_setup .eqs. ""
Packit 26a39e
$   then
Packit 26a39e
$       if gnv_root .nes. ""
Packit 26a39e
$       then
Packit 26a39e
$           gnv_device = f$parse(gnv_root,,,"DEVICE")
Packit 26a39e
$           perl_templ = "[vms$common.perl-*]perl_setup.com"
Packit 26a39e
$           perl_search = f$parse(perl_templ, gnv_device)
Packit 26a39e
$           perl_setup = f$search(perl_search)
Packit 26a39e
$       endif
Packit 26a39e
$   endif
Packit 26a39e
$   if perl_setup .nes. ""
Packit 26a39e
$   then
Packit 26a39e
$       @'perl_setup'
Packit 26a39e
$       no_perl = 0
Packit 26a39e
$   endif
Packit 26a39e
$ endif
Packit 26a39e
$!
Packit 26a39e
$ if no_perl
Packit 26a39e
$ then
Packit 26a39e
$   write sys$output "Could not find an up to date Perl installed!"
Packit 26a39e
$   help_flag = "-help"
Packit 26a39e
$ endif
Packit 26a39e
$!
Packit 26a39e
$!
Packit 26a39e
$ if help_flag .nes. ""
Packit 26a39e
$ then
Packit 26a39e
$   type sys$input
Packit 26a39e
$DECK
Packit 26a39e
This is a test script wrapper for the run_make_tests.pl script.
Packit 26a39e
Packit 26a39e
This wrapper makes sure that the DCL symbols and logical names needed to
Packit 26a39e
run the perl script are in place.
Packit 26a39e
Packit 26a39e
The test wrapper currently requires that the DCL symbols be global symbols.
Packit 26a39e
Those symbols will be left behind after the procedure is run.
Packit 26a39e
Packit 26a39e
The PERL_ROOT will be set to a compatible perl if such a perl is found and
Packit 26a39e
is not the default PERL_ROOT:.  This setting will persist after the test.
Packit 26a39e
Packit 26a39e
This wrapper should be run with the default set to the base directory
Packit 26a39e
of the make source.
Packit 26a39e
Packit 26a39e
The HELP parameter will bring up this text and then run the help script
Packit 26a39e
for the Perl wrapper.  Not all options for the perl script have been
Packit 26a39e
implemented, such as valgrind or specifying the make path or source path.
Packit 26a39e
Packit 26a39e
Running the wrapper script requires:
Packit 26a39e
  Perl 5.18 or later.
Packit 26a39e
  PCSI kits available from http://sourceforge.net/projects/vmsperlkit/files/
Packit 26a39e
Packit 26a39e
  GNV 2.1.3 or later.  GNV 3.0.1 has not tested with this script.
Packit 26a39e
  Bash 4.2.47 or later.
Packit 26a39e
  Coreutils 8.21 or later.
Packit 26a39e
  http://sourceforge.net/projects/gnv/files/
Packit 26a39e
  Read before installing:
Packit 26a39e
     http://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/
Packit 26a39e
  As updates for other GNV components get posted, those updates should
Packit 26a39e
  be used.
Packit 26a39e
Packit 26a39e
$EOD
Packit 26a39e
$ endif
Packit 26a39e
$!
Packit 26a39e
$ if no_gnv .or. no_perl then exit 44
Packit 26a39e
$!
Packit 26a39e
$!
Packit 26a39e
$ default = f$environment("DEFAULT")
Packit 26a39e
$ default_dev = f$element(0, ":", default) + ":"
Packit 26a39e
$ this = f$environment("PROCEDURE")
Packit 26a39e
$ on error then goto all_error
Packit 26a39e
$ set default 'default_dev''f$parse(this,,,"DIRECTORY")'
Packit 26a39e
$!
Packit 26a39e
$! Need to make sure that the config-flags.pm exists.
Packit 26a39e
$ if f$search("config-flags.pm") .eqs. ""
Packit 26a39e
$ then
Packit 26a39e
$   @config_flags_pm.com
Packit 26a39e
$ endif
Packit 26a39e
$ define/user bin 'default_dev'[-],gnv$gnu:[bin]
Packit 26a39e
$ define/user decc$filename_unix_noversion enable
Packit 26a39e
$ define/user decc$filename_unix_report enable
Packit 26a39e
$ define/user decc$readdir_dropdotnotype enable
Packit 26a39e
$ flags = ""
Packit 26a39e
$ if verbose_flag .nes. "" then flags = verbose_flag
Packit 26a39e
$ if detail_flag .nes. "" then flags = flags + " " + detail_flag
Packit 26a39e
$ if keep_flag .nes. "" then flags = flags + " " + keep_flag
Packit 26a39e
$ if usage_flag .nes. "" then flags = flags + " " + usage_flag
Packit 26a39e
$ if help_flag .nes. "" then flags = flags + " " + help_flag
Packit 26a39e
$ if debug_flag .nes. "" then flags = flags + " " + debug_flag
Packit 26a39e
$ flags = f$edit(flags, "TRIM, COMPRESS")
Packit 26a39e
$ if testname .nes. ""
Packit 26a39e
$ then
Packit 26a39e
$   perl run_make_tests.pl "''testname'" 'flags'
Packit 26a39e
$ else
Packit 26a39e
$   perl run_make_tests.pl 'flags'
Packit 26a39e
$ endif
Packit 26a39e
$all_error:
Packit 26a39e
$ set default 'default'
Packit 26a39e
$!