From 45a28264df3f1347eba603ee0758e5d7f063c327 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. --- decoder/Jamfile | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 decoder/Jamfile (limited to 'decoder/Jamfile') diff --git a/decoder/Jamfile b/decoder/Jamfile new file mode 100644 index 00000000..d7d42f28 --- /dev/null +++ b/decoder/Jamfile @@ -0,0 +1,72 @@ +import testing ; +import lex ; +import option ; + +if [ option.get "with-glc" ] { + glc = ff_glc.cc string_util.cc feature-factory.cc ; +} + +lib cdec_lib : + forest_writer.cc + maxtrans_blunsom.cc + cdec_ff.cc + cfg.cc + dwarf.cc + ff_dwarf.cc + rule_lexer.ll + fst_translator.cc + csplit.cc + translator.cc + scfg_translator.cc + hg.cc + hg_io.cc + decoder.cc + hg_intersect.cc + hg_sampler.cc + factored_lexicon_helper.cc + viterbi.cc + lattice.cc + aligner.cc + apply_models.cc + earley_composer.cc + phrasetable_fst.cc + trule.cc + ff.cc + ff_rules.cc + ff_wordset.cc + ff_context.cc + ff_charset.cc + ff_lm.cc + ff_klm.cc + ff_ngrams.cc + ff_spans.cc + ff_ruleshape.cc + ff_wordalign.cc + ff_csplit.cc + ff_tagger.cc + ff_source_syntax.cc + ff_bleu.cc + ff_factory.cc + lexalign.cc + lextrans.cc + tagger.cc + bottom_up_parser.cc + phrasebased_translator.cc + JSON_parser.c + json_parse.cc + grammar.cc + $(glc) + ..//utils + ..//mteval + ../klm/lm//kenlm + ..//boost_program_options + : . + ; + +exe cdec : cdec.cc cdec_lib ; + +all_tests [ glob *_test.cc : cfg_test.cc ] : cdec_lib ; + +install legacy : cdec + : $(TOP)/cdec EXE on shared:$(TOP)/cdec shared:LIB ; + -- cgit v1.2.3 From 5d2d8752f03934acb61dc9ca826563900d413e44 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 'decoder/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