File: run-basic-dotest.pl

package info (click to toggle)
abinit 9.10.4-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 518,712 kB
  • sloc: xml: 877,568; f90: 577,240; python: 80,760; perl: 7,019; ansic: 4,585; sh: 1,925; javascript: 601; fortran: 557; cpp: 454; objc: 323; makefile: 77; csh: 42; pascal: 31
file content (82 lines) | stat: -rwxr-xr-x 2,670 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# This file will run one abinit built-in test in a separate process

# Copyright (C) 1999-2022 ABINIT group (LSi)
# This file is distributed under the terms of the
# GNU General Public License, see ~ABINIT/COPYING
# 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 (fast, v1, v5, bigdft, etsf_io, libxc, wannier90)
#   $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
#
$timeout = $ENV{'timeout'};
$timeout = '0' if ($timeout eq '');
#
($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);
$abinit = &transpath("../../../src/98_main/abinit$XSUFX");
$timeout_cmd = &transpath("../../Timeout/timeout$XSUFX");
if ($SUFXstyle eq 'vms') {
  $cmd = "pipe run [-]abinit < test$TestN.files > test$TestN.log";
  }
else {
  $cmd = "$abinit < test$TestN.files > test$TestN.log";
  }
if ($timeout ne '0') {
  $cmd = "$timeout_cmd $timeout $cmd";
  }
print $cmd if ($debug >= 1);
$rc = system($cmd);		# start abinit
$_ = $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;
	}