# This file will run one abinis built-in test in a separate process # Copyright (C) 1999-2006 ABINIT group (LSi) # This file is distributed under the terms of the # GNU General Public License, see ~ABINIT/Infos/copyright # or http://www.gnu.org/copyleft/gpl.txt . # For the initials of contributors, see ~ABINIT/Infos/contributors . # # Usage : # This script is intended to be called from script run-basic-tests[.pl] # The latter starts the test in background mode and waits for # completion. When done, this script creates a test#.end file if required # # Arguments : # $TestN = test number 1-6 # $ENDtest = kind of criterion for test completion; supported values are: # ps = unix ps command # pstat = Windows NT ResKit pstat command # numeric = test#.end file with loop limit # $SLASH = subdirectory delimitor in file paths # $SUFXstyle = defines suffixes style for binaries, ...; # supported values are: unix, DOS, vms # $, = ' '; # set output field separator $\ = "\n"; # set output record separator $debug = 0; # debug level # ($TestN,$ENDtest,$SLASH,$SUFXstyle) = @ARGV; if ($SUFXstyle eq 'unix') { # unix suffixes: $XSUFX = ''; # no special suffix for binary module } elsif ($SUFXstyle eq 'DOS') { # DOS suffixes: $XSUFX = '.exe'; # suffix for binary module } elsif ($SUFXstyle eq 'vms') { # DOS suffixes: $XSUFX = '.exe'; # suffix for binary module } # make sure "files" file exist if (! -r "test$TestN.files") { print "Test number missing or invalid: $TestN"; exit 8; } print "run-basic-dotest.pl: Starting built-in test $TestN" if ($debug >= 1); $abinis = &transpath("../../../src/main/abinis$XSUFX"); if ($SUFXstyle eq 'vms') { $cmd = "pipe run [-]abinis < test$TestN.files > test$TestN.log"; } else { $cmd = "$abinis < test$TestN.files > test$TestN.log"; } print $cmd if ($debug >= 1); $rc = system($cmd); # start abinis $_ = $ENDtest; # check numeric value for test completion if (! /[^0-9]/) { open (END,">test$TestN.end"); # create a file to signal end of test to caller close (END); } exit; # **************************************** sub transpath { local($path) = @_; # # purpose: translate unix-like path of file to DOS-like according to $SLASH # argument: # $path = path to be translated # output: this subroutine acts as a function and return the path # according to host conventions $path =~ tr/\057/\\/ if ($SLASH eq '\\'); return $path; }