diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 77 | ||||
-rw-r--r-- | tools/configure.ac | 168 | ||||
-rwxr-xr-x | tools/proof | 78 | ||||
-rwxr-xr-x | tools/times.sh | 4 |
4 files changed, 226 insertions, 101 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index 5bb41cc0..04f64530 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -8,7 +8,6 @@ DISTCLEANFILES = .timestamp lib_LTLIBRARIES = \ libledger_report.la \ libledger_data.la \ - libledger_expr.la \ libledger_math.la \ libledger_util.la @@ -28,8 +27,17 @@ libledger_util_la_CPPFLAGS = $(lib_cppflags) libledger_util_la_LDFLAGS = -release $(LIBVERSION) libledger_math_la_SOURCES = \ + src/format.cc \ + src/query.cc \ + src/scope.cc \ + src/expr.cc \ + src/op.cc \ + src/parser.cc \ + src/token.cc \ + src/value.cc \ src/balance.cc \ src/quotes.cc \ + src/history.cc \ src/pool.cc \ src/annotate.cc \ src/commodity.cc \ @@ -38,22 +46,8 @@ libledger_math_la_SOURCES = \ libledger_math_la_CPPFLAGS = $(lib_cppflags) libledger_math_la_LDFLAGS = -release $(LIBVERSION) -libledger_expr_la_SOURCES = \ - src/option.cc \ - src/format.cc \ - src/query.cc \ - src/predicate.cc \ - src/scope.cc \ - src/expr.cc \ - src/op.cc \ - src/parser.cc \ - src/token.cc \ - src/value.cc - -libledger_expr_la_CPPFLAGS = $(lib_cppflags) -libledger_expr_la_LDFLAGS = -release $(LIBVERSION) - libledger_data_la_SOURCES = \ + src/option.cc \ src/lookup.cc \ src/compare.cc \ src/iterators.cc \ @@ -85,6 +79,8 @@ libledger_report_la_SOURCES = \ src/chain.cc \ src/filters.cc \ src/report.cc \ + src/views.cc \ + src/select.cc \ src/session.cc libledger_report_la_CPPFLAGS = $(lib_cppflags) @@ -104,6 +100,7 @@ pkginclude_HEADERS = \ src/amount.h \ src/commodity.h \ src/annotate.h \ + src/history.h \ src/pool.h \ src/quotes.h \ src/balance.h \ @@ -119,13 +116,13 @@ pkginclude_HEADERS = \ src/query.h \ src/format.h \ src/option.h \ - src/series.h \ \ src/item.h \ src/post.h \ src/xact.h \ src/account.h \ src/journal.h \ + src/context.h \ src/temps.h \ src/archive.h \ src/timelog.h \ @@ -134,6 +131,8 @@ pkginclude_HEADERS = \ src/lookup.h \ \ src/session.h \ + src/select.h \ + src/views.h \ src/report.h \ src/filters.h \ src/chain.h \ @@ -202,7 +201,6 @@ DISTCLEANFILES += ledger.elc timeclock.elc all_sources = $(libledger_util_la_SOURCES) \ $(libledger_math_la_SOURCES) \ - $(libledger_expr_la_SOURCES) \ $(libledger_data_la_SOURCES) \ $(libledger_report_la_SOURCES) \ $(libledger_python_la_SOURCES) \ @@ -226,6 +224,7 @@ libledger_python_la_SOURCES = \ src/py_expr.cc \ src/py_format.cc \ src/py_item.cc \ + src/py_session.cc \ src/py_journal.cc \ src/py_post.cc \ src/py_times.cc \ @@ -256,8 +255,7 @@ TESTS = RegressTests BaselineTests ManualTests ConfirmTests \ if HAVE_BOOST_TEST TESTS += \ UtilTests \ - MathTests \ - ExprTests + MathTests # DataTests \ # ReportTests endif @@ -282,6 +280,7 @@ UtilTests_CPPFLAGS = -I$(srcdir)/test $(lib_cppflags) UtilTests_LDADD = libledger_util.la $(TESTLIBS) MathTests_SOURCES = \ + test/unit/t_expr.cc \ test/unit/t_commodity.cc \ test/unit/t_amount.cc \ test/unit/t_balance.cc @@ -289,16 +288,10 @@ MathTests_SOURCES = \ MathTests_CPPFLAGS = -I$(srcdir)/test $(lib_cppflags) MathTests_LDADD = libledger_math.la $(UtilTests_LDADD) -ExprTests_SOURCES = \ - test/unit/t_expr.cc - -ExprTests_CPPFLAGS = -I$(srcdir)/test $(lib_cppflags) -ExprTests_LDADD = libledger_expr.la $(MathTests_LDADD) - DataTests_SOURCES = DataTests_CPPFLAGS = -I$(srcdir)/test $(lib_cppflags) -DataTests_LDADD = libledger_data.la $(ExprTests_LDADD) +DataTests_LDADD = libledger_data.la $(MathTests_LDADD) ReportTests_SOURCES = @@ -308,7 +301,6 @@ ReportTests_LDADD = libledger_report.la $(DataTests_LDADD) all_tests_sources = \ $(UtilTests_SOURCES) \ $(MathTests_SOURCES) \ - $(ExprTests_SOURCES) \ $(DataTests_SOURCES) \ $(ReportTests_SOURCES) @@ -321,7 +313,7 @@ all_py_tests_sources = \ test/python/%.py: test/unit/%.cc test/convert.py $(PYTHON) $(srcdir)/test/convert.py $< $@ -test/python/UnitTests.py: $(all_py_tests_sources) +test/python/ConvertedTests.py: $(all_py_tests_sources) @echo "from unittest import TextTestRunner, TestSuite" > $@ @for file in $$(ls $(srcdir)/test/unit/*.cc); do \ base=$$(basename $$file); \ @@ -346,7 +338,7 @@ ESC_distdir=`echo "$(distdir)" | sed 's/\//\\\\\//g'` # jww (2007-05-10): This rule will not be triggered on systems that # define an EXEEXT. -PyUnitTests: test/PyUnitTests.py test/python/UnitTests.py +PyUnitTests: test/PyUnitTests.py test/python/ConvertedTests.py @cat $(srcdir)/test/PyUnitTests.py \ | sed "s/%python%/$(ESC_python)/" \ | sed "s/%srcdir%/$(ESC_srcdir)/g" \ @@ -357,8 +349,15 @@ RegressTests_SOURCES = test/RegressTests.py EXTRA_DIST += test/regress test/convert.py test/LedgerHarness.py +if HAVE_BOOST_PYTHON +TEST_PYTHON_FLAGS = --python +EXTRA_DIST += test/python +else +TEST_PYTHON_FLAGS = +endif + RegressTests: $(srcdir)/test/RegressTests.py - echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/regress \"\$$@\"" > $@ + echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/regress $(TEST_PYTHON_FLAGS) \"\$$@\"" > $@ chmod 755 $@ BaselineTests_SOURCES = test/RegressTests.py @@ -366,7 +365,7 @@ BaselineTests_SOURCES = test/RegressTests.py EXTRA_DIST += test/baseline BaselineTests: $(srcdir)/test/RegressTests.py - echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/baseline \"\$$@\"" > $@ + echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/baseline $(TEST_PYTHON_FLAGS) \"\$$@\"" > $@ chmod 755 $@ ManualTests_SOURCES = test/RegressTests.py @@ -374,7 +373,7 @@ ManualTests_SOURCES = test/RegressTests.py EXTRA_DIST += test/manual ManualTests: $(srcdir)/test/RegressTests.py - echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/manual \"\$$@\"" > $@ + echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/manual $(TEST_PYTHON_FLAGS) \"\$$@\"" > $@ chmod 755 $@ ConfirmTests_SOURCES = test/ConfirmTests.py @@ -389,7 +388,7 @@ test/input/mondo.dat: test/input/standard.dat done ConfirmTests: $(srcdir)/test/ConfirmTests.py - echo "$(PYTHON) $(srcdir)/test/ConfirmTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/input \"\$$@\"" > $@ + echo "$(PYTHON) $(srcdir)/test/ConfirmTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/input $(TEST_PYTHON_FLAGS) \"\$$@\"" > $@ chmod 755 $@ GenerateTests_SOURCES = test/GenerateTests.py @@ -412,8 +411,6 @@ unittests: check 2>&1 | grep -v '^GuardMalloc:' @sh $(FULLCHECK) $(top_builddir)/MathTests$(EXEEXT) --verify \ 2>&1 | grep -v '^GuardMalloc:' - @sh $(FULLCHECK) $(top_builddir)/ExprTests$(EXEEXT) --verify \ - 2>&1 | grep -v '^GuardMalloc:' # @sh $(FULLCHECK) $(top_builddir)/DataTests$(EXEEXT) --verify \ # 2>&1 | grep -v '^GuardMalloc:' # @sh $(FULLCHECK) $(top_builddir)/ReportTests$(EXEEXT) --verify \ @@ -429,10 +426,10 @@ fullcheck: unittests @$(top_builddir)/ManualTests --verify @$(top_builddir)/ConfirmTests --verify @$(top_builddir)/GenerateTests 20 --verify - @$(top_builddir)/RegressTests --gmalloc - @$(top_builddir)/BaselineTests --gmalloc - @$(top_builddir)/ManualTests --gmalloc - @$(top_builddir)/ConfirmTests --gmalloc +# @$(top_builddir)/RegressTests --gmalloc +# @$(top_builddir)/BaselineTests --gmalloc +# @$(top_builddir)/ManualTests --gmalloc +# @$(top_builddir)/ConfirmTests --gmalloc @$(top_builddir)/GenerateTests 10000 # @$(top_builddir)/GenerateTests --gmalloc diff --git a/tools/configure.ac b/tools/configure.ac index e078ebc4..f7623f62 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -332,37 +332,143 @@ else fi # check for boost_serialization -#AC_CACHE_CHECK( -# [if boost_serialization is available], -# [boost_serialization_cpplib_avail_cv_], -# [boost_serialization_save_libs=$LIBS -# LIBS="-lboost_serialization$BOOST_SUFFIX -lboost_system$BOOST_SUFFIX $LIBS" -# AC_LANG_PUSH(C++) -# AC_LINK_IFELSE( -# [AC_LANG_PROGRAM( -# [[#include <boost/archive/binary_oarchive.hpp> -# #include <iostream> -# struct foo { -# int a; -# template<class Archive> -# void serialize(Archive & ar, const unsigned int) { -# ar & a; -# } -# };]], -# [[boost::archive::binary_oarchive oa(std::cout); -# foo x; -# oa << x;]])], -# [boost_serialization_cpplib_avail_cv_=true], -# [boost_serialization_cpplib_avail_cv_=false]) -# AC_LANG_POP -# LIBS=$boost_serialization_save_libs]) -# -#if [test x$boost_serialization_cpplib_avail_cv_ = xtrue -a x$cache = xtrue]; then -# AC_DEFINE([HAVE_BOOST_SERIALIZATION], [1], [Whether Boost.Serialization is available]) -# LIBS="-lboost_serialization$BOOST_SUFFIX $LIBS" -#fi -#AM_CONDITIONAL(HAVE_BOOST_SERIALIZATION, test x$boost_serialization_cpplib_avail_cv_ = xtrue -a x$cache = xtrue) -AM_CONDITIONAL(HAVE_BOOST_SERIALIZATION, false) +AC_CACHE_CHECK( + [if boost_serialization is available], + [boost_serialization_cpplib_avail_cv_], + [boost_serialization_save_libs=$LIBS + LIBS="-lboost_serialization$BOOST_SUFFIX -lboost_system$BOOST_SUFFIX $LIBS" + AC_LANG_PUSH(C++) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <boost/archive/binary_oarchive.hpp> + #include <iostream> + struct foo { + int a; + template<class Archive> + void serialize(Archive & ar, const unsigned int) { + ar & a; + } + };]], + [[boost::archive::binary_oarchive oa(std::cout); + foo x; + oa << x;]])], + [boost_serialization_cpplib_avail_cv_=true], + [boost_serialization_cpplib_avail_cv_=false]) + AC_LANG_POP + LIBS=$boost_serialization_save_libs]) + +if [test x$boost_serialization_cpplib_avail_cv_ = xtrue -a x$cache = xtrue]; then + AC_DEFINE([HAVE_BOOST_SERIALIZATION], [1], [Whether Boost.Serialization is available]) + LIBS="-lboost_serialization$BOOST_SUFFIX $LIBS" +fi +AM_CONDITIONAL(HAVE_BOOST_SERIALIZATION, test x$boost_serialization_cpplib_avail_cv_ = xtrue -a x$cache = xtrue) + +# check for expat or xmlparse +AC_ARG_ENABLE(xml, + [ --enable-xml Turn on support for XML parsing], + [case "${enableval}" in + yes) xml=true ;; + no) xml=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-xml) ;; + esac],[xml=true]) +AM_CONDITIONAL(USE_XML, test x$xml = xtrue) + +if [test x$xml = xtrue ]; then + AC_CACHE_CHECK( + [if libexpat is available], + [libexpat_avail_cv_], + [libexpat_save_libs=$LIBS + LIBS="-lexpat $LIBS" + AC_LANG_PUSH(C++) + AC_TRY_LINK( + [#include <stdio.h> + extern "C" { + #include <expat.h> // expat XML parser + }], + [XML_Parser parser = XML_ParserCreate(NULL); + return parser != NULL;], + [libexpat_avail_cv_=true], + [libexpat_avail_cv_=false]) + AC_LANG_POP + LIBS=$libexpat_save_libs]) + + if [test x$libexpat_avail_cv_ = xtrue ]; then + AM_CONDITIONAL(HAVE_EXPAT, true) + LIBS="-lexpat $LIBS" + else + AM_CONDITIONAL(HAVE_EXPAT, false) + fi +else + AM_CONDITIONAL(HAVE_EXPAT, false) +fi + +if [test x$xml = xtrue ]; then + if [test x$libexpat_avail_cv_ = xfalse ]; then + AC_CACHE_CHECK( + [if libxmlparse is available], + [libxmlparse_avail_cv_], + [libxmlparse_save_libs=$LIBS + LIBS="-lxmlparse -lxmltok $LIBS" + AC_LANG_PUSH(C++) + AC_TRY_LINK( + [#include <stdio.h> + extern "C" { + #include <xmlparse.h> // expat XML parser + }], + [XML_Parser parser = XML_ParserCreate(NULL); + return parser != NULL;], + [libxmlparse_avail_cv_=true], + [libxmlparse_avail_cv_=false]) + AC_LANG_POP + LIBS=$libxmlparse_save_libs]) + + if [test x$libxmlparse_avail_cv_ = xtrue ]; then + AM_CONDITIONAL(HAVE_XMLPARSE, true) + LIBS="-lxmlparse -lxmltok $LIBS" + else + AM_CONDITIONAL(HAVE_XMLPARSE, false) + fi + else + AM_CONDITIONAL(HAVE_XMLPARSE, false) + fi +else + AM_CONDITIONAL(HAVE_XMLPARSE, false) +fi + +# check for libofx +AC_ARG_ENABLE(ofx, + [ --enable-ofx Turn on support for OFX/OCF parsing], + [case "${enableval}" in + yes) ofx=true ;; + no) ofx=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-ofx) ;; + esac],[ofx=true]) +AM_CONDITIONAL(USE_OFX, test x$ofx = xtrue) + +if [test x$ofx = xtrue ]; then + AC_CACHE_CHECK( + [if libofx is available], + [libofx_avail_cv_], + [libofx_save_libs=$LIBS + LIBS="-lofx $LIBS" + AC_LANG_PUSH(C++) + AC_TRY_LINK( + [#include <libofx.h>], + [ LibofxContextPtr libofx_context = libofx_get_new_context();], + [libofx_avail_cv_=true], + [libofx_avail_cv_=false]) + AC_LANG_POP + LIBS=$libofx_save_libs]) + + if [test x$libofx_avail_cv_ = xtrue ]; then + AM_CONDITIONAL(HAVE_LIBOFX, true) + LIBS="-lofx $LIBS" + else + AM_CONDITIONAL(HAVE_LIBOFX, false) + fi +else + AM_CONDITIONAL(HAVE_LIBOFX, false) +fi # check for Python if [ test x$python = xtrue ]; then diff --git a/tools/proof b/tools/proof index 284f4e85..00c7f7d1 100755 --- a/tools/proof +++ b/tools/proof @@ -2,40 +2,62 @@ set -e -cd ~/src/ledger +ledger_proof() { + SRC="$1" + DEST="$2" + LOGDIR="$3" -VERSION=$(git describe --all --long) + cd "$SRC" + VERSION=$(git describe --all --long) -if [[ -f ~/Products/last-proofed && \ - $(< ~/Products/last-proofed) = $VERSION ]]; then - echo "No need to run tools/proof again" - exit 0 -fi + if [[ -f $DEST/last-proofed && $(< $DEST/last-proofed) = $VERSION ]]; then + echo "No need to run tools/proof again" + exit 0 + fi -rm -fr ~/Products/ledger-proof + sudo rm -fr $DEST/ledger-proof + date > $LOGDIR/ledger-proof.log + + time nice -n 20 \ + ./acprep --debug --enable-doxygen --universal --gcc47 -j16 proof 2>&1 | \ + tee -a $LOGDIR/ledger-proof.log + + time nice -n 20 \ + ./acprep --debug --enable-doxygen --universal --python --gcc47 -j16 proof 2>&1 | \ + tee -a $LOGDIR/ledger-proof.log + + time nice -n 20 \ + ./acprep --debug --enable-doxygen --universal --clang -j16 proof 2>&1 | \ + tee -a $LOGDIR/ledger-proof.log + + time nice -n 20 \ + ./acprep --debug --enable-doxygen --universal --python --clang -j16 proof 2>&1 | \ + tee -a $LOGDIR/ledger-proof.log + + if egrep -q '(ERROR|CRITICAL)' $LOGDIR/ledger-proof.log; then + mutt -a $LOGDIR/ledger-proof.log \ + -s '[ledger] Proof build FAILED' johnw@newartisans.com <<EOF +Ledger proof build FAILED, at commit $VERSION. +EOF + if [[ "$1" = "--alert" ]]; then + notify "Ledger proof build FAILED" + else + echo "Ledger proof build FAILED" + exit 1 + fi + else + echo $VERSION > $DEST/last-proofed -#time nice -n 20 \ -# ./acprep --enable-doxygen --universal -j16 --gcc46 --warn proof 2>&1 | \ -# tee ~/Desktop/proof.log -time nice -n 20 \ - ./acprep --universal -j16 --gcc46 --warn proof 2>&1 | \ - tee ~/Desktop/proof.log + cd $DEST/ledger-proof/debug; make docs + cd $DEST/ledger-proof/gcov; make report -if egrep -q '(ERROR|CRITICAL)' ~/Desktop/proof.log; then - if [[ "$1" = "--alert" ]]; then - notify "Ledger proof build FAILED" - else - echo "Ledger proof build FAILED" - exit 1 + mutt -s '[ledger] Proof build succeeded' johnw@newartisans.com <<EOF +Ledger proof build succeeded! at commit $VERSION. +EOF + echo "Ledger proof build succeeded" fi -else - echo $VERSION > ~/Products/last-proofed - mv ~/Desktop/proof.log /tmp - - cd ~/Products/ledger-proof/debug; make docs - cd ~/Products/ledger-proof/gcov; make report +} - echo "Ledger proof build succeeded" -fi +ledger_proof ${1:-$HOME/src/ledger} ${2:-$HOME/Products} ${3:-$HOME/Library/Logs} exit 0 diff --git a/tools/times.sh b/tools/times.sh index 444da993..d15431bc 100755 --- a/tools/times.sh +++ b/tools/times.sh @@ -2,5 +2,5 @@ time test/RegressTests.py ./ledger test/regress time test/RegressTests.py ./ledger test/regress --verify -time test/RegressTests.py ./ledger test/regress --gmalloc -time test/RegressTests.py ./ledger test/regress --verify --gmalloc +#time test/RegressTests.py ./ledger test/regress --gmalloc +#time test/RegressTests.py ./ledger test/regress --verify --gmalloc |