diff options
author | bgottesman <bgottesman@1f5c12ca-751b-0410-a591-d2e778427230> | 2011-08-16 14:51:43 +0400 |
---|---|---|
committer | bgottesman <bgottesman@1f5c12ca-751b-0410-a591-d2e778427230> | 2011-08-16 14:51:43 +0400 |
commit | 436a285f18e42b19e581d1e673bf55766934f10b (patch) | |
tree | 2386920eb2c6cbe7c291c38901a49e5d01adcaa7 /regression-testing | |
parent | 22da5782f36ba659f976134a9f8c10b67676014d (diff) |
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
Diffstat (limited to 'regression-testing')
-rwxr-xr-x | regression-testing/run-test-detokenizer.perl | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/regression-testing/run-test-detokenizer.perl b/regression-testing/run-test-detokenizer.perl index 22b796c6b..e297b90be 100755 --- a/regression-testing/run-test-detokenizer.perl +++ b/regression-testing/run-test-detokenizer.perl @@ -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,31 +200,27 @@ 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"); - $stderrFile = catfile($outputDir, "stderr.txt"); - } else { - $stdoutFile = catfile($outputDir, "stdout-and-stderr.txt"); - $stderrFile = $stdoutFile; - } - - my $commandRef = $buildCommandRoutineReference->(); - my $exitStatus = &runVerbosely($commandRef, $stdinFile, $stdoutFile, $stderrFile); - return unless is($exitStatus, 0, $testName.": command exited with status 0"); + my ($stdoutFile, $stderrFile); + if ($separateStdoutFromStderr) { + $stdoutFile = catfile($outputDir, "stdout.txt"); + $stderrFile = catfile($outputDir, "stderr.txt"); + } else { + $stdoutFile = catfile($outputDir, "stdout-and-stderr.txt"); + $stderrFile = $stdoutFile; + } - if (defined $failureExplanation) { - TODO: { - local $TODO = $failureExplanation; - $validationRoutineReference->(); - } - } else { - $validationRoutineReference->(); + my $commandRef = $buildCommandRoutineReference->(); + my $exitStatus = &runVerbosely($commandRef, $stdinFile, $stdoutFile, $stderrFile); + return fail($testName.": command exited with status ".$exitStatus) unless $exitStatus == 0; + if (defined $failureExplanation) { + TODO: { + local $TODO = $failureExplanation; + $validationRoutineReference->(); } - }; + } else { + $validationRoutineReference->(); + } } # Announce that we're going to run the given command, then run it. |