From e1cc454db3be1a5eedc3dba7022e813a772696d7 Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Fri, 11 May 2012 19:00:26 -0400 Subject: Add just enough jam to compile the decoder. --- mteval/Jamfile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 mteval/Jamfile (limited to 'mteval/Jamfile') diff --git a/mteval/Jamfile b/mteval/Jamfile new file mode 100644 index 00000000..f671134a --- /dev/null +++ b/mteval/Jamfile @@ -0,0 +1,8 @@ +import testing ; + +lib mteval : ter.cc comb_scorer.cc aer_scorer.cc scorer.cc external_scorer.cc ns.cc ns_ter.cc ns_ext.cc ns_comb.cc ns_docscorer.cc ..//utils : . : : . ; +exe fast_score : fast_score.cc mteval ..//utils ..//boost_program_options ; +exe mbr_kbest : mbr_kbest.cc mteval ..//utils ..//boost_program_options ; +alias programs : fast_score mbr_kbest ; + +unit-test scorer_test : scorer_test.cc mteval ..//utils ..//z ..//boost_unit_test_framework ; -- cgit v1.2.3 From 708ad7d7dbfc8f8d52312c3989f86b183e12af45 Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Fri, 11 May 2012 20:31:57 -0400 Subject: Fix relative paths in tests. --- Jamroot | 9 ++++----- decoder/Jamfile | 2 +- decoder/grammar_test.cc | 6 ++++-- mteval/Jamfile | 2 +- mteval/scorer_test.cc | 9 +++++---- sanity.jam | 12 +++++++----- 6 files changed, 22 insertions(+), 18 deletions(-) (limited to 'mteval/Jamfile') diff --git a/Jamroot b/Jamroot index ad09509d..c9a8ee76 100644 --- a/Jamroot +++ b/Jamroot @@ -14,16 +14,15 @@ if [ test_header boost/serialization/map.hpp ] && [ test_library boost_serializa project : requirements $(requirements) ; project : default-build single on release ; -install-bin-libs utils//programs mteval//programs klm/lm//programs decoder//cdec ; +install-bin-libs utils//programs mteval//programs klm/lm//programs decoder//cdec phrasinator//programs ; -build-project mteval ; -build-project decoder ; +build-projects mteval decoder klm/lm ; #Compile everything ending with _test.cc into a test and run it. -rule all_tests ( targets * : dependencies ) { +rule all_tests ( targets * : dependencies : properties * ) { targets ?= [ glob *_test.cc ] ; for t in $(targets) { local base = [ MATCH "^(.*).cc$" : $(t) ] ; - unit-test $(base) : $(t) $(dependencies) ..//boost_unit_test_framework ; + unit-test $(base) : $(t) $(dependencies) ..//boost_unit_test_framework : $(properties) ; } } diff --git a/decoder/Jamfile b/decoder/Jamfile index d7d42f28..f8112cae 100644 --- a/decoder/Jamfile +++ b/decoder/Jamfile @@ -65,7 +65,7 @@ lib cdec_lib : exe cdec : cdec.cc cdec_lib ; -all_tests [ glob *_test.cc : cfg_test.cc ] : cdec_lib ; +all_tests [ glob *_test.cc : cfg_test.cc ] : cdec_lib : $(TOP)/decoder/test_data ; install legacy : cdec : $(TOP)/cdec EXE on shared:$(TOP)/cdec shared:LIB ; diff --git a/decoder/grammar_test.cc b/decoder/grammar_test.cc index e1a94709..4500490a 100644 --- a/decoder/grammar_test.cc +++ b/decoder/grammar_test.cc @@ -17,7 +17,8 @@ using namespace std; struct GrammarTest { GrammarTest() { - Weights::InitFromFile("test_data/weights.gt", &wts); + std::string path(boost::unit_test::framework::master_test_suite().argc == 2 ? boost::unit_test::framework::master_test_suite().argv[1] : "test_data"); + Weights::InitFromFile(path + "/weights.gt", &wts); } vector wts; }; @@ -40,7 +41,8 @@ BOOST_AUTO_TEST_CASE(TestTextGrammar) { } BOOST_AUTO_TEST_CASE(TestTextGrammarFile) { - GrammarPtr g(new TextGrammar("./test_data/grammar.prune")); + std::string path(boost::unit_test::framework::master_test_suite().argc == 2 ? boost::unit_test::framework::master_test_suite().argv[1] : "test_data"); + GrammarPtr g(new TextGrammar(path + "/grammar.prune")); vector grammars(1, g); LatticeArc a(TD::Convert("ein"), 0.0, 1); diff --git a/mteval/Jamfile b/mteval/Jamfile index f671134a..24a95e8f 100644 --- a/mteval/Jamfile +++ b/mteval/Jamfile @@ -5,4 +5,4 @@ exe fast_score : fast_score.cc mteval ..//utils ..//boost_program_options ; exe mbr_kbest : mbr_kbest.cc mteval ..//utils ..//boost_program_options ; alias programs : fast_score mbr_kbest ; -unit-test scorer_test : scorer_test.cc mteval ..//utils ..//z ..//boost_unit_test_framework ; +unit-test scorer_test : scorer_test.cc mteval ..//utils ..//z ..//boost_unit_test_framework : $(TOP)/mteval/test_data ; diff --git a/mteval/scorer_test.cc b/mteval/scorer_test.cc index 0e400a3a..9b765d0f 100644 --- a/mteval/scorer_test.cc +++ b/mteval/scorer_test.cc @@ -36,11 +36,12 @@ struct Stuff { BOOST_FIXTURE_TEST_SUITE( s, Stuff ); BOOST_AUTO_TEST_CASE(TestCreateFromFiles) { + std::string path(boost::unit_test::framework::master_test_suite().argc == 2 ? boost::unit_test::framework::master_test_suite().argv[1] : "test_data"); vector files; - files.push_back("test_data/re.txt.0"); - files.push_back("test_data/re.txt.1"); - files.push_back("test_data/re.txt.2"); - files.push_back("test_data/re.txt.3"); + files.push_back(path + "/re.txt.0"); + files.push_back(path + "/re.txt.1"); + files.push_back(path + "/re.txt.2"); + files.push_back(path + "/re.txt.3"); DocScorer ds(IBM_BLEU, files); } diff --git a/sanity.jam b/sanity.jam index 1b37a4e7..a89e95f9 100644 --- a/sanity.jam +++ b/sanity.jam @@ -21,11 +21,7 @@ rule test_flags ( flags * ) { echo $(cmd) ; echo $(ret) ; } - if $(ret[2]) = 0 { - return true ; - } else { - return ; - } + return $(ret[2]) == 0 ; } rule test_header ( name ) { @@ -182,3 +178,9 @@ rule install-headers ( name : list * : source-root ? ) { source-root ?= "." ; install $(name) : $(list) : $(includedir) $(source-root) ; } + +rule build-projects ( projects * ) { + for p in $(projects) { + build-project $(p) ; + } +} -- cgit v1.2.3