stop using 'subtest' because it doesn't work for everyone, e.g. Hieu reports it doesn't work on a Mac even with an up-to-date Test::Simple module

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@4144 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
bgottesman 2011-08-16 10:51:43 +00:00
parent 22da5782f3
commit 436a285f18

View File

@ -187,7 +187,7 @@ sub runDetokenizerTest {
# $stdinFile, if defined, is a file to send to the command via STDIN
# $buildCommandRoutineReference is a reference to a zero-argument subroutine that returns the
# system command to run in the form of an array reference
# $validationRoutineReference is a reference to a zero-argument subroutine that makes some calls
# $validationRoutineReference is a reference to a zero-argument subroutine that makes exactly one call
# to ok() or similar to validate the contents of the output directory
# $separateStdoutFromStderr is an optional boolean argument; if omitted or false, the command's
# STDOUT and STDERR are mixed together in out output file called
@ -200,8 +200,6 @@ sub runDetokenizerTest {
sub runTest {
my ($testName, $outputDir, $stdinFile, $buildCommandRoutineReference, $validationRoutineReference, $separateStdoutFromStderr, $failureExplanation) = @_;
# Note: You may need to upgrade your version of the Perl module Test::Simple in order to get this 'subtest' thing to work. (Perl modules are installed/upgraded using CPAN; google 'how do I upgrade a perl module')
subtest $testName => sub {
my ($stdoutFile, $stderrFile);
if ($separateStdoutFromStderr) {
$stdoutFile = catfile($outputDir, "stdout.txt");
@ -213,7 +211,7 @@ sub runTest {
my $commandRef = $buildCommandRoutineReference->();
my $exitStatus = &runVerbosely($commandRef, $stdinFile, $stdoutFile, $stderrFile);
return unless is($exitStatus, 0, $testName.": command exited with status 0");
return fail($testName.": command exited with status ".$exitStatus) unless $exitStatus == 0;
if (defined $failureExplanation) {
TODO: {
@ -222,9 +220,7 @@ sub runTest {
}
} else {
$validationRoutineReference->();
}
};
}
# Announce that we're going to run the given command, then run it.