diff options
author | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2011-08-04 12:11:40 +0400 |
---|---|---|
committer | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2011-08-04 12:11:40 +0400 |
commit | e988361d62eb6bd05698ccd9eb12bb24da5fd5b0 (patch) | |
tree | b441dc81b96fc35d5471fb23dfe27a825f8e8b18 /regression-testing | |
parent | cdbb850cc3771770e3abbe378757659bae14962d (diff) |
regression test for score
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@4111 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'regression-testing')
-rwxr-xr-x | regression-testing/run-single-test.perl (renamed from regression-testing/run-single-test.pl) | 0 | ||||
-rwxr-xr-x | regression-testing/run-test-scorer.perl | 43 | ||||
-rwxr-xr-x | regression-testing/run-test-suite.perl (renamed from regression-testing/run-test-suite.pl) | 6 | ||||
-rwxr-xr-x | regression-testing/tests/score.phrase-based/run-test.pl | 28 |
4 files changed, 46 insertions, 31 deletions
diff --git a/regression-testing/run-single-test.pl b/regression-testing/run-single-test.perl index 45a5ca278..45a5ca278 100755 --- a/regression-testing/run-single-test.pl +++ b/regression-testing/run-single-test.perl diff --git a/regression-testing/run-test-scorer.perl b/regression-testing/run-test-scorer.perl new file mode 100755 index 000000000..4adfc2433 --- /dev/null +++ b/regression-testing/run-test-scorer.perl @@ -0,0 +1,43 @@ +#!/usr/bin/perl -w + +use strict; +use FindBin qw($Bin); +use MosesRegressionTesting; +use Getopt::Long; +use File::Temp qw ( tempfile ); +use POSIX qw ( strftime ); + +my $scoreExe; +my $test_name; +my $data_dir; +my $test_dir; +my $results_dir; + +GetOptions("decoder=s" => \$scoreExe, + "test=s" => \$test_name, + "data-dir=s"=> \$data_dir, + "test-dir=s"=> \$test_dir, + "results-dir=s"=> \$results_dir, + ) or exit 1; + +my $outPath = "$test_dir/phrase-table.4.half.f2e"; +my $cmdMain = "$scoreExe $test_dir/extract.sorted $test_dir/lex.f2e $outPath --GoodTuring \n"; + +`$cmdMain`; + +my $truthPath = "$test_dir/truth/results.txt"; +my $cmd = "diff $outPath $truthPath | wc -l"; + +my $numDiff = 554; +$numDiff = `$cmd`; + +if ($numDiff == 0) +{ + print STDERR "SUCCESS\n"; + exit 0; +} +else +{ + print STDERR "FAILURE. Ran $cmdMain\n"; + exit 1; +} diff --git a/regression-testing/run-test-suite.pl b/regression-testing/run-test-suite.perl index a407cf8a4..1a11e55bf 100755 --- a/regression-testing/run-test-suite.pl +++ b/regression-testing/run-test-suite.perl @@ -85,17 +85,17 @@ foreach my $test (@tests) if ($model_type eq 'phrase') { - $cmd .= "$test_run --decoder=$decoderPhrase"; + $cmd .= "$BIN_TEST/run-single-test.perl $test_run --decoder=$decoderPhrase"; $cmd .= " --test=$test"; } elsif ($model_type eq 'chart.') { - $cmd .= "$test_run --decoder=$decoderChart"; + $cmd .= "$BIN_TEST/run-single-test.perl $test_run --decoder=$decoderChart"; $cmd .= " --test=$test"; } elsif ($model_type eq 'score.') { - $cmd = "$Bin/tests/$test/run-test.pl $scoreExe"; + $cmd = "$Bin/run-test-scorer.perl $scoreExe $Bin/tests/$test"; } else { diff --git a/regression-testing/tests/score.phrase-based/run-test.pl b/regression-testing/tests/score.phrase-based/run-test.pl deleted file mode 100755 index 888f19e42..000000000 --- a/regression-testing/tests/score.phrase-based/run-test.pl +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use FindBin qw($Bin); - -my $scoreExe = $ARGV[0]; - -my $outPath = "$Bin/phrase-table.4.half.f2e"; -my $cmdMain = "$scoreExe $Bin/extract.sorted $Bin/lex.f2e $outPath --GoodTuring \n"; - -`$cmdMain`; - -my $truthPath = "$Bin/truth/results.txt"; -my $cmd = "diff $outPath $truthPath | wc -l"; - -my $numDiff = 554; -$numDiff = `$cmd`; - -if ($numDiff == 0) -{ - print STDERR "SUCCESS\n"; - exit 0; -} -else -{ - print STDERR "FAILURE. Ran $cmdMain\n"; - exit 1; -} |