torque_install/torque/torque.test
ruoyunbai 2bb9621e30 1
2021-09-29 21:06:16 +08:00

60 lines
1.7 KiB
Perl

#!/usr/bin/perl -w
#
# Commandline Options:
#
# -f - Force: run the test in non-interactive mode
#
# -u <username> - User: username to use when submitting jobs to TORQUE
#
use strict;
use warnings;
use Test::Harness;
use Getopt::Std;
print '-' x 21, "\n",
"- TORQUE Test Suite -\n",
'-' x 21, "\n\n";
our ($opt_f, $opt_u) = (undef, undef);
getopts('fu:');
$ENV{'TORQUE_TEST_USER'} = $opt_u
if defined $opt_u;
if (defined $opt_f)
{
# Non-Interactive Mode
print "* Non-Interactive Mode *\n\n";
}
else
{
# Interactive Mode
print "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"
. "* This test suite attempts to verify that the TORQUE install is *\n"
. "* complete and configured correctly. As part of the test jobs will *\n"
. "* be submitted to TORQUE for execution. One test will attempt to *\n"
. "* start a job on every processor in your cluster. This can take *\n"
. "* some time, depending on the size of your cluster. *\n"
. "* *\n"
. "* This prompt can be bypassed by using the -f commandline flag. *\n"
. "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\n";
my $cont = '';
while ($cont !~ /^[YN]$/)
{
print 'Continue [y/N] ';
$cont = uc <stdin>;
chomp $cont;
$cont = 'N' unless length $cont;
}
exit unless 'Y' eq $cont;
}
my $dir = 't/';
opendir DIR, $dir or die "Cannot open test directory: $!";
my @tests = sort
grep { /^$dir\d\d_\w+\.t$/ }
map { s/[\r\n]//g; "$dir$_" }
readdir DIR;
closedir DIR;
runtests(@tests);