From 2722fe23174634bf79de9a72d3db6f99c6e2764b Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Mon, 28 Nov 2011 15:52:53 +0000 Subject: [PATCH] Add optional regression testing to the build --- Jamroot | 6 ++++++ regression-testing/Jamfile | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 regression-testing/Jamfile diff --git a/Jamroot b/Jamroot index 0b31c6de0..754b9400a 100644 --- a/Jamroot +++ b/Jamroot @@ -20,6 +20,10 @@ #Builds scripts/training/train-model.perl using these paths. # # +#REGRESSION TESTING +#--with-regtest=/path/to/moses-reg-test-data +# +# #INSTALLATION #--prefix=/path/to/prefix sets the install prefix [dist]. #--bindir=/path/to/prefix/bin sets the bin directory [PREFIX/bin] @@ -177,6 +181,8 @@ build-project moses-cmd/src ; build-project moses-chart-cmd/src ; #Scripts have their own binaries. build-project scripts ; +#Regression tests (only enabled if --data-dir is passed) +build-project regression-testing ; if [ option.get "git" : : "yes" ] { local revision = [ _shell "git rev-parse --verify HEAD |head -c 7" ] ; diff --git a/regression-testing/Jamfile b/regression-testing/Jamfile new file mode 100644 index 000000000..c12fa3973 --- /dev/null +++ b/regression-testing/Jamfile @@ -0,0 +1,34 @@ +import option ; + +with-regtest = [ option.get "with-regtest" ] ; +if $(with-regtest) { + path-constant TESTS : tests ; + + local all-tests = ; + + rule reg_test ( name : tests * : program : action ) { + alias $(name) : $(tests:D=).passed ; + for test in $(tests) { + make $(test:D=).passed : $(program) : $(action) ; + all-tests = $(test:D=).passed $(all-tests) ; + } + } + + actions reg_test_decode { + $(TOP)/regression-testing/run-single-test.perl --decoder=$(>) --test=$(<:B) --data-dir=$(with-regtest) --test-dir=$(TESTS) && touch $(<) + } + reg_test phrase : [ glob tests/phrase.* ] : ../moses-cmd/src//moses : @reg_test_decode ; + reg_test chart : chart.target-syntax chart.target-syntax.ondisk chart.hierarchical chart.hierarchical-withsrilm chart.hierarchical.ondisk : ../moses-chart-cmd/src//moses_chart : @reg_test_decode ; + + actions reg_test_score { + $(TOP)/regression-testing/run-test-scorer.perl --scorer=$(>) --test=$(<:B) --data-dir=$(with-regtest) --test-dir=$(TESTS) && touch $(<) + } + reg_test score : [ glob tests/score.* ] : ../scripts/training/phrase-extract//score : @reg_test_score ; + + actions reg_test_mert { + $(TOP)/regression-testing/run-test-mert.perl --mert-dir=$(TOP)/mert --test=$(<:B) --data-dir=$(with-regtest) --test-dir=$(TESTS) && touch $(<) + } + reg_test mert : [ glob tests/mert.* ] : ../mert//legacy : @reg_test_mert ; + + alias all : phrase chart score mert ; +}